source: mainline/uspace/srv/net/il/arp/arp.h@ d011038

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

do not intermix low-level IPC methods with async framework methods

  • Property mode set to 100644
File size: 4.1 KB
Line 
1/*
2 * Copyright (c) 2009 Lukas Mejdrech
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup arp
30 * @{
31 */
32
33/** @file
34 * ARP module.
35 */
36
37#ifndef NET_ARP_H_
38#define NET_ARP_H_
39
40#include <fibril_synch.h>
41#include <ipc/services.h>
42#include <net/device.h>
43#include <net/packet.h>
44#include <net_hardware.h>
45#include <adt/generic_char_map.h>
46#include <adt/int_map.h>
47#include <adt/measured_strings.h>
48
49/** Type definition of the ARP device specific data.
50 * @see arp_device
51 */
52typedef struct arp_device arp_device_t;
53
54/** Type definition of the ARP global data.
55 * @see arp_globals
56 */
57typedef struct arp_globals arp_globals_t;
58
59/** Type definition of the ARP protocol specific data.
60 * @see arp_proto
61 */
62typedef struct arp_proto arp_proto_t;
63
64/** Type definition of the ARP address translation record.
65 * @see arp_trans
66 */
67typedef struct arp_trans arp_trans_t;
68
69/** ARP address map.
70 *
71 * Translates addresses.
72 * @see generic_char_map.h
73 */
74GENERIC_CHAR_MAP_DECLARE(arp_addr, arp_trans_t);
75
76/** ARP address cache.
77 *
78 * Maps devices to the ARP device specific data.
79 * @see device.h
80 */
81DEVICE_MAP_DECLARE(arp_cache, arp_device_t);
82
83/** ARP protocol map.
84 *
85 * Maps protocol identifiers to the ARP protocol specific data.
86 * @see int_map.h
87 */
88INT_MAP_DECLARE(arp_protos, arp_proto_t);
89
90/** ARP device specific data. */
91struct arp_device {
92 /** Actual device hardware address. */
93 measured_string_t *addr;
94 /** Actual device hardware address data. */
95 uint8_t *addr_data;
96 /** Broadcast device hardware address. */
97 measured_string_t *broadcast_addr;
98 /** Broadcast device hardware address data. */
99 uint8_t *broadcast_data;
100 /** Device identifier. */
101 device_id_t device_id;
102 /** Hardware type. */
103 hw_type_t hardware;
104 /** Packet dimension. */
105 packet_dimension_t packet_dimension;
106 /** Device module phone. */
107 int phone;
108
109 /**
110 * Protocol map.
111 * Address map for each protocol.
112 */
113 arp_protos_t protos;
114
115 /** Device module service. */
116 services_t service;
117};
118
119/** ARP global data. */
120struct arp_globals {
121 /** ARP address cache. */
122 arp_cache_t cache;
123
124 /** Networking module phone. */
125 int net_phone;
126 /** Safety lock. */
127 fibril_mutex_t lock;
128};
129
130/** ARP protocol specific data. */
131struct arp_proto {
132 /** Actual device protocol address. */
133 measured_string_t *addr;
134 /** Actual device protocol address data. */
135 uint8_t *addr_data;
136 /** Address map. */
137 arp_addr_t addresses;
138 /** Protocol service. */
139 services_t service;
140};
141
142/** ARP address translation record. */
143struct arp_trans {
144 /**
145 * Hardware address for the translation. NULL denotes an incomplete
146 * record with possible waiters.
147 */
148 measured_string_t *hw_addr;
149 /** Condition variable used for waiting for completion of the record. */
150 fibril_condvar_t cv;
151};
152
153#endif
154
155/** @}
156 */
157
Note: See TracBrowser for help on using the repository browser.