STREAMS-UX Programmer's Guide (February 2007)

Multiplexing
Overview
Chapter 5
110
Overview
STREAMS multiplexing is a special feature in the STREAMS framework. It provides a mechanism to connect
multiple streams below a driver so that data can be routed among the connected streams. The special purpose
STREAMS driver used in implementing STREAMS multiplexing is called a STREAMS multiplexor.
A multiplexor is logically partitioned into an upper-half and a lower-half. The upper-half deals with the
streams opened to the multiplexor while the lower-half deals with the streams linked under the
multiplexor.The upper-half of a multiplexor acts like a software driver. It follows the same rules regarding
unrecognized messages, flushing, and M_IOCTL processing. The lower-half of a multiplexor acts like a stream
head when processing messages.
A multiplexor which multiplexes data from several upper stream to a single lower stream is called an N-to-1
or upper multiplexor. A multiplexor that has only one upper stream but several lower streams is called a
1-to-M or lower multiplexor. M-to-N multiplexing configurations are implemented by using both mechanisms
in a driver. In addition to M-to-N multiplexors configuration, more complex configurations can be created by
connecting streams containing multiplexors to other multiplexors.
The M-to-N configuration is useful in implementing protocols which route data between multiple upper and
lower streams. For example, the IP multiplexing driver is an M-to-N configuration.
Multiplexor configurations can be built and dismantled at the user level by using I_LINK/I_UNLINK ioctl
commands.
A single stream can be linked under one multiplexor only. The number of streams that can be linked to a
multiplexor is implementation dependent and is not controlled by STREAMS framework.
The relationship between the multiple streams connected above or below the multiplexor is opaque to
STREAMS framework. It is the responsibility of the STREAMS multiplexor to route data between the
appropriate streams and to handle the flow control condition. STREAMS does not directly support the flow
control between multiplexed streams. The flow control in a multiplexor is discussed inFlow Control in a
Multiplexor” on page 124