eth.c File Reference

Ethernet module implementation. More...

#include <async.h>
#include <malloc.h>
#include <mem.h>
#include <stdio.h>
#include <byteorder.h>
#include <str.h>
#include <errno.h>
#include <ipc/nil.h>
#include <ipc/net.h>
#include <ipc/services.h>
#include <net/modules.h>
#include <net_checksum.h>
#include <ethernet_lsap.h>
#include <ethernet_protocols.h>
#include <protocol_map.h>
#include <net/device.h>
#include <netif_remote.h>
#include <net_interface.h>
#include <il_remote.h>
#include <adt/measured_strings.h>
#include <packet_client.h>
#include <packet_remote.h>
#include <nil_skel.h>
#include "eth.h"

Go to the source code of this file.

Defines

#define ETH_8023_2_LSAP   (2 << ETH_MODE_SHIFT)
 802.3 + 802.2 + LSAP mode flag.
#define ETH_8023_2_SNAP   (3 << ETH_MODE_SHIFT)
 802.3 + 802.2 + LSAP + SNAP mode flag.
#define ETH_DIX   (1 << ETH_MODE_SHIFT)
 DIX Ethernet mode flag.
#define ETH_DUMMY   (1 << ETH_DUMMY_SHIFT)
 Dummy device flag.
#define ETH_DUMMY_SHIFT   0
 Dummy flag shift value.
#define ETH_MAX_CONTENT   1500u
 Maximum packet content length.
#define ETH_MAX_TAGGED_CONTENT(flags)
 Maximum tagged packet content length.
#define ETH_MIN_CONTENT   46u
 Minimum packet content length.
#define ETH_MIN_TAGGED_CONTENT(flags)
 Minimum tagged packet content length.
#define ETH_MODE_MASK   (3 << ETH_MODE_SHIFT)
 Device mode flags.
#define ETH_MODE_SHIFT   1
 Mode flag shift value.
#define ETH_PREFIX
 Reserved packet prefix length.
#define ETH_SUFFIX   (sizeof(eth_fcs_t))
 Reserved packet suffix length.
#define IS_8023_2_LSAP(flags)   (((flags) & ETH_MODE_MASK) == ETH_8023_2_LSAP)
 Return whether the 802.3 + 802.2 + LSAP mode flag is set.
#define IS_8023_2_SNAP(flags)   (((flags) & ETH_MODE_MASK) == ETH_8023_2_SNAP)
 Return whether the 802.3 + 802.2 + LSAP + SNAP mode flag is set.
#define IS_DIX(flags)   (((flags) & ETH_MODE_MASK) == ETH_DIX)
 Return whether the DIX Ethernet mode flag is set.
#define IS_DUMMY(flags)   ((flags) & ETH_DUMMY)
 Returns the dummy flag.
#define NAME   "eth"
 The module name.

Typedefs

typedef enum eth_addr_type eth_addr_type_t
 Type definition of the ethernet address type.

Enumerations

enum  eth_addr_type { ETH_LOCAL_ADDR, ETH_BROADCAST_ADDR }
 Ethernet address type. More...

Functions

static int eth_addr_message (device_id_t device_id, eth_addr_type_t type, measured_string_t **address)
 Returns the device hardware address.
static int eth_device_message (device_id_t device_id, services_t service, size_t mtu)
 Registers new device or updates the MTU of an existing one.
static int eth_packet_space_message (device_id_t device_id, size_t *addr_len, size_t *prefix, size_t *content, size_t *suffix)
 Returns the device packet dimensions for sending.
static int eth_prepare_packet (int flags, packet_t *packet, uint8_t *src_addr, int ethertype, size_t mtu)
 Prepares the packet for sending.
static eth_proto_teth_process_packet (int flags, packet_t *packet)
 Processes the received packet and chooses the target registered module.
static void eth_receiver (ipc_callid_t iid, ipc_call_t *icall)
 Processes IPC messages from the registered device driver modules in an infinite loop.
static int eth_register_message (services_t service, int phone)
 Registers receiving module service.
static int eth_send_message (device_id_t device_id, packet_t *packet, services_t sender)
 Sends the packet queue.
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.

Variables

eth_globals_t eth_globals
 Ethernet module global data.


Detailed Description

Ethernet module implementation.

See also:
eth.h

Definition in file eth.c.


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