• Home
  • Raw
  • Download

Lines Matching refs:pcb

69 raw_input_local_match(struct raw_pcb *pcb, u8_t broadcast)  in raw_input_local_match()  argument
74 if ((pcb->netif_idx != NETIF_NO_INDEX) && in raw_input_local_match()
75 (pcb->netif_idx != netif_get_index(ip_data.current_input_netif))) { in raw_input_local_match()
81 if (IP_IS_ANY_TYPE_VAL(pcb->local_ip)) { in raw_input_local_match()
83 if ((broadcast != 0) && !ip_get_option(pcb, SOF_BROADCAST)) { in raw_input_local_match()
92 if (IP_ADDR_PCB_VERSION_MATCH_EXACT(pcb, ip_current_dest_addr())) { in raw_input_local_match()
98 if (ip_get_option(pcb, SOF_BROADCAST)) in raw_input_local_match()
101 if (ip4_addr_isany(ip_2_ip4(&pcb->local_ip))) { in raw_input_local_match()
108 if (ip_addr_isany(&pcb->local_ip) || in raw_input_local_match()
109 ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr())) { in raw_input_local_match()
137 struct raw_pcb *pcb, *prev; in raw_input() local
163 pcb = raw_pcbs; in raw_input()
166 while (pcb != NULL) { in raw_input()
167 if ((pcb->protocol == proto) && raw_input_local_match(pcb, broadcast) && in raw_input()
168 (((pcb->flags & RAW_FLAGS_CONNECTED) == 0) || in raw_input()
169 ip_addr_cmp(&pcb->remote_ip, ip_current_src_addr()))) { in raw_input()
171 if (pcb->recv != NULL) { in raw_input()
178 eaten = pcb->recv(pcb->recv_arg, pcb, p, ip_current_src_addr()); in raw_input()
185 prev->next = pcb->next; in raw_input()
186 pcb->next = raw_pcbs; in raw_input()
187 raw_pcbs = pcb; in raw_input()
199 prev = pcb; in raw_input()
200 pcb = pcb->next; in raw_input()
221 raw_bind(struct raw_pcb *pcb, const ip_addr_t *ipaddr) in raw_bind() argument
224 if ((pcb == NULL) || (ipaddr == NULL)) { in raw_bind()
227 ip_addr_set_ipaddr(&pcb->local_ip, ipaddr); in raw_bind()
232 if (IP_IS_V6(&pcb->local_ip) && in raw_bind()
233 ip6_addr_lacks_zone(ip_2_ip6(&pcb->local_ip), IP6_UNKNOWN)) { in raw_bind()
234 ip6_addr_select_zone(ip_2_ip6(&pcb->local_ip), ip_2_ip6(&pcb->local_ip)); in raw_bind()
253 raw_bind_netif(struct raw_pcb *pcb, const struct netif *netif) in raw_bind_netif() argument
257 pcb->netif_idx = netif_get_index(netif); in raw_bind_netif()
259 pcb->netif_idx = NETIF_NO_INDEX; in raw_bind_netif()
278 raw_connect(struct raw_pcb *pcb, const ip_addr_t *ipaddr) in raw_connect() argument
281 if ((pcb == NULL) || (ipaddr == NULL)) { in raw_connect()
284 ip_addr_set_ipaddr(&pcb->remote_ip, ipaddr); in raw_connect()
288 if (IP_IS_V6(&pcb->remote_ip) && in raw_connect()
289 ip6_addr_lacks_zone(ip_2_ip6(&pcb->remote_ip), IP6_UNKNOWN)) { in raw_connect()
290 ip6_addr_select_zone(ip_2_ip6(&pcb->remote_ip), ip_2_ip6(&pcb->local_ip)); in raw_connect()
293 raw_set_flags(pcb, RAW_FLAGS_CONNECTED); in raw_connect()
304 raw_disconnect(struct raw_pcb *pcb) in raw_disconnect() argument
309 if (IP_IS_ANY_TYPE_VAL(pcb->local_ip)) { in raw_disconnect()
310 ip_addr_copy(pcb->remote_ip, *IP_ANY_TYPE); in raw_disconnect()
313 ip_addr_set_any(IP_IS_V6_VAL(pcb->remote_ip), &pcb->remote_ip); in raw_disconnect()
317 pcb->netif_idx = NETIF_NO_INDEX; in raw_disconnect()
319 raw_clear_flags(pcb, RAW_FLAGS_CONNECTED); in raw_disconnect()
334 raw_recv(struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg) in raw_recv() argument
338 pcb->recv = recv; in raw_recv()
339 pcb->recv_arg = recv_arg; in raw_recv()
354 raw_sendto(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr) in raw_sendto() argument
359 if ((pcb == NULL) || (ipaddr == NULL) || !IP_ADDR_PCB_VERSION_MATCH(pcb, ipaddr)) { in raw_sendto()
365 if (pcb->netif_idx != NETIF_NO_INDEX) { in raw_sendto()
366 netif = netif_get_by_index(pcb->netif_idx); in raw_sendto()
374 netif = netif_get_by_index(pcb->mcast_ifindex); in raw_sendto()
380 netif = ip_route(&pcb->local_ip, ipaddr); in raw_sendto()
390 if (ip_addr_isany(&pcb->local_ip) || ip_addr_ismulticast(&pcb->local_ip)) { in raw_sendto()
400 src_ip = &pcb->local_ip; in raw_sendto()
403 return raw_sendto_if_src(pcb, p, ipaddr, netif, src_ip); in raw_sendto()
420 raw_sendto_if_src(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, in raw_sendto_if_src() argument
430 if ((pcb == NULL) || (dst_ip == NULL) || (netif == NULL) || (src_ip == NULL) || in raw_sendto_if_src()
431 !IP_ADDR_PCB_VERSION_MATCH(pcb, src_ip) || !IP_ADDR_PCB_VERSION_MATCH(pcb, dst_ip)) { in raw_sendto_if_src()
446 if (pcb->flags & RAW_FLAGS_HDRINCL) { in raw_sendto_if_src()
453 NETIF_SET_HINTS(netif, &pcb->netif_hints); in raw_sendto_if_src()
490 if (!ip_get_option(pcb, SOF_BROADCAST) && ip_addr_isbroadcast(dst_ip, netif)) { in raw_sendto_if_src()
491 …EBUG | LWIP_DBG_LEVEL_WARNING, ("raw_sendto: SOF_BROADCAST not enabled on pcb %p\n", (void *)pcb)); in raw_sendto_if_src()
503 if (((pcb->flags & RAW_FLAGS_MULTICAST_LOOP) != 0) && ip_addr_ismulticast(dst_ip)) { in raw_sendto_if_src()
511 if (IP_IS_V6(dst_ip) && pcb->chksum_reqd) { in raw_sendto_if_src()
512 …u16_t chksum = ip6_chksum_pseudo(p, pcb->protocol, p->tot_len, ip_2_ip6(src_ip), ip_2_ip6(dst_ip)); in raw_sendto_if_src()
513 LWIP_ASSERT("Checksum must fit into first pbuf", p->len >= (pcb->chksum_offset + 2)); in raw_sendto_if_src()
514 SMEMCPY(((u8_t *)p->payload) + pcb->chksum_offset, &chksum, sizeof(u16_t)); in raw_sendto_if_src()
520 ttl = (ip_addr_ismulticast(dst_ip) ? raw_get_multicast_ttl(pcb) : pcb->ttl); in raw_sendto_if_src()
522 ttl = pcb->ttl; in raw_sendto_if_src()
525 NETIF_SET_HINTS(netif, &pcb->netif_hints); in raw_sendto_if_src()
526 err = ip_output_if(q, src_ip, dst_ip, ttl, pcb->tos, pcb->protocol, netif); in raw_sendto_if_src()
546 raw_send(struct raw_pcb *pcb, struct pbuf *p) in raw_send() argument
548 return raw_sendto(pcb, p, &pcb->remote_ip); in raw_send()
561 raw_remove(struct raw_pcb *pcb) in raw_remove() argument
566 if (raw_pcbs == pcb) { in raw_remove()
573 if (pcb2->next != NULL && pcb2->next == pcb) { in raw_remove()
575 pcb2->next = pcb->next; in raw_remove()
580 memp_free(MEMP_RAW_PCB, pcb); in raw_remove()
597 struct raw_pcb *pcb; in raw_new() local
602 pcb = (struct raw_pcb *)memp_malloc(MEMP_RAW_PCB); in raw_new()
604 if (pcb != NULL) { in raw_new()
606 memset(pcb, 0, sizeof(struct raw_pcb)); in raw_new()
607 pcb->protocol = proto; in raw_new()
608 pcb->ttl = RAW_TTL; in raw_new()
610 raw_set_multicast_ttl(pcb, RAW_TTL); in raw_new()
612 pcb->next = raw_pcbs; in raw_new()
613 raw_pcbs = pcb; in raw_new()
615 return pcb; in raw_new()
636 struct raw_pcb *pcb; in raw_new_ip_type() local
638 pcb = raw_new(proto); in raw_new_ip_type()
640 if (pcb != NULL) { in raw_new_ip_type()
641 IP_SET_TYPE_VAL(pcb->local_ip, type); in raw_new_ip_type()
642 IP_SET_TYPE_VAL(pcb->remote_ip, type); in raw_new_ip_type()
647 return pcb; in raw_new_ip_type()