VxWorks API Reference : OS Libraries
muxLib - MUX network interface library
muxLibInit( ) - initialize global state for the MUX
muxDevLoad( ) - load a driver into the MUX
muxDevStart( ) - start a device by calling its start routine
muxDevStop( ) - stop a device by calling its stop routine
muxShow( ) - display configuration of devices registered with the MUX
muxBind( ) - create a binding between a network service and an END
muxSend( ) - send a packet out on a network interface
muxPollSend( ) - now deprecated, see muxTkPollSend( )
muxPollReceive( ) - now deprecated, see muxTkPollReceive( )
muxIoctl( ) - send control information to the MUX or to a device
muxMCastAddrAdd( ) - add a multicast address to a device's multicast table
muxMCastAddrDel( ) - delete a multicast address from a device's multicast table
muxMCastAddrGet( ) - get the multicast address table from the MUX/Driver
muxUnbind( ) - detach a network service from the specified device
muxDevUnload( ) - unloads a device from the MUX
muxLinkHeaderCreate( ) - attach a link-level header to a packet
muxAddressForm( ) - form a frame with a link-layer address
muxPacketDataGet( ) - return the data from a packet
muxPacketAddrGet( ) - get addressing information from a packet
endFindByName( ) - find a device using its string name
muxDevExists( ) - tests whether a device is already loaded into the MUX
muxAddrResFuncAdd( ) - replace the default address resolution function
muxAddrResFuncGet( ) - get the address resolution function for ifType/protocol
muxAddrResFuncDel( ) - delete an address resolution function
muxTaskDelaySet( ) - set the inter-cycle delay on the polling task
muxTaskDelayGet( ) - get the delay on the polling task
muxTaskPrioritySet( ) - reset the priority of tMuxPollTask
muxTaskPriorityGet( ) - get the priority of tMuxPollTask
muxPollStart( ) - initialize and start the MUX poll task
muxPollEnd( ) - shuts down tMuxPollTask and returns devices to interrupt mode
muxPollDevAdd( ) - adds a device to list polled by tMuxPollTask
muxPollDevDel( ) - removes a device from the list polled by tMuxPollTask
muxPollDevStat( ) - reports whether device is on list polled by tMuxPollTask
muxIterateByName( ) - Iterate throught all end devices for a given name.
This library provides the routines that define the MUX interface, a facility that handles communication between the data link layer and the network protocol layer. Using the MUX, the VxWorks network stack has decoupled the data link and network layers. Drivers and services no longer need knowledge of each other's internals. This independence makes it much easier to add new drivers or services. For example, if you add a new MUX-based "END" driver, all existing MUX-based services can use the new driver. Likewise, if you add a new MUX-based service, any existing END can use the MUX to access the new service.
errno.h, lstLib.h, logLib.h, string.h, m2Lib.h, bufLib.h, if.h, end.h, muxLib.h, vxWorks.h, taskLib.h, stdio.h, errnoLib.h, if_ether.h, netLib.h, semLib.h, rebootLib.h
To use this feature, include the following component: INCLUDE_MUX
VxWorks AE Network Programmer's Guide
muxLibInit( ) - initialize global state for the MUX
STATUS muxLibInit (void)
This routine initializes all global states for the MUX.
OK or ERROR.
muxDevLoad( ) - load a driver into the MUX
void * muxDevLoad ( int unit, /* unit number of device */ END_OBJ * (* endLoad) (char* , void* ), /* load function of the driver */ char * pInitString, /* init string for this driver */ BOOL loaning, /* we loan buffers */ void * pBSP /* for BSP group */ )
The muxDevLoad( ) routine loads a network driver into the MUX. Internally, this routine calls the specified endLoad routine to initialize the software state of the device. After the device is initialized, you must call muxDevStart( ) to start the device.
- unit
- Expects the unit number of the device.
- endLoad
- Expects a pointer to the network driver's endLoad( ) or nptLoad( ) entry point.
- pInitString
- Expects a pointer to an initialization string, typically a colon-delimited list of options. The muxDevLoad( ) routine passes this along blindly to the endLoad function.
- loaning
- Currently unused.
- pBSP
- The MUX blindly passes this argument to the driver, which may or may not use it. Some BSPs use this parameter to pass in tables of functions that the diver can use to deal with the particulars of the BSP.
Under VxWorks AE, you can call muxDevLoad( ) from within the kernel protection domain only, and the data referenced in the endLoad and pBSP parameters must reside in the kernel protection domain. In addition, the returned void pointer is valid in the kernel protection domain only. This restriction does not apply under non-AE versions of VxWorks.
A cookie representing the new device, or NULL if an error occurred.
S_muxLib_LOAD_FAILED
muxDevStart( ) - start a device by calling its start routine
STATUS muxDevStart ( void * pCookie /* device identifier from muxDevLoad() routine */ )
This routine starts a device that has already been initialized and loaded into the MUX with muxDevLoad( ). muxDevStart( ) activates the network interfaces for a device, and calls the device's endStart( ) or nptStart( ) routine, which registers the driver's interrupt service routine and does whatever else is needed to allow the device to handle receiving and transmitting. This call to endStart( ) or nptStart( ) puts the device into a running state.
- pCookie
- Expects the pointer returned as the function value of the muxDevLoad( ) call for this device. This pointer identifies the device.
Under VxWorks AE, you can call muxDevStart( ) from within the kernel protection domain only, and the data referenced in the pCookie parameter must reside in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.
OK; ENETDOWN, if pCookie does not represent a valid device; or ERROR, if the start routine for the device fails.
S_muxLib_NO_DEVICE
muxDevStop( ) - stop a device by calling its stop routine
STATUS muxDevStop ( void * pCookie /* device identifier from muxDevLoad() routine */ )
This routine stops the device specified in pCookie. muxDevStop( ) calls the device's endStop( ) or nptStop( ) routine.
- pCookie
- Expects the cookie returned as the function value of the muxDevLoad( ) call for this device. This cookie identifies the device.
Under VxWorks AE, you can call muxDevStop( ) from within the kernel protection domain only, and the data referenced in the pCookie parameter must reside in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.
OK; ENETDOWN, if pCookie does not represent a valid device; or ERROR, if the endStop( ) or nptStop( ) routine for the device fails.
S_muxLib_NO_DEVICE
muxShow( ) - display configuration of devices registered with the MUX
void muxShow ( char * pDevName, /* pointer to device name, or NULL for all */ int unit /* unit number for a single device */ )
If the pDevName and unit arguments specify an existing device, this routine reports the name and type of each protocol bound to it. Otherwise, if pDevName is NULL, the routine displays the entire list of existing devices and their associated protocols.
- pDevName
- A string that contains the name of the device, or a null pointer to indicate "all devices."
- unit
- Specifies the unit number of the device (if pDevName is not a null pointer).
N/A
muxBind( ) - create a binding between a network service and an END
void * muxBind ( char * pName, /* interface name, for example, ln, ei,... */ int unit, /* unit number */ BOOL (* stackRcvRtn) (void* , long, M_BLK_ID, LL_HDR_INFO * , void* ), /* receive function to be called. */ STATUS (* stackShutdownRtn) (void* , void* ), /* routine to call to shutdown the stack */ STATUS (* stackTxRestartRtn) (void* , void* ), /* routine to tell the stack it can transmit */ void (* stackErrorRtn) (END_OBJ* , END_ERR* , void* ), /* routine to call on an error. */ long type, /* protocol type from RFC1700 and many */ /* other sources (for example, 0x800 is IP) */ char * pProtoName, /* string name for protocol */ void * pSpare /* per protocol spare pointer */ )
A network service uses this routine to bind to an END specified by the pName and unit arguments (for example, ln and 0, ln and 1, or ei and 0).
This routine should only be used to bind to drivers that use the old END driver callback function prototypes. NPT drivers, or END drivers that use the newer callback function prototypes, should use muxTkBind( ) instead. See the Network Protocol Toolkit Programmer's Guide for more information on when to use muxBind( ) and muxTkBind( ).
The type argument assigns a network service to one of several classes. Standard services receive the portion of incoming data associated with type values from RFC 1700. Only one service for each RFC 1700 type value may be bound to an END.
Services with type MUX_PROTO_SNARF provide a mechanism for bypassing the standard services for purposes such as firewalls. These services will get incoming packets before any of the standard services.
Promiscuous services with type MUX_PROTO_PROMISC receive any packets not consumed by the snarf or standard services.
The MUX allows multiple snarf and promiscuous services but does not coordinate between them. It simply delivers available packets to each service in FIFO order. Services that consume packets may prevent "downstream" services from receiving data if the desired packets overlap.
An output service (with type MUX_PROTO_OUTPUT) receives outgoing data before it is sent to the device. This service type allows two network services to communicate directly and provides a mechanism for loop-back testing. Only one output service is supported for each driver.
The MUX calls the registered stackRcvRtn whenever it receives a packet of the appropriate type. If that routine returns TRUE, the packet is not offered to any remaining services (or to the driver in the case of output services). A service (including an output service) may return FALSE to examine a packet without consuming it. See the description of a stackRcvRtn( ) in the Network Protocol Toolkit Programmer's Guide for additional information about the expected behavior of that routine.
The stackShutdownRtn argument provides a function that the MUX can use to shut down the service. See the Network Protocol Toolkit Programmer's Guide for a description of how to write such a routine.
The pProtoName argument provides the name of the service as a character string. A service name is assigned internally if the argument is NULL.
The pSpare argument registers a pointer to data defined by the service. The MUX includes this argument in calls to the call back routines from this service.
Under VxWorks AE, you can call muxBind( ) from within the kernel protection domain only, and the data referenced in the stackRcvRtn, stackShutdownRtn, stackTxRestartRtn, stackErrorRtn and pSpare parameters must reside in the kernel protection domain. In addition, the returned void pointer is valid in the kernel protection domain only. This restriction does not apply under non-AE versions of VxWorks.
A cookie identifying the binding between the service and driver; or NULL, if an error occurred.
S_muxLib_NO_DEVICE, S_muxLib_ALREADY_BOUND, S_muxLib_ALLOC_FAILED
muxSend( ) - send a packet out on a network interface
STATUS muxSend ( void * pCookie, /* protocol/device binding from muxBind() */ M_BLK_ID pNBuff /* data to be sent */ )
This routine transmits a packet for the service specified by pCookie. You got this cookie from a previous bind call that bound the service to a particular interface. This muxSend( ) call uses this bound interface to transmit the packet.
- pCookie
- Expects the cookie returned from muxBind( ). This cookie identifies a particular service-to-interface binding.
- pNBuff
- Expects a pointer to the buffer that contains the packet you want to transmit. Before you call muxSend( ), you need to put the addressing information at the head of the buffer. To do this, call muxAddressForm( ).
Under VxWorks AE, you can call muxSend( ) from within the kernel protection domain only, and the data referenced in the pCookie and pNBuff parameters must reside in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.
OK; ENETDOWN, if pCookie does not represent a valid binding; or ERROR, if the driver's endSend( ) routine fails.
S_muxLib_NO_DEVICE
muxPollSend( ) - now deprecated, see muxTkPollSend( )
STATUS muxPollSend ( void * pCookie, /* binding instance from muxBind() */ M_BLK_ID pNBuff /* data to be sent */ )
This routine transmits a packet for the service specified by pCookie. You got this cookie from a previous bind call that bound the service to a particular interface. This muxPollSend( ) call uses this bound interface to transmit the packet. The pNBuff argument is a buffer (mBlk) chain that contains the packet to be sent.
OK; ENETDOWN, if pCookie does not represent a valid device; ERROR, if the device type is not recognized; or an error value from the device's registered endPollSend( ) routine.
S_muxLib_NO_DEVICE
muxPollReceive( ) - now deprecated, see muxTkPollReceive( )
STATUS muxPollReceive ( void * pCookie, /* binding instance from muxBind() */ M_BLK_ID pNBuff /* a vector of buffers passed to us */ )
This routine has been deprecated in favor of muxTkPollReceive( )
Upper layers can call this routine to poll for a packet.
- pCookie
- Expects the cookie that was returned from muxBind( ). This cookie indicates which driver to query for available data.
- pNBuff
- Expects a pointer to a buffer chain into which to receive data.
Under VxWorks AE, you can call muxPollReceive( ) from within the kernel protection domain only, and the data referenced in the pCookie and pNBuff parameters must reside in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.
OK; ENETDOWN, if the pCookie argument does not represent a loaded driver; or an error value returned from the driver's registered endPollReceive( ) function.
S_muxLib_NO_DEVICE
muxIoctl( ) - send control information to the MUX or to a device
STATUS muxIoctl ( void * pCookie, /* service/device binding from */ /* muxBind()/muxTkBind() */ int cmd, /* command to pass to ioctl */ caddr_t data /* data need for command in cmd */ )
This routine gives the service access to the network driver's control functions. The MUX itself can implement some of the standard control functions, so not all commands necessarily pass down to the device. Otherwise, both command and data pass to the device without modification.
Typical uses of muxIoctl( ) include commands to start, stop, or reset the network interface, or to add or configure MAC and network addresses.
- pCookie
- Expects the cookie returned from muxBind( ) or muxTkBind( ). This cookie indicates the device to which this service is bound.
- cmd
- Expects a value indicating the control command you want to execute. For valid cmd values, see the description of the endIoctl( ) and nptIoctl( ) routines provided in the Network Protocol Toolkit Programmer's Guide .
- data
- Expects the data or a pointer to the data needed to carry out the command specified in cmd.
Under VxWorks AE, you can call muxIoctl( ) from within the kernel protection domain only, and the data referenced in the pCookie and data parameters must reside in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.
OK; ENETDOWN, if pCookie does not represent a bound device; or ERROR, if the command fails.
S_muxLib_NO_DEVICE
muxMCastAddrAdd( ) - add a multicast address to a device's multicast table
STATUS muxMCastAddrAdd ( void * pCookie, /* binding instance from muxBind() or */ /* muxTkBind() */ char * pAddress /* address to add to the table */ )
This routine adds an address to the multicast table maintained by a device. This routine calls the driver's endMCastAddrAdd( ) or nptMCastAddrAdd( ) routine to accomplish this.
If the device does not support multicasting, muxMCastAddrAdd( ) will return ERROR and errno will be set to ENOTSUP (assuming the driver has been written properly).
- pCookie
- Expects the cookie returned from the muxBind( ) or muxTkBind( ) call. This cookie identifies the device to which the MUX has bound this service.
- pAddress
- Expects a pointer to a character string containing the address you want to add.
Under VxWorks AE, you can call muxMCastAddrAdd( ) from within the kernel protection domain only, and the data referenced in the pCookie parameter must reside in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.
OK; ENETDOWN, if pCookie does not represent a valid device; or ERROR, if the device's endMCastAddrAdd( ) function fails.
S_muxLib_NO_DEVICE
muxMCastAddrDel( ) - delete a multicast address from a device's multicast table
STATUS muxMCastAddrDel ( void * pCookie, /* binding instance from muxBind() or */ /* muxTkBind() */ char * pAddress /* Address to delete from the table. */ )
This routine deletes an address from the multicast table maintained by a device by calling that device's endMCastAddrDel( ) or nptMCastAddrDel( ) routine.
If the device does not support multicasting, muxMCastAddrAdd( ) will return ERROR and errno will be set to ENOTSUP (assuming the driver has been written properly).
- pCookie
- Expects the cookie returned from muxBind( ) or muxTkBind( ) call. This cookie identifies the device to which the MUX bound this service.
- pAddress
- Expects a pointer to a character string containing the address you want to delete.
Under VxWorks AE, you can call muxMCastAddrDell( ) from within the kernel protection domain only, and the data referenced in the pCookie parameter must reside in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.
OK; ENETDOWN, if pCookie does not represent a valid driver; or ERROR, if the driver's registered endMCastAddrDel( ) or nptMCastAddrDel( ) functions fail.
S_muxLib_NO_DEVICE
muxMCastAddrGet( ) - get the multicast address table from the MUX/Driver
int muxMCastAddrGet ( void * pCookie, /* binding instance from muxBind() or */ /* muxTkBind() */ MULTI_TABLE * pTable /* pointer to a table to be filled and */ /* returned. */ )
This routine writes the list of multicast addresses for a specified device into a buffer. To get this list, it calls the driver's own endMCastAddrGet( ) or nptMCastAddrGet( ) routine.
- pCookie
- Expects the cookie returned from muxBind( ) or muxTkBind( ) call. This cookie indicates the device to which the MUX has bound this service.
- pTable
- Expects a pointer to a MULTI_TABLE structure. You must have allocated this structure at some time before the call to muxMCastAddrGet( ). The MULTI_TABLE structure is defined in end.h as:
typedef struct multi_table { int tableLen; /* length of table in bytes */ char * pTable; /* pointer to entries */ } MULTI_TABLE;
Under VxWorks AE, you can call muxMCastAddrGet( ) from within the kernel protection domain only, and the data referenced in the pCookie parameter must reside in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.
OK; ENETDOWN, if pCookie does not represent a valid driver; or ERROR, if the driver's registered endMCastAddrGet( ) or nptMCastAddrGet( ) routines fail.
S_muxLib_NO_DEVICE
muxUnbind( ) - detach a network service from the specified device
STATUS muxUnbind ( void * pCookie, /* binding instance from muxBind() or */ /* muxTkBind() */ long type, /* type passed to muxBind() or muxTkBind() call */ FUNCPTR stackRcvRtn /* pointer to stack receive routine */ )
This routine disconnects a network service from the specified device. The pCookie argument indicates the service/device binding returned by the muxBind( ) or muxTkBind( ) routine. The type and stackRcvRtn arguments must also match the values given to the original muxBind( ) or muxTkBind( ) call.
If muxUnbind( ) returns ERROR, and errno is set to EINVAL, this indicates that the device is not bound to the service.
OK; or ERROR, if muxUnbind( ) fails.
Under VxWorks AE, you can call muxUnBind( ) from within the kernel protection domain only, and the data referenced in the stackRcvRtn and pCookie parameters must reside in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.
EINVAL, S_muxLib_NO_DEVICE
muxDevUnload( ) - unloads a device from the MUX
STATUS muxDevUnload ( char * pName, /* a string containing the name of the */ /* device for example, ln or ei */ int unit /* the unit number */ )
This routine unloads a device from the MUX. This breaks any network connections that use the device. When this routine is called, each service bound to the device disconnects from it with the stackShutdownRtn( ) routine that was registered by the service. The stackShutdownRtn( ) should call muxUnbind( ) to detach from the device. Then, muxDevUnload( ) calls the device's endUnload( ) or nptUnload( ) routine.
- pName
- Expects a pointer to a string containing the name of the device, for example ln or ei
- unit
- Expects the unit number of the device indicated by pName
Under VxWorks AE, you can call muxDevUnLoad( ) from within the kernel protection domain only. This restriction does not apply under non-AE versions of VxWorks.
OK, on success; ERROR, if the specified device was not found or some other error occurred; or the error value returned by the driver's unload( ) routine.
S_muxLib_UNLOAD_FAILED, S_muxLib_NO_DEVICE
muxLinkHeaderCreate( ) - attach a link-level header to a packet
M_BLK_ID muxLinkHeaderCreate ( void * pCookie, /* protocol/device binding from muxBind() */ M_BLK_ID pPacket, /* structure containing frame contents */ M_BLK_ID pSrcAddr, /* structure containing source address */ M_BLK_ID pDstAddr, /* structure containing destination address */ BOOL bcastFlag /* use broadcast destination (if available)? */ )
This routine constructs a link-level header using the source address of the device indicated by the pCookie argument as returned from the muxBind( ) routine.
The pDstAddr argument provides an M_BLK_ID buffer containing the link-level destination address. Alternatively, the bcastFlag argument, if TRUE, indicates that the routine should use the link-level broadcast address, if available for the device. Although other information contained in the pDstAddr argument must be accurate, the address data itself is ignored in that case.
The pPacket argument contains the contents of the resulting link-level frame. This routine prepends the new link-level header to the initial mBlk in that network packet if space is available or allocates a new mBlk-clBlk-cluster triplet and prepends it to the mBlk chain. When construction of the header is complete, it returns an M_BLK_ID that points to the initial mBlk in the assembled link-level frame.
M_BLK_ID or NULL.
S_muxLib_INVALID_ARGS
muxAddressForm( ) - form a frame with a link-layer address
M_BLK_ID muxAddressForm ( void * pCookie, /* protocol/device binding from muxBind() */ M_BLK_ID pMblk, /* structure to contain packet */ M_BLK_ID pSrcAddr, /* structure containing source address */ M_BLK_ID pDstAddr /* structure containing destination address */ )
Use this routine to create a frame with an appropriate link-layer address. As input, this function expects the source address, the destination address, and the data you want to include in the frame. When control returns from the muxAddressForm( ) call, the pMblk parameter references a frame ready for transmission. Internally, muxAddressForm( ) either prepended the link-layer header to the data buffer supplied in pMblk (if there was enough room) or it allocated a new mBlk-clBlk-cluster and prepended the new mBlk to the mBlk chain supplied in pMblk.
You should set the pDstAddr.mBlkHdr.reserved field to the network service type.
- pCookie
- Expects the cookie returned from the muxBind( ). This cookie indicates the device to which the MUX has bound this protocol.
- pMblk
- Expects a pointer to the mBlk structure that contains the packet.
- pSrcAddr
- Expects a pointer to the mBlk that contains the source address.
- pDstAddr
- Expects a pointer to the mBlk that contains the destination address.
This routine is used only with ENDs, and is not needed for NPT drivers.
Under VxWorks AE, you can call muxAddressForm( ) from within the kernel protection domain only, and the data referenced in the pCookie parameter must reside in the kernel protection domain. In addition, the returned M_BLK_ID is valid in the kernel protection domain only. This restriction does not apply under non-AE versions of VxWorks.
M_BLK_ID or NULL.
S_muxLib_NO_DEVICE
muxPacketDataGet( ) - return the data from a packet
STATUS muxPacketDataGet ( void * pCookie, /* protocol/device binding from muxBind() */ M_BLK_ID pMblk, /* returns the packet data */ LL_HDR_INFO * pLinkHdrInfo /* returns the packet header information */ )
Any service bound to a driver may use this routine to extract the packet data and remove the link-level header information. This routine copies the header information from the packet referenced in pMblk into the LL_HDR_INFO structure referenced in pLinkHdrInfo.
- pCookie
- Expects the cookie returned from the muxBind( ) call. This cookie indicates the device to which the MUX bound this service.
- pMblk
- Expects a pointer to an mBlk or mBlk cluster representing a packet containing the data to be returned
- pLinkHdrInfo
- Expects a pointer to an LL_HDR_INFO structure into which the packet header information is copied from the incoming mBlk
Under VxWorks AE, you can call muxPacketDataGet( ) from within the kernel protection domain only, and the data referenced in the parameters must reside in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.
OK; or ERROR, if the device type is not recognized.
S_muxLib_NO_DEVICE
muxPacketAddrGet( ) - get addressing information from a packet
STATUS muxPacketAddrGet ( void * pCookie, /* protocol/device binding from muxBind() */ M_BLK_ID pMblk, /* structure to contain packet */ M_BLK_ID pSrcAddr, /* structure containing source address */ M_BLK_ID pDstAddr, /* structure containing destination address */ M_BLK_ID pESrcAddr, /* structure containing the end source */ M_BLK_ID pEDstAddr /* structure containing the end destination */ )
The routine returns the immediate source, immediate destination, ultimate source, and ultimate destination addresses from the packet pointed to in the first M_BLK_ID. This routine makes no attempt to extract that information from the packet directly. Instead, it passes the packet through to the driver routine that knows how to interpret the packets that it has received.
- pCookie
- Expects the cookie returned from the muxBind( ) call. This cookie indicates the device to which the MUX bound this service.
- pMblk
- Expects an M_BLK_ID representing packet data from which the addressing information is to be extracted
- pSrcAddr
- Expects NULL or an M_BLK_ID which will hold the local source address extracted from the packet
- pDstAddr
- Expects NULL or an M_BLK_ID which will hold the local destination address extracted from the packet
- pESrcAddr
- Expects NULL or an M_BLK_ID which will hold the end source address extracted from the packet
- pEDstAddr
- Expects NULL or an M_BLK_ID which will hold the end destination address extracted from the packet
Under VxWorks AE, you can call muxPacketAddrGet( ) from within the kernel protection domain only, and the data referenced in the parameters must reside in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.
OK or ERROR.
S_muxLib_NO_DEVICE
endFindByName( ) - find a device using its string name
END_OBJ * endFindByName ( char * pName, /* device name to search for */ int unit )
This routine takes a string name and a unit number and finds the device that has that name/unit combination.
Under VxWorks AE, you can call endFindByName( ) from within the kernel protection domain only, and the data referenced in the pName parameter must reside in the kernel protection domain. In addition, the returned END_OBJ is valid in the kernel protection domain only. This restriction does not apply under non-AE versions of VxWorks.
A pointer to an END_OBJ; or NULL, if the device is not found.
muxDevExists( ) - tests whether a device is already loaded into the MUX
BOOL muxDevExists ( char * pName, /* string containing a device name (ln, ei, ...)*/ int unit /* unit number */ )
This routine takes a string device name (for example, ln or ei) and a unit number. If this device is already known to the MUX, it returns TRUE. Otherwise, this routine returns FALSE.
- pName
- Expects a pointer to a string containing the device name
- unit
- Expects the unit number of the device
Under VxWorks AE, you can call muxDevExists( ) from within the kernel protection domain only, and the data referenced in the pName parameter must reside in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.
TRUE, if the device exists; else FALSE.
muxAddrResFuncAdd( ) - replace the default address resolution function
STATUS muxAddrResFuncAdd ( long ifType, /* Media interface type, typically from m2Lib.h */ long protocol, /* Service type, for instance from RFC 1700 */ FUNCPTR addrResFunc /* Function to call. */ )
Use muxAddrResFuncAdd( ) to register an address resolution function for an interface-type/protocol pair. You must call muxAddrResFuncAdd( ) prior to calling the protocol's protocolAttach( ) routine. If the driver registers itself as an Ethernet driver, you do not need to call muxAddrResFuncAdd( ). VxWorks automatically assigns arpresolve( ) to registered Ethernet devices. The muxAddrResFuncAdd( ) functionality is intended for those who want to use VxWorks network stack with non-Ethernet drivers that require address resolution.
- ifType
- Expects a media interface or network driver type, such as can be found in m2Lib.h. If using the END model, the ifType argument is restricted to the values in m2Lib.h. In the NPT model, this restriction does not apply.
- protocol
- Expects a network service or protocol type, such as can be found in RFC 1700. Look for the values under ETHER TYPES. For example, Internet IP would be identified as 2048 (0x800 hexadecimal). If using the END model, protocol is restricted to the values in RFC 1700. In the NPT model, this restriction does not apply.
- addrResFunc
- Expects a pointer to an address resolution function for this combination of driver type and service type. The prototype of your replacement address resolution function must match that of arpresolve( ):
int arpresolve ( struct arpcom * ac, struct rtentry * rt, struct mbuf * m, struct sockaddr * dst, u_char * desten )This function returns one upon success, which indicates that desten has been updated with the necessary data-link layer information and that the IP sublayer output function can transmit the packet.This function returns zero if it cannot resolve the address immediately. In the default arpresolve( ) implementation, resolving the address immediately means arpresolve( ) was able to find the address in its table of results from previous ARP requests. Returning zero indicates that the table did not contain the information but that the packet has been stored and that an ARP request has been queued.
If the ARP request times out, the packet is dropped. If the ARP request completes successfully, processing that event updates the local ARP table and resubmits the packet to the IP sublayer's output function for transmission. This time, the arpresolve( ) call will return one.
What is essential to note here is that arpresolve( ) did not wait for the ARP request to complete before returning. If you replace the default arpresolve( ) function, you must make sure your function returns as soon as possible and that it never blocks. Otherwise, you block the IP sublayer from transmitting other packets out through the interface for which this packet was queued. You must also make sure that your arpresolve( ) function takes responsibility for the packet if it returns zero. Otherwise, the packet is dropped.
OK, or ERROR.
Under VxWorks AE, you can call muxAddrResFuncAdd( ) from within the kernel protection domain only, and the data referenced in the addrResFunc parameter must reside in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.
muxAddrResFuncGet( ) - get the address resolution function for ifType/protocol
FUNCPTR muxAddrResFuncGet ( long ifType, /* ifType from m2Lib.h */ long protocol /* protocol from RFC 1700 */ )
This routine gets a pointer to the registered address resolution function for the specified interface-protocol pair. If no such function exists, muxAddResFuncGet( ) returns NULL.
- ifType
- Expects a media interface or network driver type, such as those found in m2Lib.h. If using the END model, the ifType argument is restricted to the m2Lib.h values. In the NPT model, this restriction does not apply.
- protocol
- Expects a network service or protocol type such as those found in RFC 1700. Look for the values under ETHER TYPES. For example, Internet IP would be identified as 2048 (0x800 hexadecimal). If using the END model, the protocol argument is restricted to the RFC 1700 values. In the NPT model, this restriction does not apply.
Under VxWorks AE, you can call muxAddrResFuncGet( ) from within the kernel protection domain only. In addition, the returned FUNCPTR is valid in the kernel protection domain only. This restriction does not apply under non-AE versions of VxWorks.
FUNCPTR to the routine or NULL.
muxAddrResFuncDel( ) - delete an address resolution function
STATUS muxAddrResFuncDel ( long ifType, /* ifType of function you want to delete */ long protocol /* protocol from which to delete the function */ )
This function deletes the address resolution function registered for the specified interface-protocol pair. If using the NPT architecture, the ifType and protocol arguments are not restricted to the m2Lib.h or RFC 1700 values.
- ifType
- Expects a media interface or network driver type. For and END driver, use the values specified in m2Lib.h.
- protocol
- Expects a network service or protocol type. For example, Internet IP would be identified as 2048 (0x800 hexadecimal). This value can be found in RFC 1700 under the heading, ETHER TYPES.
Under VxWorks AE, you can call muxAddrResFuncDel( ) from within the kernel protection domain only. This restriction does not apply under non-AE versions of VxWorks.
OK or ERROR.
muxTaskDelaySet( ) - set the inter-cycle delay on the polling task
STATUS muxTaskDelaySet ( int delay )
This routine sets up a delay (measured in ticks) that is inserted at the end of each run through the list of devices polled by tMuxPollTask.
OK; or ERROR, if you specify a delay less than zero.
muxTaskDelayGet( ) - get the delay on the polling task
STATUS muxTaskDelayGet ( int* pDelay )
This routine returns the amount of delay (in ticks) that is inserted between the polling runs of tMuxPollTask. This value is written to the location specified by pDelay.
OK; or ERROR, if NULL is passed in the pDelay variable.
muxTaskPrioritySet( ) - reset the priority of tMuxPollTask
STATUS muxTaskPrioritySet ( int priority )
This routine resets the priority of a running tMuxPollTask. Valid task priorities are values between zero and 255 inclusive. However, do not set the priority of tMuxPollTask to exceed that of tNetTask. Otherwise, you will shut out tNetTask from getting any processor time.
OK; or ERROR, if you specify a non-valid priority value.
muxTaskPriorityGet( ) - get the priority of tMuxPollTask
STATUS muxTaskPriorityGet ( int* pPriority )
This routine returns the current priority of tMuxPollTask. This value is returned to the location specified by the pPriority parameter.
OK; or ERROR, if NULL is passed in the pPriority parameter.
muxPollStart( ) - initialize and start the MUX poll task
STATUS muxPollStart ( int numDev, /* Maximum number of devices to support */ /* poll mode. */ int priority, /* tMuxPollTask priority, not to exceed */ /* tNetTask. */ int delay /* Delay, in ticks, at end of each polling */ /* cycle. */ )
This routine initializes and starts the MUX poll task, tMuxPollTask. This task runs an infinite loop in which it polls each of the interfaces referenced on a list of network interfaces. To add or remove devices from this list, use muxPollDevAdd( ) and muxPollDevDel( ). Removing all devices from the list automatically triggers a call to muxPollEnd( ), which shuts down tMuxPollTask.
Using the priority parameter, you assign the priority to tMuxPollTask. Valid values are between 0 and 255, inclusive. However, you must not set the priority of tMuxPollTask to exceed that of tNetTask. Otherwise, you risk shutting tNetTask out from getting processor time. To reset the tMuxPollTask priority after launch, use muxTaskPrioritySet( ).
Using the delay parameter, you can set up a delay at the end of each trip though the poll list. To reset the value of this delay after the launch of tNetTask, call muxTaskDelaySet( ).
To shut down tMuxPollTask, call muxPollEnd( ).
OK or ERROR
muxPollEnd( ) - shuts down tMuxPollTask and returns devices to interrupt mode
STATUS muxPollEnd ()
This routine shuts down tMuxPollTask and returns network devices to run in their interrupt-driven mode.
OK or ERROR
muxPollDevAdd( ) - adds a device to list polled by tMuxPollTask
STATUS muxPollDevAdd ( int unit, /* Device unit number */ char * pName /* Device name */ )
This routine adds a device to list of devices polled by tMuxPollTask. It assumes that you have already called muxPollStart( ) and that tMuxPollTask is still running.
You cannot use a device for WDB_COMM_END type debugging while that device is on the tMuxPollTask poll list.
OK or ERROR
muxPollDevDel( ) - removes a device from the list polled by tMuxPollTask
STATUS muxPollDevDel ( int unit, /* Device unit number */ char * pName /* Device name */ )
This routine removes a device from the list of devices polled by tMuxPollTask. If you remove the last device on the list, a call to muxPollDevDel( ) also makes an internal call to muxPollEnd( ). This shuts down tMuxPollTask completely.
OK or ERROR
muxPollDevStat( ) - reports whether device is on list polled by tMuxPollTask
BOOL muxPollDevStat ( int unit, /* Device unit number */ char * pName /* Device name */ )
This routine returns true or false depending on whether the specified device is on the list of devices polled by tMuxPollTask.
TRUE, if it is; or FALSE.
muxIterateByName( ) - Iterate throught all end devices for a given name.
STATUS muxIterateByName ( char * pName, /* device name to search for */ FUNCPTR pCallbackRtn, /* pointer to callback routine */ void * pCallbackArg /* user-specified callback arg */ )
This routine takes a string name and a function pointer and finds the END devices that has the given name. The function pointer will be called as follows:
(*pCallbackRtn)(void * pCallbackArg, void * pEnd, int unit);
OK or ERROR if NULL is passed in the variable pDelay