Download VxWorks

Transcript
H
Implementing a MUX-Based Network Interface Driver
the packet, the MUX does not show the packet to any of the other protocols further
down on the END_OBJ.protocols list.
If you want a protocol to act as a firewall, the protocol should register as type
MUX_PROTO_SNARF and should return TRUE from its receive function. If you
want a protocol to see all uneaten packets that show up on the device, register the
protocol with type MUX_PROTO_PROMISC.
Protocols and Network Addressing
The system is written to support both RFC 894 type Ethernet packets as well as
802.3 encoded packets. If a protocol wants to use 802.3 style packets, it must
register SAP (Service Access Point) as its protocol type. Otherwise, the protocol
must use one of the accepted protocol types from RFC 1700.
Output Protocols
A single protocol can be bound to each device for the filtering of output packets.
This functionality is provided for applications that want to look at every packet
that is output on a particular device. The type MUX_PROTO_OUTPUT is passed
into muxBind( ) when this protocol is registered. Only the stackRcvRtn parameter
is valid with this type.
Sending Data
To put the appropriate address header information into the buffer, the protocol
calls muxAddressForm( ). Finally, to send the packet, the protocol calls
muxSend( ), passing in the cookie returned from the muxBind( ) as well as the
mBlk that contains the packet it wants to send. The MUX then hands the packet to
the driver.
Receiving Data
In response to an interrupt from the network device, VxWorks executes the
device’s previously registered interrupt service routine. This routine gets the
packet off the device and queues it for processing the task level, where the driver
prepares the packet for hand-off to the MUX. For a more detailed description of
this process, see H.3 Guidelines for Handling Packet Reception in Your Driver, p.275.
To hand the packet off to the MUX, the driver calls muxReceive( ). The
muxReceive( ) routine determines the protocol type of the packet (0x800 for IP,
303
H