~jakub/helenos/ia64-revival

« back to all changes in this revision

Viewing changes to uspace/srv/net/il/ip/ip.h

  • Committer: Jakub Jermar
  • Date: 2011-04-13 14:45:41 UTC
  • mfrom: (527.1.397 main-clone)
  • Revision ID: jakub@jermar.eu-20110413144541-x0j3r1zxqhsljx1o
MergeĀ mainlineĀ changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 */
28
28
 
29
29
/** @addtogroup ip
30
 
 *  @{
 
30
 * @{
31
31
 */
32
32
 
33
33
/** @file
34
 
 *  IP module.
 
34
 * IP module.
35
35
 */
36
36
 
37
 
#ifndef __NET_IP_H__
38
 
#define __NET_IP_H__
 
37
#ifndef NET_IP_H_
 
38
#define NET_IP_H_
39
39
 
40
40
#include <fibril_synch.h>
41
 
#include <ipc/ipc.h>
42
41
#include <ipc/services.h>
43
 
 
44
 
#include <net_device.h>
45
 
#include <inet.h>
 
42
#include <net/device.h>
 
43
#include <net/inet.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>
50
48
 
51
49
/** Type definition of the IP global data.
52
 
 *  @see ip_globals
 
50
 * @see ip_globals
53
51
 */
54
 
typedef struct ip_globals       ip_globals_t;
 
52
typedef struct ip_globals ip_globals_t;
55
53
 
56
54
/** Type definition of the IP network interface specific data.
57
 
 *  @see ip_netif
58
 
 */
59
 
typedef struct ip_netif ip_netif_t;
60
 
 
61
 
/** Type definition of the IP network interface specific data pointer.
62
 
 *  @see ip_netif
63
 
 */
64
 
typedef ip_netif_t *    ip_netif_ref;
 
55
 * @see ip_netif
 
56
 */
 
57
typedef struct ip_netif ip_netif_t;
65
58
 
66
59
/** Type definition of the IP protocol specific data.
67
 
 *  @see ip_proto
68
 
 */
69
 
typedef struct ip_proto ip_proto_t;
70
 
 
71
 
/** Type definition of the IP protocol specific data pointer.
72
 
 *  @see ip_proto
73
 
 */
74
 
typedef ip_proto_t *    ip_proto_ref;
 
60
 * @see ip_proto
 
61
 */
 
62
typedef struct ip_proto ip_proto_t;
75
63
 
76
64
/** Type definition of the IP route specific data.
77
65
 *  @see ip_route
78
66
 */
79
67
typedef struct ip_route ip_route_t;
80
68
 
81
 
/** Type definition of the IP route specific data pointer.
82
 
 *  @see ip_route
83
 
 */
84
 
typedef ip_route_t *    ip_route_ref;
85
 
 
86
69
/** IP network interfaces.
87
 
 *  Maps devices to the IP network interface specific data.
88
 
 *  @see device.h
 
70
 * Maps devices to the IP network interface specific data.
 
71
 * @see device.h
89
72
 */
90
 
DEVICE_MAP_DECLARE(ip_netifs, ip_netif_t)
 
73
DEVICE_MAP_DECLARE(ip_netifs, ip_netif_t);
91
74
 
92
75
/** IP registered protocols.
93
 
 *  Maps protocols to the IP protocol specific data.
94
 
 *  @see int_map.h
 
76
 * Maps protocols to the IP protocol specific data.
 
77
 * @see int_map.h
95
78
 */
96
 
INT_MAP_DECLARE(ip_protos, ip_proto_t)
 
79
INT_MAP_DECLARE(ip_protos, ip_proto_t);
97
80
 
98
81
/** IP routing table.
99
 
 *  @see generic_field.h
 
82
 * @see generic_field.h
100
83
 */
101
 
GENERIC_FIELD_DECLARE(ip_routes, ip_route_t)
 
84
GENERIC_FIELD_DECLARE(ip_routes, ip_route_t);
102
85
 
103
 
/** IP network interface specific data.
104
 
 */
105
 
struct  ip_netif{
106
 
        /** ARP module.
107
 
         *  Assigned if using ARP.
108
 
         */
109
 
        module_ref arp;
110
 
        /** Broadcast address.
111
 
         */
 
86
/** IP network interface specific data. */
 
87
struct ip_netif {
 
88
        /** ARP module. Assigned if using ARP. */
 
89
        module_t *arp;
 
90
        /** Broadcast address. */
112
91
        in_addr_t broadcast;
113
 
        /** Device identifier.
114
 
         */
 
92
        /** Device identifier. */
115
93
        device_id_t device_id;
116
 
        /** Indicates whether using DHCP.
117
 
         */
 
94
        /** Indicates whether using DHCP. */
118
95
        int dhcp;
119
 
        /** IP version.
120
 
         */
 
96
        /** IP version. */
121
97
        int ipv;
122
 
        /** Packet dimension.
123
 
         */
 
98
        /** Packet dimension. */
124
99
        packet_dimension_t packet_dimension;
125
 
        /** Netif module phone.
126
 
         */
 
100
        /** Netif module phone. */
127
101
        int phone;
128
 
        /** Routing table.
129
 
         */
 
102
        /** Routing table. */
130
103
        ip_routes_t routes;
131
 
        /** Indicates whether IP routing is enabled.
132
 
         */
 
104
        /** Indicates whether IP routing is enabled. */
133
105
        int routing;
134
 
        /** Netif module service.
135
 
         */
 
106
        /** Netif module service. */
136
107
        services_t service;
137
 
        /** Device state.
138
 
         */
 
108
        /** Device state. */
139
109
        device_state_t state;
140
110
};
141
111
 
142
 
/** IP protocol specific data.
143
 
 */
144
 
struct ip_proto{
145
 
        /** Protocol module phone.
146
 
         */
 
112
/** IP protocol specific data. */
 
113
struct ip_proto {
 
114
        /** Protocol module phone. */
147
115
        int phone;
148
 
        /** Protocol number.
149
 
         */
 
116
        /** Protocol number. */
150
117
        int protocol;
151
 
        /** Protocol packet receiving function.
152
 
         */
 
118
        /** Protocol packet receiving function. */
153
119
        tl_received_msg_t received_msg;
154
 
        /** Protocol module service.
155
 
         */
 
120
        /** Protocol module service. */
156
121
        services_t service;
157
122
};
158
123
 
159
 
/** IP route specific data.
160
 
 */
161
 
struct ip_route{
162
 
        /** Target address.
163
 
         */
 
124
/** IP route specific data. */
 
125
struct ip_route {
 
126
        /** Target address. */
164
127
        in_addr_t address;
165
 
        /** Gateway.
166
 
         */
 
128
        /** Gateway. */
167
129
        in_addr_t gateway;
168
 
        /** Parent netif.
169
 
         */
170
 
        ip_netif_ref netif;
171
 
        /** Target network mask.
172
 
         */
 
130
        /** Parent netif. */
 
131
        ip_netif_t *netif;
 
132
        /** Target network mask. */
173
133
        in_addr_t netmask;
174
134
};
175
135
 
176
 
/** IP global data.
177
 
 */
178
 
struct  ip_globals{
179
 
        /** Default client connection function for support modules.
180
 
         */
181
 
        async_client_conn_t client_connection;
182
 
        /** Default gateway.
183
 
         */
 
136
/** IP global data. */
 
137
struct ip_globals {
 
138
        /** Default gateway. */
184
139
        ip_route_t gateway;
185
 
        /** Safety lock.
186
 
         */
 
140
        /** Safety lock. */
187
141
        fibril_rwlock_t lock;
188
 
        /** Known support modules.
189
 
         */
 
142
        /** Known support modules. */
190
143
        modules_t modules;
191
 
        /** Networking module phone.
192
 
         */
 
144
        /** Networking module phone. */
193
145
        int net_phone;
194
 
        /** Registered network interfaces.
195
 
         */
 
146
        /** Registered network interfaces. */
196
147
        ip_netifs_t netifs;
197
 
        /** Netifs safeyt lock.
198
 
         */
 
148
        /** Netifs safeyt lock. */
199
149
        fibril_rwlock_t netifs_lock;
200
 
        /** Packet counter.
201
 
         */
 
150
        /** Packet counter. */
202
151
        uint16_t packet_counter;
203
 
        /** Registered protocols.
204
 
         */
 
152
        /** Registered protocols. */
205
153
        ip_protos_t protos;
206
 
        /** Protocols safety lock.
207
 
         */
 
154
        /** Protocols safety lock. */
208
155
        fibril_rwlock_t protos_lock;
209
156
};
210
157