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

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 08e3ca4 was e9caf47, checked in by Jakub Jermar <jakub@…>, 15 years ago

Cleanup arp.

  • Property mode set to 100644
File size: 4.0 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
42#include <ipc/ipc.h>
43#include <ipc/services.h>
44
45#include <net/device.h>
46#include <net/packet.h>
47#include <net_hardware.h>
48#include <adt/generic_char_map.h>
49#include <adt/int_map.h>
50#include <adt/measured_strings.h>
51
52/** Type definition of the ARP device specific data.
53 * @see arp_device
54 */
55typedef struct arp_device arp_device_t;
56
57/** Type definition of the ARP device specific data pointer.
58 * @see arp_device
59 */
60typedef arp_device_t *arp_device_ref;
61
62/** Type definition of the ARP global data.
63 * @see arp_globals
64 */
65typedef struct arp_globals arp_globals_t;
66
67/** Type definition of the ARP protocol specific data.
68 * @see arp_proto
69 */
70typedef struct arp_proto arp_proto_t;
71
72/** Type definition of the ARP protocol specific data pointer.
73 * @see arp_proto
74 */
75typedef arp_proto_t *arp_proto_ref;
76
77/** ARP address map.
78 *
79 * Translates addresses.
80 * @see generic_char_map.h
81 */
82GENERIC_CHAR_MAP_DECLARE(arp_addr, measured_string_t);
83
84/** ARP address cache.
85 *
86 * Maps devices to the ARP device specific data.
87 * @see device.h
88 */
89DEVICE_MAP_DECLARE(arp_cache, arp_device_t);
90
91/** ARP protocol map.
92 *
93 * Maps protocol identifiers to the ARP protocol specific data.
94 * @see int_map.h
95 */
96INT_MAP_DECLARE(arp_protos, arp_proto_t);
97
98/** ARP device specific data. */
99struct arp_device {
100 /** Actual device hardware address. */
101 measured_string_ref addr;
102 /** Actual device hardware address data. */
103 char *addr_data;
104 /** Broadcast device hardware address. */
105 measured_string_ref broadcast_addr;
106 /** Broadcast device hardware address data. */
107 char *broadcast_data;
108 /** Device identifier. */
109 device_id_t device_id;
110 /** Hardware type. */
111 hw_type_t hardware;
112 /** Packet dimension. */
113 packet_dimension_t packet_dimension;
114 /** Device module phone. */
115 int phone;
116
117 /**
118 * Protocol map.
119 * Address map for each protocol.
120 */
121 arp_protos_t protos;
122
123 /** Device module service. */
124 services_t service;
125};
126
127/** ARP global data. */
128struct arp_globals {
129 /** ARP address cache. */
130 arp_cache_t cache;
131
132 /**
133 * The client connection processing function.
134 * The module skeleton propagates its own one.
135 */
136 async_client_conn_t client_connection;
137
138 /** Networking module phone. */
139 int net_phone;
140 /** Safety lock. */
141 fibril_rwlock_t lock;
142};
143
144/** ARP protocol specific data. */
145struct arp_proto {
146 /** Actual device protocol address. */
147 measured_string_ref addr;
148 /** Actual device protocol address data. */
149 char *addr_data;
150 /** Address map. */
151 arp_addr_t addresses;
152 /** Protocol service. */
153 services_t service;
154};
155
156#endif
157
158/** @}
159 */
Note: See TracBrowser for help on using the repository browser.