Abstract:
A common data link interface providing a framework for device drivers and data link providers. This interface allows multiple frameworks to coexist and share a single device driver. The common data link interface is framework independant and provides functions that are common to a plurality of frameworks. The common data link interface comprises three components, a network device driver, network demultiplexers, and network services. The network device driver provides a simple interface to network based devices that can be used by both the sockets IFNET and the streams DLPI data link layers. The network demultiplexor provides common data link receive functionality. Network services provides the remaining additional functionality required to bind the common data link interface together.

Description:
This is a continuation of application Ser. No. 08/004,145 (now abandoned) filed Jan. 13, 1993. 
    
    
     TECHNICAL FIELD 
     This invention relates to data processing systems, and more particularly to a common interface for supporting a plurality of data frameworks. 
     BACKGROUND OF THE INVENTION 
     Various dissimilar data protocols have evolved in the data processing industry, each having various advantages/disadvantages in a particular application or use. For example, BSD provides networking code that uses a framework known as Sockets to implement a communication protocol compatible with Unix 1  operating systems. Numerous communication protocols have been written which are based on the Sockets framework, most notably TCP/IP. A framework is essentially a programming interface, or set of libraries which can be called by an application program, that provides data communication functions independant from the underlying protocol used to transfer the data. As such, various versions of a particular framework could provide support for different underlying protocols. For example, Sockets could support TCP/IP, SNA or ArcNet. Frameworks and protocols are further described in the IBM publication &#34;AIX Version 3.2 Communication Programming Concepts&#34;, publication number SC23-2206-03, dated September 1992, and hereby incorporated by reference as background material. 
    
     AT&amp;T introduced Streams as a framework to develop a Unix communication protocol. This Streams framework addressed some of the Sockets framework&#39;s shortcomings, 
     Trademark of Unix System Laboratories, Inc. and has become popular in the data processing industry. Problems are encountered in that Sockets and Streams are completely independant frameworks. Thus, if a new communication protocol is desired to be added by an operating system provider, the provider must choose one or the other framework prior to the new protocol development. Providing support for multiple frameworks requires different hardware adapters and different device drivers corresponding to such hardware adapters. 
     This problem is further amplified when an operating system vendor is trying to provide a common operating system for a plurality of underlying data processing systems having differing processors, busses, etc. In this situation, the operating system provider would have dissimilar code support not only for the differing processors (e.g. an 80486, 68200 or RISC microprocessor), but for the differing frameworks and hardware adapters as well. This leads to larger development resource requirements, and an increase in hardware adapter requirements. 
     SUMMARY OF THE INVENTION 
     The Common Data Link Interface (CDLI) provides a framework for network device drivers and data link providers. This framework allows sockets and streams protocols to coexist and share a single device driver. The framework is socket/stream independent and only provides function that is common. General users interface indirectly to CDLI through sockets and DLPI (described below). 
     CDLI is composed of three components: Network Device Drivers, Network Demuxers, and Network Services. The Network Device Driver (NDD) model defines a lean, simple interface to network based devices that can be used by both the sockets IFNET and the streams Data Link Provider Interface (DLPI) data link layers. Common data link receive functionality is provided by a Network Demuxer. The demuxer specifies receive filters that will be used to distribute network packets. Network Services (NS) is a set of kernel functions that provides services to NDDs, Network Demuxers, and NS users(data links and protocols). NS is the glue that binds CDLI together. 
     In light of the foregoing, it is an object of the present invention to provide an improved data processing system. 
     It is a further object of the present invention to provide an improved data communication subsystem. 
     It is yet a further object of the present invention to provide a single hardware interface for supporting multiple communication frameworks. 
     It is still a further object of the present invention to provide a single driver interface to a hardware adapter which supports multiple communication frameworks. 
     These, and other, objects and features of the invention will become apparent from the following detailed description in which the preferred embodiment is set forth with reference to the accompanying drawing. 
    
    
     BRIEF DESCRIPTION OF THE DRAWING 
     FIG. 1 depicts a traditional framework providing data link, or network, services using a generic programming interface. 
     FIG. 2 depicts a traditional multi-user, multi-adapter configuration of that shown in FIG. 1. 
     FIG. 3 is a overall system block diagram of a common data link interface (CDLI). 
     FIG. 4 illustrates adding a network device driver to the CDLI system. 
     FIG. 5 illustrates allocating the use of a network device driver in the CDLI system. 
     FIG. 6 illustrates adding a receive filter for input packets in the CDLI system. 
     FIG. 7 illustrates using an allocated network device driver in the CDLI system. 
     FIG. 8 illustrates the data/code flow in the CDLI system. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     FIG. 1 depicts a representative of a traditional generic data link control 11, or framework. The framework defines a generic interface definition that provides application 13 or kernel 15 users with a common set of commands to control a data link for the transfer of data. Users within the kernel at 15 have access to the communications memory buffers 21 and call the device driver (dd) entry points by way of the fp kernel services. Users above the kernel at 13 access the standard interface-to-kernel device drivers, and the file system calls the dd entry points. Data transfers generally require a move of data between user and kernel space. The application user 13 resides above the kernel as an application or access method. The kernel user 15 resides within the kernel as a kernel process of device manager. The file I/O subsystem 17 converts the file descriptor and file-pointer subroutines to file pointer(fp) accesses of a switch table (not shown). The DLC device manager 19 accesses the buffer pool in interfacing between the file I/O subsystem and the Comm I/O device driver. This device manager may support multiple user above, as well as multiple device drivers and adapters below. The buffer pool 21 provides data-buffer services for the communication subsystem. The Comm I/O device driver 23 controls hardware adapter I/O and DMA registers, and routes receive packets to the DLC device manager. The adapter 25 attaches to the communications media. 
     A multi-user, multi-adapter configuration 27 is shown in FIG. 2, comprising multiple application users 29 and kernel users 35, along with multiple communication I/O device drivers 31 with corresponding adapters 33. This traditional approach suffers from requiring multiple I/O device drivers for differing frameworks. 
     The following describes common functions and how they are accomplished using the common data link interface of this invention. The functions generally occur in the following order. 
     1--Adding a Network Demuxer 
     2--Adding a Network Device Driver 
     3--Allocating Use of a Network Device Driver 
     4--Adding a Receive Filter For Input Packets 
     5--Adding a Status Processing Function 
     6--Adding a Network Demuxer 
     Adding a Network Demuxer 
     Referring now to FIG. 3, Network demuxers 14 are responsible for routing both input packets and asynchronous status from a Network Device Driver (NDD) 12 to a NS user that has expressed interest (through ns --  add --  filter and ns --  add --  status). For instance, a demuxer for 802.2 LLC would use DSAP (and possibly ethertype) to determine which user will receive an input packet. The nd --  add --  filter and nd --  del --  filter (accessed through ns --  add --  filter and ns --  del --  filter) functions of a demuxer handle adding and removing receive filters. The demuxer 14 is responsible for keeping a list of filters and the associated users. After being configured, a Network Demuxer 14 makes itself available to the system by the ns --  add --  demux service. 
     The following table shows an example of a ns --  add --  demux service. 
     
                       TABLE 1______________________________________struct ns.sub.-- demuxer demuxer;demuxer.use.sub.-- nsdmx = TRUE;demuxer.add.sub.-- filter = eth.sub.-- add.sub.-- filter;demuxer.del.sub.-- filter = eth.sub.-- del.sub.-- filter;demuxer.add.sub.-- status = eth.sub.-- add.sub.-- status;demuxer.del.sub.-- status = eth.sub.-- del.sub.-- status;demuxer.receive = eth.sub.-- receive;demuxer.status = eth.sub.-- status;demuxer.response = eth.sub.-- response;ns.sub.-- add.sub.-- demux(NDD.sub.-- ETHER, &amp;demuxer);______________________________________ 
    
     Adding a Network Device Driver 
     After a Network Device Driver has been configured, it needs to make itself available to NDD users. This is accomplished by the ns --  attach network service. This service adds the NDD to Network Service&#39;s list of available network device drivers. FIG. 4 illustrates this. As shown in the top block 30, an ndd structure 32 has the next ns --  nddnet value pointing to NULL. A new network device as addressed by &amp;dd.ndd 34 is to be added. This new network device has a data structure 36. The device driver&#39;s NDD is added to the list of available network device drivers, as shown in the ndd data structure ndd struct 32 of lower block 40. Block 40 shows the resultant data structure interrelations after having added a network device driver. 
     The ns --  detach service is the opposite of ns --  attach; that is it removes the network device from the list of available devices. 
     Allocating Use of a Network Device Driver 
     After a device driver has made itself available to the system (using ns --  attach), it may be accessed by users. Device driver users gain access to a NDD through the ns --  alloc network service. This service allocates use of the NDD (through a ndd structure 42 of FIG. 5) and opens the NDD if necessary. Access to the device is relinquished through the ns --  free network service. The specific steps are shown and described in FIG. 5. 
     Adding a Receive Filter For Input Packets 
     In order to receive input packets (IP), a user must specify the type of packets in which it is interested in. For instance, IP would indicate that it would like ethertype 0×0800 packets. This registration is accomplished through the ns --  add --  filter network service. The Network Demuxer for the specified NDD will add the receive filter to it&#39;s list of filters and users. A filter is removed by the ns --  del --  filter service. The receive packet flow for an 802.3 local area network packet is shown and described in lower box 50 of FIG. 6. The filter structure is defined at 52, with the particular filter parameters for an 802.2 LAN shown at 60. The user is defined at 54. 
     Adding a Status Processing Function 
     If a user wishes to receive NDD status information it must register with the network demuxer. This registration is accomplished through the ns --  add --  status network service. The Network Demuxer for the specified NDD will add the status filter to it&#39;s list of filters and users. A status filter is removed by the ns --  del --  status service. 
     Using an Allocated Network Device Driver 
     Referring now to FIG. 7, after a NDD user has allocated a NDD with the ns --  alloc service, it may use the nd --  output 70 and ndd --  ctl 72 functions of the NDD. ndd --  output is used to transmit data to the associated device driver 74. Various device control and status functions for a particular hardware adapter are available through the ndd --  ctl function. Sample code for transmitting a packet and issuing a control function is shown in the lower portion of FIG. 7. 
     Functional Interactions 
     FIG. 8 depicts the interfaces and interplay between the network device driver 12, used to control physical device 26, and the network demuxer 14, network services 16, and a CDLI user 80. The CDLI user could be, for example, using the sockets framework 22 of FIG. 1, and thus the interface between the CDLI user 80 and network services 16 of FIG. 8 would be interface 41 of FIG. 1. Alternatively, the CDLI user could be using the streams framework 24 of FIG. 1, and thus the interface between the CDLI user 80 and network services of FIG. 8 would be interface 43 of FIG. 1. Each of the functions/routines shown in FIG. 8 will now be described. 
     Network Services Overview 
     The following routines provide various aspects of network services, as described by the definitions for the respective routines. 
     Network Services for users (sockets, DLPI) 
     ns --  alloc 
     Allocates use of the specified network device. 
     ns --  free 
     Relinquishes access to a network device. 
     ns --  add --  filter 
     Adds a receive filter that enables the reception of packets that match the filter. 
     ns --  del --  filter 
     Deletes a receive filter and disables reception of packets that match the filter. 
     ns --  add --  status 
     Adds a filter for routing of asynchronous status. 
     ns --  del --  status 
     Deletes a previously added status filter. 
     Network Services for network demuxers 
     ns --  add --  demux 
     Adds a demuxer for the specified type of network device. 
     ns --  del --  demux 
     Removes a demuxer for the specified type of network device. 
     Network Services for network device drivers 
     ns --  attach 
     Places a device into the available NS device chain. 
     ns --  detach 
     Removes a device from the available device chain. 
     The following provides detailed implementation information for implementing the above listed network service routines. 
     NAME 
     ns --  alloc 
     Allocates use of a network device driver. 
     
         ______________________________________  SYNOPSIS    #include &lt;sys/ndd.h&gt;    int ns.sub.-- alloc ( nddname, nddpp)      char     *nddname;      struct ndd               **nddpp;______________________________________ 
    
     PARAMETERS 
     nddname 
     The device name to be allocated. 
     nddpp 
     Address of pointer to a ndd structure. 
     DESCRIPTION 
     This network service will walk the NS device chain to find the device driver with the specified nddname. If a match is found, then the reference count for the specified device driver will be incremented. If the reference count is incremented to 1, then the ndd --  open() routine specified in the ndd structure is called to open the device driver. 
     EXAMPLES 
     struct ndd *nddp; error=ns --  alloc(&#34;enO&#34;, &amp;nddp); 
     RETURN VALUE 
     If a match is found and the open to the device is successful, a pointer to the ndd structure for the specified device is stored in nddpp. If no match is found or the open of the device is unsuccessful, then a non zero value is returned. 
     0--The operation was successful. 
     ENODEV--Indicates an invalid network device. 
     ENOENT--No network demuxer available for this device. 
     Other return values from the open of the NDD. 
     FILES 
     net/ns.c 
     RELATED INFORMATION 
     Interfaces: ns --  free(), ndd --  open() 
     Network Device Drivers 
     NAME 
     ns --  free 
     Relinquishes access to a network device. 
     
         ______________________________________   SYNOPSIS     #include &lt;sys/ndd.h&gt;     void ns.sub.-- free ( nddp)       struct ndd *nddp;______________________________________ 
    
     PARAMETERS 
     nddp 
     Specifies the ndd structure of the network device that is to be freed from use. 
     DESCRIPTION 
     This network service will decrement the reference count for the specified ndd structure. If the reference count becomes 0, then the ndd --  close() routine specified in the ndd structure is called. 
     EXAMPLES 
     struct ndd *nddp; 
     ns --  free(nddp); 
     RETURN VALUE 
     none 
     FILES 
     net/ns.c 
     RELATED INFORMATION 
     Interface: ns --  alloc() 
     Network Device Drivers 
     NAME 
     ns --  add --  filter 
     Registers a receive filter to enable the reception of packets. 
     
         ______________________________________SYNOPSIS#include        &lt;sys/cdli.h&gt;int ns.sub.-- add.sub.-- filter ( nddp, filter, len, ns.sub.-- user)  struct ndd *nddp;  caddr.sub.-- t filter;  int len;  struct ns.sub.-- user *ns.sub.-- user;______________________________________ 
    
     PARAMETERS 
     nddp 
     Specifies the ndd that this add request is for. 
     filter 
     Pointer to the receive filter. 
     len 
     The length in bytes of the receive filter pointed to by the filter parameter. 
     ns --  user 
     Pointer to a ns --  user structure that defines the user. 
     DESCRIPTION 
     The ns --  add --  filter network service is called to register a receive filter for the reception of packets. This enables a network demuxer to route packets to the appropriate users. The add request is passed on to the nd --  add --  filter function of the demuxer for the specified NDD. The caller of ns --  add --  filter is responsible for relinquishing filters before calling ns --  free. 
     EXAMPLES 
     struct ns --  8022 dl; /* filter for 802.2 LANS */ 
     struct ns --  user ns --  user; /* describes the user */ 
     dl.filtertype=NS --  LLC --  DSAP --  SNAP; 
     dl.dsap=Oxaa; 
     dl.orgcode[0]=0x0; 
     dl.orgcode[1]=0x0; 
     dl.orgcode[2]=0x0; 
     dl.ethertype=0x0800; 
     ns --  user.isr=ipintr; 
     ns --  user.protoq=&amp;ipintrq; 
     ns --  user.netisr=NETISR --  IP; 
     ns --  user.pkt --  format=NS --  PROTO --  SNAP; 
     ns --  add --  filter(nddp, &amp;dl, sizeof(dl), &amp;ns --  user); 
     RETURN VALUE 
     0--The operation was successful. 
     ENODEV--Indicates an invalid network device. 
     ENOENT--No network demuxer available for this device. 
     Other return values from network demuxer. 
     FILES 
     net/ns.c 
     RELATED INFORMATION 
     Interfaces: ns --  del --  filter() 
     Network Demuxers 
     NAME 
     ns --  del --  filter 
     Deletes a receive filter. 
     
         ______________________________________SYNOPSIS   #include &lt;sys/cdli.h&gt;   int ns.sub.-- del.sub.-- filter ( nddp, filter, len)     struct ndd             *nddp;     caddr.sub.-- t             filter;     int     len;______________________________________ 
    
     PARAMETERS 
     nddp 
     Specifies the ndd that this delete request is for. 
     filter 
     Pointer to the receive filter. 
     len 
     The length in bytes of the receive filter. 
     DESCRIPTION 
     This network service will delete the receive filter from the corresponding network demuxer. This has the effect of disabling packet reception for packets that match the filter. The delete request is passed on to the nd --  del --  filter function of the demuxer for the specified NDD. 
     EXAMPLES 
     struct ns --  8022 dl; /* filter for 802.2 LANS */ 
     dl.filtertype=NS --  LLC --  DSAP --  SNAP; 
     dl.dsap=Oxaa; 
     dl.orgcode[0]=0x0; 
     dl.orgcode[1]=0x0; 
     dl.orgcode[2]=0x0; 
     dl.ethertype =0x0800; 
     ns --  del --  filter(nddp, &amp;dl, size of(dl)); 
     RETURN VALUE 
     0--The operation was successful. 
     ENODEV--Indicates an invalid network device. 
     Other return values from Network Demuxer. 
     FILES 
     net/ns.c 
     RELATED INFORMATION 
     Interfaces: ns --  add --  filter() and ns --  alloc() 
     NAME ns --  add --  status 
     Adds a status filter for the routing of asynchronous status. 
     
         ______________________________________SYNOPSIS  #include &lt;sys/cdli.h&gt;  int ns.sub.-- add.sub.-- status (nddp, statfilter, len,  ns.sub.-- statuser)    struct ndd *nddp;    caddr.sub.-- t               statfilter;    int        len;    struct ns.sub.-- statuser               *ns.sub.-- statuser;______________________________________ 
    
     PARAMETERS 
     nddp 
     Pointer to the ndd structure that this add request is for. 
     statfilter 
     Pointer the status filter. 
     len The length in bytes of statfilter. 
     ns --  statuser 
     Pointer to a ns --  statuser structure that defines this user. 
     DESCRIPTION 
     The ns --  add status network service is called to register a status filter. The add request is passed on to the nd --  add status function of the demuxer for the specified NDD. This enables the user to receive asynchronous status information from the specified device. 
     NOTES 
     The user&#39;s status processing function will be called by the Network Demuxer when asynchronous status becomes available. The user&#39;s status processing function will be called directly, the status processing function can not be a scheduled routine. 
     EXAMPLES 
     struct ns --  statuser user; 
     struct ns --  com --  status filter; 
     filter.mask=NDD --  HARD --  FAIL; 
     filter.sid=0; 
     user.isr=status --  fn; 
     user.isr --  data=whatever --  makes --  sense; 
     error=ns --  add --  status(nddp, &amp;filter, sizeof(filter), &amp;user); 
     RETURN VALUE 0--The operation was successful. 
     ENODEV--Indicates an invalid device. 
     Other return values from the network demuxer. 
     FILES 
     net/ns.c 
     RELATED INFORMATION 
     Interfaces: ns --  del --  status() 
     Network Demuxers 
     NAME 
     ns --  del --  status 
     Deletes a previously added status filter. 
     
         ______________________________________SYNOPSIS  #include &lt;sys/cdli.h&gt;  int ns.sub.-- del.sub.-- status (nddp, statfilter, len)    struct ndd  *nddp;    caddr.sub.-- t                statfilter;    int         len;______________________________________ 
    
     PARAMETERS 
     nddp 
     Pointer to the ndd structure that this delete request is for. 
     statfilter 
     Pointer to the status filter. 
     len 
     The length in bytes of statfilter. 
     DESCRIPTION 
     The ns --  del --  status network service is called to delete a previously added status filter from the corresponding network demuxer. The delete request is passed on to the nd --  del --  status function of the demuxer for the specified NDD. This has the effect of disabling asynchronous status notification from the specified device. 
     EXAMPLES 
     /* The filter parameter is the same as used in the ns --  add --  status call . */ 
     error=ns --  add --  status(nddp. &amp;filter. sizeof(filter)); 
     RETURN VALUE 
     0--The operation was successful. 
     ENODEV--Indicates an invalid device. 
     EINVAL--Indicates an invalid parameter. 
     Other return values from the network demuxer. 
     FILES 
     net/ns.c 
     RELATED INFORMATION 
     Interfaces: ns --  add --  status() 
     Network Demuxers 
     NAME 
     ns --  add --  demux 
     adds a demuxer for the specified type of network interface. 
     
         ______________________________________SYNOPSIS  #include &lt;sys/ndd.h&gt;  #include &lt;sys/cdli.h&gt;  int ns.sub.-- add.sub.-- demux ( ndd.sub.-- type, demux)    int     ndd.sub.-- type;    struct ns.sub.-- demux *demux;______________________________________ 
    
     PARAMETERS 
     ndd --  type 
     The interface type of the demuxer to be added. 
     demux 
     Pointer to a ns demux structure that defines the demuxer. 
     DESCRIPTION 
     This network service adds the specified demuxer to the list of available network demuxers. There can only be one demuxer per network interface type. An interface type describes a certain class of network devices that have the same characteristics (ie ethernet, tokne ring). The ndd --  type values listed in sys/ndd.h are the numbers defined by SNMP. If the desired type is not in ndd.h, the SNMP value should be used if it is defined. If not, any undefined type above NDD --  MAX --  TYPE may be used. 
     EXAMPLES 
     struct ns --  demux demuxer; 
     demuxer.add --  filter=eth --  add --  filter; 
     demuxer.del --  filter=eth --  del --  filter; 
     demuxer.add --  status=eth --  add --  status; 
     demuxer.del --  status=eth --  del --  status; 
     demuxer.receive=eth --  receive; 
     demuxer.status=eth --  status; 
     demuxer.response=eth --  response; 
     ns --  add --  demux(NDD --  IS088023, &amp;demuxer); 
     RETURN VALUE 
     0--The operation was successful. 
     EEXIST--a demuxer already exists for the given type. 
     EINVAL--ndd --  type out of range 
     FILES 
     net/ns.c 
     RELATED INFORMATION 
     Network Demuxers, ns --  del --  demux() 
     NAME 
     ns --  del --  demux 
     deletes a demuxer for the specified type of network interface. 
     SYNOPSIS 
     #include &lt;sys/ndd.h&gt;int ns --  del --  demux (ndd --  type) 
     int ndd --  type; 
     PARAMETERS 
     ndd --  type 
     The network interface type of the demuxer that is to be deleted. 
     DESCRIPTION 
     If the demuxer is not currently in use, this network service will delete the specified demuxer from the list of available network demuxers. A demuxer is in use if a NDD is open for the demuxer. 
     EXAMPLES 
     ns --  del --  demux(NDD --  IS088023); 
     RETURN VALUE 
     0--The operation was successful. 
     ENOENT--The demux of the specified type does not exist. 
     EINVAL--ndd --  type out of range 
     EBUSY--The demuxer is currently in use. 
     FILES 
     net/ns.c 
     RELATED INFORMATION 
     Network Demuxers, ns --  add --  demux() 
     NAME 
     ns --  attach 
     Attaches a network device to the network subsystem. 
     SYNOPSIS 
     #include &lt;sys/ndd.h&gt; 
     int ns --  attach (nddp) 
     struct ndd *nddp; 
     PARAMETERS 
     nddp 
     A pointer to a ndd structure describing the device to be attached. 
     DESCRIPTION 
     This network service is called to place the device into the available NS device chain. The NDD should be prepared to be opened after ns --  attach is called. 
     NOTES 
     The ndd structure is allocated and initialized by the device. It should be pinned. 
     EXAMPLES 
     /* Example of adding a NDD during NDD configuration */ 
     struct ndd ndd; 
     ndd.ndd --  name=&#34;en&#34;; 
     ndd.ndd --  unit=adap --  num; 
     ndd.ndd --  addrlen=6; 
     ndd.ndd --  hdrlen=14; 
     ndd.ndd --  mtu=ETHERMTU; 
     ndd.ndd --  mintu=60; 
     ndd.ndd --  type=NDD --  ETHER; 
     ndd.ndd --  flags= 
     NDD --  UP | NDD --  BROADCAST | NDD --  SIMPLEX; 
     ndd.ndd --  open=entopen; 
     ndd.ndd --  output=entwrite; 
     ndd,ndd --  ctl=entctl; 
     ndd.ndd --  close=entclose; 
     ns --  attach(&amp;ndd); 
     RETURN VALUE 
     0--The operation was successful. 
     EEXIST--Indicates that the device is already in the available NS device chain. 
     FILES 
     net/ns.c 
     RELATED INFORMATION 
     Interfaces: ns --  detach() 
     NAME 
     ns --  detach 
     Removes a network device from the network subsystem. 
     SYNOPSIS 
     #include &lt;sys/ndd.h&gt; 
     int ns_detach (nddp) 
     struct ndd *nddp; 
     PARAMETERS 
     nddp 
     A pointer to a ndd structure describing the device to be detached. 
     DESCRIPTION 
     This service removes the ndd structure from the chain of available NS devices. 
     EXAMPLES 
     /* nddp is address of previously attached ndd structure */ 
     ns --  detach(nddp); 
     RETURN VALUE 
     0--The operation was successful. 
     ENOENT--The specified ndd structure was not found. 
     FILES 
     net/ns.c 
     RELATED INFORMATION 
     Interface: ns --  attach() 
     Network Demuxer Overview 
     A network demuxer provides functions for the routing of receive data and status information to the appropriate user(s). The demuxer must be able to interpret and route the different types of receive data that may be received from the interface. For example, a network demuxer for a FDDI interface (NDD type NDD --  FDDI) would need to interpret MAC, SMT, implementor, and LLC frames. The FDDI demuxer would also be responsible for specifying the format of the receive filter (the criteria for demuxing input packets) that would be used in the ns --  add --  filter network service call. 
     A network demuxer registers with NS by means of the ns --  add --  demux network service. 
     There can only be one demuxer registered with NS per network interface type (as defined in &lt;sys/ndd.h&gt;). 
     A Network Demuxer consists of the following functions. 
     nd --  config() 
     This optional entry point provides configuration functions for the demuxer. 
     nd --  receive() 
     Routes received data to the appropriate NS user(s). 
     nd --  status() 
     Distributes asynchronous status to the appropriate NS user(s). nd --  add --  filter() 
     Adds a receive filter for the routing of received data. 
     nd --  del --  filter() 
     Deletes a previously specified receive filter. 
     nd --  add --  status() 
     Adds a filter for routing of asynchronous status. 
     nd --  del --  status() 
     Deletes a previously added status filter. 
     The following provides detailed implementation information for implementing the above listed network demuxer routines. 
     NAME 
     nd --  config() 
     Network Demuxer configuration 
     
         ______________________________________SYNOPSIS#include &lt;sys/cdli.h&gt;#include &lt;sys/ndd.h&gt;int nd.sub.-- config( op, indata, indatalen, outdata,outdatalen)   sysconfig.sub.-- op.sub.-- t             op;   nd.sub.-- config.sub.-- t *             indata;   size.sub.-- t             indatalen;   nd.sub.-- config.sub.-- t *             outdata;   size.sub.-- t             outdatalen;______________________________________ 
    
     PARAMETERS 
     op 
     either SYSCONFIG --  CONFIGURE or SYSCONFIG --  UNCONFIGURE 
     indata 
     demuxer configuration information 
     indatalen 
     the length in bytes of indata 
     outdata 
     returned configuration information 
     outdatalen 
     the length in bytes of outdata 
     DESCRIPTION 
     This function provides configuration for Network Demuxers. SYSCONFIG --  CONFIGURE will configure the demuxer into the system. The demuxer is removed by SYSCONFIG --  UNCONFIGURE. The Network Demuxer type is contained in indata. 
     NOTES 
     SYSCONFIG --  CONFIGURE should call the ns --  add --  demux network service to add the demuxer for the specified type of network interface. SYSCONFIG --  UNCONFIGURE should call ns --  del  --  demux to remove the demuxer. 
     RETURN VALUE 
     Return values of ns --  add --  demux and ns del demux 
     RELATED INFORMATION 
     Interfaces: ns --  add --  demux(), ns --  del --  demux() OSF/1 System Extension Guide. 
     NAME 
     nd --  receive() 
     Process receive data from a NDD. 
     
         ______________________________________   SYNOPSIS     #include &lt;sys/ndd.h&gt;     #include &lt;sys/mbuf.h&gt;     void nd.sub.-- receive( nddp, m)       struct ndd *nddp;       struct mbuf *m;______________________________________ 
    
     PARAMETERS 
     nddp 
     The address of the ndd structure from which the receive data originated. 
     Pointer to a mbuf chain containing the received packet. 
     DESCRIPTION 
     This function will process the incoming data and route the data to the appropriate user. It must be capable of interpreting the different types of frames that may be received from the interface type. The network device driver passes all valid received frames (as indicated by the hardware) to the network demuxer receive function. 
     NOTES 
     The nd --  receive() function must be interrupt safe. The first mbuf in the mbuf chain must be of M --  PKTHDR format. The m --  pkthdr.len field must be set to the total length of the packet. Multiple input packets may be passed to a demuxer by chaining with the m --  nextpkt field of a mbuf. If the input packet(s) is not passed on to a user, the nd --  receive function is responsible for freeing the buffers. 
     RETURN VALUE 
     There is no return value for this function. 
     RELATED INFORMATION 
     Network Device Drivers, mbuf services 
     NAME 
     nd --  status() 
     Process status information from a NDD. 
     
         ______________________________________SYNOPSIS#include &lt;sys/ndd.h&gt;#include &lt;sys/cdli.h&gt;void nd.sub.-- status ( nddp, status)  struct ndd *nddp;  ndd.sub.-- stat.sub.-- t *status;______________________________________ 
    
     PARAMETERS 
     nddp 
     Specifies-the ndd structure for the device from which this status originated. 
     status 
     Pointer to a ndd --  stat --  t status block. The status block contains device specific information on the status event. The status block is defined in sys/ndd.h 
     DESCRIPTION 
     When a status event has occurred on a network device, the NDD builds the appropriate status block and calls the status function. This function is responsible for routing the status information to the appropriate user(s). 
     NOTES 
     The nd --  status() function must be interrupt safe. The status block is passed by reference and is valid only for the duration of the call. 
     RETURN VALUE 
     There is no return value for this function. 
     RELATED INFORMATION 
     Network Demuxers 
     NAME 
     nd --  add --  filter() 
     Adds a receive filter for the specified device. 
     
         ______________________________________SYNOPSIS#include         &lt;sys/ndd.h&gt;#include         &lt;sys/cdli.h&gt;int nd.sub.-- add.sub.-- filter ( nddp, filter, len, ns.sub.-- user)  struct ndd *nddp;  caddr.sub.-- t filter;  int len;  struct ns.sub.-- user *ns.sub.-- user;______________________________________ 
    
     PARAMETERS 
     nddp 
     Specifies the ndd structure of the device. 
     filter Points to the receive filter to be added. The format is demuxer dependent. 
     len 
     The length in bytes of the receive filter pointed to by the filter parameter. The demuxer must verify that the length is correct. 
     ns --  user 
     Pointer to a ns --  user structure describing this user. 
     DESCRIPTION 
     The nd --  add --  filter() function is called from the ns --  add --  filter network service call. The nd --  add --  filter() routine will add the specified receive filter to the list of possible receive patterns. Following this the NDD ndd --  ctl function will be called with the NDD --  ADD --  FILTER operation and the value specified in the filter parameter. 
     RETURN VALUE 
     0--The operation was successful. 
     EEXIST--Receive filter is already in use. 
     EINVAL--Receive filter is invalid. 
     Other demuxer dependent return values. 
     RELATED INFORMATION 
     Interfaces: ns --  add --  filter() 
     NAME 
     nd --  del --  filter() 
     Deletes a receive filter for the specified device. 
     
         ______________________________________SYNOPSIS#include         &lt;sys/ndd.h&gt;#include         &lt;sys/cdli.h&gt;int nd.sub.-- del.sub.-- filter ( nddp, filter, len)  struct ndd *nddp;  caddr.sub.-- t filter;  int len;______________________________________ 
    
     PARAMETERS 
     nddp 
     Specifies the ndd structure of the device for this delete request. 
     filter 
     Points to the receive filter to be deleted. The format is demuxer dependent. 
     len 
     The length in bytes of the receive filter pointed to by the filter parameter. The demuxer must verify that the length is correct. 
     DESCRIPTION 
     The nd --  del --  filter() is called from the ns --  del --  filter network service call. The nd --del   --  filter() routine will remove the specified receive filter from the list of possible receive patterns. Following this the NDD ndd --  ctl function will be called with the NDD --  DEL --  FILTER operation and the value specified in the filter parameter. 
     RETURN VALUE 
     0--The operation was successful. 
     EINVAL--Indicates an invalid receive filter. 
     Other demuxer dependent return values. 
     RELATED INFORMATION 
     Interfaces: ns --  del --  filter() and ns --  add --  demux() 
     NAME 
     nd --  add --  status() 
     Adds a status processing function for the specified device. 
     
         ______________________________________SYNOPSIS#include         &lt;sys/ndd.h&gt;#include         &lt;sys/cdli.h&gt;int nd.sub.-- add.sub.-- status ( nddp, statfilter, len,ns.sub.-- statuser)  struct ndd *nddp;  caddr.sub.-- t statfilter;  int len;  struct ns.sub.-- statuser *ns.sub.-- statuser;______________________________________ 
    
     PARAMETERS 
     nddp Specifies the ndd structure of the device for this add request. 
     statfilter 
     Points to the status filter to be added. The format is demuxer dependent. 
     len 
     The length in bytes of the status filter pointed to by the statfilter parameter. 
     ns --  statuser 
     Pointer to a ns --  statuser structure describing this user. 
     DESCRIPTION 
     The nd --  add --  status() function is called from the ns --  add --  status network service call. The nd --  add --  status() routine will add the specified status filter to the list of status processing functions. Following this the NDD ndd --  ctl function will be called with the NDD --  ADD --  STATUS operation and the value specified in the filter parameter. 
     RETURN VALUE 
     0--The operation was successful. 
     EINVAL--Status filter is invalid. 
     Other demuxer dependent return values. 
     RELATED INFORMATION 
     Interfaces: ns --  add --  status() 
     NAME 
     nd --  del --  status() 
     Deletes a status filter for the specified device. 
     
         ______________________________________SYNOPSIS#include         &lt;sys/ndd.h&gt;#include         &lt;sys/cdli.h&gt;int nd.sub.-- del.sub.-- status ( nddp, statfilter, len)  struct ndd *nddp;  caddr.sub.-- t statfilter;  int len;______________________________________ 
    
     PARAMETERS 
     nddp 
     Specifies the ndd structure of the device for this add request. 
     statfilter 
     Points to the status filter to be added. The format is demuxer dependent. 
     len 
     The length in bytes of the status filter pointed to by the statfilter parameter. 
     DESCRIPTION 
     The nd --  del --  status() function is called from the ns --  del --  status network service call. The nd --  del --  status() routine will use the specified status filter to remove the caller&#39;s status processing function. Following this the NDD ndd --  ctl function will be called with the NDD --  DEL --  STATUS operation and the value specified in the filter parameter. 
     RETURN VALUE 
     0--The operation was successful. 
     EINVAL--Invalid parameter. 
     Other demuxer dependent return values. 
     RELATED INFORMATION 
     Interfaces: ns --  del --  status() 
     NAME 
     nd --  response() 
     Build and send a response frame for an 802.2 LLC XID or TEST request. 
     
         ______________________________________SYNOPSIS#include &lt;sys/ndd.h&gt;#include &lt;sys/mbuf.h&gt;void nd.sub.-- response ( nddp, m, llcoffset)  struct ndd            *nddp;  struct mbuf            *m;  caddr.sub.-- t            llcoffset;______________________________________ 
    
     PARAMETERS 
     nddp 
     The address of the ndd structure that the response should be sent on. 
     Pointer to a mbuf chain containing the XID or TEST packet. 
     llcoffset Offset of start of 802.2 LLC header. 
     DESCRIPTION 
     This function will process the incoming XID or TEST request by doing and MAC level processing. For instance, an 802.3 demuxer would have to reverse the source and destination fields in the 802.3 header. The caller of this function must have already done any 802.2 XID/TEST processing. After processing the packet, this function should call the ndd --  output function of the specified NDD. 
     NOTES 
     The nd --  response() function must be interrupt safe. The first mbuf in the chain must be of M --  PKTHDR format. The m --  pkthdr.len field must be set to the total length of the packet. Multiple packets may not be passed to this function by chaining with the m --  nextpkt field of a mbuf. If an error occurs the mbuf is freed and no response frame is transmitted. 
     RETURN VALUE 
     There is no return value for this function. 
     RELATED INFORMATION 
     Network Device Drivers 
     Network Device Driver Overview 
     A Network Device Driver (NDD) provides functions for transmitting data to and receiving data from the physical hardware. User applications interface to network devices by way of sockets or streams. A NDD consists the following entry point and functions. 
     ndd --  config--provides configuration functions. 
     ndd --  open--allocates system resources and initializes the device for reading and writing of data. 
     ndd --  close--resets the device to a known state and frees system resources. 
     ndd --  output--provides the means for transmitting data. 
     ndd --  ctl--various functions for controlling the device. 
     A NDD also interfaces to a demuxer through the following functions. 
     nd --  rcv--this function conforms to the syntax of the 
     nd --  receive function of a network demuxer 
     nd --  stat--this function conforms to the syntax of the nd --  status function of a network demuxer. 
     At the completion of configuration, the ns --  attach network service is called to place the specified device into the available NS device chain. The call to ns --  attach may be deferred until the required microcode, routing table, or other information is loaded. 
     Before the completion of termination, the ns --  detach network service is called to remove the specified device from the available NS device chain. 
     The following provides detailed implementation information for implementing the above listed network device driver routines. 
     NAME 
     ndd --  open function 
     opens the specified device. 
     
         ______________________________________SYNOPSIS#include &lt;sys/ndd.h&gt;int ndd.sub.-- open ( nddp)  struct ndd *nddp;______________________________________ 
    
     PARAMETERS 
     nddp 
     Pointer to the ndd structure of the device that this open request is for. 
     DESCRIPTION 
     When the ndd --  open() function is called, the device driver should allocate any necessary system resources and attach the device to the network. Only one open is supported per device. The Network Demuxer receive and status functions are placed in the ndd structure by NS prior to this call. 
     NOTES 
     Transmitting and receiving data using the device can only be performed after the ndd --  open() function has successfully completed. At open time Network Device Drivers (NDDs) will do any necessary initialization in order to attach to the network. The NDD will block for a &#34;reasonable&#34; amount of time waiting for initialization to complete. A reasonable amount of time is adapter specific. For ethernet it may be one second while token ring may be one minute. If this time limit is reached, the NDD will set the NDD --  UP flag and return success to the caller. When initialization finally completes, asynchronous status will be sent to indicate the open has completed. The NDD --  RUNNING flag will also be set in the ndd --  flags field of the ndd structure. Only hard open errors are returned. If the connection fails for an asynchronous open, the NDD --  UP flag is turned off. The ndd --  open function is only called from the ns --  alloc network service. 
     RETURN VALUE 
     0--The operation was successful. 
     EBUSY--Device is already open. 
     ENOMEM--Unable to allocate required memory. 
     ENODEV--Invalid device. 
     ENOCONNECT--Indicates that open failed, unable to connect to the network. 
     RELATED INFORMATION 
     ndd --  close() function 
     NAME 
     ndd --  close function 
     Closes the specified device. 
     
         ______________________________________SYNOPSIS#include &lt;sys/ndd.h&gt;int ndd.sub.-- close( nddp)  struct ndd *nddp;______________________________________ 
    
     PARAMETERS 
     nddp 
     Pointer to the ndd structure of the device to be closed. 
     DESCRIPTION 
     When the ndd --  close() function is called, the device driver detaches the specified device from the network and frees previously allocated system resources. The device will not be detached from the network until the device&#39;s transmit queue is allowed to drain. That is, ndd --  close() will not return until all packets have been transmitted. If the device is inoperable at the time of the close, the device&#39;s transmit queue does not have to be allowed to drain. The NDD is responsible for freeing any buffers that are in it&#39;s possession at the time of the ndd --  close(). This function resets the device to a known state. 
     NOTES 
     The ndd --  close function is only called from the ns --  free network service. 
     RETURN VALUE 
     0--The operation was successful. 
     RELATED INFORMATION 
     ndd --  open() function 
     NAME 
     ndd --  output function 
     Outputs data to the specified network device. 
     
         ______________________________________SYNOPSIS#include         &lt;sys/ndd.h&gt;#include         &lt;sys/mbuf.h&gt;int ndd.sub.-- output(nddp, m)  struct ndd            *nddp;  struct mbuf            *m;______________________________________ 
    
     PARAMETERS 
     nddp 
     Address of the ndd structure of the device. 
     A mbuf pointer of the packet(s) to be transmitted. 
     DESCRIPTION 
     The ndd --  output() function is called by a NS user to transmit data onto the network. Transmit data is passed in mbufs. On successful write requests, the NDD is responsible for freeing all the buffers associated with the request. If the call to ndd --  output fails, the NDD will not free the mbuf. If any of the chained packets can be transmitted, the write is considered successful and the NDD is responsible for all mbufs in the chain. 
     NOTES 
     ndd --  output() must be interrupt safe and cannot block. The first mbuf in the mbuf chain must be of M --  PKTHDR format and the m --  pkthdr.len field must be set to the total length (in bytes) of the packet. Multiple packets may be chained by using the m --  nextpkt field of a mbuf. 
     RETURN VALUE 
     0--the transmit was successful 
     EAGAIN--The transmit queue is full. 
     ENETDOWN--The network is permanently down. 
     ENETUNREACH--Network is temporarily unreachable. 
     RELATED INFORMATION 
     ndd --  open() function, mbuf services 
     NAME 
     ndd --  ctl function 
     provides device control functions 
     
         ______________________________________SYNOPSIS#include &lt;sys/ndd.h&gt;int ndd.sub.-- ctl ( nddp, cmd, arg, len)       struct ndd *nddp;       int cmd;       caddr.sub.-- t arg;       int len;______________________________________ 
    
     PARAMETERS 
     nddp Address of the ndd structure of the device. 
     cmd 
     Specifies the control operation to be performed. The commands are described below. 
     arg 
     Specifies the address of the control parameter block. The format is command specific. 
     len 
     Length (in bytes) of the arg parameter. 
     DESCRIPTION 
     NDD --  GET --  STATS 
     Retrieves generic and device specific statistics. arg is the address of a buffer in which statistics will be returned. 
     NDD --  ENABLE --  ADDRESS 
     Enables reception of packets with an alternate address (e.g., multicast). arg points to the multicast address to be enabled. The format of arg is specific to a NDD type. The NDD --  ALTADDRS flag should be set in the ndd --  flags field. 
     NDD --  DISABLE 
     --ADDRESS 
     Disables the receipt of an alternate address. The arg parameter points to the address to be disabled. The format of arg is specific to a NDD type. The NDD --  ALTADDRS flag should be reset in the ndd --  flags field of the ndd structure if this is the last alternate address. 
     NDD --  PROMISCUOUS --  ON 
     Turns on promiscuous mode for devices that support it. 
     NDD --  PROMISCUOUS OFF 
     Terminates promiscuous mode. 
     NDD --  ADD --  FILTER 
     This command is for use by devices that support hardware level filtering. The arg parameter points to the receive filter (e.g., sap) to be added to the filter list. The format of the filter is device type specific. The format of arg is specific to a NDD type. 
     NDD --  DEL --  FILTER 
     Removes a previously added filter from the hardware filter list. The arg parameter points to the filter to be removed. The format of arg is specific to a NDD type. 
     NDD --MIB   --  SET 
     Set MIB(s) on the specified device. The arg parameter specifies the address of the ndd --  mib --  acc structure which contains the following fields: length: total length in bytes of ndd --  mib --  set parameter. 
     ndd --  mib --  set 
     count--the number of MIB variables to set. 
     The following fields are repeated &#34;count&#34; times. 
     mib--the MIB variable to set. 
     status--return status from the set operation. Values are defined in sys/ndd.h. 
     mib --  len --  length in bytes of the mib --  value field. 
     mib --  value--value of the MIB variable to be set. 
     NDD --  MIB --  QUERY 
     Determines which device specific MIBs are supported. The arg parameter points to a ndd --  mib --  acc structure. 
     length 
     total length in bytes of ndd --  mib --  query 
     ndd --  mib --  query 
     Pointer to device specific MIB structure. This portion of the structure will be filled with flags indicating the level of support for each MIB variable. These flags are defined in sys/ndd.h. 
     NDD --  MIB --  GET 
     Retrieves the values of all MIBs on the specified device. The arg parameter points to a ndd --  mib --  acc structure. 
     length 
     total length in bytes of ndd --  mib --  get 
     ndd --  mib --  get 
     Pointer to device specific MIB structure. 
     NDD --  ENABLE --  MULTICAST 
     Enables reception of all multicast packets. The NDD --  MULTICAST flag should be set in the ndd --  flags 
     field of the ndd structure. 
     NDD --  DISABLE --  MULTICAST 
     Disables the receipt of all multicast packets. The 
     NDD --  MULTICAST flag should be reset in the ndd --  flags field of the ndd structure. 
     NOTES 
     All device drivers conforming to the NDD Interface must recognize, but not necessarily support, each of the above command operations. Additional control operations may be specified by the individual NDD as required. 
     The ndd --  ctl() function must be interrupt safe. It must also maintain reference counts on control operations that require it (ex set promiscuous). 
     Privilege checks are not required of this function. They are done at a higher level. 
     RETURN VALUE 
     0--success 
     EOPNOTSUPP--The cmd is not supported. 
     EINVAL--An invalid parameter was specified. 
     ENETUNREACH--The network is currently unreachable. 
     ENETDOWN--The network is permanently down. 
     Common Demuxer Services Overview 
     Common Demuxer Services provide common functions so that Network Demuxers may be created more easily. These services consists of the following functions. 
     dmx --  8022 --  receive() 
     Routes received 802.2 LLC data to the appropriate user(s). 
     dmx --  status() 
     Distributes asynchronous status to the appropriate user(s). 
     dmx --  8022 --  add --  filter() 
     Adds a 802.2 receive filter for the routing of received data. 
     dmx --  8022 --  del --  filter() 
     Deletes a previously specified 802.2 receive filter. 
     dmx --  add --  status() 
     Adds a filter for routing of asynchronous status. 
     dmx --  del --  status() 
     Deletes a previously added status filter. 
     The following provides detailed implementation information for implementing the above listed common demuxer service routines. 
     NAME 
     dmx --  8022 --  receive() 
     Process receive data from a NDD. 
     
         ______________________________________SYNOPSIS______________________________________#include &lt;sys/ndd.h&gt;#include &lt;sys/mbuf.h&gt;void dmx.sub.-- 8022.sub.-- receive(nddp, m, llcoffset)  struct ndd *nddp;  struct mbuf *m;  int llcoffset;______________________________________ 
    
     PARAMETERS 
     nddp 
     The address of the ndd structure from which the receive data originated. 
     Pointer to a mbuf chain containing the received packet. 
     llcoffset 
     Specifies the offset in bytes to the 802.2 LLC header. 
     DESCRIPTION 
     This function will process incoming 802.2 data and route the data to the appropriate user. Routing of data is accomplished by using 802.2 filters that have previously been added through the ns --  add --  filter and dmx --  8022 --  add filter Network Services. 
     NOTES 
     The dmx --  8022 --  receive() function must be interrupt safe. The first mbuf in the chain must be of M --  PKTHDR format. The m --  pkthdr.len field must be set to the total length of the packet. Multiple input packets may not be passed to a demuxer by chaining with the m --  nextpkt field of a mbuf. If the input packet(s) is not passed on to a user, the dmx --  8022 --  receive function will free the buffers. 
     RETURN VALUE 
     There is no return value for this function. 
     RELATED INFORMATION 
     Network Device Drivers 
     NAME 
     dmx --  status() 
     Process status information from a NDD. 
     
         ______________________________________SYNOPSIS______________________________________#include &lt;sys/ndd.h&gt;#include &lt;sys/cdli.h&gt;void dmx.sub.-- status(nddp, status)  struct ndd *nddp;  struct ndd.sub.-- statblk *status;______________________________________ 
    
     PARAMETERS 
     nddp 
     Specifies the ndd structure for the device from which this status originated. 
     status 
     Pointer to a ndd statblk status block. The status block contains device specific information on the status event. The status block is defined in sys/ndd.h. 
     DESCRIPTION 
     The dmx --  status Network Service is called from a Network Demuxer&#39;s status function. It is responsible for routing the status information to the appropriate user(s). 
     NOTES 
     The dmx --  status() function must be interrupt safe. The status block is passed by reference and is valid only for the duration of the call. 
     RETURN VALUE 
     There is no return value for this function. 
     RELATED INFORMATION 
     Network Demuxers 
     NAME 
     dmx --  8022 --  add --  filter() 
     Adds an 802.2 receive filter for the specified device. 
     
         ______________________________________SYNOPSIS______________________________________#include     &lt;sys/ndd.h&gt;#include     &lt;sys/cdli.h&gt;int dmx.sub.-- 8022.sub.-- add.sub.-- filter (nddp, filter, ns.sub.--user)  struct ndd *nddp;  struct ns.sub.-- 8022 *filter;  struct ns.sub.-- user *ns.sub.-- user;______________________________________ 
    
     PARAMETERS 
     nddp 
     Specifies the ndd structure of the device. 
     filter 
     Points to the 802.2 receive filter to be added. 
     ns --  user 
     Pointer to a ns --  user structure describing this user. 
     DESCRIPTION 
     The dmx --  8022 --  add --  filter() function is called from a Network Demuxer&#39;s add filter function. The routine will add the specified 802.2 LLC receive filter to the list of possible receive patterns. 
     RETURN VALUE 
     0--The operation was successful. 
     ENOMEM--Unable to allocate the required resources. 
     EEXIST--Receive filter is already in use. 
     EINVAL--Receive filter is invalid. 
     RELATED INFORMATION 
     Interfaces: ns --  add --  filter() 
     NAME 
     dmx --  8022 --  del --  filter() 
     Deletes an 802.2 LLC receive filter for the specified device. 
     
         ______________________________________SYNOPSIS______________________________________#include     &lt;sys/ndd.h&gt;#include     &lt;sys/cdli.h&gt;int dmx.sub.-- 8022.sub.-- del.sub.-- filter (nddp, filter)  struct ndd *nddp;  struct ns.sub.-- 8022 *filter;______________________________________ 
    
     PARAMETERS 
     nddp 
     Specifies the ndd structure of the device for this delete request. 
     filter 
     Points to a ns --  8022 structure that specifies the receive filter to be deleted. 
     DESCRIPTION 
     The dmx --  8022 --  del --  filter() service is called from a Network Demuxer&#39;s delete filter function. It will delete the specified 802.2 LLC receive filter from the list of possible receive patterns. 
     RETURN VALUE 
     0--The operation was successful. 
     ENOENT--The specified filter was not found. 
     EINVAL--Indicates an invalid receive filter. 
     RELATED INFORMATION 
     Interfaces: ns --  del --  filter() 
     NAME 
     dmx --  add --  status() 
     Adds a status processing function for the specified device. 
     
         ______________________________________SYNOPSIS______________________________________#include     &lt;sys/ndd.h&gt;#include     &lt;sys/cdli.h&gt;int dmx.sub.-- add.sub.-- status (nddp, statfilter, ns.sub.-- statuser)  struct ndd *nddp;  struct ns.sub.-- com.sub.-- status *statfilter;  struct ns.sub.-- statuser *ns.sub.-- statuser;______________________________________ 
    
     PARAMETERS 
     nddp 
     Specifies the ndd structure of the device for this add request. 
     statfilter 
     Points to the status filter to be added. 
     ns --  statuser 
     Pointer to a ns statuser structure describing this user. 
     DESCRIPTION 
     The dmx --  add --  status() function is called from a Network Demuxer&#39;s add status function. It will add the specified ns --  com --  status filter to the list of status processing functions. The dmx --  status service will use the status filter when determining if a status user should be called to process a status event. 
     RETURN VALUE 
     0--The operation was successful. 
     ENOMEM--Unable to allocate required resources. 
     EINVAL--Status filter is invalid. 
     RELATED INFORMATION 
     Interfaces: ns --  add --  status() 
     NAME 
     dmx --  del --  status() 
     Deletes a status filter for the specified device. 
     
         ______________________________________SYNOPSIS______________________________________#include     &lt;sys/ndd.h&gt;#include     &lt;sys/cdli.h&gt;int dmx.sub.-- del.sub.-- status (nddp, statfilter)  struct ndd *nddp;  struct ns.sub.-- com.sub.-- status *statfilter;______________________________________ 
    
     PARAMETERS 
     nddp 
     Specifies the ndd structure of the device for this add request. 
     statfilter 
     Points to the status filter to be added. 
     DESCRIPTION 
     The dmx --  del --  status() function is called from a Network Demuxer&#39;s delete status function. It will delete the specified ns --  com --  status filter from the list of status processing functions. The sid field of the ns --  com --  status structure will be used to remove the proper status filter. Because of this users of the common status functions must save the status filter from the dmx --  add --  status call. 
     RETURN VALUE 
     0--The operation was successful. 
     ENOENT--The specified filter was not found. 
     EINVAL--Invalid parameter. 
     RELATED INFORMATION 
     Interfaces: ns --  del --  status() 
     The following data structure definitions are used in conjunction with the above described routines for enabling the common data link interface. 
     NAME 
     ndd--Defines a Network Device Driver 
     
         ______________________________________SYNOPSIS______________________________________#include &lt;sys/ndd.h&gt;struct ndd {struct      ndd *ndd.sub.-- next;u.sub.-- int       ndd.sub.-- refcnt;char        *ndd.sub.-- name;u.sub.-- short       ndd.sub.-- unit;u.sub.-- long       ndd.sub.-- flags;caddr.sub.-- t       ndd.sub.-- correlator;/* procedure handles */int         (*ndd.sub.-- open) ( );int         (*ndd.sub.-- close) ( );int         (*ndd.sub.-- output) ( );int         (*ndd.sub.-- ctl) ( );/* user receive and status functions */void        (*nd.sub.-- receive) ( );void        (*nd.sub.-- status) ( );/* driver description */u.sub.-- long       ndd.sub.-- mtu;u.sub.-- long       ndd.sub.-- mintu;u.sub.-- char       ndd.sub.-- type;u.sub.-- char       ndd.sub.-- addrlen;u.sub.-- char       ndd.sub.-- hdrlen;caddr.sub.-- t       ndd.sub.-- physaddr;/* stats */struct ndd.sub.-- genstats             ndd.sub.-- genstats;caddr.sub.-- t ndd.sub.-- specsats;caddr.sub.-- t ndd.sub.-- speclen;struct ns.sub.-- demuxer             *ndd.sub.-- demuxer;struct ns.sub.-- dmx.sub.-- .sub.-- ctl             *ndd.sub.-- nsdemux;caddr.sub.-- t ndd.sub.-- specdemux;};______________________________________ 
    
     FIELDS 
     ndd --  next 
     A pointer to the next NDD in the available NDD chain. This field should only be modified by the ns --  attach and ns --  detach network services. 
     ndd --  refcnt 
     A counter of the number of outstanding ns --  alloc&#39;s for the NDD. The ns --  alloc network service will increment this counter while the ns --  free service will decrement it. 
     ndd --  name 
     The name of this NDD, e.g., &#34;en&#34;. 
     ndd --  unit 
     Used to identify a specific device of the same type. An ethernet NDD could have a name of &#34;en&#34; and units of 0 and 1 if there are two adapters in the system. Users of the NDD would then reference the adapters with names of &#34;en0&#34; and &#34;en1&#34; 
     ndd --  flags 
     Describes device state and characteristics. All these flags are set by the NDD. NDD --  RUNNING, NDD --  DEAD, and NDD --  LIMBO are mutually exclusive. 
     NDD --  UP 
     Set when a NDD is successfully opened. If an asynchronous open later fails, this flag should be reset. 
     NDD --  RUNNING 
     The NDD has been opened and is operational. 
     NDD --  DEAD 
     The adapter is not operative. 
     5O 
     NDD --LIMBO   
     The NDD is attempting to recover from a device error. 
     NDD --  BROADCAST 
     This adapter has media broadcast capability. 
     NDD --  SIMPLEX 
     The adapter can not hear it&#39;s own transmissions. 
     NDD --  DEBUG 
     The NDD is operating in debug mode. 
     NDD --  PROMISC 
     The adapter is in promiscuous mode. 
     NDD --  ALTADDRS 
     Adapter is receiving alternate addresses (e.g., multicast). 
     NDD --  MULTICAST 
     Adapter is receiving all multicast addresses. 
     ndd --  correlator 
     The field can be used by a NDD to correlate to an internal control structure. 
     ndd --  open 
     The address of the open function of the NDD. 
     ndd --  close 
     The address of the close function of the NDD. 
     ndd --  output 
     The address of the packet transmit function of the NDD. 
     ndd --  ctl 
     The address of the device control function of the NDD. 
     ndd --  rcv 
     A pointer to a demuxer receive function. A NDD will call this function when a packet is received. This field is initialized by the ns --  alloc network service. 
     ndd --  star 
     A pointer to a demuxer status function. A NDD will call this function when asynchronous status is available. This field is initialized by the ns --  alloc network service. 
     ndd --  mtu 
     The maximum packet size that can be transmitted. 
     ndd --  mintu 
     The minimum packet size that can be transmitted. 
     ndd --  type 
     The media type of the NDD, (e.g., NDD --  FDDI for a FDDI NDD). If an ethernet NDD supports 802.3 it should use a type of NDD --  IS088023. Otherwise it should be NDD --  ETHER. See sys/ndd.h for a list of possible values. 
     ndd --  addrlen 
     This field contains the length in bytes of physical address. For example, this would be 6 for ethernet. 
     ndd --  hdrlen 
     The total length in bytes of media and link level headers for this NDD. If headers are of variable length, the maximum length should be specified. 
     ndd --  physaddr 
     A pointer to the physical address of this device. 
     ndd --  genstats 
     The ndd --  genstats structure contains simple counters that are common to all NDD types. 
     ndd --  specstats 
     A pointer to NDD specific counters, If there are no device specific counters this field may be NULL. 
     ndd --  speclen 
     Length of device specific statistics pointed to by ndd --  specstats, 
     ndd --  demuxer 
     This field points to the network demuxer (struct ns --  demuxer) associated with the NDD, If NULL at the time of the first ns --  alloc, this field is initialized by Network Services. Otherwise the specified demuxer is used, 
     ndd --  nsdemux 
     If common demuxer services are used by the demuxer associated with the NDD, this field points to a demuxer control structure, Network Services will initialize this field. 
     ndd --  specdemux 
     A demuxer may initialize and use this field to point to a per NDD demuxer structure. 
     DESCRIPTION 
     The ndd structure defines a Network Device Driver and provides a linkage between a NDD and it&#39;s users, Each network device will have a ndd structure associated with it, 
     NOTES 
     The ndd structure is allocated and owned by the NDD. It must be pinned 
     FILES 
     sys/ndd.h 
     NAME 
     ndd --  genstats 
     Defines common NDD statistics 
     
         ______________________________________SYNOPSIS______________________________________#include &lt;sys/ndd.h&gt;struct ndd.sub.-- genstats {u.sub.-- long      ndd.sub.-- ipackets.sub.-- msw;u.sub.-- long      ndd.sub.-- ipackets.sub.-- lsw;u.sub.-- long      ndd.sub.-- ibytes.sub.-- msw;u.sub.-- long      ndd.sub.-- ibytes.sub.-- lsw;u.sub.-- long      ndd.sub.-- recvintr.sub.-- msw;u.sub.-- long      ndd.sub.-- recvintr.sub.-- lsw;u.sub.-- long      ndd.sub.-- ierrors;u.sub.-- long      ndd.sub.-- opackets.sub.-- msw;u.sub.-- long      ndd.sub.-- opackets.sub.-- lsw;u.sub.-- long      ndd.sub.-- obytes.sub.-- msw;u.sub.-- long      ndd.sub.-- obytes.sub.-- lsw;u.sub.-- long      ndd.sub.-- xmitintr.sub.-- msw;u.sub.-- long      ndd.sub.-- xmitintr.sub.-- lsw;u.sub.-- long      ndd.sub.-- oerrors;u.sub.-- long      ndd.sub.-- nobufs;u.sub.-- long      ndd.sub.-- xmitque.sub.-- max;u.sub.-- long      ndd.sub.-- xmitque.sub.-- ovf; /*XXX - Paul */};______________________________________ 
    
     FIELDS 
     ndd --  ipackets --  msw 
     Most significant word of the number of packets received on this NDD. 
     ndd --  ipackets --  lsw 
     Least significant word of the number of packets received on this NDD. 
     ndd --  ibytes --  msw 
     Most significant word of the total received bytes. 
     ndd --  ibytes --  lsw 
     Least significant word of the total received bytes. 
     ndd --  ierrors 
     Number of receive errors encountered. 
     ndd --  opackets --  msw 
     Most significant word of the number of packets transmitted on this NDD. 
     ndd --  opackets --  lsw 
     Least significant word of the number of packets transmitted on this NDD. 
     ndd --  obytes --  msw 
     Most significant word of the number of transmitted bytes. 
     ndd --  obytes --  lsw 
     Least significant word of the number of transmitted bytes. 
     ndd --  oerrors 
     Number of output errors for this NDD. 
     ndd --  xmitintr --  msw 
     Most significant word of the count of transmit complete interrupts. 
     ndd --  xmitintr --  lsw 
     Least significant word of the count of transmit complete interrupts. 
     ndd --  recvintr --  msw 
     Most significant word of the count of receive data interrupts. 
     ndd --  recvintr --  lsw 
     Least significant word of the count of receive data interrupts. 
     ndd --  nobufs 
     Number of times that buffers were not available. 
     ndd --  xmitque --  max 
     Maximum number of transmits ever queued. 
     ndd --  xmitque --  ovf 
     Number of transmit queue overflow errors. 
     DESCRIPTION 
     The ndd --  genstats structure is used to keep simple counters that are common to all NDD types. 
     NOTES 
     The ndd --  genstats structure is part of the ndd structure. 
     FILES 
     sys/ndd.h 
     NAME 
     ndd --  statblk 
     Network Device Driver status block. 
     
         ______________________________________SYNOPSIS______________________________________#include &lt;sys/ndd.h&gt;struct ndd.sub.-- statblk {     u.sub.-- int              code;     u.sub.-- int              option[10];};______________________________________ 
    
     FIELDS 
     code 
     Defines the type of status block. Possible code values are in sys/ndd.h 
     NDD --  HARD FAIL 
     A hardware failure has occurred 
     NDD --  LIMBO --  ENTER 
     Entered Network Recovery Mode 
     NDD --  LIMBO --  EXIT 
     Exited Network Recovery Mode 
     NDD --  STATUS 
     Various status and event info option 
     This field can contain reason codes and/or other information. The option field format is specified on a per code basis, 
     NDD --  ADAP --  CHECK 
     Adapter checkstop condition NDD --  BUS --  ERROR 
     Bus error 
     NDD --  CMD --  FAIL 
     A device command has failed NDD --  PIO --  FAIL 
     A PIO operation has failed NDD --  UCODE --  FAIL 
     Failure of device microcode NDD --  TX --  ERROR 
     A transmission error has occurred NDD --  TX --  TIMEOUT 
     Transmission timeout error NDD --  RCV --  ERROR 
     A receive error has occurred NDD --  AUTO --  RMV 
     Auto-remove error detected NDD --  CONNECTED 
     Device open successful NDD --  BAD --  PKTS 
     A bad packet was received 
     DESCRIPTION 
     This structure is used to convey asynchronous device status information to CDLI users. 
     FILES 
     sys/ndd.h 
     NAME 
     ns --  user 
     Describes user characteristics for delivering input packets. 
     
         ______________________________________SYNOPSIS______________________________________#include &lt;sys/cdli.h&gt;#include &lt;net/if.h&gt;struct ns.sub.-- user {    int      (*isr) ( );    caddr.sub.-- t             isr.sub.-- data;    struct ifqueue             *protoq;    u.sub.-- short             pkt.sub.-- format;    u.sub.-- short             netisr;    struct ifnet             *ifp;};______________________________________ 
    
     FIELDS 
     isr 
     Address of a function that handles input packets. The function will be called when there is receive data available that matches a user specified filter. 
     isr --  data 
     If the protoq parameter is NULL, this field will be passed to isr as a parameter. 
     protoq 
     The address of an input ifqueue. If this field is non-NULL, input packets will enqueued and the isr will be scheduled with schednetisr(netisr). If it is NULL, the isr will called directly as such: 
       isr(nddp, m, macp, isr --  data); 
     where: 
     nddp is the ndd structure from which the data originated. 
     m is the input packet. 
     macp points to the start of the packet. 
     isr --  data is the value specified in the 
     ns --  add --  filter call. 
     pkt --  format 
     This field specifies the packet header presentation of input packets. Possible values are: 
     NS --  PROTO 
     Remove all link-level headers. SNAP is not used. 
     NS --  PROTO --  SNAP 
     Remove all link-level headers including SNAP. 
     NS --  INCLUDE --  LLC 
     Leave LLC headers in place. 
     NS --  INCLUDE --  MAC 
     Do not remove any headers. 
     NS --  HANDLE --  NON --  UI 
     Automatically handle XID and TEST frames. 
     netisr 
     This field indicates a netisr number that will be used to schedule the users isr function. If netisr is non-zero, then the protoq must all be specified and the user must call the netisr --  add service to register the netisr. 
     ifp 
     If the caller is an IFNET driver, this field should be set to the appropriate ifnet pointer. The field should be NULL if the caller is not an IFNET driver. 
     DESCRIPTION 
     This structure is used to describe how packets are to be delivered to a user of a demuxer. The user initializes this structure before calling the ns --  add --  filter service. 
     FILES 
     sys/cdli.h 
     NAME 
     ns --  statuser 
     Describes an asynchronous status user of a device. 
     
         ______________________________________SYNOPSIS______________________________________    struct ns.sub.-- statuser       int    (*isr) ( );       caddr.sub.-- t              isr.sub.-- data;    };______________________________________ 
    
     FIELDS 
     isr 
     Address of a function that handles asynchronous status. The function will be called when an asynchronous status event occurs. The isr will called directly as such: 
     isr(nddp, status, isr. --  data); 
     where: 
     nddp is the ndd structure from which the status originated. 
     status is a pointer to a ndd --  statblk structure. 
     isr --  data is the value specified in the ns --  add --  status call. 
     isr --  data 
     This field will be passed to isr as a parameter. 
     DESCRIPTION 
     This structure is used to describe a status user. It is used to present asynchronous status when it occurs. 
     FILES 
     sys/cdli.h 
     NAME 
     ns --  8022 
     802.2 LLC receive filter used by common demuxer services. 
     
         ______________________________________SYNOPSIS______________________________________    struct ns.sub.-- 8022 {        u.sub.-- int                filtertype;        u.sub.-- char                dsap;        u.sub.-- char                orgcode [3];        u.sub.-- short                ethertype;    };______________________________________ 
    
     FIELDS 
     filtertype 
     Specifies the type of receive filtering. One of: 
     NS --  8022 --  LLC --  DSAP 
     filter on 802.2 DSAP field 
     NS --  8022 --  LLC --  DSAP --  SNAP 
     filter on 802.2 with SNAP 
     NS --  TAP 
     Receive all network packets from a NDD. 
     NS --  TAP users cannot specify to have packets queued, they are called directly and must copy the packet if they are interested in it. 
     dsap 
     The 802.2 LLC DSAP on which to filter. 
     orgcode 
     Specifies the organization code in the 802.2 SNAP header. This field is only valid if filtertype is set to NS --  8022 --  LLC --  DSAP --  SNAP. 
     ethertype 
     Specifies the ethertype field in the 802.2 SNAP header. This field is only valid if filtertype is set to NS --  8022 --  LLC --  DSAP --  SNAP. 
     DESCRIPTION 
     This structure is the receive filter that is used by the Common Demuxer Services. It allows filtering on networks that use 802.2 LLC for protocol multiplexing. 
     FILES 
     sys/cdli.h 
     NAME 
     ns --  comstatus 
     Status filter for Common Demuxer Services 
     
         ______________________________________SYNOPSIS______________________________________    struct ns.sub.-- comstatus {       u.sub.-- int              filtertype;       u.sub.-- int              mask;       u.sub.-- int              sid;    };______________________________________ 
    
     FIELDS 
     filtertype 
     Specifies the type of status filter. It should be set to NS --  STATUS --  MASK. 
     mask 
     The status code mask value. When an asynchronous event has occurred on a device, the Network Demuxer will logical AND the specified mask field with the status block&#39;s code field. If the result is non-zero the status block will be delivered to the user. 
     sid 
     This field holds the status id that is calculated by the ns --  add --  status service. The user must keep track of this value and provide it to the ns --  del --  status service. 
     DESCRIPTION 
     This structure is the status filter that is used by the Common Demuxer services. It provides a user with a means of specifying which status events are of interest. 
     FILES 
     sys/cdli.h 
     NAME 
     ifqueue 
     Network packet queue. 
     
         ______________________________________SYNOPSIS______________________________________    struct ifqueue {        struct mbuf                *ifq.sub.-- head;        struct mbuf                *ifq.sub.-- tail;        int  ifq.sub.-- len;        int  ifq.sub.-- maxlen;        int  ifq.sub.-- drops;    };______________________________________ 
    
     FIELDS 
     ifq --  head 
     Pointer to the first mbuf in the queue. 
     ifq --  tail 
     Pointer to the last mbuf in the queue. 
     ifq --  len 
     The number of packets in the queue. 
     ifq --  maxlen 
     Maximum number of packets than can be queued on this queue. 
     ifq --  drops 
     Number of packets dropped because the queue was full. 
     DESCRIPTION 
     This structure is used to queue network packets for CDLI users that have requested queued service. Macros for manipulating ifqueues may be found in net/if.h. Packets are enqueued FIFO. The m --  nextpkt field of a mbuf is used as the queueing mechanism. Packets may be removed one at a time by using the IF-DEQUEUE macro. 
     FILED 
     net/if.h 
     NAME 
     nd --  dmxstats 
     Network Demuxer statistics. 
     
         ______________________________________SYNOPSIS______________________________________    struct nd.sub.-- dmxstats {        u.sub.-- long               nd.sub.-- nofilter;        u.sub.-- long               nd.sub.-- nobufs;        u.sub.-- long               nd.sub.-- bcast;        u.sub.-- long               nd.sub.-- mcast;    };______________________________________ 
    
     FIELDS 
     nd --  nofilter 
     The number of packets dropped due to no user. 
     nd --  nobufs 
     The number of packets dropped because buffers were unavailable. 
     nd --  bcast 
     Number of broadcast packets received. 
     nd --  mcast 
     Number of multicast packets received. 
     DESCRIPTION 
     This structure contains statistics that are independent of demuxer type. The statistics provide usage and diagnostic counters. 
     FILES 
     sys/cdli.h 
     NAME 
     ns --  demuxer 
     Defines a Network Demuxer. 
     
         ______________________________________SYNOPSIS______________________________________    struct ns.sub.-- demuxer {         u.sub.-- short inuse;         u.sub.-- short use.sub.-- nsdmx;         int   (*add.sub.-- filter) ( );         int   (*del.sub.-- filter) ( );         int   (*add.sub.-- status) ( );         int   (*del.sub.-- status) ( );         int   (*receive) ( );         int   (*status) ( );         int   (*response) ( );    };______________________________________ 
    
     FIELDS 
     inuse 
     Indicates if a demuxer is currently being used. This field is only set by network services. It is incremented for each ns --  alloc and decremented for each ns --  free. 
     use --  nsdmx 
     This field is a boolean variable that should be set to TRUE if the demuxer is going to use the common demuxer services provided by CDLI. If the common services are not used, the valuse should be FALSE. 
     add --  filter 
     The address of the add filter function of the demuxer. This function will be called from the ns --  add --  filter network service. 
     del --  filter 
     The address of the delete filter function of the demuxer. This function will be called from the ns --  del --  filter network service, 
     add --  status 
     The address of the add status function of the demuxer. This function will be called from the ns --  add --  status network service. 
     del --  status 
     The address of the delete status function of the demuxer. This function will be called from the ns --  del status network service, 
     receive 
     The address of the packet input function of a demuxer. A NDD will call this function when receive data is available. 
     status 
     The address of the status processing function of a demuxer. A NDD will call this function when asynchronous status has occurred. 
     response 
     The address of a function that will be called when a XID or TEST frame response is required. 
     DESCRIPTION 
     This structure is used to register a Network Demuxer through the ns --  add --  demux service. It specifies the various entry points of a demuxer. 
     FILES 
     sys/cdli.h 
     NAME 
     nd --  config 
     Provides Network Demuxer configuration information. 
     
         ______________________________________SYNOPSIS______________________________________    #include &lt;sys/cdli.h&gt;    struct nd.sub.-- config {         int  version;         int  errcode;         int  ndd.sub.-- type;    };______________________________________ 
    
     FIELDS 
     version 
     The version number of the nd --  config structure. Set to ND --  CONFIG --  VERSION --  1. 
     errcode 
     Return status from the demuxer configuration. 
     ndd --  type 
     Specifies the type of NDD this demuxer serves. 
     DESCRIPTION 
     This structure is used to convey configuration information to a Network Demuxer. 
     FILES 
     sys/cdli.h 
     To summarize, a uniform interface is provided that allows for enabling multiple data frameworks through the use of a single hardware adapter. This greatly simplifies operating system portability to various hardware platforms, as well as minimizing hardware adapter requirements to provide such multiple framework support. 
     It will be understood that the preferred embodiment herein presented is for illustrative purposes and, as such, will not be construed to place a limitation on the invention. Those skilled in the art will understand that changes in form and detail of the preferred embodiment herein disclosed may be made without departing from the spirit and scope of the claimed invention.