Add the following features and bugfixes:

Added select() functionality to sockets library.
Support for errno in sockets library.
Byte ordering fixes.
basic lwip_ioctl(), FIONREAD, get/setsockopt() etc. support

- added additional argument to netif_add to pass state pointer so that the
if_init function has access to context information before
the interface is added, without accessing globals.

- added netif_remove()

- to conserve cpu load the tcpip_tcp_timer should only be active
when tcbs that need it exist.

- pass length of available data to callbacks for NETCONN_EVT_RCV events

- added tcpip_link_input(), a hack to allow processing of PPP
packets in tcpip_thread() context. This saves threads and context
switches.

- renamed incompatible ASSERT() macro to LWIP_ASSERT() to avoid name
collision.

- changed a bunch of %d's to %u's in format strings for unsigned values.

- added ip_frag to lwip_stats.

- changed IP_REASS_MAXAGE and IP_REASS_TMO defaults to more realistic
values.

- added sys_timeout_remove() function to cancel timeouts (needed by PPP
amongst other things).

- tolerate NULL returns from sys_arch_timeouts() since some threads might
not need to use or have timeouts.

- added sys_sem_wait_timeout()

- moved mem_malloc() function to end of mem.c to work around tasking
compiler bug.

- automatically bind to local tcp port if 0.

- allow customization of port ranges for automatic local bindings.

- corrected various typos, spelling errors, etc..

Thanks to Marc Boucher for many of these changes.
This commit is contained in:
davidhaas
2003-02-06 22:18:56 +00:00
parent d2e008d4b4
commit dd2fa15e8a
28 changed files with 1599 additions and 300 deletions

View File

@@ -49,15 +49,32 @@ static void (* tcpip_init_done)(void *arg) = NULL;
static void *tcpip_init_done_arg;
static sys_mbox_t mbox;
static int tcpip_tcp_timer_active = 0;
/*-----------------------------------------------------------------------------------*/
static void
tcpip_tcp_timer(void *arg)
{
(void)arg;
tcp_tmr();
sys_timeout(TCP_TMR_INTERVAL, (sys_timeout_handler)tcpip_tcp_timer, NULL);
if(tcp_active_pcbs || tcp_tw_pcbs) {
sys_timeout(TCP_TMR_INTERVAL, (sys_timeout_handler)tcpip_tcp_timer, NULL);
} else {
tcpip_tcp_timer_active = 0;
}
}
void
tcp_timer_needed(void)
{
if(!tcpip_tcp_timer_active && (tcp_active_pcbs || tcp_tw_pcbs)) {
tcpip_tcp_timer_active = 1;
sys_timeout(TCP_TMR_INTERVAL, (sys_timeout_handler)tcpip_tcp_timer, NULL);
}
}
/*-----------------------------------------------------------------------------------*/
static void
tcpip_thread(void *arg)
{
@@ -67,8 +84,6 @@ tcpip_thread(void *arg)
udp_init();
tcp_init();
sys_timeout(TCP_TMR_INTERVAL, (sys_timeout_handler)tcpip_tcp_timer, NULL);
if(tcpip_init_done != NULL) {
tcpip_init_done(tcpip_init_done_arg);
}
@@ -84,6 +99,10 @@ tcpip_thread(void *arg)
DEBUGF(TCPIP_DEBUG, ("tcpip_thread: IP packet %p\n", (void *)msg));
ip_input(msg->msg.inp.p, msg->msg.inp.netif);
break;
case TCPIP_MSG_LINK:
DEBUGF(TCPIP_DEBUG, ("tcpip_thread: LINK packet %p\n", (void *)msg));
msg->msg.inp.netif->input(msg->msg.inp.p, msg->msg.inp.netif);
break;
default:
break;
}
@@ -109,6 +128,24 @@ tcpip_input(struct pbuf *p, struct netif *inp)
return ERR_OK;
}
/*-----------------------------------------------------------------------------------*/
err_t
tcpip_link_input(struct pbuf *p, struct netif *inp)
{
struct tcpip_msg *msg;
msg = memp_mallocp(MEMP_TCPIP_MSG);
if(msg == NULL) {
pbuf_free(p);
return ERR_MEM;
}
msg->type = TCPIP_MSG_LINK;
msg->msg.inp.p = p;
msg->msg.inp.netif = inp;
sys_mbox_post(mbox, msg);
return ERR_OK;
}
/*-----------------------------------------------------------------------------------*/
void
tcpip_apimsg(struct api_msg *apimsg)
{
@@ -129,7 +166,7 @@ tcpip_init(void (* initfunc)(void *), void *arg)
tcpip_init_done = initfunc;
tcpip_init_done_arg = arg;
mbox = sys_mbox_new();
sys_thread_new((void *)tcpip_thread, NULL);
sys_thread_new(tcpip_thread, NULL);
}
/*-----------------------------------------------------------------------------------*/