Files | |
file | lo.c |
Loopback network interface implementation. | |
Defines | |
#define | DEFAULT_ADDR "\0\0\0\0\0\0" |
Default hardware address. | |
#define | DEFAULT_ADDR_LEN (sizeof(DEFAULT_ADDR) / sizeof(char)) |
Default address length. | |
#define | NAME "lo - loopback interface" |
Loopback module name. | |
Functions | |
int | change_state_message (device_ref device, device_state_t state) |
Changes the loopback state. | |
int | create (device_id_t device_id, device_ref *device) |
Creates and returns the loopback network interface structure. | |
void | module_print_name (void) |
Prints the module name. | |
int | netif_specific_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count) |
Processes the netif driver specific message. | |
int | netif_get_addr_message (device_id_t device_id, measured_string_ref address) |
Returns the device local hardware address. | |
int | netif_get_device_stats (device_id_t device_id, device_stats_ref stats) |
Returns the device usage statistics. | |
int | netif_initialize (void) |
Initializes the specific module. | |
int | netif_probe_message (device_id_t device_id, int irq, uintptr_t io) |
Probes the existence of the device. | |
int | netif_send_message (device_id_t device_id, packet_t packet, services_t sender) |
Sends the packet queue. | |
int | netif_start_message (device_ref device) |
Starts the device. | |
int | netif_stop_message (device_ref device) |
Stops the device. | |
Variables | |
netif_globals_t | netif_globals |
Network interface global data. |
#define DEFAULT_ADDR "\0\0\0\0\0\0" |
Default hardware address.
Referenced by netif_get_addr_message().
#define DEFAULT_ADDR_LEN (sizeof(DEFAULT_ADDR) / sizeof(char)) |
Default address length.
Referenced by netif_get_addr_message(), and packet_get_1().
#define NAME "lo - loopback interface" |
Loopback module name.
int change_state_message | ( | device_ref | device, | |
device_state_t | state | |||
) |
Changes the loopback state.
[in] | device | The device structure. |
[in] | state | The new device state. |
References NETIF_ACTIVE, and netif_device::state.
Referenced by netif_start_message(), and netif_stop_message().
int create | ( | device_id_t | device_id, | |
device_ref * | device | |||
) |
Creates and returns the loopback network interface structure.
[in] | device_id | The new devce identifier. |
[out] | device | The device structure. |
References netif_globals::device_map, free, NETIF_STOPPED, null_device_stats(), and netif_device::specific.
Referenced by netif_probe_message().
int netif_get_addr_message | ( | device_id_t | device_id, | |
measured_string_ref | address | |||
) |
Returns the device local hardware address.
[in] | device_id | The device identifier. |
[out] | address | The device local hardware address. |
References CONVERT_SIZE, DEFAULT_ADDR, DEFAULT_ADDR_LEN, ERROR_DECLARE, ERROR_PROPAGATE, find_device(), measured_string::length, netif_device::specific, and measured_string::value.
int netif_get_device_stats | ( | device_id_t | device_id, | |
device_stats_ref | stats | |||
) |
Returns the device usage statistics.
[in] | device_id | The device identifier. |
[out] | stats | The device usage statistics. |
References device_stats::collisions, ERROR_DECLARE, ERROR_PROPAGATE, eth_stat::ets_carrSense, eth_stat::ets_CDheartbeat, eth_stat::ets_collision, eth_stat::ets_CRCerr, eth_stat::ets_frameAll, eth_stat::ets_missedP, eth_stat::ets_OWC, eth_stat::ets_packetR, eth_stat::ets_packetT, eth_stat::ets_recvErr, eth_stat::ets_sendErr, eth_stat::ets_transAb, find_device(), null_device_stats(), device_stats::receive_crc_errors, device_stats::receive_errors, device_stats::receive_frame_errors, device_stats::receive_missed_errors, device_stats::receive_packets, device_stats::send_aborted_errors, device_stats::send_carrier_errors, device_stats::send_errors, device_stats::send_heartbeat_errors, device_stats::send_packets, device_stats::send_window_errors, and netif_device::specific.
int netif_initialize | ( | void | ) |
Initializes the specific module.
References irq_handler(), and REGISTER_ME.
int netif_probe_message | ( | device_id_t | device_id, | |
int | irq, | |||
uintptr_t | io | |||
) |
Probes the existence of the device.
[in] | device_id | The device identifier. |
[in] | irq | The device interrupt number. |
[in] | io | The device input/output address. |
References create(), dpeth::de_base_port, dpeth::de_irq, dpeth::de_mode, DEM_DISABLED, netif_device::device_id, netif_globals::device_map, do_probe(), DP8390_IO_SIZE, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, free, NETIF_STOPPED, netif_device::nil_phone, netif_device::specific, and netif_device::state.
int netif_send_message | ( | device_id_t | device_id, | |
packet_t | packet, | |||
services_t | sender | |||
) |
Sends the packet queue.
[in] | device_id | The device identifier. |
[in] | packet | The packet queue. |
[in] | sender | The sending module service. |
References do_pwrite(), ERROR_DECLARE, ERROR_PROPAGATE, FALSE, find_device(), netif_globals::lock, NETIF_ACTIVE, netif_pq_release(), netif_device::nil_phone, nil_received_msg(), packet_get_data(), packet_get_data_length(), packet_get_id(), pq_detach(), pq_next(), netif_device::specific, and netif_device::state.
int netif_specific_message | ( | ipc_callid_t | callid, | |
ipc_call_t * | call, | |||
ipc_call_t * | answer, | |||
int * | answer_count | |||
) |
Processes the netif driver specific message.
This function is called for uncommon messages received by the netif skeleton.
[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. |
int netif_start_message | ( | device_ref | device | ) |
Starts the device.
[in] | device | The device structure. |
References change_state(), change_state_message(), dpeth::de_dp8390_port, dpeth::de_irq, netif_device::device_id, DL_BROAD_REQ, do_init(), dp8390_cmds, dp8390_code, DP_ISR, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, NETIF_ACTIVE, netif_device::specific, and netif_device::state.
int netif_stop_message | ( | device_ref | device | ) |
Stops the device.
[in] | device | The device structure. |
References change_state(), change_state_message(), dpeth::de_irq, netif_device::device_id, do_stop(), NETIF_STOPPED, netif_device::specific, and netif_device::state.
Network interface global data.
Network interface module global data.