337 |
|
|
338 |
DEBUGF(UDP_DEBUG | DBG_TRACE | 3, ("udp_send\n")); |
DEBUGF(UDP_DEBUG | DBG_TRACE | 3, ("udp_send\n")); |
339 |
|
|
340 |
/* if the PCB is not yet bound, bind it here */ |
/* if the PCB is not yet bound to a port, bind it here */ |
341 |
if (pcb->local_port == 0) { |
if (pcb->local_port == 0) { |
342 |
DEBUGF(UDP_DEBUG | DBG_TRACE | 2, ("udp_send: not yet bound\n")); |
DEBUGF(UDP_DEBUG | DBG_TRACE | 2, ("udp_send: not yet bound to a port, binding now\n")); |
343 |
err = udp_bind(pcb, &pcb->local_ip, pcb->local_port); |
err = udp_bind(pcb, &pcb->local_ip, pcb->local_port); |
344 |
if (err != ERR_OK) { |
if (err != ERR_OK) { |
345 |
DEBUGF(UDP_DEBUG | DBG_TRACE | 2, ("udp_send: forced bind failed\n")); |
DEBUGF(UDP_DEBUG | DBG_TRACE | 2, ("udp_send: forced port bind failed\n")); |
346 |
return err; |
return err; |
347 |
} |
} |
348 |
} |
} |
360 |
pbuf_chain(q, p); |
pbuf_chain(q, p); |
361 |
/* { first pbuf q points to header pbuf } */ |
/* { first pbuf q points to header pbuf } */ |
362 |
DEBUGF(UDP_DEBUG, ("udp_send: added header pbuf %p before given pbuf %p\n", (void *)q, (void *)p)); |
DEBUGF(UDP_DEBUG, ("udp_send: added header pbuf %p before given pbuf %p\n", (void *)q, (void *)p)); |
363 |
|
/* adding a header within p succeeded */ |
364 |
} else { |
} else { |
365 |
/* first pbuf q equals given pbuf */ |
/* first pbuf q equals given pbuf */ |
366 |
q = p; |
q = p; |
454 |
DEBUGF(UDP_DEBUG | DBG_TRACE | 3, ("udp_bind(ipaddr = %lx, port = %u)\n", ipaddr->addr, port)); |
DEBUGF(UDP_DEBUG | DBG_TRACE | 3, ("udp_bind(ipaddr = %lx, port = %u)\n", ipaddr->addr, port)); |
455 |
rebind = 0; |
rebind = 0; |
456 |
/* Check for double bind and rebind of the same pcb */ |
/* Check for double bind and rebind of the same pcb */ |
457 |
for(ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) { |
for (ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) { |
458 |
/* is this UDP PCB already on active list? */ |
/* is this UDP PCB already on active list? */ |
459 |
if (pcb == ipcb) { |
if (pcb == ipcb) { |
460 |
/* pcb may occur at most once in active list */ |
/* pcb may occur at most once in active list */ |