4.4  Configuration of STREAMS Drivers and Modules in WindNet STREAMS

Configuration of STREAMS drivers and modules into WindNet STREAMS is dynamic and can be done any time after WindNet STREAMS has been initialized. WindNet STREAMS provides the routine strmDriverAdd( )for installing drivers, and the routine strmModuleAdd( ) for installing modules. Once installed, STREAMS applications can access the STREAMS drivers and modules.

4.4.1  strmDriverAdd( )

The routine strmDriverAdd( ) configures a single STREAMS driver. You can configure multiple drivers with additional calls to strmDriverAdd( ). The parameters that must be specified are as follows:

pStrmDriverName
the driver name to be used by STREAMS applications to access the driver being configured. Driver names begin with the prefix /dev/, followed by the device name, which is referred to here as a base name. The base name can be composed by the letters a-z or A-Z. It is used by WindNet STREAMS as a major device number, and is followed by an optional minor device number specified with the digits 0-9.

For example, the name of a driver device with echo capabilities could be /dev/echo1. In this case, the base name is echo and the minor device is 1. The base name without a minor device number can be used as the name of the clone device for drivers that support clone devices.

pStreamtab
the data structure streamtab that provides the driver entry points.

cloneFlag
the constant TRUE if the driver supports clone devices, otherwise the constant FALSE must be specified. The cloneFlag parameter should only be set to TRUE when the driver base name is not associated with a minor number.

pBuddyStreamtab
the data structure streamtab that provides the entry points of a writer buddy of the driver being configured. If the driver being configured does not require a writer buddy, you must set the value of pBuddyStreamtab to NULL. For a description of writer buddies, see §4.1.3.1 Writer Buddies.

flags
the constant SVR3_STYLE_OPEN if the driver supports SVR3-style open and close routines. Set the argument to SVR4_STYLE_OPEN, if the driver supports SVR4-style open and close routines.

sqlvl
the synchronization level required by the driver to execute successfully in WindNet STREAMS. For a description of synchronization levels, see §4.1.1 Synchronization Levels.

After the routine strmDriverAdd( ) is executed, the device name specified in that call is added to the list of VxWorks devices in the system and to the list of drivers managed by WindNet STREAMS.

For example, the following code shows how to configure into WindNet STREAMS a STREAMS printer driver that has a clone device capable of selecting a printer that is not busy and that provides support for several printers with parallel interfaces:

#include "strmLib.h"

/* Install the printer clone device */
strmDriverAdd ("/dev/printer", pPrinterStreamTab, TRUE, NULL, 
SVR4_STYLE_OPEN, SQLVL_QUEUE);
/* Install the device for the printer with minor device 1 */ strmDriverAdd ("/dev/printer1", pPrinterStreamTab, FALSE, NULL,
SVR4_STYLE_OPEN, SQLVL_QUEUE);
/* Install the device for the printer with minor device 2 ... etc */ strmDriverAdd ("/dev/printer2", pPrinterStreamTab, FALSE, NULL,
SVR4_STYLE_OPEN, SQLVL_QUEUE);

To list the devices created in the VxWorks system, use the VxWorks command devs as follows:

-> devs

drv name
  3 /dev/printer
  3 /dev/printer1
  3 /dev/printer2

For more information on strmDriverAdd( ), see its manual entry.

4.4.2  strmModuleAdd( )

The routine strmModuleAdd( ) configures a single STREAMS module. Multiple modules can be configured with additional calls to strmModuleAdd( ). The parameters that must be specified are as follows:

pModuleName
the module name to be used by STREAMS applications to access the module being configured.

pStreamtab
the data structure streamtab that provides the module entry points.

pBuddyStreamtab
the data structure streamtab that provides the entry points of a writer buddy of the module being configured. If the module being configured does not require a writer buddy, you must set the value of pBuddyStreamtab to NULL. For a description of writer buddies, see §4.1.3.1 Writer Buddies.

flags
the constant SVR3_STYLE_OPEN if the driver supports SVR3-style open and close routines. Set the argument to SVR4_STYLE_OPEN, if the driver supports SVR4-style open and close routines.

sqlvl
the synchronization level required by the module to execute successfuly in WindNet STREAMS. For a description of synchronization levels, see §4.1.1 Synchronization Levels.

For example, the following code shows how to configure into WindNet STREAMS a STREAMS module that converts upper case letters to lower case:

#include "strmLib.h"

/* Install the upper to lower case conversion module */
strmModuleAdd ("upToLow", pUptoLowStreamTab, NULL,
                SVR4_STYLE_OPEN, SQLVL_QUEUE);

After the driver and modules have been configured into WindNet STREAMS, you can list them with strmDriverModShow( ), described in §5.3.8 strmDriverModShow( ).

For more information on strmModuleAdd( ), see its manual entry.