1
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
89
90
91
92
93
94
95
96
99
100
101
102
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
136
137
138
139
140
141
142
143
/* ... */
/* ... */
#ifndef LWIP_HDR_RAW_H
#define LWIP_HDR_RAW_H
#include "lwip/opt.h"
#if LWIP_RAW
#include "lwip/pbuf.h"
#include "lwip/def.h"
#include "lwip/ip.h"
#include "lwip/ip_addr.h"
#include "lwip/ip6_addr.h"
5 includes
#ifdef __cplusplus
extern "C" {
#endif
#define RAW_FLAGS_CONNECTED 0x01U
#define RAW_FLAGS_HDRINCL 0x02U
#define RAW_FLAGS_MULTICAST_LOOP 0x04U
struct raw_pcb;
/* ... */
typedef u8_t (*raw_recv_fn)(void *arg, struct raw_pcb *pcb, struct pbuf *p,
const ip_addr_t *addr);
struct raw_pcb {
IP_PCB;
struct raw_pcb *next;
u8_t protocol;
u8_t flags;
#if LWIP_MULTICAST_TX_OPTIONS
u8_t mcast_ifindex;
u8_t mcast_ttl;/* ... */
#endif
raw_recv_fn recv;
void *recv_arg;
#if LWIP_IPV6
u16_t chksum_offset;
u8_t chksum_reqd;/* ... */
#endif
...};
/* ... */
struct raw_pcb * raw_new (u8_t proto);
struct raw_pcb * raw_new_ip_type(u8_t type, u8_t proto);
void raw_remove (struct raw_pcb *pcb);
err_t raw_bind (struct raw_pcb *pcb, const ip_addr_t *ipaddr);
void raw_bind_netif (struct raw_pcb *pcb, const struct netif *netif);
err_t raw_connect (struct raw_pcb *pcb, const ip_addr_t *ipaddr);
void raw_disconnect (struct raw_pcb *pcb);
err_t raw_sendto (struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr);
err_t raw_sendto_if_src(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, struct netif *netif, const ip_addr_t *src_ip);
err_t raw_send (struct raw_pcb *pcb, struct pbuf *p);
void raw_recv (struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg);
#define raw_flags(pcb) ((pcb)->flags)
#define raw_setflags(pcb,f) ((pcb)->flags = (f))
#define raw_set_flags(pcb, set_flags) do { (pcb)->flags = (u8_t)((pcb)->flags | (set_flags)); } while(0)
#define raw_clear_flags(pcb, clr_flags) do { (pcb)->flags = (u8_t)((pcb)->flags & (u8_t)(~(clr_flags) & 0xff)); } while(0)
#define raw_is_flag_set(pcb, flag) (((pcb)->flags & (flag)) != 0)
#define raw_init()
#define raw_new_ip6(proto) raw_new_ip_type(IPADDR_TYPE_V6, proto)
7 defines
#if LWIP_MULTICAST_TX_OPTIONS
#define raw_set_multicast_netif_index(pcb, idx) ((pcb)->mcast_ifindex = (idx))
#define raw_get_multicast_netif_index(pcb) ((pcb)->mcast_ifindex)
#define raw_set_multicast_ttl(pcb, value) ((pcb)->mcast_ttl = (value))
#define raw_get_multicast_ttl(pcb) ((pcb)->mcast_ttl)
/* ... */#endif
#ifdef __cplusplus
}extern "C" { ... }
#endif
/* ... */
#endif
/* ... */
#endif