source: mainline/uspace/srv/net/net/net.h@ 5cc9eba

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 5cc9eba was 5cc9eba, checked in by Martin Decky <martin@…>, 14 years ago

cstyle
(no change in functionality)

  • Property mode set to 100644
File size: 4.1 KB
Line 
1/*
2 * Copyright (c) 2009 Lukas Mejdrech
3 * Copyright (c) 2011 Radim Vansa
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
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.
17 *
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.
28 */
29
30/** @addtogroup net
31 * @{
32 */
33
34#ifndef NET_NET_H_
35#define NET_NET_H_
36
37#include <ipc/loc.h>
38#include <net/device.h>
39#include <adt/char_map.h>
40#include <adt/generic_char_map.h>
41#include <adt/measured_strings.h>
42#include <adt/module_map.h>
43#include <net/packet.h>
44
45#define NAME "net"
46
47#define ETHERNET_FILENAME "/srv/eth"
48#define ETHERNET_NAME "eth"
49
50#define IP_FILENAME "/srv/ip"
51#define IP_NAME "ip"
52
53#define NILDUMMY_FILENAME "/srv/nildummy"
54#define NILDUMMY_NAME "nildummy"
55
56/** @}
57 */
58
59/** @name Configuration setting names definitions
60 * @{
61 */
62
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. */
70
71/** @}
72 */
73
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. */
77
78/** Configuration settings.
79 *
80 * Maps setting names to the values.
81 * @see generic_char_map.h
82 *
83 */
84GENERIC_CHAR_MAP_DECLARE(measured_strings, measured_string_t);
85
86/** Present network interface device.
87 *
88 */
89typedef struct {
90 /** System-unique network interface name. */
91 uint8_t *name;
92 /** System-unique network interface identifier. */
93 nic_device_id_t id;
94 /** Configuration. */
95 measured_strings_t configuration;
96
97 /** Serving network interface driver module index. */
98 service_id_t sid; /**< Service ID */
99 async_sess_t *sess; /**< Driver session. */
100
101 module_t *nil; /**< Serving link layer module index. */
102 module_t *il; /**< Serving internet layer module index. */
103
104 link_t netif_list;
105} netif_t;
106
107/** Present network interfaces.
108 *
109 * Maps devices to the networking device specific data.
110 * @see device.h
111 *
112 */
113DEVICE_MAP_DECLARE(netifs, netif_t);
114
115/** Networking module global data.
116 *
117 */
118typedef struct {
119 measured_strings_t configuration; /**< Global configuration. */
120 modules_t modules; /**< Available modules. */
121
122 /** Network interface structure indices by hardware path. */
123 char_map_t netif_hwpaths;
124
125 /** Present network interfaces. */
126 netifs_t netifs;
127} net_globals_t;
128
129#endif
130
131/** @}
132 */
Note: See TracBrowser for help on using the repository browser.