Network interface layer
[Networking Stack]

Collaboration diagram for Network interface layer:

Modules

 Ethernet (IEEE 802.3) network interface layer Service
 Dummy network interface layer Service

Files

file  hardware.h
 

Hardware types according to the on-line IANA - Address Resolution Protocol (ARP) Parameters - <http://www.iana.org/assignments/arp-parameters/arp-parameters.xml>, cited January 14 2009.


file  nil_interface.h
 

Network interface layer module interface.


file  protocol_map.h
 

Internetwork layer services - network interface layer service type translation.


file  nil_messages.h
 

Network interface layer module messages.


file  nil_module.h
 

Network interface layer modules common skeleton.


file  nil_remote.c
 

Network interface layer interface implementation for standalone remote modules.


Typedefs

typedef uint8_t hw_type_t
 Network interface layer type type definition.

Enumerations

enum  nil_messages {
  NET_NIL_DEVICE = NET_NIL_FIRST, NET_NIL_DEVICE_STATE, NET_NIL_RECEIVED, NET_NIL_SEND,
  NET_NIL_PACKET_SPACE, NET_NIL_ADDR, NET_NIL_BROADCAST_ADDR
}
 

Network interface layer module messages.

More...

Functions

static eth_type_t protocol_map (services_t nil, services_t il)
 Maps the internetwork layer service to the network interface layer type.
static services_t protocol_unmap (services_t nil, int protocol)
 Maps the network interface layer type to the internetwork layer service.
static eth_type_t lsap_map (eth_lsap_t lsap)
 Maps the link service access point identifier to the Ethernet protocol identifier.
static eth_lsap_t lsap_unmap (eth_type_t ethertype)
 Maps the Ethernet protocol identifier to the link service access point identifier.
static hw_type_t hardware_map (services_t nil)
 Maps the network interface layer services to the hardware types.
int nil_initialize (int net_phone)
 Module initialization.
int nil_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count)
 Message processing function.

Network interface layer module interface

This interface is used by other modules.



int nil_device_state_msg (int nil_phone, device_id_t device_id, int state)
 Notifies the network interface layer about the device state change.
int nil_received_msg (int nil_phone, device_id_t device_id, packet_t packet, services_t target)
 Passes the packet queue to the network interface layer.
#define nil_get_addr_req(nil_phone, device_id, address, data)   generic_get_addr_req(nil_phone, NET_NIL_ADDR, device_id, address, data)
 Returns the device local hardware address.
#define nil_get_broadcast_addr_req(nil_phone, device_id, address, data)   generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, address, data)
 Returns the device broadcast hardware address.
#define nil_send_msg(nil_phone, device_id, packet, sender)   generic_send_msg(nil_phone, NET_NIL_SEND, device_id, packet_get_id(packet), sender, 0)
 Sends the packet queue.
#define nil_packet_size_req(nil_phone, device_id, packet_dimension)   generic_packet_size_req(nil_phone, NET_NIL_PACKET_SPACE, device_id, packet_dimension)
 Returns the device packet dimension for sending.
#define nil_device_req(nil_phone, device_id, mtu, netif_service)   generic_device_req(nil_phone, NET_NIL_DEVICE, device_id, mtu, netif_service)
 Registers new device or updates the MTU of an existing one.
#define nil_bind_service(service, device_id, me, receiver)   bind_service(service, device_id, me, 0, receiver);
 Creates bidirectional connection with the network interface layer module and registers the message receiver.

Network interface layer types definitions



#define HW_ETHER   1
 Ethernet (10Mb) hardware type.
#define HW_EETHER   2
 Experimental Ethernet (3Mb) hardware type.
#define HW_AX25   3
 Amateur Radio AX.25 hardware type.
#define HW_PRONET   4
 Proteon ProNET Token Ring hardware type.
#define HW_CHAOS   5
 Chaos hardware type.
#define HW_IEEE802   6
 IEEE 802 Networks hardware type.
#define HW_ARCNET   7
 ARCNET hardware type.
#define HW_Hyperchannel   8
 Hyperchannel hardware type.
#define HW_Lanstar   9
 Lanstar hardware type.
#define HW_ASA   10
 Autonet Short Address hardware type.
#define HW_LocalTalk   11
 LocalTalk hardware type.
#define HW_LocalNet   12
 LocalNet (IBM PCNet or SYTEK LocalNET) hardware type.
#define HW_Ultra_link   13
 Ultra link hardware type.
#define HW_SMDS   14
 SMDS hardware type.
#define HW_DLCI   15
 Frame Relay DLCI hardware type.
#define HW_ATM   16
 Asynchronous Transmission Mode (ATM) hardware type.
#define HW_HDLC   17
 HDLC hardware type.
#define HW_Fibre_Channel   18
 Fibre Channel hardware type.
#define HW_ATM2   19
 Asynchronous Transmission Mode (ATM) hardware type.
#define HW_Serial_Line   20
 Serial Line hardware type.
#define HW_ATM3   21
 Asynchronous Transmission Mode (ATM) hardware type.
#define HW_MIL_STD_188_220   22
 MIL-STD-188-220 hardware type.
#define HW_METRICOM   23
 Metricom hardware type.
#define HW_IEEE1394   24
 IEEE 1394.1995 hardware type.
#define HW_MAPOS   25
 MAPOS hardware type.
#define HW_Twinaxial   26
 Twinaxial hardware type.
#define HW_EUI64   27
 EUI-64 hardware type.
#define HW_HIPARP   28
 HIPARP hardware type.
#define HW_ISO_7816_3   29
 IP and ARP over ISO 7816-3 hardware type.
#define HW_ARPSec   30
 ARPSec hardware type.
#define HW_IPsec_tunnel   31
 IPsec tunnel hardware type.
#define HW_INFINIBAND   32
 InfiniBand (TM) hardware type.
#define HW_CAI   33
 TIA-102 Project 25 Common Air Interface (CAI) hardware type.
#define HW_Wiegand   34
 Wiegand Interface hardware type.
#define HW_Pure_IP   35
 Pure IP hardware type.

Network interface layer specific message parameters definitions



#define NIL_GET_PROTO(call)   (services_t) IPC_GET_ARG2(*call)
 Returns the protocol service message parameter.

Define Documentation

#define HW_ARCNET   7

ARCNET hardware type.

#define HW_ARPSec   30

ARPSec hardware type.

#define HW_ASA   10

Autonet Short Address hardware type.

#define HW_ATM   16

Asynchronous Transmission Mode (ATM) hardware type.

#define HW_ATM2   19

Asynchronous Transmission Mode (ATM) hardware type.

#define HW_ATM3   21

Asynchronous Transmission Mode (ATM) hardware type.

#define HW_AX25   3

Amateur Radio AX.25 hardware type.

#define HW_CAI   33

TIA-102 Project 25 Common Air Interface (CAI) hardware type.

#define HW_CHAOS   5

Chaos hardware type.

#define HW_DLCI   15

Frame Relay DLCI hardware type.

#define HW_EETHER   2

Experimental Ethernet (3Mb) hardware type.

#define HW_ETHER   1

Ethernet (10Mb) hardware type.

Referenced by hardware_map().

#define HW_EUI64   27

EUI-64 hardware type.

#define HW_Fibre_Channel   18

Fibre Channel hardware type.

#define HW_HDLC   17

HDLC hardware type.

#define HW_HIPARP   28

HIPARP hardware type.

#define HW_Hyperchannel   8

Hyperchannel hardware type.

#define HW_IEEE1394   24

IEEE 1394.1995 hardware type.

#define HW_IEEE802   6

IEEE 802 Networks hardware type.

#define HW_INFINIBAND   32

InfiniBand (TM) hardware type.

#define HW_IPsec_tunnel   31

IPsec tunnel hardware type.

#define HW_ISO_7816_3   29

IP and ARP over ISO 7816-3 hardware type.

#define HW_Lanstar   9

Lanstar hardware type.

#define HW_LocalNet   12

LocalNet (IBM PCNet or SYTEK LocalNET) hardware type.

#define HW_LocalTalk   11

LocalTalk hardware type.

#define HW_MAPOS   25

MAPOS hardware type.

#define HW_METRICOM   23

Metricom hardware type.

#define HW_MIL_STD_188_220   22

MIL-STD-188-220 hardware type.

#define HW_PRONET   4

Proteon ProNET Token Ring hardware type.

#define HW_Pure_IP   35

Pure IP hardware type.

#define HW_Serial_Line   20

Serial Line hardware type.

#define HW_SMDS   14

SMDS hardware type.

#define HW_Twinaxial   26

Twinaxial hardware type.

#define HW_Ultra_link   13

Ultra link hardware type.

#define HW_Wiegand   34

Wiegand Interface hardware type.

#define nil_bind_service ( service,
device_id,
me,
receiver   )     bind_service(service, device_id, me, 0, receiver);

Creates bidirectional connection with the network interface layer module and registers the message receiver.

Parameters:
[in] service The network interface layer module service.
[in] device_id The device identifier.
[in] me The requesting module service.
[in] receiver The message receiver.
Returns:
The phone of the needed service.
EOK on success.
Other error codes as defined for the bind_service() function.

Referenced by arp_device_message(), and ip_netif_initialize().

#define nil_device_req ( nil_phone,
device_id,
mtu,
netif_service   )     generic_device_req(nil_phone, NET_NIL_DEVICE, device_id, mtu, netif_service)

Registers new device or updates the MTU of an existing one.

Parameters:
[in] nil_phone The network interface layer phone.
[in] device_id The new device identifier.
[in] mtu The device maximum transmission unit.
[in] netif_service The device driver service.
Returns:
EOK on success.
EEXIST if the device with the different service exists.
ENOMEM if there is not enough memory left.
Other error codes as defined for the generic_device_req() function.

Referenced by start_device().

#define nil_get_addr_req ( nil_phone,
device_id,
address,
data   )     generic_get_addr_req(nil_phone, NET_NIL_ADDR, device_id, address, data)

Returns the device local hardware address.

Parameters:
[in] nil_phone The network interface layer phone.
[in] device_id The device identifier.
[out] address The device local hardware address.
[out] data The address data.
Returns:
EOK on success.
EBADMEM if the address parameter and/or the data parameter is NULL.
ENOENT if there no such device.
Other error codes as defined for the generic_get_addr_req() function.

Referenced by arp_device_message().

#define nil_get_broadcast_addr_req ( nil_phone,
device_id,
address,
data   )     generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, address, data)

Returns the device broadcast hardware address.

Parameters:
[in] nil_phone The network interface layer phone.
[in] device_id The device identifier.
[out] address The device broadcast hardware address.
[out] data The address data.
Returns:
EOK on success.
EBADMEM if the address parameter is NULL.
ENOENT if there no such device.
Other error codes as defined for the generic_get_addr_req() function.

Referenced by arp_device_message().

#define NIL_GET_PROTO ( call   )     (services_t) IPC_GET_ARG2(*call)

Returns the protocol service message parameter.

Referenced by nil_message().

#define nil_packet_size_req ( nil_phone,
device_id,
packet_dimension   )     generic_packet_size_req(nil_phone, NET_NIL_PACKET_SPACE, device_id, packet_dimension)

Returns the device packet dimension for sending.

Parameters:
[in] nil_phone The network interface layer phone.
[in] device_id The device identifier.
[out] packet_dimension The packet dimensions.
Returns:
EOK on success.
ENOENT if there is no such device.
Other error codes as defined for the generic_packet_size_req() function.

Referenced by arp_device_message(), and ip_netif_initialize().

#define nil_send_msg ( nil_phone,
device_id,
packet,
sender   )     generic_send_msg(nil_phone, NET_NIL_SEND, device_id, packet_get_id(packet), sender, 0)

Sends the packet queue.

Parameters:
[in] nil_phone The network interface layer phone.
[in] device_id The device identifier.
[in] packet The packet queue.
[in] sender The sending module service.
Returns:
EOK on success.
Other error codes as defined for the generic_send_msg() function.

Referenced by arp_receive_message(), arp_translate_message(), and ip_send_route().


Typedef Documentation

typedef uint8_t hw_type_t

Network interface layer type type definition.


Enumeration Type Documentation

Network interface layer module messages.

Enumerator:
NET_NIL_DEVICE 

New device or update MTU message.

See also:
nil_device_req()
NET_NIL_DEVICE_STATE 

New device state message.

See also:
nil_device_state_msg()
NET_NIL_RECEIVED 

Received packet queue message.

See also:
nil_received_msg()
NET_NIL_SEND 

Send packet queue message.

See also:
nil_send_msg()
NET_NIL_PACKET_SPACE 

Packet size message.

See also:
nil_packet_size_req()
NET_NIL_ADDR 

Device local hardware address message.

See also:
nil_get_addr()
NET_NIL_BROADCAST_ADDR 

Device broadcast hardware address message.

See also:
nil_get_broadcast_addr()

Function Documentation

static hw_type_t hardware_map ( services_t  nil  )  [inline, static]

Maps the network interface layer services to the hardware types.

Parameters:
[in] nil The network interface service.
Returns:
The hardware type of the network interface service.
0 if mapping is not found.

References HW_ETHER.

Referenced by arp_device_message().

Here is the caller graph for this function:

static eth_type_t lsap_map ( eth_lsap_t  lsap  )  [inline, static]

Maps the link service access point identifier to the Ethernet protocol identifier.

Parameters:
[in] lsap Link service access point identifier.
Returns:
Ethernet protocol identifier of the link service access point identifier.
ETH_LSAP_NULL if mapping is not found.

References ETH_LSAP_ARP, ETH_LSAP_IP, ETH_LSAP_NULL, ETH_P_ARP, and ETH_P_IP.

Referenced by eth_process_packet().

Here is the caller graph for this function:

static eth_lsap_t lsap_unmap ( eth_type_t  ethertype  )  [inline, static]

Maps the Ethernet protocol identifier to the link service access point identifier.

Parameters:
[in] ethertype Ethernet protocol identifier.
Returns:
Link service access point identifier.
0 if mapping is not found.

References ETH_LSAP_ARP, ETH_LSAP_IP, ETH_P_ARP, and ETH_P_IP.

Referenced by eth_prepare_packet().

Here is the caller graph for this function:

int nil_device_state_msg ( int  nil_phone,
device_id_t  device_id,
int  state 
)

Notifies the network interface layer about the device state change.

Parameters:
[in] nil_phone The network interface layer phone.
[in] device_id The device identifier.
[in] state The new device state.
Returns:
EOK on success.
Other error codes as defined for each specific module device state function.

References generic_device_state_msg(), and NET_NIL_DEVICE_STATE.

Referenced by eth_receiver(), and nildummy_receiver().

Here is the call graph for this function:

Here is the caller graph for this function:

int nil_initialize ( int  net_phone  ) 

Module initialization.

Is called by the module_start() function.

Parameters:
[in] net_phone The networking moduel phone.
Returns:
EOK on success.
Other error codes as defined for each specific module initialize function.

References eth_globals::broadcast_addr, CONVERT_SIZE, nildummy_globals::devices, eth_globals::devices, nildummy_globals::devices_lock, eth_globals::devices_lock, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, ETH_ADDR, measured_string_create_bulk(), nildummy_globals::net_phone, eth_globals::net_phone, nildummy_proto::phone, nildummy_globals::proto, eth_globals::protos, nildummy_globals::protos_lock, and eth_globals::protos_lock.

Referenced by module_start().

Here is the call graph for this function:

Here is the caller graph for this function:

int nil_message ( ipc_callid_t  callid,
ipc_call_t *  call,
ipc_call_t *  answer,
int *  answer_count 
)

Message processing function.

Parameters:
[in] callid The message identifier.
[in] call The message parameters.
[out] answer The message answer parameters.
[out] answer_count The last parameter for the actual answer in the answer parameter.
Returns:
EOK on success.
ENOTSUP if the message is not known.
Other error codes as defined for each specific module message function.
See also:
nil_interface.h
IS_NET_NIL_MESSAGE()

References ERROR_DECLARE, ERROR_PROPAGATE, eth_addr_message(), ETH_BROADCAST_ADDR, eth_device_message(), ETH_LOCAL_ADDR, eth_packet_space_message(), eth_register_message(), eth_send_message(), IPC_GET_DEVICE, IPC_GET_MTU, IPC_GET_PACKET, IPC_GET_PHONE, IPC_GET_SERVICE, IPC_SET_ADDR, IPC_SET_CONTENT, IPC_SET_PREFIX, IPC_SET_SUFFIX, measured_strings_reply(), NET_NIL_ADDR, NET_NIL_BROADCAST_ADDR, NET_NIL_DEVICE, NET_NIL_PACKET_SPACE, NET_NIL_SEND, nildummy_globals::net_phone, eth_globals::net_phone, NIL_GET_PROTO, nildummy_addr_message(), nildummy_device_message(), nildummy_packet_space_message(), nildummy_register_message(), nildummy_send_message(), and packet_translate().

Referenced by module_message().

Here is the call graph for this function:

Here is the caller graph for this function:

int nil_received_msg ( int  nil_phone,
device_id_t  device_id,
packet_t  packet,
services_t  target 
)

Passes the packet queue to the network interface layer.

Processes and redistributes the received packet queue to the registered upper layers.

Parameters:
[in] nil_phone The network interface layer phone.
[in] device_id The source device identifier.
[in] packet The received packet or the received packet queue.
target The target service. Ignored parameter.
Returns:
EOK on success.
Other error codes as defined for each specific module received function.

References generic_received_msg(), NET_NIL_RECEIVED, and packet_get_id().

Referenced by eth_receiver(), irq_handler(), netif_send_message(), and nildummy_receiver().

Here is the call graph for this function:

Here is the caller graph for this function:

static eth_type_t protocol_map ( services_t  nil,
services_t  il 
) [inline, static]

Maps the internetwork layer service to the network interface layer type.

Parameters:
[in] nil Network interface layer service.
[in] il Internetwork layer service.
Returns:
Network interface layer type of the internetworking layer service.
0 if mapping is not found.

References ETH_P_ARP, and ETH_P_IP.

Referenced by arp_translate_message(), eth_register_message(), and eth_send_message().

Here is the caller graph for this function:

static services_t protocol_unmap ( services_t  nil,
int  protocol 
) [inline, static]

Maps the network interface layer type to the internetwork layer service.

Parameters:
[in] nil Network interface layer service.
[in] protocol Network interface layer type.
Returns:
Internetwork layer service of the network interface layer type.
0 if mapping is not found.

References ETH_P_ARP, and ETH_P_IP.

Referenced by arp_receive_message().

Here is the caller graph for this function:


Generated on Thu Mar 11 20:46:38 2010 for Networking and TCP/IP stack for HelenOS system by  doxygen 1.6.1