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

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

cherrypick general networking improvements from lp:~helenos-nicf/helenos/nicf (after sanitization)
remove obsolete networking drivers
this renders the networking non-functional for the time being

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