2
* Copyright (c) 2009 Lukas Mejdrech
3
* Copyright (c) 2011 Radim Vansa
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
10
* - Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
12
* - Redistributions in binary form must reproduce the above copyright
13
* notice, this list of conditions and the following disclaimer in the
14
* documentation and/or other materials provided with the distribution.
15
* - The name of the author may not be used to endorse or promote products
16
* derived from this software without specific prior written permission.
18
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
#include <net/device.h>
38
#include <adt/char_map.h>
39
#include <adt/generic_char_map.h>
40
#include <adt/measured_strings.h>
41
#include <adt/module_map.h>
42
#include <net/packet.h>
47
#define ETHERNET_FILENAME "/srv/eth"
48
#define ETHERNET_NAME "eth"
50
#define IP_FILENAME "/srv/ip"
53
#define NILDUMMY_FILENAME "/srv/nildummy"
54
#define NILDUMMY_NAME "nildummy"
59
/** @name Configuration setting names definitions
63
#define CONF_IL "IL" /**< Internet protocol module name configuration label. */
64
#define CONF_IO "IO" /**< Device input/output address configuration label. */
65
#define CONF_IRQ "IRQ" /**< Interrupt number configuration label. */
66
#define CONF_MTU "MTU" /**< Maximum transmission unit configuration label. */
67
#define CONF_NAME "NAME" /**< Network interface name configuration label. */
68
#define CONF_HWPATH "HWPATH" /**< Network interface hardware pathname label. */
69
#define CONF_NIL "NIL" /**< Network interface layer module name configuration label. */
74
#define CONF_DIR "/cfg/net" /**< Configuration directory. */
75
#define CONF_GENERAL_FILE "general" /**< General configuration file. */
76
#define CONF_EXT ".nic" /**< Extension for NIC's configuration files. */
78
/** Configuration settings.
80
* Maps setting names to the values.
81
* @see generic_char_map.h
84
GENERIC_CHAR_MAP_DECLARE(measured_strings, measured_string_t);
86
/** Present network interface device.
90
/** System-unique network interface name. */
92
/** System-unique network interface identifier. */
95
measured_strings_t configuration;
97
/** Serving network interface driver module index. */
98
devman_handle_t handle; /**< Handle for devman */
99
async_sess_t *sess; /**< Driver session. */
101
module_t *nil; /**< Serving link layer module index. */
102
module_t *il; /**< Serving internet layer module index. */
105
/** Present network interfaces.
107
* Maps devices to the networking device specific data.
111
DEVICE_MAP_DECLARE(netifs, netif_t);
113
/** Networking module global data.
117
measured_strings_t configuration; /**< Global configuration. */
118
modules_t modules; /**< Available modules. */
120
/** Network interface structure indices by hardware path. */
121
char_map_t netif_hwpaths;
123
/** Present network interfaces. */