source: mainline/uspace/srv/net/inetsrv/inetsrv.h@ 7c15d6f

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

Find the association to deliver the datagram using amap.

  • Property mode set to 100644
File size: 4.0 KB
RevLine 
[59157eb]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
[b4ec1ea]29/** @addtogroup inetsrv
[59157eb]30 * @{
31 */
32/**
33 * @file
34 * @brief
35 */
36
[b4ec1ea]37#ifndef INETSRV_H_
38#define INETSRV_H_
[59157eb]39
40#include <adt/list.h>
[3e6a98c5]41#include <stdbool.h>
[1c7ba2da]42#include <inet/addr.h>
[ceba4bed]43#include <inet/iplink.h>
44#include <ipc/loc.h>
[59157eb]45#include <sys/types.h>
[b8b1adb1]46#include <types/inet.h>
[59157eb]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
[6428115]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
[1d24ad3]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
[fe4310f]76typedef struct {
[8d48c7e]77 /** Local link ID */
78 service_id_t link_id;
[7f95c904]79 /** Source address */
[fe4310f]80 inet_addr_t src;
[7f95c904]81 /** Destination address */
[fe4310f]82 inet_addr_t dest;
[7f95c904]83 /** Type of service */
[fe4310f]84 uint8_t tos;
[7f95c904]85 /** Protocol */
[fe4310f]86 uint8_t proto;
[7f95c904]87 /** Time to live */
[fe4310f]88 uint8_t ttl;
[7f95c904]89 /** Identifier */
[313824a]90 uint32_t ident;
[7f95c904]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 */
[fe4310f]98 void *data;
[7f95c904]99 /** Packet data size in bytes */
[fe4310f]100 size_t size;
101} inet_packet_t;
102
[ceba4bed]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;
[347768d]109 size_t def_mtu;
[a17356fd]110 addr48_t mac;
111 bool mac_valid;
[ceba4bed]112} inet_link_t;
113
114typedef struct {
115 link_t addr_list;
[0e94b979]116 sysarg_t id;
[ceba4bed]117 inet_naddr_t naddr;
118 inet_link_t *ilink;
[0e94b979]119 char *name;
[ceba4bed]120} inet_addrobj_t;
121
[8bf672d]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
[59157eb]152extern int inet_ev_recv(inet_client_t *, inet_dgram_t *);
[fe4310f]153extern int inet_recv_packet(inet_packet_t *);
[637a3b4]154extern int inet_route_packet(inet_dgram_t *, uint8_t, uint8_t, int);
[6428115]155extern int inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
[7f95c904]156extern int inet_recv_dgram_local(inet_dgram_t *, uint8_t);
[59157eb]157
158#endif
159
160/** @}
161 */
Note: See TracBrowser for help on using the repository browser.