509 |
udp_pcbs = pcb; |
udp_pcbs = pcb; |
510 |
} |
} |
511 |
DEBUGF(UDP_DEBUG | DBG_TRACE | DBG_STATE, ("udp_bind: bound to %u.%u.%u.%u, port %u\n", |
DEBUGF(UDP_DEBUG | DBG_TRACE | DBG_STATE, ("udp_bind: bound to %u.%u.%u.%u, port %u\n", |
512 |
(u8_t)(ntohl(ipaddr->addr) >> 24 & 0xff), |
(u8_t)(ntohl(pcb->local_ip.addr) >> 24 & 0xff), |
513 |
(u8_t)(ntohl(ipaddr->addr) >> 16 & 0xff), |
(u8_t)(ntohl(pcb->local_ip.addr) >> 16 & 0xff), |
514 |
(u8_t)(ntohl(ipaddr->addr) >> 8 & 0xff), |
(u8_t)(ntohl(pcb->local_ip.addr) >> 8 & 0xff), |
515 |
(u8_t)(ntohl(ipaddr->addr) & 0xff), port)); |
(u8_t)(ntohl(pcb->local_ip.addr) & 0xff), pcb->local_port)); |
516 |
return ERR_OK; |
return ERR_OK; |
517 |
} |
} |
518 |
/** |
/** |
543 |
pcb->remote_port = port; |
pcb->remote_port = port; |
544 |
/** TODO: this functionality belongs in upper layers */ |
/** TODO: this functionality belongs in upper layers */ |
545 |
#if 0 |
#if 0 |
|
|
|
546 |
pcb->flags |= UDP_FLAGS_CONNECTED; |
pcb->flags |= UDP_FLAGS_CONNECTED; |
547 |
/* Nail down local IP for netconn_addr()/getsockname() */ |
/* Nail down local IP for netconn_addr()/getsockname() */ |
548 |
if(ip_addr_isany(&pcb->local_ip) && !ip_addr_isany(&pcb->remote_ip)) { |
if(ip_addr_isany(&pcb->local_ip) && !ip_addr_isany(&pcb->remote_ip)) { |
563 |
pcb->local_ip.addr = 0; |
pcb->local_ip.addr = 0; |
564 |
} |
} |
565 |
#endif |
#endif |
566 |
|
DEBUGF(UDP_DEBUG | DBG_TRACE | DBG_STATE, ("udp_connect: connected to %u.%u.%u.%u, port %u\n", |
567 |
|
(u8_t)(ntohl(pcb->remote_ip.addr) >> 24 & 0xff), |
568 |
|
(u8_t)(ntohl(pcb->remote_ip.addr) >> 16 & 0xff), |
569 |
|
(u8_t)(ntohl(pcb->remote_ip.addr) >> 8 & 0xff), |
570 |
|
(u8_t)(ntohl(pcb->remote_ip.addr) & 0xff), pcb->remote_port)); |
571 |
|
|
572 |
/* Insert UDP PCB into the list of active UDP PCBs. */ |
/* Insert UDP PCB into the list of active UDP PCBs. */ |
573 |
for(ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) { |
for(ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) { |
574 |
if(pcb == ipcb) { |
if(pcb == ipcb) { |