mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-09-30 00:55:17 +00:00
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:
parent
59897844aa
commit
6929a67489
@ -41,9 +41,4 @@
|
|||||||
#define errno (*sys_arch_errno())
|
#define errno (*sys_arch_errno())
|
||||||
|
|
||||||
|
|
||||||
/* Error numbers */
|
|
||||||
#define EBADF 9 /* Bad file number */
|
|
||||||
#define EINVAL 22 /* Invalid argument */
|
|
||||||
#define ENOBUFS 105 /* No buffer space available */
|
|
||||||
#define EWOULDBLOCK 40 /* We would have blocked if this was'nt non-blocking i/o */
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -196,4 +196,5 @@ a lot of data that needs to be copied, this should be set high. */
|
|||||||
|
|
||||||
|
|
||||||
#define LWIP_COMPAT_SOCKETS
|
#define LWIP_COMPAT_SOCKETS
|
||||||
|
#define LWIP_PROVIDE_ERRNO
|
||||||
#endif /* __LWIPOPTS_H__ */
|
#endif /* __LWIPOPTS_H__ */
|
||||||
|
@ -397,7 +397,7 @@ sys_mbox_post(sys_mbox_t mbox, void *msg)
|
|||||||
&msg,
|
&msg,
|
||||||
1,
|
1,
|
||||||
NU_NO_SUSPEND);
|
NU_NO_SUSPEND);
|
||||||
ASSERT("sys_mbox_post: mbx post failed", status == NU_SUCCESS);
|
LWIP_ASSERT("sys_mbox_post: mbx post failed", status == NU_SUCCESS);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
u32_t
|
u32_t
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
#ifndef __ARCH_SYS_ARCH_H__
|
#ifndef __ARCH_SYS_ARCH_H__
|
||||||
#define __ARCH_SYS_ARCH_H__
|
#define __ARCH_SYS_ARCH_H__
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
#define SYS_MBOX_NULL NULL
|
#define SYS_MBOX_NULL NULL
|
||||||
#define SYS_SEM_NULL NULL
|
#define SYS_SEM_NULL NULL
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
*
|
*
|
||||||
* Author: Kieran Mansley <kjm25@cam.ac.uk>
|
* Author: Kieran Mansley <kjm25@cam.ac.uk>
|
||||||
*
|
*
|
||||||
* $Id: unixlib.c,v 1.1 2003/01/31 13:35:43 jani Exp $
|
* $Id: unixlib.c,v 1.2 2003/02/06 22:18:31 davidhaas Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
@ -83,7 +83,7 @@ void _init(void){
|
|||||||
IP4_ADDR(&ipaddr, 192,168,1,1);
|
IP4_ADDR(&ipaddr, 192,168,1,1);
|
||||||
IP4_ADDR(&netmask, 255,255,255,0);
|
IP4_ADDR(&netmask, 255,255,255,0);
|
||||||
|
|
||||||
netif_set_default(netif_add(&ipaddr, &netmask, &gateway, tapif_init,
|
netif_set_default(netif_add(&ipaddr, &netmask, &gateway, NULL, tapif_init,
|
||||||
tcpip_input));
|
tcpip_input));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ main(int argc, char **argv)
|
|||||||
IP4_ADDR(&ipaddr, 192,168,0,2);
|
IP4_ADDR(&ipaddr, 192,168,0,2);
|
||||||
IP4_ADDR(&netmask, 255,255,255,0);
|
IP4_ADDR(&netmask, 255,255,255,0);
|
||||||
|
|
||||||
netif = netif_add(&ipaddr, &netmask, &gw, mintapif_init, ip_input);
|
netif = netif_add(&ipaddr, &netmask, &gw, NULL, mintapif_init, ip_input);
|
||||||
|
|
||||||
netif_set_default(netif);
|
netif_set_default(netif);
|
||||||
|
|
||||||
|
@ -123,6 +123,11 @@ a lot of data that needs to be copied, this should be set high. */
|
|||||||
/* Maximum number of retransmissions of SYN segments. */
|
/* Maximum number of retransmissions of SYN segments. */
|
||||||
#define TCP_SYNMAXRTX 4
|
#define TCP_SYNMAXRTX 4
|
||||||
|
|
||||||
|
/* TCP writable space (bytes). This must be less than or equal
|
||||||
|
to TCP_SND_BUF. It is the amount of space which must be
|
||||||
|
available in the tcp snd_buf for select to return writable */
|
||||||
|
#define TCP_SNDLOWAT TCP_SND_BUF/2
|
||||||
|
|
||||||
/* ---------- ARP options ---------- */
|
/* ---------- ARP options ---------- */
|
||||||
#define ARP_TABLE_SIZE 10
|
#define ARP_TABLE_SIZE 10
|
||||||
#define ARP_QUEUEING 1
|
#define ARP_QUEUEING 1
|
||||||
|
@ -106,7 +106,7 @@ main_thread(void *arg)
|
|||||||
IP4_ADDR(&ipaddr, 0,0,0,0);
|
IP4_ADDR(&ipaddr, 0,0,0,0);
|
||||||
IP4_ADDR(&netmask, 0,0,0,0);
|
IP4_ADDR(&netmask, 0,0,0,0);
|
||||||
|
|
||||||
netif = netif_add(&ipaddr, &netmask, &gw, tapif_init,
|
netif = netif_add(&ipaddr, &netmask, &gw, NULL, tapif_init,
|
||||||
tcpip_input);
|
tcpip_input);
|
||||||
netif_set_default(netif);
|
netif_set_default(netif);
|
||||||
dhcp_init();
|
dhcp_init();
|
||||||
@ -117,9 +117,9 @@ main_thread(void *arg)
|
|||||||
IP4_ADDR(&ipaddr, 192,168,0,2);
|
IP4_ADDR(&ipaddr, 192,168,0,2);
|
||||||
IP4_ADDR(&netmask, 255,255,255,0);
|
IP4_ADDR(&netmask, 255,255,255,0);
|
||||||
|
|
||||||
/* netif_set_default(netif_add(&ipaddr, &netmask, &gw, tapif_init,
|
/* netif_set_default(netif_add(&ipaddr, &netmask, &gw, NULL, tapif_init,
|
||||||
tcpip_input));*/
|
tcpip_input));*/
|
||||||
netif_set_default(netif_add(&ipaddr, &netmask, &gw, tapif_init,
|
netif_set_default(netif_add(&ipaddr, &netmask, &gw, NULL, tapif_init,
|
||||||
tcpip_input));
|
tcpip_input));
|
||||||
#endif
|
#endif
|
||||||
/* Only used for testing purposes: */
|
/* Only used for testing purposes: */
|
||||||
@ -127,14 +127,14 @@ main_thread(void *arg)
|
|||||||
IP4_ADDR(&ipaddr, 193,10,66,107);
|
IP4_ADDR(&ipaddr, 193,10,66,107);
|
||||||
IP4_ADDR(&netmask, 255,255,252,0);
|
IP4_ADDR(&netmask, 255,255,252,0);
|
||||||
|
|
||||||
netif_add(&ipaddr, &netmask, &gw, pcapif_init,
|
netif_add(&ipaddr, &netmask, &gw, NULL, pcapif_init,
|
||||||
tcpip_input);*/
|
tcpip_input);*/
|
||||||
|
|
||||||
IP4_ADDR(&gw, 127,0,0,1);
|
IP4_ADDR(&gw, 127,0,0,1);
|
||||||
IP4_ADDR(&ipaddr, 127,0,0,1);
|
IP4_ADDR(&ipaddr, 127,0,0,1);
|
||||||
IP4_ADDR(&netmask, 255,0,0,0);
|
IP4_ADDR(&netmask, 255,0,0,0);
|
||||||
|
|
||||||
netif_add(&ipaddr, &netmask, &gw, loopif_init,
|
netif_add(&ipaddr, &netmask, &gw, NULL, loopif_init,
|
||||||
tcpip_input);
|
tcpip_input);
|
||||||
|
|
||||||
tcpecho_init();
|
tcpecho_init();
|
||||||
|
@ -90,9 +90,9 @@ main_thread(void *arg)
|
|||||||
IP4_ADDR(&ipaddr, 192,168,1,2);
|
IP4_ADDR(&ipaddr, 192,168,1,2);
|
||||||
IP4_ADDR(&netmask, 255,255,255,0);
|
IP4_ADDR(&netmask, 255,255,255,0);
|
||||||
|
|
||||||
netif_set_default(netif_add(&ipaddr, &netmask, &gw, unixif_init_client,
|
netif_set_default(netif_add(&ipaddr, &netmask, &gw, NULL, unixif_init_client,
|
||||||
tcpip_input));
|
tcpip_input));
|
||||||
/* netif_set_default(netif_add(&ipaddr, &netmask, &gw, sioslipif_init1,
|
/* netif_set_default(netif_add(&ipaddr, &netmask, &gw, NULL, sioslipif_init1,
|
||||||
tcpip_input)); */
|
tcpip_input)); */
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,20 +92,20 @@ main_thread(void *arg)
|
|||||||
IP4_ADDR(&ipaddr, 192,168,0,2);
|
IP4_ADDR(&ipaddr, 192,168,0,2);
|
||||||
IP4_ADDR(&netmask, 255,255,255,0);
|
IP4_ADDR(&netmask, 255,255,255,0);
|
||||||
|
|
||||||
netif_set_default(netif_add(&ipaddr, &netmask, &gw, tapif_init,
|
netif_set_default(netif_add(&ipaddr, &netmask, &gw, NULL, tapif_init,
|
||||||
tcpip_input));
|
tcpip_input));
|
||||||
|
|
||||||
IP4_ADDR(&gw, 192,168,1,1);
|
IP4_ADDR(&gw, 192,168,1,1);
|
||||||
IP4_ADDR(&ipaddr, 192,168,1,1);
|
IP4_ADDR(&ipaddr, 192,168,1,1);
|
||||||
IP4_ADDR(&netmask, 255,255,255,0);
|
IP4_ADDR(&netmask, 255,255,255,0);
|
||||||
netif_set_default(netif_add(&ipaddr, &netmask, &gw, unixif_init_server,
|
netif_set_default(netif_add(&ipaddr, &netmask, &gw, NULL, unixif_init_server,
|
||||||
tcpip_input));
|
tcpip_input));
|
||||||
|
|
||||||
system("route add 192.168.1.1 192.168.0.2");
|
system("route add 192.168.1.1 192.168.0.2");
|
||||||
system("route add 192.168.1.2 192.168.0.2");
|
system("route add 192.168.1.2 192.168.0.2");
|
||||||
|
|
||||||
|
|
||||||
/*netif_set_default(netif_add(&ipaddr, &netmask, &gw, sioslipif_init1,
|
/*netif_set_default(netif_add(&ipaddr, &netmask, &gw, NULL, sioslipif_init1,
|
||||||
tcpip_input)); */
|
tcpip_input)); */
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +46,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "lwip/debug.h"
|
#include "lwip/debug.h"
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -221,7 +220,7 @@ sys_mbox_post(struct sys_mbox *mbox, void *msg)
|
|||||||
|
|
||||||
sys_sem_wait(mbox->mutex);
|
sys_sem_wait(mbox->mutex);
|
||||||
|
|
||||||
DEBUGF(SYS_DEBUG, ("sys_mbox_post: mbox %p msg %p\n", mbox, msg));
|
DEBUGF(SYS_DEBUG, ("sys_mbox_post: mbox %p msg %p\n", (void *)mbox, (void *)msg));
|
||||||
|
|
||||||
while((mbox->last + 1) >= (mbox->first + SYS_MBOX_SIZE)) {
|
while((mbox->last + 1) >= (mbox->first + SYS_MBOX_SIZE)) {
|
||||||
mbox->wait_send++;
|
mbox->wait_send++;
|
||||||
@ -276,7 +275,7 @@ sys_arch_mbox_fetch(struct sys_mbox *mbox, void **msg, u32_t timeout)
|
|||||||
sys_arch_sem_wait(mbox->mutex, 0);
|
sys_arch_sem_wait(mbox->mutex, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUGF(SYS_DEBUG, ("sys_mbox_fetch: mbox %p msg %p\n", mbox, *msg));
|
DEBUGF(SYS_DEBUG, ("sys_mbox_fetch: mbox %p msg %p\n", (void *)mbox, *msg));
|
||||||
|
|
||||||
if(msg != NULL) {
|
if(msg != NULL) {
|
||||||
*msg = mbox->msgs[mbox->first % SYS_MBOX_SIZE];
|
*msg = mbox->msgs[mbox->first % SYS_MBOX_SIZE];
|
||||||
|
Loading…
Reference in New Issue
Block a user