40
40
#include <fibril_synch.h>
42
41
#include <ipc/services.h>
44
#include <net_device.h>
42
#include <net/device.h>
46
44
#include <ip_interface.h>
47
45
#include <adt/int_map.h>
48
46
#include <adt/generic_field.h>
49
47
#include <adt/module_map.h>
51
49
/** Type definition of the IP global data.
54
typedef struct ip_globals ip_globals_t;
52
typedef struct ip_globals ip_globals_t;
56
54
/** Type definition of the IP network interface specific data.
59
typedef struct ip_netif ip_netif_t;
61
/** Type definition of the IP network interface specific data pointer.
64
typedef ip_netif_t * ip_netif_ref;
57
typedef struct ip_netif ip_netif_t;
66
59
/** Type definition of the IP protocol specific data.
69
typedef struct ip_proto ip_proto_t;
71
/** Type definition of the IP protocol specific data pointer.
74
typedef ip_proto_t * ip_proto_ref;
62
typedef struct ip_proto ip_proto_t;
76
64
/** Type definition of the IP route specific data.
79
67
typedef struct ip_route ip_route_t;
81
/** Type definition of the IP route specific data pointer.
84
typedef ip_route_t * ip_route_ref;
86
69
/** IP network interfaces.
87
* Maps devices to the IP network interface specific data.
70
* Maps devices to the IP network interface specific data.
90
DEVICE_MAP_DECLARE(ip_netifs, ip_netif_t)
73
DEVICE_MAP_DECLARE(ip_netifs, ip_netif_t);
92
75
/** IP registered protocols.
93
* Maps protocols to the IP protocol specific data.
76
* Maps protocols to the IP protocol specific data.
96
INT_MAP_DECLARE(ip_protos, ip_proto_t)
79
INT_MAP_DECLARE(ip_protos, ip_proto_t);
98
81
/** IP routing table.
99
* @see generic_field.h
82
* @see generic_field.h
101
GENERIC_FIELD_DECLARE(ip_routes, ip_route_t)
84
GENERIC_FIELD_DECLARE(ip_routes, ip_route_t);
103
/** IP network interface specific data.
107
* Assigned if using ARP.
110
/** Broadcast address.
86
/** IP network interface specific data. */
88
/** ARP module. Assigned if using ARP. */
90
/** Broadcast address. */
112
91
in_addr_t broadcast;
113
/** Device identifier.
92
/** Device identifier. */
115
93
device_id_t device_id;
116
/** Indicates whether using DHCP.
94
/** Indicates whether using DHCP. */
122
/** Packet dimension.
98
/** Packet dimension. */
124
99
packet_dimension_t packet_dimension;
125
/** Netif module phone.
100
/** Netif module phone. */
102
/** Routing table. */
130
103
ip_routes_t routes;
131
/** Indicates whether IP routing is enabled.
104
/** Indicates whether IP routing is enabled. */
134
/** Netif module service.
106
/** Netif module service. */
136
107
services_t service;
139
109
device_state_t state;
142
/** IP protocol specific data.
145
/** Protocol module phone.
112
/** IP protocol specific data. */
114
/** Protocol module phone. */
116
/** Protocol number. */
151
/** Protocol packet receiving function.
118
/** Protocol packet receiving function. */
153
119
tl_received_msg_t received_msg;
154
/** Protocol module service.
120
/** Protocol module service. */
156
121
services_t service;
159
/** IP route specific data.
124
/** IP route specific data. */
126
/** Target address. */
164
127
in_addr_t address;
167
129
in_addr_t gateway;
171
/** Target network mask.
132
/** Target network mask. */
173
133
in_addr_t netmask;
179
/** Default client connection function for support modules.
181
async_client_conn_t client_connection;
136
/** IP global data. */
138
/** Default gateway. */
184
139
ip_route_t gateway;
187
141
fibril_rwlock_t lock;
188
/** Known support modules.
142
/** Known support modules. */
190
143
modules_t modules;
191
/** Networking module phone.
144
/** Networking module phone. */
194
/** Registered network interfaces.
146
/** Registered network interfaces. */
196
147
ip_netifs_t netifs;
197
/** Netifs safeyt lock.
148
/** Netifs safeyt lock. */
199
149
fibril_rwlock_t netifs_lock;
150
/** Packet counter. */
202
151
uint16_t packet_counter;
203
/** Registered protocols.
152
/** Registered protocols. */
205
153
ip_protos_t protos;
206
/** Protocols safety lock.
154
/** Protocols safety lock. */
208
155
fibril_rwlock_t protos_lock;