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

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 9934f7d 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
RevLine 
[21580dd]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
[e9caf47]30 * @{
[21580dd]31 */
32
33/** @file
[e9caf47]34 * ARP module.
[21580dd]35 */
36
[e9caf47]37#ifndef NET_ARP_H_
38#define NET_ARP_H_
[21580dd]39
40#include <fibril_synch.h>
41#include <ipc/services.h>
[e526f08]42#include <net/device.h>
[e9caf47]43#include <net/packet.h>
[849ed54]44#include <net_hardware.h>
45#include <adt/generic_char_map.h>
46#include <adt/int_map.h>
47#include <adt/measured_strings.h>
[21580dd]48
49/** Type definition of the ARP device specific data.
[e9caf47]50 * @see arp_device
[21580dd]51 */
[e9caf47]52typedef struct arp_device arp_device_t;
[21580dd]53
[a64c64d]54/** Type definition of the ARP global data.
[e9caf47]55 * @see arp_globals
[a64c64d]56 */
[e9caf47]57typedef struct arp_globals arp_globals_t;
[a64c64d]58
[21580dd]59/** Type definition of the ARP protocol specific data.
[e9caf47]60 * @see arp_proto
[21580dd]61 */
[e9caf47]62typedef struct arp_proto arp_proto_t;
[21580dd]63
[fc3dba14]64/** Type definition of the ARP address translation record.
65 * @see arp_trans
66 */
67typedef struct arp_trans arp_trans_t;
68
[a64c64d]69/** ARP address map.
[e9caf47]70 *
71 * Translates addresses.
72 * @see generic_char_map.h
[a64c64d]73 */
[fc3dba14]74GENERIC_CHAR_MAP_DECLARE(arp_addr, arp_trans_t);
[a64c64d]75
[21580dd]76/** ARP address cache.
[e9caf47]77 *
78 * Maps devices to the ARP device specific data.
79 * @see device.h
[21580dd]80 */
[e9caf47]81DEVICE_MAP_DECLARE(arp_cache, arp_device_t);
[21580dd]82
83/** ARP protocol map.
[e9caf47]84 *
85 * Maps protocol identifiers to the ARP protocol specific data.
86 * @see int_map.h
[21580dd]87 */
[e9caf47]88INT_MAP_DECLARE(arp_protos, arp_proto_t);
[21580dd]89
[e9caf47]90/** ARP device specific data. */
91struct arp_device {
92 /** Actual device hardware address. */
[fc3dba14]93 measured_string_t *addr;
[e9caf47]94 /** Actual device hardware address data. */
[854151c]95 uint8_t *addr_data;
[e9caf47]96 /** Broadcast device hardware address. */
[fc3dba14]97 measured_string_t *broadcast_addr;
[e9caf47]98 /** Broadcast device hardware address data. */
[854151c]99 uint8_t *broadcast_data;
[e9caf47]100 /** Device identifier. */
[a64c64d]101 device_id_t device_id;
[e9caf47]102 /** Hardware type. */
[a64c64d]103 hw_type_t hardware;
[e9caf47]104 /** Packet dimension. */
[a64c64d]105 packet_dimension_t packet_dimension;
[e9caf47]106 /** Device module phone. */
[aadf01e]107 int phone;
[e9caf47]108
109 /**
110 * Protocol map.
111 * Address map for each protocol.
[21580dd]112 */
[aadf01e]113 arp_protos_t protos;
[e9caf47]114
115 /** Device module service. */
[aadf01e]116 services_t service;
[21580dd]117};
118
[e9caf47]119/** ARP global data. */
120struct arp_globals {
121 /** ARP address cache. */
[a64c64d]122 arp_cache_t cache;
[e9caf47]123
124 /** Networking module phone. */
[aadf01e]125 int net_phone;
[e9caf47]126 /** Safety lock. */
[fc3dba14]127 fibril_mutex_t lock;
[a64c64d]128};
129
[e9caf47]130/** ARP protocol specific data. */
131struct arp_proto {
132 /** Actual device protocol address. */
[4eca056]133 measured_string_t *addr;
[e9caf47]134 /** Actual device protocol address data. */
[854151c]135 uint8_t *addr_data;
[e9caf47]136 /** Address map. */
[a64c64d]137 arp_addr_t addresses;
[e9caf47]138 /** Protocol service. */
[a64c64d]139 services_t service;
[21580dd]140};
141
[fc3dba14]142/** ARP address translation record. */
143struct arp_trans {
144 /**
145 * Hardware address for the translation. NULL denotes an incomplete
146 * record with possible waiters.
[854151c]147 */
[fc3dba14]148 measured_string_t *hw_addr;
149 /** Condition variable used for waiting for completion of the record. */
150 fibril_condvar_t cv;
151};
152
[21580dd]153#endif
154
155/** @}
156 */
[fc3dba14]157
Note: See TracBrowser for help on using the repository browser.