/[lwip]/lwip/src/core/udp.c
ViewVC logotype

Diff of /lwip/src/core/udp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by likewise, Fri Jan 17 15:16:33 2003 UTC revision 1.10 by jani, Tue Jan 21 14:09:31 2003 UTC
# Line 396  err_t Line 396  err_t
396  udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)  udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
397  {  {
398    struct udp_pcb *ipcb;    struct udp_pcb *ipcb;
   ip_addr_set(&pcb->local_ip, ipaddr);  
   pcb->local_port = port;  
399    
400    /* Insert UDP PCB into the list of active UDP PCBs. */    /* Insert UDP PCB into the list of active UDP PCBs. */
401    for(ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) {    for(ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) {
# Line 405  udp_bind(struct udp_pcb *pcb, struct ip_ Line 403  udp_bind(struct udp_pcb *pcb, struct ip_
403        /* Already on the list, just return. */        /* Already on the list, just return. */
404        return ERR_OK;        return ERR_OK;
405      }      }
406        if (ipcb->local_port == port) {
407          if(ip_addr_isany(&(ipcb->local_ip)) ||
408             ip_addr_isany(ipaddr) ||
409             ip_addr_cmp(&(ipcb->local_ip), ipaddr)) {
410              /* Port/IP pair already bound */
411              return ERR_USE;          
412          }
413        }
414    }    }
415      
416      ip_addr_set(&pcb->local_ip, ipaddr);
417      pcb->local_port = port;
418      
419    /* We need to place the PCB on the list. */    /* We need to place the PCB on the list. */
420    pcb->next = udp_pcbs;    pcb->next = udp_pcbs;
421    udp_pcbs = pcb;    udp_pcbs = pcb;

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26