add_input_type Kernel Service
Purpose
Adds a new input type to the Network Input table.
Syntax
#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;
Parameters
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.
(*isr)(CommonPortion,Buffer);
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. |
Description
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 toAIX Version 4.3 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.
Return Values
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. |
Examples
- To register an Internet packet type (TYPE_IP), invoke the add_input_type service as follows:
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
.
- To specify the input handler for ARP packets, invoke the add_input_type service as follows:
add_input_type(TYPE_ARP, NET_OFF_LEVEL, arpinput, NULL, NULL);
Packets are not queued and the arpinput
subroutine is called directly.
Implementation Specifics
The add_input_type kernel service is part of Base Operating System (BOS) Runtime.
Related Information
The del_input_type kernel service, find_input_type kernel service.
Network Kernel Services in AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts.