66static struct raw_pcb *raw_pcbs;
79#if LWIP_IPV4 && LWIP_IPV6
82#if IP_SOF_BROADCAST_RECV
97#if IP_SOF_BROADCAST_RECV
101 if (ip4_addr_isany(ip_2_ip4(&pcb->local_ip))) {
137 struct raw_pcb *pcb, *prev;
139 raw_input_state_t
ret = RAW_INPUT_NONE;
166 while (pcb !=
NULL) {
167 if ((pcb->protocol ==
proto) && raw_input_local_match(pcb,
broadcast) &&
168 (((pcb->flags & RAW_FLAGS_CONNECTED) == 0) ||
171 if (pcb->recv !=
NULL) {
174 void *old_payload =
p->payload;
176 ret = RAW_INPUT_DELIVERED;
185 prev->
next = pcb->next;
186 pcb->next = raw_pcbs;
189 return RAW_INPUT_EATEN;
192 LWIP_ASSERT(
"raw pcb recv callback altered pbuf payload pointer without eating packet",
193 p->payload == old_payload);
221raw_bind(
struct raw_pcb *pcb,
const ip_addr_t *ipaddr)
224 if ((pcb ==
NULL) || (ipaddr ==
NULL)) {
228#if LWIP_IPV6 && LWIP_IPV6_SCOPES
233 ip6_addr_lacks_zone(
ip_2_ip6(&pcb->local_ip), IP6_UNKNOWN)) {
253raw_bind_netif(
struct raw_pcb *pcb,
const struct netif *
netif)
278raw_connect(
struct raw_pcb *pcb,
const ip_addr_t *ipaddr)
281 if ((pcb ==
NULL) || (ipaddr ==
NULL)) {
285#if LWIP_IPV6 && LWIP_IPV6_SCOPES
289 ip6_addr_lacks_zone(
ip_2_ip6(&pcb->remote_ip), IP6_UNKNOWN)) {
293 raw_set_flags(pcb, RAW_FLAGS_CONNECTED);
304raw_disconnect(
struct raw_pcb *pcb)
308#if LWIP_IPV4 && LWIP_IPV6
314#if LWIP_IPV4 && LWIP_IPV6
319 raw_clear_flags(pcb, RAW_FLAGS_CONNECTED);
334raw_recv(
struct raw_pcb *pcb, raw_recv_fn
recv,
void *recv_arg)
339 pcb->recv_arg = recv_arg;
354raw_sendto(
struct raw_pcb *pcb,
struct pbuf *
p,
const ip_addr_t *ipaddr)
368#if LWIP_MULTICAST_TX_OPTIONS
380 netif = ip_route(&pcb->local_ip, ipaddr);
393 src_ip = ip_netif_get_local_ip(
netif, ipaddr);
395 if (src_ip ==
NULL) {
401 src_ip = &pcb->local_ip;
404 return raw_sendto_if_src(pcb,
p, ipaddr,
netif, src_ip);
421raw_sendto_if_src(
struct raw_pcb *pcb,
struct pbuf *
p,
const ip_addr_t *dst_ip,
437#if LWIP_IPV4 && LWIP_IPV6
447 if (pcb->flags & RAW_FLAGS_HDRINCL) {
450 if (
p->len < header_size) {
455 err = ip_output_if_hdrincl(
p, src_ip, dst_ip,
netif);
461 if ((
u16_t)(
p->tot_len + header_size) <
p->tot_len) {
473 if (
p->tot_len != 0) {
478 LWIP_DEBUGF(
RAW_DEBUG, (
"raw_sendto: added header pbuf %p before given pbuf %p\n", (
void *)
q, (
void *)
p));
483 LWIP_ASSERT(
"Can't restore header we just removed!", 0);
503#if LWIP_MULTICAST_TX_OPTIONS
512 if (
IP_IS_V6(dst_ip) && pcb->chksum_reqd) {
514 LWIP_ASSERT(
"Checksum must fit into first pbuf",
p->len >= (pcb->chksum_offset + 2));
520#if LWIP_MULTICAST_TX_OPTIONS
527 err = ip_output_if(
q, src_ip, dst_ip, ttl, pcb->tos, pcb->protocol,
netif);
547raw_send(
struct raw_pcb *pcb,
struct pbuf *
p)
549 return raw_sendto(pcb,
p, &pcb->remote_ip);
562raw_remove(
struct raw_pcb *pcb)
564 struct raw_pcb *pcb2;
567 if (raw_pcbs == pcb) {
569 raw_pcbs = raw_pcbs->next;
572 for (pcb2 = raw_pcbs; pcb2 !=
NULL; pcb2 = pcb2->
next) {
574 if (pcb2->next !=
NULL && pcb2->
next == pcb) {
576 pcb2->next = pcb->next;
607 memset(pcb, 0,
sizeof(
struct raw_pcb));
608 pcb->protocol =
proto;
610#if LWIP_MULTICAST_TX_OPTIONS
611 raw_set_multicast_ttl(pcb,
RAW_TTL);
614 pcb->next = raw_pcbs;
640 pcb = raw_new(
proto);
641#if LWIP_IPV4 && LWIP_IPV6
659 struct raw_pcb *
rpcb;
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
#define LWIP_DEBUGF(debug, message)
#define LWIP_ASSERT(message, assertion)
#define ip_get_option(pcb, opt)
#define ip_current_src_addr()
#define ip_current_dest_addr()
#define ip_current_netif()
struct ip_globals ip_data
#define pcb_tci_init(pcb)
#define IP_HDR_GET_VERSION(ptr)
GLuint GLuint GLsizei GLenum type
GLdouble GLdouble GLdouble GLdouble q
#define LWIP_UNUSED_ARG(x)
#define LWIP_DBG_LEVEL_SERIOUS
#define LWIP_DBG_LEVEL_WARNING
#define LWIP_ASSERT_CORE_LOCKED()
#define SMEMCPY(dst, src, len)
struct netif * netif_get_by_index(u8_t idx)
void pbuf_chain(struct pbuf *h, struct pbuf *t)
struct pbuf * pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
u8_t pbuf_free(struct pbuf *p)
#define ip_addr_isbroadcast(addr, netif)
#define IP_IS_V6_VAL(ipaddr)
#define ip_addr_ismulticast(ipaddr)
#define IP_ADDR_PCB_VERSION_MATCH(addr, pcb)
#define ip_addr_isany(ipaddr)
#define ip_addr_eq(addr1, addr2)
#define ip_addr_copy(dest, src)
#define IP_ADDR_PCB_VERSION_MATCH_EXACT(pcb, ipaddr)
#define IP_IS_ANY_TYPE_VAL(ipaddr)
#define ip_addr_set_any(is_ipv6, ipaddr)
#define IP_SET_TYPE_VAL(ipaddr, iptype)
#define ip_addr_set_ipaddr(dest, src)
#define ip_addr_debug_print(debug, ipaddr)
void * memp_malloc(memp_t type)
void memp_free(memp_t type, void *mem)
#define NETIF_RESET_HINTS(netif)
#define netif_get_index(netif)
#define NETIF_SET_HINTS(netif, netifhint)
u8_t pbuf_add_header(struct pbuf *p, size_t header_size_increment)
u8_t pbuf_remove_header(struct pbuf *p, size_t header_size_decrement)
#define PBUF_FLAG_MCASTLOOP
static const u8_t broadcast[6]