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

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

streamline internetworking layer

  • IPC method renaming

NET_IL_DEVICE → NET_IP_DEVICE
NET_IL_PACKET_SPACE → NET_IP_PACKET_SPACE
NET_IL_SEND → NET_IP_SEND

The original methods were actually not generic methods of the IL layer (used by the lower layers), but specific methods of the IP module
and used by the higher layers. The original naming was rather confusing.

  • implelement common IL module skeleton
  • small improvements in the comments of the NETIF and NIL skeletons
  • IL modules now use a separate receiver function for the NET_IL_* calls
  • 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
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 global data.
58 * @see arp_globals
59 */
60typedef struct arp_globals arp_globals_t;
61
62/** Type definition of the ARP protocol specific data.
63 * @see arp_proto
64 */
65typedef struct arp_proto arp_proto_t;
66
67/** Type definition of the ARP address translation record.
68 * @see arp_trans
69 */
70typedef struct arp_trans arp_trans_t;
71
72/** ARP address map.
73 *
74 * Translates addresses.
75 * @see generic_char_map.h
76 */
77GENERIC_CHAR_MAP_DECLARE(arp_addr, arp_trans_t);
78
79/** ARP address cache.
80 *
81 * Maps devices to the ARP device specific data.
82 * @see device.h
83 */
84DEVICE_MAP_DECLARE(arp_cache, arp_device_t);
85
86/** ARP protocol map.
87 *
88 * Maps protocol identifiers to the ARP protocol specific data.
89 * @see int_map.h
90 */
91INT_MAP_DECLARE(arp_protos, arp_proto_t);
92
93/** ARP device specific data. */
94struct arp_device {
95 /** Actual device hardware address. */
96 measured_string_t *addr;
97 /** Actual device hardware address data. */
98 uint8_t *addr_data;
99 /** Broadcast device hardware address. */
100 measured_string_t *broadcast_addr;
101 /** Broadcast device hardware address data. */
102 uint8_t *broadcast_data;
103 /** Device identifier. */
104 device_id_t device_id;
105 /** Hardware type. */
106 hw_type_t hardware;
107 /** Packet dimension. */
108 packet_dimension_t packet_dimension;
109 /** Device module phone. */
110 int phone;
111
112 /**
113 * Protocol map.
114 * Address map for each protocol.
115 */
116 arp_protos_t protos;
117
118 /** Device module service. */
119 services_t service;
120};
121
122/** ARP global data. */
123struct arp_globals {
124 /** ARP address cache. */
125 arp_cache_t cache;
126
127 /** Networking module phone. */
128 int net_phone;
129 /** Safety lock. */
130 fibril_mutex_t lock;
131};
132
133/** ARP protocol specific data. */
134struct arp_proto {
135 /** Actual device protocol address. */
136 measured_string_t *addr;
137 /** Actual device protocol address data. */
138 uint8_t *addr_data;
139 /** Address map. */
140 arp_addr_t addresses;
141 /** Protocol service. */
142 services_t service;
143};
144
145/** ARP address translation record. */
146struct arp_trans {
147 /**
148 * Hardware address for the translation. NULL denotes an incomplete
149 * record with possible waiters.
150 */
151 measured_string_t *hw_addr;
152 /** Condition variable used for waiting for completion of the record. */
153 fibril_condvar_t cv;
154};
155
156#endif
157
158/** @}
159 */
160
Note: See TracBrowser for help on using the repository browser.