Files | |
file | nildummy.c |
Dummy network interface layer module implementation. | |
file | nildummy.h |
Dummy network interface layer module. | |
Data Structures | |
struct | nildummy_device |
Dummy nil device specific data. More... | |
struct | nildummy_globals |
Dummy nil global data. More... | |
struct | nildummy_proto |
Dummy nil protocol specific data. More... | |
Defines | |
#define | NAME "nildummy" |
The module name. | |
#define | NET_DEFAULT_MTU 1500 |
Default maximum transmission unit. | |
Typedefs | |
typedef nildummy_device | nildummy_device_t |
Type definition of the dummy nil device specific data. | |
typedef nildummy_globals | nildummy_globals_t |
Type definition of the dummy nil global data. | |
typedef nildummy_proto | nildummy_proto_t |
Type definition of the dummy nil protocol specific data. | |
Functions | |
DEVICE_MAP_DECLARE (nildummy_devices, nildummy_device_t) | |
Dummy nil device map. | |
int | main (int argc, char *argv[]) |
Main entry point. | |
int | nil_device_state_msg_local (int nil_phone, device_id_t device_id, int state) |
Notify the network interface layer about the device state change. | |
int | nil_initialize (int net_phone) |
Module initialization. | |
int | nil_module_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, size_t *answer_count) |
Message processing function. | |
int | nil_received_msg_local (int nil_phone, device_id_t device_id, packet_t *packet, services_t target) |
Pass the packet queue to the network interface layer. | |
static int | nildummy_addr_message (device_id_t device_id, measured_string_t **address) |
Return the device hardware address. | |
static int | nildummy_device_message (device_id_t device_id, services_t service, size_t mtu) |
Register new device or updates the MTU of an existing one. | |
static int | nildummy_packet_space_message (device_id_t device_id, size_t *addr_len, size_t *prefix, size_t *content, size_t *suffix) |
Return the device packet dimensions for sending. | |
static void | nildummy_receiver (ipc_callid_t iid, ipc_call_t *icall) |
Process IPC messages from the registered device driver modules. | |
static int | nildummy_register_message (services_t service, int phone) |
Register receiving module service. | |
static int | nildummy_send_message (device_id_t device_id, packet_t *packet, services_t sender) |
Send the packet queue. | |
Variables | |
nildummy_globals_t | nildummy_globals |
Network interface layer module global data. |
typedef struct nildummy_device nildummy_device_t |
Type definition of the dummy nil device specific data.
Definition at line 58 of file nildummy.h.
typedef struct nildummy_globals nildummy_globals_t |
Type definition of the dummy nil global data.
Definition at line 51 of file nildummy.h.
typedef struct nildummy_proto nildummy_proto_t |
Type definition of the dummy nil protocol specific data.
Definition at line 65 of file nildummy.h.
DEVICE_MAP_DECLARE | ( | nildummy_devices | , | |
nildummy_device_t | ||||
) |
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Main entry point.
[in] | argc | Nmber of arguments in argv vector (ignored). |
[in] | argv | Cmdline argument vector (ignored). |
Definition at line 443 of file nildummy.c.
int nil_device_state_msg_local | ( | int | , | |
device_id_t | , | |||
int | ||||
) |
Notify the network interface layer about the device state change.
This has to be implemented in user code.
[in] | nil_phone | Network interface layer phone. |
[in] | device_id | Device identifier. |
[in] | state | New device state. |
Other error codes as defined for each specific module device state function.
Definition at line 69 of file nildummy.c.
int nil_initialize | ( | int | net_phone | ) |
Module initialization.
This has to be implemented in user code.
[in] | net_phone | Networking module phone. |
Other error codes as defined for each specific module initialize function.
Definition at line 80 of file nildummy.c.
int nil_module_message | ( | ipc_callid_t | , | |
ipc_call_t * | , | |||
ipc_call_t * | , | |||
size_t * | ||||
) |
Message processing function.
This has to be implemented in user code.
[in] | name | Module name. |
[in] | callid | Message identifier. |
[in] | call | Message parameters. |
[out] | answer | Message answer parameters. |
[out] | count | Message answer arguments. |
ENOTSUP if the message is not known.
Other error codes as defined for each specific module message function.
Definition at line 383 of file nildummy.c.
int nil_received_msg_local | ( | int | , | |
device_id_t | , | |||
packet_t * | , | |||
services_t | ||||
) |
Pass the packet queue to the network interface layer.
Process and redistribute the received packet queue to the registered upper layers.
This has to be implemented in user code.
[in] | nil_phone | Network interface layer phone. |
[in] | device_id | Source device identifier. |
[in] | packet | Received packet or the received packet queue. |
[in] | target | Target service. Ignored parameter. |
Other error codes as defined for each specific module received function.
Definition at line 306 of file nildummy.c.
static int nildummy_addr_message | ( | device_id_t | device_id, | |
measured_string_t ** | address | |||
) | [static] |
Return the device hardware address.
[in] | device_id | Device identifier. |
[out] | address | Device hardware address. |
EBADMEM if the address parameter is NULL.
ENOENT if there no such device.
Definition at line 246 of file nildummy.c.
static int nildummy_device_message | ( | device_id_t | device_id, | |
services_t | service, | |||
size_t | mtu | |||
) | [static] |
Register new device or updates the MTU of an existing one.
Determine the device local hardware address.
[in] | device_id | New device identifier. |
[in] | service | Device driver service. |
[in] | mtu | Device maximum transmission unit. |
EEXIST if the device with the different service exists.
ENOMEM if there is not enough memory left.
Other error codes as defined for the netif_bind_service() function.
Other error codes as defined for the netif_get_addr_req() function.
Definition at line 151 of file nildummy.c.
static int nildummy_packet_space_message | ( | device_id_t | device_id, | |
size_t * | addr_len, | |||
size_t * | prefix, | |||
size_t * | content, | |||
size_t * | suffix | |||
) | [static] |
Return the device packet dimensions for sending.
[in] | device_id | Device identifier. |
[out] | addr_len | Minimum reserved address length. |
[out] | prefix | Minimum reserved prefix size. |
[out] | content | Maximum content size. |
[out] | suffix | Minimum reserved suffix size. |
EBADMEM if either one of the parameters is NULL.
ENOENT if there is no such device.
Definition at line 281 of file nildummy.c.
static void nildummy_receiver | ( | ipc_callid_t | iid, | |
ipc_call_t * | icall | |||
) | [static] |
Process IPC messages from the registered device driver modules.
[in] | iid | Message identifier. |
[in,out] | icall | Message parameters. |
Definition at line 103 of file nildummy.c.
static int nildummy_register_message | ( | services_t | service, | |
int | phone | |||
) | [static] |
Register receiving module service.
Pass received packets for this service.
[in] | service | Module service. |
[in] | phone | Service phone. |
ENOENT if the service is not known.
ENOMEM if there is not enough memory left.
Definition at line 337 of file nildummy.c.
static int nildummy_send_message | ( | device_id_t | device_id, | |
packet_t * | packet, | |||
services_t | sender | |||
) | [static] |
Send the packet queue.
[in] | device_id | Device identifier. |
[in] | packet | Packet queue. |
[in] | sender | Sending module service. |
ENOENT if there no such device.
EINVAL if the service parameter is not known.
Definition at line 361 of file nildummy.c.