source: mainline/uspace/srv/net/inetsrv/inetsrv.h@ 8d48c7e

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

Find the association to deliver the datagram using amap.

  • Property mode set to 100644
File size: 4.0 KB
Line 
1/*
2 * Copyright (c) 2012 Jiri Svoboda
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 inetsrv
30 * @{
31 */
32/**
33 * @file
34 * @brief
35 */
36
37#ifndef INETSRV_H_
38#define INETSRV_H_
39
40#include <adt/list.h>
41#include <stdbool.h>
42#include <inet/addr.h>
43#include <inet/iplink.h>
44#include <ipc/loc.h>
45#include <sys/types.h>
46#include <types/inet.h>
47#include <async.h>
48
49/** Inet Client */
50typedef struct {
51 async_sess_t *sess;
52 uint8_t protocol;
53 link_t client_list;
54} inet_client_t;
55
56/** Inetping Client */
57typedef struct {
58 /** Callback session */
59 async_sess_t *sess;
60 /** Session identifier */
61 uint16_t ident;
62 /** Link to client list */
63 link_t client_list;
64} inetping_client_t;
65
66/** Inetping6 Client */
67typedef struct {
68 /** Callback session */
69 async_sess_t *sess;
70 /** Session identifier */
71 uint16_t ident;
72 /** Link to client list */
73 link_t client_list;
74} inetping6_client_t;
75
76typedef struct {
77 /** Local link ID */
78 service_id_t link_id;
79 /** Source address */
80 inet_addr_t src;
81 /** Destination address */
82 inet_addr_t dest;
83 /** Type of service */
84 uint8_t tos;
85 /** Protocol */
86 uint8_t proto;
87 /** Time to live */
88 uint8_t ttl;
89 /** Identifier */
90 uint32_t ident;
91 /** Do not fragment */
92 bool df;
93 /** More fragments */
94 bool mf;
95 /** Offset of fragment into datagram, in bytes */
96 size_t offs;
97 /** Packet data */
98 void *data;
99 /** Packet data size in bytes */
100 size_t size;
101} inet_packet_t;
102
103typedef struct {
104 link_t link_list;
105 service_id_t svc_id;
106 char *svc_name;
107 async_sess_t *sess;
108 iplink_t *iplink;
109 size_t def_mtu;
110 addr48_t mac;
111 bool mac_valid;
112} inet_link_t;
113
114typedef struct {
115 link_t addr_list;
116 sysarg_t id;
117 inet_naddr_t naddr;
118 inet_link_t *ilink;
119 char *name;
120} inet_addrobj_t;
121
122/** Static route configuration */
123typedef struct {
124 link_t sroute_list;
125 sysarg_t id;
126 /** Destination network */
127 inet_naddr_t dest;
128 /** Router via which to route packets */
129 inet_addr_t router;
130 char *name;
131} inet_sroute_t;
132
133typedef enum {
134 /** Destination is on this network node */
135 dt_local,
136 /** Destination is directly reachable */
137 dt_direct,
138 /** Destination is behind a router */
139 dt_router
140} inet_dir_type_t;
141
142/** Direction (next hop) to a destination */
143typedef struct {
144 /** Route type */
145 inet_dir_type_t dtype;
146 /** Address object (direction) */
147 inet_addrobj_t *aobj;
148 /** Local destination address */
149 inet_addr_t ldest;
150} inet_dir_t;
151
152extern int inet_ev_recv(inet_client_t *, inet_dgram_t *);
153extern int inet_recv_packet(inet_packet_t *);
154extern int inet_route_packet(inet_dgram_t *, uint8_t, uint8_t, int);
155extern int inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
156extern int inet_recv_dgram_local(inet_dgram_t *, uint8_t);
157
158#endif
159
160/** @}
161 */
Note: See TracBrowser for help on using the repository browser.