nbtpi(ADMP) nbtpi(ADMP) Name nbtpi - NetBIOS TPI Drivers Syntax #include <xti.h> fd = t_open("/dev/nbcots", O_RDWR, &info); fd = t_open("/dev/nbclts", O_RDWR, &info); cc ... -lxti Description The drivers nbcots and nbclts provide an interface to NetBIOS using the Transport Provider Interface (TPI) STREAMS protocol and the X/Open Trans- port Interface (XTI) library (libxti.a). This interface to NetBIOS is primarily provided to support the Microsoft LAN Manager for UNIX Systems product, but is available for use by any user application. Using these drivers, the NetBIOS service is accessed with the routines in the XTI library. Connection-oriented (session) service is obtained by opening /dev/nbcots, while connectionless (datagram) service is obtained by opening /dev/nbclts. Note that nbcots provides the service type TCOTS -- the orderly release facility is not supported. Before an endpoint can be used, it must be bound to a transport address. In this case, the ``address'' bound to is actually a NetBIOS user name. The name which is bound to is registered at this time if it has not already been registered locally (binding to a name that has already been registered locally is not allowed). A flag given with the name specifies whether the name should be registered as a unique name or a group name. A user may also specify that an endpoint should be bound to receive only broadcast datagrams. If the requested name cannot be bound (the name is in use on another machine, or the name is registered locally with a dif- ferent type than that specified, or the name is in conflict), tbind fails with terrno set to TNOADDR. If a NULL address is bound, the end- point is bound to the permanent node name. Binding a connectionless endpoint implies a desire to receive datagrams sent to the bound name (or broadcast datagrams if the endpoint is so bound -- see below). All endpoints bound to a given name will receive a copy of each datagram received for that name. When a connection-oriented endpoint is bound, if the connection queue length (qlen field of the tbind structure) is greater than zero, the endpoint is set up to listen for connections on the bound name. Although it is permissible for more than one endpoint to be bound to the same name, only one may be listening (qlen > 0). If a second bind with a non-zero queue length is attempted, it will fail with terrno set to TNOADDR. The maximum allowed value of qlen is 4. The address format used with the t primitives is given by the nbaddr structure: #define NB_NAMELEN 16 /* size of NetBIOS name */ struct nbaddr { char nb_type; /* name type (see below) */ char nb_name[NB_NAMELEN]; /* NetBIOS name */ }; /* * the following are used in the nb_type field */ #define NB_UNIQUE 0 /* name is unique*/ #define NB_GROUP 1 /* name is a group name */ The nbtype field is only meaningful in the context of the tbind primi- tive - it is ignored by all other primitives. If the NBGROUP bit is set in nbtype, the name is registered as a group name. tsndudata sends a broadcast datagram if the destination name begins with an asterisk (*). The following table shows the values of the tinfo fields returned by nbcots and nbclts: _________________________________________________________________________ Field nbcots nbclts _________________________________________________________________________ addr 18 18 options -2 -2 tsdu 65535 512 etsdu -2 -2 connect -2 -2 discon -2 -2 servtype T_COTS T_CLTS Files /dev/nbcots Device node for connection-oriented (session) service /dev/nbclts Device node for connectionless (datagram) service /dev/nb Same as /dev/nbcots (used by LM/X) /dev/nb-dg Same as /dev/nbclts (used by LM/X) See also netbios(ADMP)