Subversion Repositories HelenOS

Rev

Rev 3901 | Rev 3991 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3901 Rev 3912
Line 1... Line 1...
1
/*
1
/*
2
 * Copyright (c) 2008 Lukas Mejdrech
2
 * Copyright (c) 2009 Lukas Mejdrech
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
Line 29... Line 29...
29
/** @addtogroup arp
29
/** @addtogroup arp
30
 *  @{
30
 *  @{
31
 */
31
 */
32
 
32
 
33
/** @file
33
/** @file
-
 
34
 *  ARP module.
34
 */
35
 */
35
 
36
 
36
#ifndef __NET_ARP_H__
37
#ifndef __NET_ARP_H__
37
#define __NET_ARP_H__
38
#define __NET_ARP_H__
38
 
39
 
Line 42... Line 43...
42
 
43
 
43
#include "../../structures/generic_char_map.h"
44
#include "../../structures/generic_char_map.h"
44
#include "../../structures/int_map.h"
45
#include "../../structures/int_map.h"
45
#include "../../structures/measured_strings.h"
46
#include "../../structures/measured_strings.h"
46
 
47
 
-
 
48
 
-
 
49
/** Type definition of the ARP global data.
-
 
50
 *  @see arp_globals
-
 
51
 */
47
typedef struct arp_globals  arp_globals_t;
52
typedef struct arp_globals  arp_globals_t;
-
 
53
 
48
typedef arp_globals_t *     arp_globals_ref;
54
/** Type definition of the ARP device specific data.
-
 
55
 *  @see arp_device
-
 
56
 */
49
typedef struct arp_device   arp_device_t;
57
typedef struct arp_device   arp_device_t;
-
 
58
 
-
 
59
/** Type definition of the ARP device specific data pointer.
-
 
60
 *  @see arp_device
-
 
61
 */
50
typedef arp_device_t *      arp_device_ref;
62
typedef arp_device_t *      arp_device_ref;
-
 
63
 
-
 
64
/** Type definition of the ARP protocol specific data.
-
 
65
 *  @see arp_proto
-
 
66
 */
51
typedef struct arp_proto    arp_proto_t;
67
typedef struct arp_proto    arp_proto_t;
-
 
68
 
-
 
69
/** Type definition of the ARP protocol specific data pointer.
-
 
70
 *  @see arp_proto
-
 
71
 */
52
typedef arp_proto_t *       arp_proto_ref;
72
typedef arp_proto_t *       arp_proto_ref;
53
 
73
 
-
 
74
/** ARP address cache.
-
 
75
 *  Maps devices to the ARP device specific data.
-
 
76
 *  @see device.h
-
 
77
 */
54
DEVICE_MAP_DECLARE( arp_cache, arp_device_t )
78
DEVICE_MAP_DECLARE( arp_cache, arp_device_t )
55
 
79
 
-
 
80
/** ARP protocol map.
-
 
81
 *  Maps protocol identifiers to the ARP protocol specific data.
-
 
82
 *  @see int_map.h
-
 
83
 */
56
INT_MAP_DECLARE( arp_protos, arp_proto_t )
84
INT_MAP_DECLARE( arp_protos, arp_proto_t )
57
 
85
 
-
 
86
/** ARP address map.
-
 
87
 *  Translates addresses.
-
 
88
 *  @see generic_char_map.h
-
 
89
 */
58
GENERIC_CHAR_MAP_DECLARE( arp_addr, measured_string_t )
90
GENERIC_CHAR_MAP_DECLARE( arp_addr, measured_string_t )
59
 
91
 
-
 
92
/** ARP device specific data.
-
 
93
 */
60
struct arp_device{
94
struct arp_device{
-
 
95
    /** Device identifier.
-
 
96
     */
61
    device_id_t         device_id;
97
    device_id_t         device_id;
-
 
98
    /** Hardware type.
-
 
99
     */
62
    ipcarg_t            hardware;
100
    ipcarg_t            hardware;
63
    ipcarg_t            protocol;
101
    /** Reserved packet prefix length.
-
 
102
     */
64
    ipcarg_t            prefix;
103
    ipcarg_t            prefix;
-
 
104
    /** Maximal packet content length.
-
 
105
     */
65
    ipcarg_t            content;
106
    ipcarg_t            content;
-
 
107
    /** Reserved packet suffix length.
-
 
108
     */
66
    ipcarg_t            sufix;
109
    ipcarg_t            suffix;
-
 
110
    /** Packet address length.
-
 
111
     *  The hardware address length is used.
-
 
112
     */
67
    ipcarg_t            addr_len;
113
    ipcarg_t            addr_len;
-
 
114
    /** Actual device hardware address.
-
 
115
     */
68
    measured_string_ref addr;
116
    measured_string_ref addr;
-
 
117
    /** Actual device hardware address data.
-
 
118
     */
69
    char *              addr_data;
119
    char *              addr_data;
-
 
120
    /** Broadcast device hardware address.
-
 
121
     */
70
    measured_string_ref broadcast_addr;
122
    measured_string_ref broadcast_addr;
-
 
123
    /** Broadcast device hardware address data.
-
 
124
     */
71
    char *              broadcast_data;
125
    char *              broadcast_data;
-
 
126
    /** Device driver service.
-
 
127
     */
72
    services_t          service;
128
    services_t          service;
-
 
129
    /** Driver phone.
-
 
130
     */
73
    int                 phone;
131
    int                 phone;
-
 
132
    /** Protocol map.
-
 
133
     *  Address map for each protocol.
-
 
134
     */
74
    arp_protos_t        protos;
135
    arp_protos_t        protos;
75
};
136
};
76
 
137
 
-
 
138
/** ARP protocol specific data.
-
 
139
 */
77
struct arp_proto{
140
struct arp_proto{
-
 
141
    /** Protocol service.
-
 
142
     */
78
    services_t          service;
143
    services_t          service;
79
//  int                 phone;
144
//  int                 phone;
-
 
145
    /** Actual device protocol address.
-
 
146
     */
80
    measured_string_ref addr;
147
    measured_string_ref addr;
-
 
148
    /** Actual device protocol address data.
-
 
149
     */
81
    char *              addr_data;
150
    char *              addr_data;
-
 
151
    /** Address map.
-
 
152
     */
82
    arp_addr_t          addresses;
153
    arp_addr_t          addresses;
83
};
154
};
84
 
155
 
-
 
156
/** ARP global data.
-
 
157
 */
85
struct  arp_globals{
158
struct  arp_globals{
-
 
159
    /** Networking module phone.
-
 
160
     */
86
    int         networking_phone;
161
    int         networking_phone;
-
 
162
    /** ARP address cache.
-
 
163
     */
87
    arp_cache_t cache;
164
    arp_cache_t cache;
88
};
165
};
89
 
166
 
90
#endif
167
#endif
91
 
168