Loopback Service
[Network interface drivers]


Files

file  lo.c
 Loopback network interface implementation.

Defines

#define DEFAULT_ADDR_LEN   6
 Default address length.
#define NAME   "lo"
 Loopback module name.

Functions

static void change_state_message (netif_device_t *device, device_state_t state)
 Change the loopback state.
static int lo_create (device_id_t device_id, netif_device_t **device)
 Create and return the loopback network interface structure.
int main (int argc, char *argv[])
 Main entry point.
int netif_get_addr_message (device_id_t device_id, measured_string_t *address)
 Return the device local hardware address.
int netif_get_device_stats (device_id_t device_id, device_stats_t *stats)
 Return the device usage statistics.
int netif_initialize (void)
 Initialize the specific module.
int netif_probe_message (device_id_t device_id, int irq, void *io)
 Probe the existence of the device.
int netif_send_message (device_id_t device_id, packet_t *packet, services_t sender)
 Send the packet queue.
int netif_specific_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, size_t *count)
 Process the netif driver specific message.
int netif_start_message (netif_device_t *device)
 Start the device.
int netif_stop_message (netif_device_t *device)
 Stop the device.

Variables

static uint8_t default_addr [DEFAULT_ADDR_LEN]

Function Documentation

static void change_state_message ( netif_device_t device,
device_state_t  state 
) [static]

Change the loopback state.

Parameters:
[in] device The device structure.
[in] state The new device state.
Returns:
New state if changed.

EOK otherwise.

Definition at line 101 of file lo.c.

static int lo_create ( device_id_t  device_id,
netif_device_t **  device 
) [static]

Create and return the loopback network interface structure.

Parameters:
[in] device_id New devce identifier.
[out] device Device structure.
Returns:
EOK on success.

EXDEV if one loopback network interface already exists.

ENOMEM if there is not enough memory left.

Definition at line 132 of file lo.c.

int main ( int  argc,
char *  argv[] 
)

Main entry point.

Parameters:
[in] argc Nmber of arguments in argv vector (ignored).
[in] argv Cmdline argument vector (ignored).
Returns:
Error code.
Driver debug level is set here.

Definition at line 224 of file lo.c.

int netif_get_addr_message ( device_id_t  device_id,
measured_string_t address 
)

Return the device local hardware address.

This has to be implemented in user code.

Parameters:
[in] device_id Device identifier.
[out] address Device local hardware address.
Returns:
EOK on success.

EBADMEM if the address parameter is NULL.

ENOENT if there no such device.

Other error codes as defined for the find_device() function.

Other error codes as defined for the specific module message implementation.

Definition at line 65 of file lo.c.

int netif_get_device_stats ( device_id_t  device_id,
device_stats_t stats 
)

Return the device usage statistics.

This has to be implemented in user code.

Parameters:
[in] device_id Device identifier.
[out] stats Device usage statistics.
Returns:
EOK on success.

Other error codes as defined for the find_device() function.

Other error codes as defined for the specific module message implementation.

Definition at line 76 of file lo.c.

int netif_initialize ( void   ) 

Initialize the specific module.

This function has to be implemented in user code.

Definition at line 164 of file lo.c.

int netif_probe_message ( device_id_t  device_id,
int  irq,
void *  io 
)

Probe the existence of the device.

This has to be implemented in user code.

Parameters:
[in] device_id Device identifier.
[in] irq Device interrupt number.
[in] io Device input/output address.
Returns:
EOK on success.

Other error codes as defined for the find_device() function.

Other error codes as defined for the specific module message implementation.

Definition at line 169 of file lo.c.

int netif_send_message ( device_id_t  device_id,
packet_t packet,
services_t  sender 
)

Send the packet queue.

This has to be implemented in user code.

Parameters:
[in] device_id Device identifier.
[in] packet Packet queue.
[in] sender Sending module service.
Returns:
EOK on success.

EFORWARD if the device is not active (in the NETIF_ACTIVE state).

Other error codes as defined for the find_device() function.

Other error codes as defined for the specific module message implementation.

Definition at line 181 of file lo.c.

int netif_specific_message ( ipc_callid_t  callid,
ipc_call_t call,
ipc_call_t answer,
size_t count 
)

Process the netif driver specific message.

This function is called for uncommon messages received by the netif skeleton. This has to be implemented in user code.

Parameters:
[in] callid Message identifier.
[in] call Message.
[out] answer Answer.
[out] count Number of answer arguments.
Returns:
EOK on success.

ENOTSUP if the message is not known.

Other error codes as defined for the specific module message implementation.

Definition at line 59 of file lo.c.

int netif_start_message ( netif_device_t device  ) 

Start the device.

This has to be implemented in user code.

Parameters:
[in] device Device structure.
Returns:
New network interface state (non-negative values).

Other error codes as defined for the find_device() function.

Other error codes as defined for the specific module message implementation.

Definition at line 212 of file lo.c.

int netif_stop_message ( netif_device_t device  ) 

Stop the device.

This has to be implemented in user code.

Parameters:
[in] device Device structure.
Returns:
EOK on success.

Other error codes as defined for the find_device() function.

Other error codes as defined for the specific module message implementation.

Definition at line 218 of file lo.c.


Generated on Thu Jun 2 07:45:55 2011 for HelenOS/USB by  doxygen 1.4.7