Rev 4307 | Rev 4351 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4307 | Rev 4350 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | /** @addtogroup net |
29 | /** @addtogroup net |
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | 32 | ||
33 | /** @file |
33 | /** @file |
34 | * Networking subsystem compilation configuration. |
34 | * Networking subsystem central module. |
35 | */ |
35 | */ |
36 | 36 | ||
37 | #ifndef __NET_NET_H__ |
37 | #ifndef __NET_NET_H__ |
38 | #define __NET_NET_H__ |
38 | #define __NET_NET_H__ |
39 | 39 | ||
Line 45... | Line 45... | ||
45 | #include "../structures/generic_char_map.h" |
45 | #include "../structures/generic_char_map.h" |
46 | #include "../structures/measured_strings.h" |
46 | #include "../structures/measured_strings.h" |
47 | #include "../structures/module_map.h" |
47 | #include "../structures/module_map.h" |
48 | #include "../structures/packet/packet.h" |
48 | #include "../structures/packet/packet.h" |
49 | 49 | ||
- | 50 | /** Loopback network interface module name. |
|
- | 51 | */ |
|
50 | #define LO_NAME "lo" |
52 | #define LO_NAME "lo" |
- | 53 | ||
- | 54 | /** Loopback network interface module full path filename. |
|
- | 55 | */ |
|
51 | #define LO_FILENAME "/srv/lo" |
56 | #define LO_FILENAME "/srv/lo" |
- | 57 | ||
- | 58 | /** DP8390 network interface module name. |
|
- | 59 | */ |
|
52 | #define DP8390_NAME "dp8390" |
60 | #define DP8390_NAME "dp8390" |
- | 61 | ||
- | 62 | /** DP8390 network interface module full path filename. |
|
- | 63 | */ |
|
53 | #define DP8390_FILENAME "/srv/dp8390" |
64 | #define DP8390_FILENAME "/srv/dp8390" |
- | 65 | ||
- | 66 | /** Ethernet module name. |
|
- | 67 | */ |
|
54 | #define ETHERNET_NAME "ethernet" |
68 | #define ETHERNET_NAME "ethernet" |
- | 69 | ||
- | 70 | /** Ethernet module full path filename. |
|
- | 71 | */ |
|
55 | #define ETHERNET_FILENAME "/srv/eth" |
72 | #define ETHERNET_FILENAME "/srv/eth" |
- | 73 | ||
- | 74 | /** Internet protocol module name. |
|
- | 75 | */ |
|
56 | #define IP_NAME "ip" |
76 | #define IP_NAME "ip" |
- | 77 | ||
- | 78 | /** Internet protocol module full path filename. |
|
- | 79 | */ |
|
57 | #define IP_FILENAME "/srv/ip" |
80 | #define IP_FILENAME "/srv/ip" |
58 | 81 | ||
- | 82 | /** Network interface name configuration label. |
|
- | 83 | */ |
|
59 | #define CONF_NAME "NAME" |
84 | #define CONF_NAME "NAME" |
- | 85 | ||
- | 86 | /** Network interface module name configuration label. |
|
- | 87 | */ |
|
60 | #define CONF_NETIF "NETIF" |
88 | #define CONF_NETIF "NETIF" |
- | 89 | ||
- | 90 | /** Network interface layer module name configuration label. |
|
- | 91 | */ |
|
61 | #define CONF_NIL "NIL" |
92 | #define CONF_NIL "NIL" |
- | 93 | ||
- | 94 | /** Internet protocol module name configuration label. |
|
- | 95 | */ |
|
62 | #define CONF_IL "IL" |
96 | #define CONF_IL "IL" |
- | 97 | ||
- | 98 | /** Interrupt number configuration label. |
|
- | 99 | */ |
|
63 | #define CONF_IRQ "IRQ" |
100 | #define CONF_IRQ "IRQ" |
- | 101 | ||
- | 102 | /** Device input/output address configuration label. |
|
- | 103 | */ |
|
64 | #define CONF_IO "IO" |
104 | #define CONF_IO "IO" |
- | 105 | ||
- | 106 | /** Maximum transmission unit configuration label. |
|
- | 107 | */ |
|
65 | #define CONF_MTU "MTU" |
108 | #define CONF_MTU "MTU" |
66 | 109 | ||
- | 110 | /** Type definition of the network interface specific data. |
|
- | 111 | * @see netif |
|
- | 112 | */ |
|
67 | typedef struct netif netif_t; |
113 | typedef struct netif netif_t; |
- | 114 | ||
- | 115 | /** Type definition of the network interface specific data pointer. |
|
- | 116 | * @see netif |
|
- | 117 | */ |
|
68 | typedef netif_t * netif_ref; |
118 | typedef netif_t * netif_ref; |
69 | 119 | ||
- | 120 | /** Type definition of the networking module global data. |
|
- | 121 | * @see net_globals |
|
- | 122 | */ |
|
70 | typedef struct net_globals net_globals_t; |
123 | typedef struct net_globals net_globals_t; |
71 | 124 | ||
- | 125 | /** Present network interfaces. |
|
- | 126 | * Maps devices to the networking device specific data. |
|
- | 127 | * @see device.h |
|
- | 128 | */ |
|
72 | DEVICE_MAP_DECLARE( netifs, netif_t ) |
129 | DEVICE_MAP_DECLARE( netifs, netif_t ) |
73 | 130 | ||
- | 131 | /** Configuration settings. |
|
- | 132 | * Maps setting names to the values. |
|
- | 133 | * @see generic_char_map.h |
|
- | 134 | */ |
|
74 | GENERIC_CHAR_MAP_DECLARE( measured_strings, measured_string_t ) |
135 | GENERIC_CHAR_MAP_DECLARE( measured_strings, measured_string_t ) |
75 | 136 | ||
76 | /** A present network interface device. |
137 | /** Present network interface device. |
77 | */ |
138 | */ |
78 | struct netif{ |
139 | struct netif{ |
79 | /** A system-unique network interface identifier. |
140 | /** System-unique network interface identifier. |
80 | */ |
141 | */ |
81 | device_id_t id; |
142 | device_id_t id; |
82 | /** A serving network interface driver module index. |
143 | /** Serving network interface driver module index. |
83 | */ |
144 | */ |
84 | module_ref driver; |
145 | module_ref driver; |
85 | /** A serving link layer module index. |
146 | /** Serving link layer module index. |
86 | */ |
147 | */ |
87 | module_ref nil; |
148 | module_ref nil; |
88 | /** A serving internet layer module index. |
149 | /** Serving internet layer module index. |
89 | */ |
150 | */ |
90 | module_ref il; |
151 | module_ref il; |
91 | /** A system-unique network interface name. |
152 | /** System-unique network interface name. |
92 | */ |
153 | */ |
93 | char * name; |
154 | char * name; |
94 | /** Configuration. |
155 | /** Configuration. |
95 | */ |
156 | */ |
96 | measured_strings_t configuration; |
157 | measured_strings_t configuration; |
97 | }; |
158 | }; |
98 | 159 | ||
99 | /** A net module global variables. |
160 | /** Networking module global variables. |
100 | */ |
161 | */ |
101 | struct net_globals{ |
162 | struct net_globals{ |
102 | /** Present network interfaces. |
163 | /** Present network interfaces. |
103 | */ |
164 | */ |
104 | netifs_t netifs; |
165 | netifs_t netifs; |
Line 111... | Line 172... | ||
111 | /** Global configuration. |
172 | /** Global configuration. |
112 | */ |
173 | */ |
113 | measured_strings_t configuration; |
174 | measured_strings_t configuration; |
114 | }; |
175 | }; |
115 | 176 | ||
- | 177 | /** Adds the configured setting to the configuration map. |
|
- | 178 | * @param configuration The configuration map. Input parameter. |
|
- | 179 | * @param name The setting name. Input parameter. |
|
- | 180 | * @param value The setting value. Input parameter. |
|
- | 181 | * @returns EOK on success. |
|
- | 182 | * @returns ENOMEM if there is not enough memory left. |
|
- | 183 | */ |
|
116 | int add_configuration( measured_strings_ref configuration, const char * name, const char * value ); |
184 | int add_configuration( measured_strings_ref configuration, const char * name, const char * value ); |
- | 185 | ||
- | 186 | /** Processes the networking message. |
|
- | 187 | * @param callid The message identifier. Input parameter. |
|
- | 188 | * @param call The message parameters. Input parameter. |
|
- | 189 | * @param answer The message answer parameters. Output parameter. |
|
- | 190 | * @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter. |
|
- | 191 | * @returns EOK on success. |
|
- | 192 | * @returns ENOTSUP if the message is not known. |
|
- | 193 | * @see net_interface.h |
|
- | 194 | * @see IS_NET_NET_MESSAGE() |
|
- | 195 | */ |
|
117 | int net_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
196 | int net_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
- | 197 | ||
- | 198 | /** Initializes the networking module. |
|
- | 199 | * @returns EOK on success. |
|
- | 200 | * @returns ENOMEM if there is not enough memory left. |
|
- | 201 | */ |
|
118 | int net_initialize( void ); |
202 | int net_initialize( void ); |
- | 203 | ||
- | 204 | /** Processes the module message. |
|
- | 205 | * Distributes the message to the right bundled module. |
|
- | 206 | * @param callid The message identifier. Input parameter. |
|
- | 207 | * @param call The message parameters. Input parameter. |
|
- | 208 | * @param answer The message answer parameters. Output parameter. |
|
- | 209 | * @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter. |
|
- | 210 | * @returns EOK on success. |
|
- | 211 | * @returns ENOTSUP if the message is not known. |
|
- | 212 | * @returns Other error codes as defined for each bundled module message function. |
|
- | 213 | */ |
|
119 | int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
214 | int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
- | 215 | ||
- | 216 | /** Reads the network interface specific configuration. |
|
- | 217 | * @param name The network interface name. Input parameter. |
|
- | 218 | * @param netif The network interface structure. Input/output parameter. |
|
- | 219 | * @returns EOK on success. |
|
- | 220 | * @returns Other error codes as defined for the add_configuration() function. |
|
- | 221 | */ |
|
120 | int read_netif_configuration( char * name, netif_ref netif ); |
222 | int read_netif_configuration( char * name, netif_ref netif ); |
121 | 223 | ||
122 | #endif |
224 | #endif |
123 | 225 | ||
124 | /** @} |
226 | /** @} |