next up previous top
Next: Priority
Up: Property
Previous: PipeType

PortBinding

Description

The PortBinding property is used to further specify a StreamIn or StreamOut player in
UniCon.

In a Unix process, input and output is accomplished through ports. There are typically 64 ports in a Unix process, although there may be more depending upon the version of Unix. A port is represented as an integer value (the values are zero based, ranging between 0 and 63) in the source code of the process, and this value is referred to as a file descriptor.

Unix filter processes perform input and output in streams, using designated ports. The ports for streams in a Unix filter are half-duplex (when hooked to named or unnamed pipes) so a filter usually performs input and output on separate ports. The choice of port numbers is a significant part of the design of a given filter; the choices are not made randomly. Most Unix filters perform input from port 0, and output to port 1. Error messages are written using port 2. These choices are a well-known convention among Unix developers. This design allows for filters to be easily composed with pipes on the Unix command line into larger, more complex tools, that are themselves filters.

In the UniCon language, the description of a StreamIn or StreamOut player captures the system designer's intentions regarding particular streams of data in a filter process. Information such as the structure of the data in the stream and the port number over which the stream of data will flow is captured for each player. The PortBinding property is used to specify the port number over which the data in the stream will flow. This property is required in the property list of a StreamIn and StreamOut player.

Property Lists

The PortBinding property can legally be specified in the property list in the following
UniCon language element:

Value Syntax

The syntax of the value part of the PortBinding property is either a non-negative
<integer> enclosed in parentheses, or one of the three keywords stdin, stdout, and stderr, optionally enclosed in double-quotes, enclosed in parentheses. The case of the letters in the keywords can be upper, lower, or mixed.

Required Rule

Required

Merge Rule

REPLACE

Subsequent specifications of the PortBinding property in a single property list replace earlier specifications (i.e., the last specification is the one that the UniCon compiler uses).

Semantic Checks

The value part of the PortBinding property must be a non-negative <integer> or one of the three keywords stdin, stdout, and stderr.

Example

The following are examples of specifications of PortBinding properties. They are embedded in the player definitions in a Filter component definition:

  COMPONENT Sort
    INTERFACE IS
      TYPE Filter
      PLAYER input IS StreamIn
        SIGNATURE ("line")
        PORTBINDING (stdin)
      END input
      PLAYER output IS StreamOut
        SIGNATURE ("line")
        PORTBINDING (1)
      END output
      PLAYER error IS StreamOut
        SIGNATURE ("line")
        PORTBINDING ("stderr")
      END error
    END INTERFACE
    IMPLEMENTATION IS
      VARIANT sort IN "sort"
        IMPLTYPE (Executable)
      END sort
    END IMPLEMENTATION
  END Sort

next up previous top
Next: Priority
Up: Property
Previous: PipeType

Comments? Mail the current maintainer of this page.

Author: Gregory Zelesnik

Last Modified: May 12, 1996