47 #include "lwip/ip_addr.h"
56 static struct raw_pcb *raw_pcbs;
76 raw_input(
struct pbuf *p,
struct netif *inp)
78 struct raw_pcb *pcb, *prev;
92 while ((eaten == 0) && (pcb !=
NULL)) {
93 if ((pcb->protocol == proto) &&
96 #if IP_SOF_BROADCAST_RECV
102 if (pcb->recv !=
NULL) {
111 prev->next = pcb->next;
112 pcb->next = raw_pcbs;
142 raw_bind(
struct raw_pcb *pcb,
ip_addr_t *ipaddr)
162 raw_connect(
struct raw_pcb *pcb,
ip_addr_t *ipaddr)
183 raw_recv(
struct raw_pcb *pcb, raw_recv_fn recv,
void *recv_arg)
187 pcb->recv_arg = recv_arg;
203 raw_sendto(
struct raw_pcb *pcb,
struct pbuf *p,
ip_addr_t *ipaddr)
226 LWIP_DEBUGF(
RAW_DEBUG, (
"raw_sendto: added header pbuf %p before given pbuf %p\n", (
void *)q, (
void *)p));
231 LWIP_ASSERT(
"Can't restore header we just removed!", 0);
263 src_ip = &(pcb->local_ip);
266 #if LWIP_NETIF_HWADDRHINT
267 netif->addr_hint = &(pcb->addr_hint);
269 err =
ip_output_if (q, src_ip, ipaddr, pcb->ttl, pcb->tos, pcb->protocol, netif);
270 #if LWIP_NETIF_HWADDRHINT
271 netif->addr_hint =
NULL;
290 raw_send(
struct raw_pcb *pcb,
struct pbuf *p)
292 return raw_sendto(pcb, p, &pcb->remote_ip);
304 raw_remove(
struct raw_pcb *pcb)
306 struct raw_pcb *pcb2;
308 if (raw_pcbs == pcb) {
310 raw_pcbs = raw_pcbs->next;
313 for(pcb2 = raw_pcbs; pcb2 !=
NULL; pcb2 = pcb2->next) {
315 if (pcb2->next !=
NULL && pcb2->next == pcb) {
317 pcb2->next = pcb->next;
345 memset(pcb, 0,
sizeof(
struct raw_pcb));
346 pcb->protocol = proto;
348 pcb->next = raw_pcbs;