Adds a new input type to the Network Input table.
#include <sys/types.h> #include <sys/errno.h> #include <net/if.h> #include <net/netisr.h> int add_input_type (type, service_level, isr, ifq, af) u_short type; u_short service_level; int (* isr) (); struct ifqueue * ifq; u_short af;
Item | Description |
---|---|
type | Specifies which type of protocol a packet contains. A value of x'FFFF' indicates that this input type is a wildcard type and matches all input packets. |
service_level | Determines the processing level at which the protocol input handler is called. If the service_level parameter is set to NET_OFF_LEVEL, the input handler specified by the isr parameter is called directly. Setting the service_level parameter to NET_KPROC schedules a network dispatcher. This dispatcher calls the subroutine identified by the isr parameter. |
isr | Identifies the routine that serves as the input handler for an input packet type. |
ifq | Specifies an input queue for holding input buffers. If this parameter has a non-null value, an input buffer (mbuf) is enqueued. The ifq parameter must be specified if the processing level specified by the service_level parameter is NET_KPROC. Specifying null for this parameter generates a call to the input handler specified by the isr parameter, as in the following: |
af | Specifies the address family of the calling protocol. The af parameter
must be specified if the ifq parameter is not a null character.
This parameter must be greater than or equal to 0 and less than NETISR_MAX.
Refer to netisr.h for the range of values
of af that are already in use. Also, other
kernel extensions that are not AIX® and that use network
ISRs currently running on the system can make use of additional values
not mentioned in netisr.h.
In this example, CommonPortion points to the network common portion (the arpcom structure) of a network interface and Buffer is a pointer to a buffer (mbuf) containing an input packet. |
To enable the reception of packets, an address family calls the add_input_type kernel service to register a packet type in the Network Input table. Multiple packet types require multiple calls to AIX Version 7.1 Kernel Extensions and Device Support Programming Concepts the add_input_type kernel service.
The add_input_type kernel service can be called from either the process or interrupt environment.
Item | Description |
---|---|
0 | Indicates that the type was successfully added. |
EEXIST | Indicates that the type was previously added to the Network Input table. |
ENOSPC | Indicates that no free slots are left in the table. |
EINVAL | Indicates that an error occurred in the input parameters. |
add_input_type(TYPE_IP, NET_KPROC, ipintr, &ipintrq, AF_INET);
This
packet is processed through the network kproc. The input
handler is ipintr. The input queue is ipintrq. add_input_type(TYPE_ARP, NET_OFF_LEVEL, arpinput, NULL, NULL);
Packets
are not queued and the arpinput subroutine is called directly.