UbixOS V2 2.0

raw.h
Go to the documentation of this file.
1
7 /*
8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright notice,
17 * this list of conditions and the following disclaimer in the documentation
18 * and/or other materials provided with the distribution.
19 * 3. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
31 * OF SUCH DAMAGE.
32 *
33 * This file is part of the lwIP TCP/IP stack.
34 *
35 * Author: Adam Dunkels <adam@sics.se>
36 *
37 */
38 #ifndef LWIP_HDR_RAW_H
39 #define LWIP_HDR_RAW_H
40
41 #include "net/opt.h"
42
43 #if LWIP_RAW /* don't build if not configured for use in lwipopts.h */
44
45 #include "net/pbuf.h"
46 #include "net/def.h"
47 #include "net/ip.h"
48 #include "net/ip_addr.h"
49 #include "net/ip6_addr.h"
50
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54
55 struct raw_pcb;
56
67 typedef u8_t (*raw_recv_fn)(void *arg, struct raw_pcb *pcb, struct pbuf *p,
68 const ip_addr_t *addr);
69
71 struct raw_pcb {
72 /* Common members of all PCB types */
73 IP_PCB;
74
75 struct raw_pcb *next;
76
77 u8_t protocol;
78
80 raw_recv_fn recv;
81 /* user-supplied argument for the recv callback */
82 void *recv_arg;
83 #if LWIP_IPV6
84 /* fields for handling checksum computations as per RFC3542. */
85 u16_t chksum_offset;
86 u8_t chksum_reqd;
87 #endif
88 };
89
90 /* The following functions is the application layer interface to the
91 RAW code. */
92 struct raw_pcb * raw_new (u8_t proto);
93 struct raw_pcb * raw_new_ip_type(u8_t type, u8_t proto);
94 void raw_remove (struct raw_pcb *pcb);
95 err_t raw_bind (struct raw_pcb *pcb, const ip_addr_t *ipaddr);
96 err_t raw_connect (struct raw_pcb *pcb, const ip_addr_t *ipaddr);
97
98 err_t raw_sendto (struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr);
99 err_t raw_send (struct raw_pcb *pcb, struct pbuf *p);
100
101 void raw_recv (struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg);
102
103 /* The following functions are the lower layer interface to RAW. */
104 u8_t raw_input (struct pbuf *p, struct netif *inp);
105 #define raw_init() /* Compatibility define, no init needed. */
106
107 void raw_netif_ip_addr_changed(const ip_addr_t* old_addr, const ip_addr_t* new_addr);
108
109 /* for compatibility with older implementation */
110 #define raw_new_ip6(proto) raw_new_ip_type(IPADDR_TYPE_V6, proto)
111
112 #ifdef __cplusplus
113 }
114 #endif
115
116 #endif /* LWIP_RAW */
117
118 #endif /* LWIP_HDR_RAW_H */
IP_PCB
#define IP_PCB
Definition: ip.h:76
opt.h
def.h
pbuf.h
u16_t
uint16_t u16_t
Definition: arch.h:124
u8_t
uint8_t u8_t
Definition: arch.h:122
ip_addr_t
ip6_addr_t ip_addr_t
Definition: ip_addr.h:290
netif
Definition: netif.h:233
err_t
s8_t err_t
Definition: err.h:57
ip.h
ip6_addr.h
pbuf
Definition: pbuf.h:142
ip_addr.h