source: mainline/uspace/srv/net/il/ip/ip.h@ da9f13f3

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since da9f13f3 was 88a1bb9, checked in by Jiri Svoboda <jiri@…>, 15 years ago

Remove xxx_ref typedefs (part 3).

  • Property mode set to 100644
File size: 4.3 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 ip
[e8199d77]30 * @{
[21580dd]31 */
32
33/** @file
[e8199d77]34 * IP module.
[21580dd]35 */
36
[e8199d77]37#ifndef NET_IP_H_
38#define NET_IP_H_
[21580dd]39
40#include <fibril_synch.h>
41#include <ipc/ipc.h>
42#include <ipc/services.h>
43
[e526f08]44#include <net/device.h>
[e4554d4]45#include <net/inet.h>
[849ed54]46#include <ip_interface.h>
47#include <adt/int_map.h>
48#include <adt/generic_field.h>
49#include <adt/module_map.h>
[21580dd]50
51/** Type definition of the IP global data.
[e8199d77]52 * @see ip_globals
[21580dd]53 */
[e8199d77]54typedef struct ip_globals ip_globals_t;
[21580dd]55
56/** Type definition of the IP network interface specific data.
[e8199d77]57 * @see ip_netif
[21580dd]58 */
[e8199d77]59typedef struct ip_netif ip_netif_t;
[21580dd]60
61/** Type definition of the IP protocol specific data.
[e8199d77]62 * @see ip_proto
[21580dd]63 */
[e8199d77]64typedef struct ip_proto ip_proto_t;
[21580dd]65
66/** Type definition of the IP route specific data.
67 * @see ip_route
68 */
69typedef struct ip_route ip_route_t;
70
71/** IP network interfaces.
[e8199d77]72 * Maps devices to the IP network interface specific data.
73 * @see device.h
[21580dd]74 */
[e8199d77]75DEVICE_MAP_DECLARE(ip_netifs, ip_netif_t);
[21580dd]76
77/** IP registered protocols.
[e8199d77]78 * Maps protocols to the IP protocol specific data.
79 * @see int_map.h
[21580dd]80 */
[e8199d77]81INT_MAP_DECLARE(ip_protos, ip_proto_t);
[21580dd]82
83/** IP routing table.
[e8199d77]84 * @see generic_field.h
[21580dd]85 */
[e8199d77]86GENERIC_FIELD_DECLARE(ip_routes, ip_route_t);
[21580dd]87
[e8199d77]88/** IP network interface specific data. */
89struct ip_netif {
90 /** ARP module. Assigned if using ARP. */
[88a1bb9]91 module_t *arp;
[e8199d77]92 /** Broadcast address. */
[a64c64d]93 in_addr_t broadcast;
[e8199d77]94 /** Device identifier. */
[a64c64d]95 device_id_t device_id;
[e8199d77]96 /** Indicates whether using DHCP. */
[aadf01e]97 int dhcp;
[e8199d77]98 /** IP version. */
[a64c64d]99 int ipv;
[e8199d77]100 /** Packet dimension. */
[a64c64d]101 packet_dimension_t packet_dimension;
[e8199d77]102 /** Netif module phone. */
[a64c64d]103 int phone;
[e8199d77]104 /** Routing table. */
[aadf01e]105 ip_routes_t routes;
[e8199d77]106 /** Indicates whether IP routing is enabled. */
[a64c64d]107 int routing;
[e8199d77]108 /** Netif module service. */
[a64c64d]109 services_t service;
[e8199d77]110 /** Device state. */
[a64c64d]111 device_state_t state;
[21580dd]112};
113
[e8199d77]114/** IP protocol specific data. */
115struct ip_proto {
116 /** Protocol module phone. */
[aadf01e]117 int phone;
[e8199d77]118 /** Protocol number. */
[a64c64d]119 int protocol;
[e8199d77]120 /** Protocol packet receiving function. */
[21580dd]121 tl_received_msg_t received_msg;
[e8199d77]122 /** Protocol module service. */
[a64c64d]123 services_t service;
[21580dd]124};
125
[e8199d77]126/** IP route specific data. */
127struct ip_route {
128 /** Target address. */
[aadf01e]129 in_addr_t address;
[e8199d77]130 /** Gateway. */
[aadf01e]131 in_addr_t gateway;
[e8199d77]132 /** Parent netif. */
[4e5c7ba]133 ip_netif_t *netif;
[e8199d77]134 /** Target network mask. */
[a64c64d]135 in_addr_t netmask;
[21580dd]136};
137
[e8199d77]138/** IP global data. */
139struct ip_globals {
140 /** Default client connection function for support modules. */
[a64c64d]141 async_client_conn_t client_connection;
[e8199d77]142 /** Default gateway. */
[a64c64d]143 ip_route_t gateway;
[e8199d77]144 /** Safety lock. */
[a64c64d]145 fibril_rwlock_t lock;
[e8199d77]146 /** Known support modules. */
[a64c64d]147 modules_t modules;
[e8199d77]148 /** Networking module phone. */
[aadf01e]149 int net_phone;
[e8199d77]150 /** Registered network interfaces. */
[aadf01e]151 ip_netifs_t netifs;
[e8199d77]152 /** Netifs safeyt lock. */
[aadf01e]153 fibril_rwlock_t netifs_lock;
[e8199d77]154 /** Packet counter. */
[a64c64d]155 uint16_t packet_counter;
[e8199d77]156 /** Registered protocols. */
[aadf01e]157 ip_protos_t protos;
[e8199d77]158 /** Protocols safety lock. */
[aadf01e]159 fibril_rwlock_t protos_lock;
[21580dd]160};
161
162#endif
163
164/** @}
165 */
Note: See TracBrowser for help on using the repository browser.