mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-12-10 08:46:40 +08:00
Removed all horizontal line seperators as they serve no use.
This commit is contained in:
parent
29f735d11a
commit
b76cd006d5
@ -38,7 +38,7 @@
|
|||||||
#include "lwip/api_msg.h"
|
#include "lwip/api_msg.h"
|
||||||
#include "lwip/memp.h"
|
#include "lwip/memp.h"
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
struct
|
struct
|
||||||
netbuf *netbuf_new(void)
|
netbuf *netbuf_new(void)
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ netbuf *netbuf_new(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
netbuf_delete(struct netbuf *buf)
|
netbuf_delete(struct netbuf *buf)
|
||||||
{
|
{
|
||||||
@ -65,7 +65,7 @@ netbuf_delete(struct netbuf *buf)
|
|||||||
memp_free(MEMP_NETBUF, buf);
|
memp_free(MEMP_NETBUF, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void *
|
void *
|
||||||
netbuf_alloc(struct netbuf *buf, u16_t size)
|
netbuf_alloc(struct netbuf *buf, u16_t size)
|
||||||
{
|
{
|
||||||
@ -80,7 +80,7 @@ netbuf_alloc(struct netbuf *buf, u16_t size)
|
|||||||
buf->ptr = buf->p;
|
buf->ptr = buf->p;
|
||||||
return buf->p->payload;
|
return buf->p->payload;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
netbuf_free(struct netbuf *buf)
|
netbuf_free(struct netbuf *buf)
|
||||||
{
|
{
|
||||||
@ -89,7 +89,7 @@ netbuf_free(struct netbuf *buf)
|
|||||||
}
|
}
|
||||||
buf->p = buf->ptr = NULL;
|
buf->p = buf->ptr = NULL;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
netbuf_ref(struct netbuf *buf, void *dataptr, u16_t size)
|
netbuf_ref(struct netbuf *buf, void *dataptr, u16_t size)
|
||||||
{
|
{
|
||||||
@ -101,7 +101,7 @@ netbuf_ref(struct netbuf *buf, void *dataptr, u16_t size)
|
|||||||
buf->p->len = buf->p->tot_len = size;
|
buf->p->len = buf->p->tot_len = size;
|
||||||
buf->ptr = buf->p;
|
buf->ptr = buf->p;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
netbuf_chain(struct netbuf *head, struct netbuf *tail)
|
netbuf_chain(struct netbuf *head, struct netbuf *tail)
|
||||||
{
|
{
|
||||||
@ -109,13 +109,13 @@ netbuf_chain(struct netbuf *head, struct netbuf *tail)
|
|||||||
head->ptr = head->p;
|
head->ptr = head->p;
|
||||||
memp_free(MEMP_NETBUF, tail);
|
memp_free(MEMP_NETBUF, tail);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u16_t
|
u16_t
|
||||||
netbuf_len(struct netbuf *buf)
|
netbuf_len(struct netbuf *buf)
|
||||||
{
|
{
|
||||||
return buf->p->tot_len;
|
return buf->p->tot_len;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
netbuf_data(struct netbuf *buf, void **dataptr, u16_t *len)
|
netbuf_data(struct netbuf *buf, void **dataptr, u16_t *len)
|
||||||
{
|
{
|
||||||
@ -126,7 +126,7 @@ netbuf_data(struct netbuf *buf, void **dataptr, u16_t *len)
|
|||||||
*len = buf->ptr->len;
|
*len = buf->ptr->len;
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
s8_t
|
s8_t
|
||||||
netbuf_next(struct netbuf *buf)
|
netbuf_next(struct netbuf *buf)
|
||||||
{
|
{
|
||||||
@ -139,13 +139,13 @@ netbuf_next(struct netbuf *buf)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
netbuf_first(struct netbuf *buf)
|
netbuf_first(struct netbuf *buf)
|
||||||
{
|
{
|
||||||
buf->ptr = buf->p;
|
buf->ptr = buf->p;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
netbuf_copy_partial(struct netbuf *buf, void *dataptr, u16_t len, u16_t offset)
|
netbuf_copy_partial(struct netbuf *buf, void *dataptr, u16_t len, u16_t offset)
|
||||||
{
|
{
|
||||||
@ -174,25 +174,25 @@ netbuf_copy_partial(struct netbuf *buf, void *dataptr, u16_t len, u16_t offset)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
netbuf_copy(struct netbuf *buf, void *dataptr, u16_t len)
|
netbuf_copy(struct netbuf *buf, void *dataptr, u16_t len)
|
||||||
{
|
{
|
||||||
netbuf_copy_partial(buf, dataptr, len, 0);
|
netbuf_copy_partial(buf, dataptr, len, 0);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
struct ip_addr *
|
struct ip_addr *
|
||||||
netbuf_fromaddr(struct netbuf *buf)
|
netbuf_fromaddr(struct netbuf *buf)
|
||||||
{
|
{
|
||||||
return buf->fromaddr;
|
return buf->fromaddr;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u16_t
|
u16_t
|
||||||
netbuf_fromport(struct netbuf *buf)
|
netbuf_fromport(struct netbuf *buf)
|
||||||
{
|
{
|
||||||
return buf->fromport;
|
return buf->fromport;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
struct
|
struct
|
||||||
netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u16_t proto,
|
netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u16_t proto,
|
||||||
void (*callback)(struct netconn *, enum netconn_evt, u16_t len))
|
void (*callback)(struct netconn *, enum netconn_evt, u16_t len))
|
||||||
@ -241,13 +241,13 @@ netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u16_t proto,
|
|||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
struct
|
struct
|
||||||
netconn *netconn_new(enum netconn_type t)
|
netconn *netconn_new(enum netconn_type t)
|
||||||
{
|
{
|
||||||
return netconn_new_with_proto_and_callback(t,0,NULL);
|
return netconn_new_with_proto_and_callback(t,0,NULL);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
struct
|
struct
|
||||||
netconn *netconn_new_with_callback(enum netconn_type t,
|
netconn *netconn_new_with_callback(enum netconn_type t,
|
||||||
void (*callback)(struct netconn *, enum netconn_evt, u16_t len))
|
void (*callback)(struct netconn *, enum netconn_evt, u16_t len))
|
||||||
@ -255,7 +255,7 @@ netconn *netconn_new_with_callback(enum netconn_type t,
|
|||||||
return netconn_new_with_proto_and_callback(t,0,callback);
|
return netconn_new_with_proto_and_callback(t,0,callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
netconn_delete(struct netconn *conn)
|
netconn_delete(struct netconn *conn)
|
||||||
{
|
{
|
||||||
@ -309,13 +309,13 @@ netconn_delete(struct netconn *conn)
|
|||||||
memp_free(MEMP_NETCONN, conn);
|
memp_free(MEMP_NETCONN, conn);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
enum netconn_type
|
enum netconn_type
|
||||||
netconn_type(struct netconn *conn)
|
netconn_type(struct netconn *conn)
|
||||||
{
|
{
|
||||||
return conn->type;
|
return conn->type;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
netconn_peer(struct netconn *conn, struct ip_addr *addr,
|
netconn_peer(struct netconn *conn, struct ip_addr *addr,
|
||||||
u16_t *port)
|
u16_t *port)
|
||||||
@ -342,7 +342,7 @@ netconn_peer(struct netconn *conn, struct ip_addr *addr,
|
|||||||
}
|
}
|
||||||
return (conn->err = ERR_OK);
|
return (conn->err = ERR_OK);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
netconn_addr(struct netconn *conn, struct ip_addr **addr,
|
netconn_addr(struct netconn *conn, struct ip_addr **addr,
|
||||||
u16_t *port)
|
u16_t *port)
|
||||||
@ -365,7 +365,7 @@ netconn_addr(struct netconn *conn, struct ip_addr **addr,
|
|||||||
}
|
}
|
||||||
return (conn->err = ERR_OK);
|
return (conn->err = ERR_OK);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
netconn_bind(struct netconn *conn, struct ip_addr *addr,
|
netconn_bind(struct netconn *conn, struct ip_addr *addr,
|
||||||
u16_t port)
|
u16_t port)
|
||||||
@ -396,7 +396,7 @@ netconn_bind(struct netconn *conn, struct ip_addr *addr,
|
|||||||
return conn->err;
|
return conn->err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
netconn_connect(struct netconn *conn, struct ip_addr *addr,
|
netconn_connect(struct netconn *conn, struct ip_addr *addr,
|
||||||
u16_t port)
|
u16_t port)
|
||||||
@ -447,7 +447,7 @@ netconn_disconnect(struct netconn *conn)
|
|||||||
return conn->err;
|
return conn->err;
|
||||||
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
netconn_listen(struct netconn *conn)
|
netconn_listen(struct netconn *conn)
|
||||||
{
|
{
|
||||||
@ -474,7 +474,7 @@ netconn_listen(struct netconn *conn)
|
|||||||
memp_free(MEMP_API_MSG, msg);
|
memp_free(MEMP_API_MSG, msg);
|
||||||
return conn->err;
|
return conn->err;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
struct netconn *
|
struct netconn *
|
||||||
netconn_accept(struct netconn *conn)
|
netconn_accept(struct netconn *conn)
|
||||||
{
|
{
|
||||||
@ -491,7 +491,7 @@ netconn_accept(struct netconn *conn)
|
|||||||
|
|
||||||
return newconn;
|
return newconn;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
struct netbuf *
|
struct netbuf *
|
||||||
netconn_recv(struct netconn *conn)
|
netconn_recv(struct netconn *conn)
|
||||||
{
|
{
|
||||||
@ -587,7 +587,7 @@ netconn_recv(struct netconn *conn)
|
|||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
netconn_send(struct netconn *conn, struct netbuf *buf)
|
netconn_send(struct netconn *conn, struct netbuf *buf)
|
||||||
{
|
{
|
||||||
@ -615,7 +615,7 @@ netconn_send(struct netconn *conn, struct netbuf *buf)
|
|||||||
memp_free(MEMP_API_MSG, msg);
|
memp_free(MEMP_API_MSG, msg);
|
||||||
return conn->err;
|
return conn->err;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
netconn_write(struct netconn *conn, void *dataptr, u16_t size, u8_t copy)
|
netconn_write(struct netconn *conn, void *dataptr, u16_t size, u8_t copy)
|
||||||
{
|
{
|
||||||
@ -691,7 +691,7 @@ netconn_write(struct netconn *conn, void *dataptr, u16_t size, u8_t copy)
|
|||||||
|
|
||||||
return conn->err;
|
return conn->err;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
netconn_close(struct netconn *conn)
|
netconn_close(struct netconn *conn)
|
||||||
{
|
{
|
||||||
@ -719,10 +719,10 @@ netconn_close(struct netconn *conn)
|
|||||||
memp_free(MEMP_API_MSG, msg);
|
memp_free(MEMP_API_MSG, msg);
|
||||||
return conn->err;
|
return conn->err;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
netconn_err(struct netconn *conn)
|
netconn_err(struct netconn *conn)
|
||||||
{
|
{
|
||||||
return conn->err;
|
return conn->err;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|||||||
@ -103,7 +103,7 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
|||||||
}
|
}
|
||||||
#endif /* LWIP_UDP */
|
#endif /* LWIP_UDP */
|
||||||
#if LWIP_TCP
|
#if LWIP_TCP
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static err_t
|
static err_t
|
||||||
recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||||
{
|
{
|
||||||
@ -134,7 +134,7 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static err_t
|
static err_t
|
||||||
poll_tcp(void *arg, struct tcp_pcb *pcb)
|
poll_tcp(void *arg, struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
@ -148,7 +148,7 @@ poll_tcp(void *arg, struct tcp_pcb *pcb)
|
|||||||
}
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static err_t
|
static err_t
|
||||||
sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len)
|
sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len)
|
||||||
{
|
{
|
||||||
@ -165,7 +165,7 @@ sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len)
|
|||||||
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
err_tcp(void *arg, err_t err)
|
err_tcp(void *arg, err_t err)
|
||||||
{
|
{
|
||||||
@ -196,7 +196,7 @@ err_tcp(void *arg, err_t err)
|
|||||||
sys_sem_signal(conn->sem);
|
sys_sem_signal(conn->sem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
setup_tcp(struct netconn *conn)
|
setup_tcp(struct netconn *conn)
|
||||||
{
|
{
|
||||||
@ -209,7 +209,7 @@ setup_tcp(struct netconn *conn)
|
|||||||
tcp_poll(pcb, poll_tcp, 4);
|
tcp_poll(pcb, poll_tcp, 4);
|
||||||
tcp_err(pcb, err_tcp);
|
tcp_err(pcb, err_tcp);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static err_t
|
static err_t
|
||||||
accept_function(void *arg, struct tcp_pcb *newpcb, err_t err)
|
accept_function(void *arg, struct tcp_pcb *newpcb, err_t err)
|
||||||
{
|
{
|
||||||
@ -265,7 +265,7 @@ accept_function(void *arg, struct tcp_pcb *newpcb, err_t err)
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
#endif /* LWIP_TCP */
|
#endif /* LWIP_TCP */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
do_newconn(struct api_msg_msg *msg)
|
do_newconn(struct api_msg_msg *msg)
|
||||||
{
|
{
|
||||||
@ -331,7 +331,7 @@ do_newconn(struct api_msg_msg *msg)
|
|||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
do_delconn(struct api_msg_msg *msg)
|
do_delconn(struct api_msg_msg *msg)
|
||||||
{
|
{
|
||||||
@ -384,7 +384,7 @@ do_delconn(struct api_msg_msg *msg)
|
|||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
do_bind(struct api_msg_msg *msg)
|
do_bind(struct api_msg_msg *msg)
|
||||||
{
|
{
|
||||||
@ -447,7 +447,7 @@ do_bind(struct api_msg_msg *msg)
|
|||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
}
|
}
|
||||||
#if LWIP_TCP
|
#if LWIP_TCP
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static err_t
|
static err_t
|
||||||
do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
|
do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||||
{
|
{
|
||||||
@ -467,7 +467,7 @@ do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
do_connect(struct api_msg_msg *msg)
|
do_connect(struct api_msg_msg *msg)
|
||||||
{
|
{
|
||||||
@ -579,7 +579,7 @@ do_disconnect(struct api_msg_msg *msg)
|
|||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
do_listen(struct api_msg_msg *msg)
|
do_listen(struct api_msg_msg *msg)
|
||||||
{
|
{
|
||||||
@ -622,7 +622,7 @@ do_listen(struct api_msg_msg *msg)
|
|||||||
}
|
}
|
||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
do_accept(struct api_msg_msg *msg)
|
do_accept(struct api_msg_msg *msg)
|
||||||
{
|
{
|
||||||
@ -647,7 +647,7 @@ do_accept(struct api_msg_msg *msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
do_send(struct api_msg_msg *msg)
|
do_send(struct api_msg_msg *msg)
|
||||||
{
|
{
|
||||||
@ -673,7 +673,7 @@ do_send(struct api_msg_msg *msg)
|
|||||||
}
|
}
|
||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
do_recv(struct api_msg_msg *msg)
|
do_recv(struct api_msg_msg *msg)
|
||||||
{
|
{
|
||||||
@ -686,7 +686,7 @@ do_recv(struct api_msg_msg *msg)
|
|||||||
#endif
|
#endif
|
||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
do_write(struct api_msg_msg *msg)
|
do_write(struct api_msg_msg *msg)
|
||||||
{
|
{
|
||||||
@ -734,7 +734,7 @@ do_write(struct api_msg_msg *msg)
|
|||||||
}
|
}
|
||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
do_close(struct api_msg_msg *msg)
|
do_close(struct api_msg_msg *msg)
|
||||||
{
|
{
|
||||||
@ -769,7 +769,7 @@ do_close(struct api_msg_msg *msg)
|
|||||||
}
|
}
|
||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
typedef void (* api_msg_decode)(struct api_msg_msg *msg);
|
typedef void (* api_msg_decode)(struct api_msg_msg *msg);
|
||||||
static api_msg_decode decode[API_MSG_MAX] = {
|
static api_msg_decode decode[API_MSG_MAX] = {
|
||||||
do_newconn,
|
do_newconn,
|
||||||
@ -789,12 +789,12 @@ api_msg_input(struct api_msg *msg)
|
|||||||
{
|
{
|
||||||
decode[msg->type](&(msg->msg));
|
decode[msg->type](&(msg->msg));
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
api_msg_post(struct api_msg *msg)
|
api_msg_post(struct api_msg *msg)
|
||||||
{
|
{
|
||||||
tcpip_apimsg(msg);
|
tcpip_apimsg(msg);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -47,13 +47,13 @@ static char *err_strerr[] = {"Ok.",
|
|||||||
"Address in use."
|
"Address in use."
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
char *
|
char *
|
||||||
lwip_strerr(err_t err)
|
lwip_strerr(err_t err)
|
||||||
{
|
{
|
||||||
return err_strerr[-err];
|
return err_strerr[-err];
|
||||||
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* LWIP_DEBUG */
|
#endif /* LWIP_DEBUG */
|
||||||
|
|||||||
@ -99,7 +99,7 @@ static int err_to_errno_table[11] = {
|
|||||||
set_errno(sk->err); \
|
set_errno(sk->err); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static struct lwip_socket *
|
static struct lwip_socket *
|
||||||
get_socket(int s)
|
get_socket(int s)
|
||||||
{
|
{
|
||||||
@ -121,7 +121,7 @@ get_socket(int s)
|
|||||||
|
|
||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static int
|
static int
|
||||||
alloc_socket(struct netconn *newconn)
|
alloc_socket(struct netconn *newconn)
|
||||||
{
|
{
|
||||||
@ -150,7 +150,7 @@ alloc_socket(struct netconn *newconn)
|
|||||||
sys_sem_signal(socksem);
|
sys_sem_signal(socksem);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||||
{
|
{
|
||||||
@ -205,7 +205,7 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
|||||||
sock_set_errno(sock, 0);
|
sock_set_errno(sock, 0);
|
||||||
return newsock;
|
return newsock;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
lwip_bind(int s, struct sockaddr *name, socklen_t namelen)
|
lwip_bind(int s, struct sockaddr *name, socklen_t namelen)
|
||||||
{
|
{
|
||||||
@ -239,7 +239,7 @@ lwip_bind(int s, struct sockaddr *name, socklen_t namelen)
|
|||||||
sock_set_errno(sock, 0);
|
sock_set_errno(sock, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
lwip_close(int s)
|
lwip_close(int s)
|
||||||
{
|
{
|
||||||
@ -270,7 +270,7 @@ lwip_close(int s)
|
|||||||
sock_set_errno(sock, 0);
|
sock_set_errno(sock, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
lwip_connect(int s, struct sockaddr *name, socklen_t namelen)
|
lwip_connect(int s, struct sockaddr *name, socklen_t namelen)
|
||||||
{
|
{
|
||||||
@ -310,7 +310,7 @@ lwip_connect(int s, struct sockaddr *name, socklen_t namelen)
|
|||||||
sock_set_errno(sock, 0);
|
sock_set_errno(sock, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
lwip_listen(int s, int backlog)
|
lwip_listen(int s, int backlog)
|
||||||
{
|
{
|
||||||
@ -335,7 +335,7 @@ lwip_listen(int s, int backlog)
|
|||||||
sock_set_errno(sock, 0);
|
sock_set_errno(sock, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
lwip_recvfrom(int s, void *mem, int len, unsigned int flags,
|
lwip_recvfrom(int s, void *mem, int len, unsigned int flags,
|
||||||
struct sockaddr *from, socklen_t *fromlen)
|
struct sockaddr *from, socklen_t *fromlen)
|
||||||
@ -442,19 +442,19 @@ lwip_recvfrom(int s, void *mem, int len, unsigned int flags,
|
|||||||
sock_set_errno(sock, 0);
|
sock_set_errno(sock, 0);
|
||||||
return copylen;
|
return copylen;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
lwip_read(int s, void *mem, int len)
|
lwip_read(int s, void *mem, int len)
|
||||||
{
|
{
|
||||||
return lwip_recvfrom(s, mem, len, 0, NULL, NULL);
|
return lwip_recvfrom(s, mem, len, 0, NULL, NULL);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
lwip_recv(int s, void *mem, int len, unsigned int flags)
|
lwip_recv(int s, void *mem, int len, unsigned int flags)
|
||||||
{
|
{
|
||||||
return lwip_recvfrom(s, mem, len, flags, NULL, NULL);
|
return lwip_recvfrom(s, mem, len, flags, NULL, NULL);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
lwip_send(int s, void *data, int size, unsigned int flags)
|
lwip_send(int s, void *data, int size, unsigned int flags)
|
||||||
{
|
{
|
||||||
@ -511,7 +511,7 @@ lwip_send(int s, void *data, int size, unsigned int flags)
|
|||||||
sock_set_errno(sock, 0);
|
sock_set_errno(sock, 0);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
lwip_sendto(int s, void *data, int size, unsigned int flags,
|
lwip_sendto(int s, void *data, int size, unsigned int flags,
|
||||||
struct sockaddr *to, socklen_t tolen)
|
struct sockaddr *to, socklen_t tolen)
|
||||||
@ -549,7 +549,7 @@ lwip_sendto(int s, void *data, int size, unsigned int flags,
|
|||||||
netconn_disconnect(sock->conn);
|
netconn_disconnect(sock->conn);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
lwip_socket(int domain, int type, int protocol)
|
lwip_socket(int domain, int type, int protocol)
|
||||||
{
|
{
|
||||||
@ -594,14 +594,14 @@ lwip_socket(int domain, int type, int protocol)
|
|||||||
set_errno(0);
|
set_errno(0);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
lwip_write(int s, void *data, int size)
|
lwip_write(int s, void *data, int size)
|
||||||
{
|
{
|
||||||
return lwip_send(s, data, size, 0);
|
return lwip_send(s, data, size, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static int
|
static int
|
||||||
lwip_selscan(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset)
|
lwip_selscan(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset)
|
||||||
{
|
{
|
||||||
@ -648,7 +648,7 @@ lwip_selscan(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
|
lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
|
||||||
struct timeval *timeout)
|
struct timeval *timeout)
|
||||||
@ -794,7 +794,7 @@ lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
|
|||||||
return nready;
|
return nready;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
||||||
{
|
{
|
||||||
@ -883,7 +883,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
int lwip_shutdown(int s, int how)
|
int lwip_shutdown(int s, int how)
|
||||||
|
|||||||
@ -50,7 +50,7 @@ static sys_mbox_t mbox;
|
|||||||
static int tcpip_tcp_timer_active = 0;
|
static int tcpip_tcp_timer_active = 0;
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
tcpip_tcp_timer(void *arg)
|
tcpip_tcp_timer(void *arg)
|
||||||
{
|
{
|
||||||
@ -73,7 +73,7 @@ tcp_timer_needed(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* LWIP_TCP */
|
#endif /* LWIP_TCP */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
tcpip_thread(void *arg)
|
tcpip_thread(void *arg)
|
||||||
{
|
{
|
||||||
@ -113,7 +113,7 @@ tcpip_thread(void *arg)
|
|||||||
memp_free(MEMP_TCPIP_MSG, msg);
|
memp_free(MEMP_TCPIP_MSG, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
tcpip_input(struct pbuf *p, struct netif *inp)
|
tcpip_input(struct pbuf *p, struct netif *inp)
|
||||||
{
|
{
|
||||||
@ -131,7 +131,7 @@ tcpip_input(struct pbuf *p, struct netif *inp)
|
|||||||
sys_mbox_post(mbox, msg);
|
sys_mbox_post(mbox, msg);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
tcpip_callback(void (*f)(void *ctx), void *ctx)
|
tcpip_callback(void (*f)(void *ctx), void *ctx)
|
||||||
{
|
{
|
||||||
@ -148,7 +148,7 @@ tcpip_callback(void (*f)(void *ctx), void *ctx)
|
|||||||
sys_mbox_post(mbox, msg);
|
sys_mbox_post(mbox, msg);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcpip_apimsg(struct api_msg *apimsg)
|
tcpip_apimsg(struct api_msg *apimsg)
|
||||||
{
|
{
|
||||||
@ -162,7 +162,7 @@ tcpip_apimsg(struct api_msg *apimsg)
|
|||||||
msg->msg.apimsg = apimsg;
|
msg->msg.apimsg = apimsg;
|
||||||
sys_mbox_post(mbox, msg);
|
sys_mbox_post(mbox, msg);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcpip_init(void (* initfunc)(void *), void *arg)
|
tcpip_init(void (* initfunc)(void *), void *arg)
|
||||||
{
|
{
|
||||||
@ -171,7 +171,7 @@ tcpip_init(void (* initfunc)(void *), void *arg)
|
|||||||
mbox = sys_mbox_new();
|
mbox = sys_mbox_new();
|
||||||
sys_thread_new(tcpip_thread, NULL, TCPIP_THREAD_PRIO);
|
sys_thread_new(tcpip_thread, NULL, TCPIP_THREAD_PRIO);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -30,14 +30,14 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* inet.c
|
/* inet.c
|
||||||
*
|
*
|
||||||
* Functions common to all TCP/IP modules, such as the Internet checksum and the
|
* Functions common to all TCP/IP modules, such as the Internet checksum and the
|
||||||
* byte order functions.
|
* byte order functions.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "lwip/opt.h"
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
@ -47,7 +47,7 @@
|
|||||||
#include "lwip/inet.h"
|
#include "lwip/inet.h"
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static u16_t
|
static u16_t
|
||||||
lwip_chksum(void *dataptr, int len)
|
lwip_chksum(void *dataptr, int len)
|
||||||
{
|
{
|
||||||
@ -75,12 +75,12 @@ lwip_chksum(void *dataptr, int len)
|
|||||||
|
|
||||||
return (u16_t)acc;
|
return (u16_t)acc;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* inet_chksum_pseudo:
|
/* inet_chksum_pseudo:
|
||||||
*
|
*
|
||||||
* Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
|
* Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u16_t
|
u16_t
|
||||||
inet_chksum_pseudo(struct pbuf *p,
|
inet_chksum_pseudo(struct pbuf *p,
|
||||||
struct ip_addr *src, struct ip_addr *dest,
|
struct ip_addr *src, struct ip_addr *dest,
|
||||||
@ -124,13 +124,13 @@ inet_chksum_pseudo(struct pbuf *p,
|
|||||||
LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%lx\n", acc));
|
LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%lx\n", acc));
|
||||||
return ~(acc & 0xffffUL);
|
return ~(acc & 0xffffUL);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* inet_chksum:
|
/* inet_chksum:
|
||||||
*
|
*
|
||||||
* Calculates the Internet checksum over a portion of memory. Used primarely for IP
|
* Calculates the Internet checksum over a portion of memory. Used primarely for IP
|
||||||
* and ICMP.
|
* and ICMP.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u16_t
|
u16_t
|
||||||
inet_chksum(void *dataptr, u16_t len)
|
inet_chksum(void *dataptr, u16_t len)
|
||||||
{
|
{
|
||||||
@ -142,7 +142,7 @@ inet_chksum(void *dataptr, u16_t len)
|
|||||||
}
|
}
|
||||||
return ~(acc & 0xffff);
|
return ~(acc & 0xffff);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u16_t
|
u16_t
|
||||||
inet_chksum_pbuf(struct pbuf *p)
|
inet_chksum_pbuf(struct pbuf *p)
|
||||||
{
|
{
|
||||||
@ -179,7 +179,7 @@ inet_chksum_pbuf(struct pbuf *p)
|
|||||||
#define isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
|
#define isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* Ascii internet address interpretation routine.
|
* Ascii internet address interpretation routine.
|
||||||
* The value returned is in network order.
|
* The value returned is in network order.
|
||||||
@ -328,24 +328,24 @@ u8_t *inet_ntoa(u32_t addr)
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#ifndef BYTE_ORDER
|
#ifndef BYTE_ORDER
|
||||||
#error BYTE_ORDER is not defined
|
#error BYTE_ORDER is not defined
|
||||||
#endif
|
#endif
|
||||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u16_t
|
u16_t
|
||||||
htons(u16_t n)
|
htons(u16_t n)
|
||||||
{
|
{
|
||||||
return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
|
return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u16_t
|
u16_t
|
||||||
ntohs(u16_t n)
|
ntohs(u16_t n)
|
||||||
{
|
{
|
||||||
return htons(n);
|
return htons(n);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u32_t
|
u32_t
|
||||||
htonl(u32_t n)
|
htonl(u32_t n)
|
||||||
{
|
{
|
||||||
@ -354,11 +354,11 @@ htonl(u32_t n)
|
|||||||
((n & 0xff0000) >> 8) |
|
((n & 0xff0000) >> 8) |
|
||||||
((n & 0xff000000) >> 24);
|
((n & 0xff000000) >> 24);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u32_t
|
u32_t
|
||||||
ntohl(u32_t n)
|
ntohl(u32_t n)
|
||||||
{
|
{
|
||||||
return htonl(n);
|
return htonl(n);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
|
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
|
||||||
|
|||||||
@ -30,14 +30,14 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* inet6.c
|
/* inet6.c
|
||||||
*
|
*
|
||||||
* Functions common to all TCP/IP modules, such as the Internet checksum and the
|
* Functions common to all TCP/IP modules, such as the Internet checksum and the
|
||||||
* byte order functions.
|
* byte order functions.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "lwip/opt.h"
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
@ -45,7 +45,7 @@
|
|||||||
#include "lwip/inet.h"
|
#include "lwip/inet.h"
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* chksum:
|
/* chksum:
|
||||||
*
|
*
|
||||||
* Sums up all 16 bit words in a memory portion. Also includes any odd byte.
|
* Sums up all 16 bit words in a memory portion. Also includes any odd byte.
|
||||||
@ -54,7 +54,7 @@
|
|||||||
* For now, this is not optimized. Must be optimized for the particular processor
|
* For now, this is not optimized. Must be optimized for the particular processor
|
||||||
* arcitecture on which it is to run. Preferebly coded in assembler.
|
* arcitecture on which it is to run. Preferebly coded in assembler.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static u32_t
|
static u32_t
|
||||||
chksum(void *dataptr, u16_t len)
|
chksum(void *dataptr, u16_t len)
|
||||||
{
|
{
|
||||||
@ -74,12 +74,12 @@ chksum(void *dataptr, u16_t len)
|
|||||||
return acc;
|
return acc;
|
||||||
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* inet_chksum_pseudo:
|
/* inet_chksum_pseudo:
|
||||||
*
|
*
|
||||||
* Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
|
* Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u16_t
|
u16_t
|
||||||
inet_chksum_pseudo(struct pbuf *p,
|
inet_chksum_pseudo(struct pbuf *p,
|
||||||
struct ip_addr *src, struct ip_addr *dest,
|
struct ip_addr *src, struct ip_addr *dest,
|
||||||
@ -122,13 +122,13 @@ inet_chksum_pseudo(struct pbuf *p,
|
|||||||
}
|
}
|
||||||
return ~(acc & 0xffff);
|
return ~(acc & 0xffff);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* inet_chksum:
|
/* inet_chksum:
|
||||||
*
|
*
|
||||||
* Calculates the Internet checksum over a portion of memory. Used primarely for IP
|
* Calculates the Internet checksum over a portion of memory. Used primarely for IP
|
||||||
* and ICMP.
|
* and ICMP.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u16_t
|
u16_t
|
||||||
inet_chksum(void *dataptr, u16_t len)
|
inet_chksum(void *dataptr, u16_t len)
|
||||||
{
|
{
|
||||||
@ -139,7 +139,7 @@ inet_chksum(void *dataptr, u16_t len)
|
|||||||
sum += (sum >> 16);
|
sum += (sum >> 16);
|
||||||
return ~(sum & 0xffff);
|
return ~(sum & 0xffff);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u16_t
|
u16_t
|
||||||
inet_chksum_pbuf(struct pbuf *p)
|
inet_chksum_pbuf(struct pbuf *p)
|
||||||
{
|
{
|
||||||
@ -165,4 +165,4 @@ inet_chksum_pbuf(struct pbuf *p)
|
|||||||
}
|
}
|
||||||
return ~(acc & 0xffff);
|
return ~(acc & 0xffff);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
#include "lwip/stats.h"
|
#include "lwip/stats.h"
|
||||||
|
|
||||||
#include "lwip/snmp.h"
|
#include "lwip/snmp.h"
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
icmp_input(struct pbuf *p, struct netif *inp)
|
icmp_input(struct pbuf *p, struct netif *inp)
|
||||||
{
|
{
|
||||||
@ -124,7 +124,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
}
|
}
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
||||||
{
|
{
|
||||||
@ -156,7 +156,7 @@ icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
|||||||
ICMP_TTL, 0, IP_PROTO_ICMP);
|
ICMP_TTL, 0, IP_PROTO_ICMP);
|
||||||
pbuf_free(q);
|
pbuf_free(q);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#if IP_FORWARD
|
#if IP_FORWARD
|
||||||
void
|
void
|
||||||
icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
|
icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
|
||||||
|
|||||||
@ -31,13 +31,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip.c
|
/* ip.c
|
||||||
*
|
*
|
||||||
* This is the code for the IP layer.
|
* This is the code for the IP layer.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "lwip/opt.h"
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
@ -62,23 +62,23 @@
|
|||||||
# include "lwip/dhcp.h"
|
# include "lwip/dhcp.h"
|
||||||
#endif /* LWIP_DHCP */
|
#endif /* LWIP_DHCP */
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_init:
|
/* ip_init:
|
||||||
*
|
*
|
||||||
* Initializes the IP layer.
|
* Initializes the IP layer.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
ip_init(void)
|
ip_init(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_lookup:
|
/* ip_lookup:
|
||||||
*
|
*
|
||||||
* An experimental feature that will be changed in future versions. Do
|
* An experimental feature that will be changed in future versions. Do
|
||||||
* not depend on it yet...
|
* not depend on it yet...
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#ifdef LWIP_DEBUG
|
#ifdef LWIP_DEBUG
|
||||||
u8_t
|
u8_t
|
||||||
ip_lookup(void *header, struct netif *inp)
|
ip_lookup(void *header, struct netif *inp)
|
||||||
@ -123,7 +123,7 @@ ip_lookup(void *header, struct netif *inp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* LWIP_DEBUG */
|
#endif /* LWIP_DEBUG */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_route:
|
/* ip_route:
|
||||||
*
|
*
|
||||||
* Finds the appropriate network interface for a given IP address. It
|
* Finds the appropriate network interface for a given IP address. It
|
||||||
@ -131,7 +131,7 @@ ip_lookup(void *header, struct netif *inp)
|
|||||||
* if the masked IP address of the network interface equals the masked
|
* if the masked IP address of the network interface equals the masked
|
||||||
* IP address given to the function.
|
* IP address given to the function.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
struct netif *
|
struct netif *
|
||||||
ip_route(struct ip_addr *dest)
|
ip_route(struct ip_addr *dest)
|
||||||
{
|
{
|
||||||
@ -149,14 +149,14 @@ ip_route(struct ip_addr *dest)
|
|||||||
return netif_default;
|
return netif_default;
|
||||||
}
|
}
|
||||||
#if IP_FORWARD
|
#if IP_FORWARD
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_forward:
|
/* ip_forward:
|
||||||
*
|
*
|
||||||
* Forwards an IP packet. It finds an appropriate route for the
|
* Forwards an IP packet. It finds an appropriate route for the
|
||||||
* packet, decrements the TTL value of the packet, adjusts the
|
* packet, decrements the TTL value of the packet, adjusts the
|
||||||
* checksum and outputs the packet on the appropriate interface.
|
* checksum and outputs the packet on the appropriate interface.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
||||||
{
|
{
|
||||||
@ -210,7 +210,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
|||||||
netif->output(netif, p, (struct ip_addr *)&(iphdr->dest));
|
netif->output(netif, p, (struct ip_addr *)&(iphdr->dest));
|
||||||
}
|
}
|
||||||
#endif /* IP_FORWARD */
|
#endif /* IP_FORWARD */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_input:
|
/* ip_input:
|
||||||
*
|
*
|
||||||
* This function is called by the network interface device driver when
|
* This function is called by the network interface device driver when
|
||||||
@ -221,7 +221,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
|||||||
*
|
*
|
||||||
* Finally, the packet is sent to the upper layer protocol input function.
|
* Finally, the packet is sent to the upper layer protocol input function.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
ip_input(struct pbuf *p, struct netif *inp) {
|
ip_input(struct pbuf *p, struct netif *inp) {
|
||||||
static struct ip_hdr *iphdr;
|
static struct ip_hdr *iphdr;
|
||||||
@ -418,7 +418,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_output_if:
|
/* ip_output_if:
|
||||||
*
|
*
|
||||||
* Sends an IP packet on a network interface. This function constructs
|
* Sends an IP packet on a network interface. This function constructs
|
||||||
@ -426,7 +426,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
* IP address is NULL, the IP address of the outgoing network
|
* IP address is NULL, the IP address of the outgoing network
|
||||||
* interface is filled in as source address.
|
* interface is filled in as source address.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||||
u8_t ttl, u8_t tos,
|
u8_t ttl, u8_t tos,
|
||||||
@ -487,13 +487,13 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
|||||||
|
|
||||||
return netif->output(netif, p, dest);
|
return netif->output(netif, p, dest);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_output:
|
/* ip_output:
|
||||||
*
|
*
|
||||||
* Simple interface to ip_output_if. It finds the outgoing network
|
* Simple interface to ip_output_if. It finds the outgoing network
|
||||||
* interface and calls upon ip_output_if to do the actual work.
|
* interface and calls upon ip_output_if to do the actual work.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||||
u8_t ttl, u8_t tos, u8_t proto)
|
u8_t ttl, u8_t tos, u8_t proto)
|
||||||
@ -510,7 +510,7 @@ ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
|||||||
|
|
||||||
return ip_output_if(p, src, dest, ttl, tos, proto, netif);
|
return ip_output_if(p, src, dest, ttl, tos, proto, netif);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#if IP_DEBUG
|
#if IP_DEBUG
|
||||||
void
|
void
|
||||||
ip_debug_print(struct pbuf *p)
|
ip_debug_print(struct pbuf *p)
|
||||||
@ -554,7 +554,7 @@ ip_debug_print(struct pbuf *p)
|
|||||||
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
|
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
|
||||||
}
|
}
|
||||||
#endif /* IP_DEBUG */
|
#endif /* IP_DEBUG */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -31,13 +31,13 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_frag.c
|
/* ip_frag.c
|
||||||
*
|
*
|
||||||
* This is the code for IP segmentation and reassembly
|
* This is the code for IP segmentation and reassembly
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "lwip/opt.h"
|
#include "lwip/opt.h"
|
||||||
#include "lwip/sys.h"
|
#include "lwip/sys.h"
|
||||||
|
|||||||
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#include "lwip/stats.h"
|
#include "lwip/stats.h"
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
icmp_input(struct pbuf *p, struct netif *inp)
|
icmp_input(struct pbuf *p, struct netif *inp)
|
||||||
{
|
{
|
||||||
@ -113,7 +113,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
|
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
||||||
{
|
{
|
||||||
@ -143,7 +143,7 @@ icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
|||||||
(struct ip_addr *)&(iphdr->src), ICMP_TTL, IP_PROTO_ICMP);
|
(struct ip_addr *)&(iphdr->src), ICMP_TTL, IP_PROTO_ICMP);
|
||||||
pbuf_free(q);
|
pbuf_free(q);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
|
icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -31,13 +31,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip.c
|
/* ip.c
|
||||||
*
|
*
|
||||||
* This is the code for the IP layer for IPv6.
|
* This is the code for the IP layer for IPv6.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "lwip/opt.h"
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
@ -53,24 +53,24 @@
|
|||||||
#include "lwip/stats.h"
|
#include "lwip/stats.h"
|
||||||
|
|
||||||
#include "arch/perf.h"
|
#include "arch/perf.h"
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_init:
|
/* ip_init:
|
||||||
*
|
*
|
||||||
* Initializes the IP layer.
|
* Initializes the IP layer.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
ip_init(void)
|
ip_init(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_route:
|
/* ip_route:
|
||||||
*
|
*
|
||||||
* Finds the appropriate network interface for a given IP address. It searches the
|
* Finds the appropriate network interface for a given IP address. It searches the
|
||||||
* list of network interfaces linearly. A match is found if the masked IP address of
|
* list of network interfaces linearly. A match is found if the masked IP address of
|
||||||
* the network interface equals the masked IP address given to the function.
|
* the network interface equals the masked IP address given to the function.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
struct netif *
|
struct netif *
|
||||||
ip_route(struct ip_addr *dest)
|
ip_route(struct ip_addr *dest)
|
||||||
{
|
{
|
||||||
@ -84,14 +84,14 @@ ip_route(struct ip_addr *dest)
|
|||||||
|
|
||||||
return netif_default;
|
return netif_default;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_forward:
|
/* ip_forward:
|
||||||
*
|
*
|
||||||
* Forwards an IP packet. It finds an appropriate route for the packet, decrements
|
* Forwards an IP packet. It finds an appropriate route for the packet, decrements
|
||||||
* the TTL value of the packet, adjusts the checksum and outputs the packet on the
|
* the TTL value of the packet, adjusts the checksum and outputs the packet on the
|
||||||
* appropriate interface.
|
* appropriate interface.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
|
ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
|
||||||
{
|
{
|
||||||
@ -142,7 +142,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
|
|||||||
|
|
||||||
netif->output(netif, p, (struct ip_addr *)&(iphdr->dest));
|
netif->output(netif, p, (struct ip_addr *)&(iphdr->dest));
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_input:
|
/* ip_input:
|
||||||
*
|
*
|
||||||
* This function is called by the network interface device driver when an IP packet is
|
* This function is called by the network interface device driver when an IP packet is
|
||||||
@ -152,7 +152,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
|
|||||||
*
|
*
|
||||||
* Finally, the packet is sent to the upper layer protocol input function.
|
* Finally, the packet is sent to the upper layer protocol input function.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
ip_input(struct pbuf *p, struct netif *inp) {
|
ip_input(struct pbuf *p, struct netif *inp) {
|
||||||
struct ip_hdr *iphdr;
|
struct ip_hdr *iphdr;
|
||||||
@ -249,14 +249,14 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
PERF_STOP("ip_input");
|
PERF_STOP("ip_input");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_output_if:
|
/* ip_output_if:
|
||||||
*
|
*
|
||||||
* Sends an IP packet on a network interface. This function constructs the IP header
|
* Sends an IP packet on a network interface. This function constructs the IP header
|
||||||
* and calculates the IP header checksum. If the source IP address is NULL,
|
* and calculates the IP header checksum. If the source IP address is NULL,
|
||||||
* the IP address of the outgoing network interface is filled in as source address.
|
* the IP address of the outgoing network interface is filled in as source address.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||||
u8_t ttl,
|
u8_t ttl,
|
||||||
@ -311,13 +311,13 @@ ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
|||||||
PERF_STOP("ip_output_if");
|
PERF_STOP("ip_output_if");
|
||||||
return netif->output(netif, p, dest);
|
return netif->output(netif, p, dest);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* ip_output:
|
/* ip_output:
|
||||||
*
|
*
|
||||||
* Simple interface to ip_output_if. It finds the outgoing network interface and
|
* Simple interface to ip_output_if. It finds the outgoing network interface and
|
||||||
* calls upon ip_output_if to do the actual work.
|
* calls upon ip_output_if to do the actual work.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||||
u8_t ttl, u8_t proto)
|
u8_t ttl, u8_t proto)
|
||||||
@ -333,7 +333,7 @@ ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
|||||||
|
|
||||||
return ip_output_if (p, src, dest, ttl, proto, netif);
|
return ip_output_if (p, src, dest, ttl, proto, netif);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#if IP_DEBUG
|
#if IP_DEBUG
|
||||||
void
|
void
|
||||||
ip_debug_print(struct pbuf *p)
|
ip_debug_print(struct pbuf *p)
|
||||||
@ -383,4 +383,4 @@ ip_debug_print(struct pbuf *p)
|
|||||||
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
|
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
|
||||||
}
|
}
|
||||||
#endif /* IP_DEBUG */
|
#endif /* IP_DEBUG */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
#include "lwip/ip_addr.h"
|
#include "lwip/ip_addr.h"
|
||||||
#include "lwip/inet.h"
|
#include "lwip/inet.h"
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
ip_addr_maskcmp(struct ip_addr *addr1, struct ip_addr *addr2,
|
ip_addr_maskcmp(struct ip_addr *addr1, struct ip_addr *addr2,
|
||||||
struct ip_addr *mask)
|
struct ip_addr *mask)
|
||||||
@ -44,7 +44,7 @@ ip_addr_maskcmp(struct ip_addr *addr1, struct ip_addr *addr2,
|
|||||||
(addr1->addr[3] & mask->addr[3]) == (addr2->addr[3] & mask->addr[3]));
|
(addr1->addr[3] & mask->addr[3]) == (addr2->addr[3] & mask->addr[3]));
|
||||||
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2)
|
ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2)
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2)
|
|||||||
addr1->addr[2] == addr2->addr[2] &&
|
addr1->addr[2] == addr2->addr[2] &&
|
||||||
addr1->addr[3] == addr2->addr[3]);
|
addr1->addr[3] == addr2->addr[3]);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
ip_addr_set(struct ip_addr *dest, struct ip_addr *src)
|
ip_addr_set(struct ip_addr *dest, struct ip_addr *src)
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ ip_addr_set(struct ip_addr *dest, struct ip_addr *src)
|
|||||||
dest->addr[2] = src->addr[2];
|
dest->addr[2] = src->addr[2];
|
||||||
dest->addr[3] = src->addr[3];*/
|
dest->addr[3] = src->addr[3];*/
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
ip_addr_isany(struct ip_addr *addr)
|
ip_addr_isany(struct ip_addr *addr)
|
||||||
{
|
{
|
||||||
@ -71,7 +71,7 @@ ip_addr_isany(struct ip_addr *addr)
|
|||||||
return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0);
|
return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*#if IP_DEBUG*/
|
/*#if IP_DEBUG*/
|
||||||
void
|
void
|
||||||
ip_addr_debug_print(struct ip_addr *addr)
|
ip_addr_debug_print(struct ip_addr *addr)
|
||||||
@ -87,4 +87,4 @@ ip_addr_debug_print(struct ip_addr *addr)
|
|||||||
ntohl(addr->addr[3]) & 0xffff);
|
ntohl(addr->addr[3]) & 0xffff);
|
||||||
}
|
}
|
||||||
/*#endif*/ /* IP_DEBUG */
|
/*#endif*/ /* IP_DEBUG */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|||||||
@ -183,7 +183,7 @@ mem_reallocm(void *rmem, mem_size_t newsize)
|
|||||||
mem_free(rmem);
|
mem_free(rmem);
|
||||||
return nmem;
|
return nmem;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void *
|
void *
|
||||||
mem_realloc(void *rmem, mem_size_t newsize)
|
mem_realloc(void *rmem, mem_size_t newsize)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -115,11 +115,11 @@ static u8_t memp_memory[(MEMP_NUM_PBUF *
|
|||||||
MEM_ALIGN_SIZE(sizeof(struct sys_timeout) +
|
MEM_ALIGN_SIZE(sizeof(struct sys_timeout) +
|
||||||
sizeof(struct memp)))];
|
sizeof(struct memp)))];
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#if !SYS_LIGHTWEIGHT_PROT
|
#if !SYS_LIGHTWEIGHT_PROT
|
||||||
static sys_sem_t mutex;
|
static sys_sem_t mutex;
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#ifndef LWIP_NOASSERT
|
#ifndef LWIP_NOASSERT
|
||||||
static int
|
static int
|
||||||
memp_sanity(void)
|
memp_sanity(void)
|
||||||
@ -141,7 +141,7 @@ memp_sanity(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif /* LWIP_DEBUG */
|
#endif /* LWIP_DEBUG */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
memp_init(void)
|
memp_init(void)
|
||||||
{
|
{
|
||||||
@ -182,7 +182,7 @@ memp_init(void)
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void *
|
void *
|
||||||
memp_malloc(memp_t type)
|
memp_malloc(memp_t type)
|
||||||
{
|
{
|
||||||
@ -236,7 +236,7 @@ memp_malloc(memp_t type)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
memp_free(memp_t type, void *mem)
|
memp_free(memp_t type, void *mem)
|
||||||
{
|
{
|
||||||
@ -271,4 +271,4 @@ memp_free(memp_t type, void *mem)
|
|||||||
sys_sem_signal(mutex);
|
sys_sem_signal(mutex);
|
||||||
#endif /* SYS_LIGHTWEIGHT_PROT */
|
#endif /* SYS_LIGHTWEIGHT_PROT */
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|||||||
@ -168,7 +168,7 @@ netif_find(char *name)
|
|||||||
LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: didn't find %c%c\n", name[0], name[1]));
|
LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: didn't find %c%c\n", name[0], name[1]));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
|
netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
|
||||||
{
|
{
|
||||||
@ -214,7 +214,7 @@ netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
|
|||||||
(unsigned int)(ntohl(netif->ip_addr.addr) >> 8 & 0xff),
|
(unsigned int)(ntohl(netif->ip_addr.addr) >> 8 & 0xff),
|
||||||
(unsigned int)(ntohl(netif->ip_addr.addr) & 0xff)));
|
(unsigned int)(ntohl(netif->ip_addr.addr) & 0xff)));
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
netif_set_gw(struct netif *netif, struct ip_addr *gw)
|
netif_set_gw(struct netif *netif, struct ip_addr *gw)
|
||||||
{
|
{
|
||||||
@ -226,7 +226,7 @@ netif_set_gw(struct netif *netif, struct ip_addr *gw)
|
|||||||
(unsigned int)(ntohl(netif->gw.addr) >> 8 & 0xff),
|
(unsigned int)(ntohl(netif->gw.addr) >> 8 & 0xff),
|
||||||
(unsigned int)(ntohl(netif->gw.addr) & 0xff)));
|
(unsigned int)(ntohl(netif->gw.addr) & 0xff)));
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
netif_set_netmask(struct netif *netif, struct ip_addr *netmask)
|
netif_set_netmask(struct netif *netif, struct ip_addr *netmask)
|
||||||
{
|
{
|
||||||
@ -238,7 +238,7 @@ netif_set_netmask(struct netif *netif, struct ip_addr *netmask)
|
|||||||
(unsigned int)(ntohl(netif->netmask.addr) >> 8 & 0xff),
|
(unsigned int)(ntohl(netif->netmask.addr) >> 8 & 0xff),
|
||||||
(unsigned int)(ntohl(netif->netmask.addr) & 0xff)));
|
(unsigned int)(ntohl(netif->netmask.addr) & 0xff)));
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
netif_set_default(struct netif *netif)
|
netif_set_default(struct netif *netif)
|
||||||
{
|
{
|
||||||
@ -246,10 +246,10 @@ netif_set_default(struct netif *netif)
|
|||||||
LWIP_DEBUGF(NETIF_DEBUG, ("netif: setting default interface %c%c\n",
|
LWIP_DEBUGF(NETIF_DEBUG, ("netif: setting default interface %c%c\n",
|
||||||
netif ? netif->name[0] : '\'', netif ? netif->name[1] : '\''));
|
netif ? netif->name[0] : '\'', netif ? netif->name[1] : '\''));
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
netif_init(void)
|
netif_init(void)
|
||||||
{
|
{
|
||||||
netif_list = netif_default = NULL;
|
netif_list = netif_default = NULL;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|||||||
@ -35,13 +35,13 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* raw.c
|
/* raw.c
|
||||||
*
|
*
|
||||||
* The code for the Raw Access to the IP
|
* The code for the Raw Access to the IP
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#include "lwip/opt.h"
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
#include "lwip/def.h"
|
#include "lwip/def.h"
|
||||||
@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
static struct raw_pcb *raw_pcbs = NULL;
|
static struct raw_pcb *raw_pcbs = NULL;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
raw_init(void)
|
raw_init(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -41,11 +41,11 @@
|
|||||||
|
|
||||||
#if LWIP_STATS
|
#if LWIP_STATS
|
||||||
struct stats_ lwip_stats;
|
struct stats_ lwip_stats;
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
stats_init(void)
|
stats_init(void)
|
||||||
{
|
{
|
||||||
memset(&lwip_stats, 0, sizeof(struct stats_));
|
memset(&lwip_stats, 0, sizeof(struct stats_));
|
||||||
}
|
}
|
||||||
#endif /* LWIP_STATS */
|
#endif /* LWIP_STATS */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ struct sswt_cb
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
sys_mbox_fetch(sys_mbox_t mbox, void **msg)
|
sys_mbox_fetch(sys_mbox_t mbox, void **msg)
|
||||||
{
|
{
|
||||||
@ -96,7 +96,7 @@ sys_mbox_fetch(sys_mbox_t mbox, void **msg)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
sys_sem_wait(sys_sem_t sem)
|
sys_sem_wait(sys_sem_t sem)
|
||||||
{
|
{
|
||||||
@ -152,7 +152,7 @@ sys_sem_wait(sys_sem_t sem)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
|
sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
|
||||||
{
|
{
|
||||||
@ -203,7 +203,7 @@ sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
|
|||||||
/* Go through timeout list (for this task only) and remove the first matching entry,
|
/* Go through timeout list (for this task only) and remove the first matching entry,
|
||||||
even though the timeout has not triggered yet.
|
even though the timeout has not triggered yet.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
sys_untimeout(sys_timeout_handler h, void *arg)
|
sys_untimeout(sys_timeout_handler h, void *arg)
|
||||||
{
|
{
|
||||||
@ -238,7 +238,7 @@ sys_untimeout(sys_timeout_handler h, void *arg)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
sswt_handler(void *arg)
|
sswt_handler(void *arg)
|
||||||
{
|
{
|
||||||
@ -252,7 +252,7 @@ sswt_handler(void *arg)
|
|||||||
/* Wait for a semaphore with timeout (specified in ms) */
|
/* Wait for a semaphore with timeout (specified in ms) */
|
||||||
/* timeout = 0: wait forever */
|
/* timeout = 0: wait forever */
|
||||||
/* Returns 0 on timeout. 1 otherwise */
|
/* Returns 0 on timeout. 1 otherwise */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
sys_sem_wait_timeout(sys_sem_t sem, u32_t timeout)
|
sys_sem_wait_timeout(sys_sem_t sem, u32_t timeout)
|
||||||
{
|
{
|
||||||
@ -279,7 +279,7 @@ sys_sem_wait_timeout(sys_sem_t sem, u32_t timeout)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
sys_msleep(u32_t ms)
|
sys_msleep(u32_t ms)
|
||||||
{
|
{
|
||||||
@ -289,6 +289,6 @@ sys_msleep(u32_t ms)
|
|||||||
|
|
||||||
sys_sem_free(delaysem);
|
sys_sem_free(delaysem);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* NO_SYS */
|
#endif /* NO_SYS */
|
||||||
|
|||||||
126
src/core/tcp.c
126
src/core/tcp.c
@ -36,7 +36,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* tcp.c
|
/* tcp.c
|
||||||
*
|
*
|
||||||
* This file contains common functions for the TCP implementation, such as functinos
|
* This file contains common functions for the TCP implementation, such as functinos
|
||||||
@ -44,7 +44,7 @@
|
|||||||
* related to input and output is found in tcp_input.c and tcp_output.c respectively.
|
* related to input and output is found in tcp_input.c and tcp_output.c respectively.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "lwip/opt.h"
|
#include "lwip/opt.h"
|
||||||
@ -74,13 +74,13 @@ static u8_t tcp_timer;
|
|||||||
|
|
||||||
static u16_t tcp_new_port(void);
|
static u16_t tcp_new_port(void);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_init():
|
* tcp_init():
|
||||||
*
|
*
|
||||||
* Initializes the TCP layer.
|
* Initializes the TCP layer.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_init(void)
|
tcp_init(void)
|
||||||
{
|
{
|
||||||
@ -95,14 +95,14 @@ tcp_init(void)
|
|||||||
tcp_timer = 0;
|
tcp_timer = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_tmr():
|
* tcp_tmr():
|
||||||
*
|
*
|
||||||
* Called periodically to dispatch TCP timers.
|
* Called periodically to dispatch TCP timers.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_tmr(void)
|
tcp_tmr(void)
|
||||||
{
|
{
|
||||||
@ -115,14 +115,14 @@ tcp_tmr(void)
|
|||||||
tcp_slowtmr();
|
tcp_slowtmr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_close():
|
* tcp_close():
|
||||||
*
|
*
|
||||||
* Closes the connection held by the PCB.
|
* Closes the connection held by the PCB.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
tcp_close(struct tcp_pcb *pcb)
|
tcp_close(struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
@ -176,7 +176,7 @@ tcp_close(struct tcp_pcb *pcb)
|
|||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_abort()
|
* tcp_abort()
|
||||||
*
|
*
|
||||||
@ -185,7 +185,7 @@ tcp_close(struct tcp_pcb *pcb)
|
|||||||
* killed because of shortage of memory.
|
* killed because of shortage of memory.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_abort(struct tcp_pcb *pcb)
|
tcp_abort(struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
@ -233,7 +233,7 @@ tcp_abort(struct tcp_pcb *pcb)
|
|||||||
tcp_rst(seqno, ackno, &local_ip, &remote_ip, local_port, remote_port);
|
tcp_rst(seqno, ackno, &local_ip, &remote_ip, local_port, remote_port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_bind():
|
* tcp_bind():
|
||||||
*
|
*
|
||||||
@ -242,7 +242,7 @@ tcp_abort(struct tcp_pcb *pcb)
|
|||||||
* the outgoing network interface is used instead.
|
* the outgoing network interface is used instead.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
||||||
{
|
{
|
||||||
@ -390,7 +390,7 @@ tcp_accept_null(void *arg, struct tcp_pcb *pcb, err_t err)
|
|||||||
return ERR_ABRT;
|
return ERR_ABRT;
|
||||||
}
|
}
|
||||||
#endif /* LWIP_CALLBACK_API */
|
#endif /* LWIP_CALLBACK_API */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_listen():
|
* tcp_listen():
|
||||||
*
|
*
|
||||||
@ -400,7 +400,7 @@ tcp_accept_null(void *arg, struct tcp_pcb *pcb, err_t err)
|
|||||||
* connection to LISTEN is an irreversible process.
|
* connection to LISTEN is an irreversible process.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
struct tcp_pcb *
|
struct tcp_pcb *
|
||||||
tcp_listen(struct tcp_pcb *pcb)
|
tcp_listen(struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
@ -429,7 +429,7 @@ tcp_listen(struct tcp_pcb *pcb)
|
|||||||
TCP_REG(&tcp_listen_pcbs, lpcb);
|
TCP_REG(&tcp_listen_pcbs, lpcb);
|
||||||
return (struct tcp_pcb *)lpcb;
|
return (struct tcp_pcb *)lpcb;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_recved():
|
* tcp_recved():
|
||||||
*
|
*
|
||||||
@ -438,7 +438,7 @@ tcp_listen(struct tcp_pcb *pcb)
|
|||||||
* when the data has been processed.
|
* when the data has been processed.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_recved(struct tcp_pcb *pcb, u16_t len)
|
tcp_recved(struct tcp_pcb *pcb, u16_t len)
|
||||||
{
|
{
|
||||||
@ -455,14 +455,14 @@ tcp_recved(struct tcp_pcb *pcb, u16_t len)
|
|||||||
LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: recveived %u bytes, wnd %u (%u).\n",
|
LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: recveived %u bytes, wnd %u (%u).\n",
|
||||||
len, pcb->rcv_wnd, TCP_WND - pcb->rcv_wnd));
|
len, pcb->rcv_wnd, TCP_WND - pcb->rcv_wnd));
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_new_port():
|
* tcp_new_port():
|
||||||
*
|
*
|
||||||
* A nastly hack featuring 'goto' statements that allocates a
|
* A nastly hack featuring 'goto' statements that allocates a
|
||||||
* new TCP local port.
|
* new TCP local port.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static u16_t
|
static u16_t
|
||||||
tcp_new_port(void)
|
tcp_new_port(void)
|
||||||
{
|
{
|
||||||
@ -495,7 +495,7 @@ tcp_new_port(void)
|
|||||||
}
|
}
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_connect():
|
* tcp_connect():
|
||||||
*
|
*
|
||||||
@ -503,7 +503,7 @@ tcp_new_port(void)
|
|||||||
* argument will be called when the connection has been established.
|
* argument will be called when the connection has been established.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
|
tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
|
||||||
err_t (* connected)(void *arg, struct tcp_pcb *tpcb, err_t err))
|
err_t (* connected)(void *arg, struct tcp_pcb *tpcb, err_t err))
|
||||||
@ -550,7 +550,7 @@ tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_slowtmr():
|
* tcp_slowtmr():
|
||||||
*
|
*
|
||||||
@ -558,7 +558,7 @@ tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
|
|||||||
* removes PCBs that have been in TIME-WAIT for enough time. It also increments
|
* removes PCBs that have been in TIME-WAIT for enough time. It also increments
|
||||||
* various timers such as the inactivity timer in each PCB.
|
* various timers such as the inactivity timer in each PCB.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_slowtmr(void)
|
tcp_slowtmr(void)
|
||||||
{
|
{
|
||||||
@ -734,13 +734,13 @@ tcp_slowtmr(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_fasttmr():
|
* tcp_fasttmr():
|
||||||
*
|
*
|
||||||
* Is called every TCP_FAST_INTERVAL (250 ms) and sends delayed ACKs.
|
* Is called every TCP_FAST_INTERVAL (250 ms) and sends delayed ACKs.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_fasttmr(void)
|
tcp_fasttmr(void)
|
||||||
{
|
{
|
||||||
@ -755,14 +755,14 @@ tcp_fasttmr(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_segs_free():
|
* tcp_segs_free():
|
||||||
*
|
*
|
||||||
* Deallocates a list of TCP segments (tcp_seg structures).
|
* Deallocates a list of TCP segments (tcp_seg structures).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u8_t
|
u8_t
|
||||||
tcp_segs_free(struct tcp_seg *seg)
|
tcp_segs_free(struct tcp_seg *seg)
|
||||||
{
|
{
|
||||||
@ -775,14 +775,14 @@ tcp_segs_free(struct tcp_seg *seg)
|
|||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_seg_free():
|
* tcp_seg_free():
|
||||||
*
|
*
|
||||||
* Frees a TCP segment.
|
* Frees a TCP segment.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u8_t
|
u8_t
|
||||||
tcp_seg_free(struct tcp_seg *seg)
|
tcp_seg_free(struct tcp_seg *seg)
|
||||||
{
|
{
|
||||||
@ -799,28 +799,28 @@ tcp_seg_free(struct tcp_seg *seg)
|
|||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_setprio():
|
* tcp_setprio():
|
||||||
*
|
*
|
||||||
* Sets the priority of a connection.
|
* Sets the priority of a connection.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_setprio(struct tcp_pcb *pcb, u8_t prio)
|
tcp_setprio(struct tcp_pcb *pcb, u8_t prio)
|
||||||
{
|
{
|
||||||
pcb->prio = prio;
|
pcb->prio = prio;
|
||||||
}
|
}
|
||||||
#if TCP_QUEUE_OOSEQ
|
#if TCP_QUEUE_OOSEQ
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_seg_copy():
|
* tcp_seg_copy():
|
||||||
*
|
*
|
||||||
* Returns a copy of the given TCP segment.
|
* Returns a copy of the given TCP segment.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
struct tcp_seg *
|
struct tcp_seg *
|
||||||
tcp_seg_copy(struct tcp_seg *seg)
|
tcp_seg_copy(struct tcp_seg *seg)
|
||||||
{
|
{
|
||||||
@ -835,7 +835,7 @@ tcp_seg_copy(struct tcp_seg *seg)
|
|||||||
return cseg;
|
return cseg;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#if LWIP_CALLBACK_API
|
#if LWIP_CALLBACK_API
|
||||||
static err_t
|
static err_t
|
||||||
tcp_recv_null(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
tcp_recv_null(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||||
@ -849,7 +849,7 @@ tcp_recv_null(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
#endif /* LWIP_CALLBACK_API */
|
#endif /* LWIP_CALLBACK_API */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
tcp_kill_prio(u8_t prio)
|
tcp_kill_prio(u8_t prio)
|
||||||
{
|
{
|
||||||
@ -880,7 +880,7 @@ tcp_kill_prio(u8_t prio)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
tcp_kill_timewait(void)
|
tcp_kill_timewait(void)
|
||||||
{
|
{
|
||||||
@ -902,8 +902,8 @@ tcp_kill_timewait(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
struct tcp_pcb *
|
struct tcp_pcb *
|
||||||
tcp_alloc(u8_t prio)
|
tcp_alloc(u8_t prio)
|
||||||
{
|
{
|
||||||
@ -955,7 +955,7 @@ tcp_alloc(u8_t prio)
|
|||||||
}
|
}
|
||||||
return pcb;
|
return pcb;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_new():
|
* tcp_new():
|
||||||
*
|
*
|
||||||
@ -963,13 +963,13 @@ tcp_alloc(u8_t prio)
|
|||||||
* any of the TCP PCB lists.
|
* any of the TCP PCB lists.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
struct tcp_pcb *
|
struct tcp_pcb *
|
||||||
tcp_new(void)
|
tcp_new(void)
|
||||||
{
|
{
|
||||||
return tcp_alloc(TCP_PRIO_NORMAL);
|
return tcp_alloc(TCP_PRIO_NORMAL);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_arg():
|
* tcp_arg():
|
||||||
*
|
*
|
||||||
@ -977,14 +977,14 @@ tcp_new(void)
|
|||||||
* functions.
|
* functions.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_arg(struct tcp_pcb *pcb, void *arg)
|
tcp_arg(struct tcp_pcb *pcb, void *arg)
|
||||||
{
|
{
|
||||||
pcb->callback_arg = arg;
|
pcb->callback_arg = arg;
|
||||||
}
|
}
|
||||||
#if LWIP_CALLBACK_API
|
#if LWIP_CALLBACK_API
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_recv():
|
* tcp_recv():
|
||||||
*
|
*
|
||||||
@ -992,14 +992,14 @@ tcp_arg(struct tcp_pcb *pcb, void *arg)
|
|||||||
* connection receives data.
|
* connection receives data.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_recv(struct tcp_pcb *pcb,
|
tcp_recv(struct tcp_pcb *pcb,
|
||||||
err_t (* recv)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err))
|
err_t (* recv)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err))
|
||||||
{
|
{
|
||||||
pcb->recv = recv;
|
pcb->recv = recv;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_sent():
|
* tcp_sent():
|
||||||
*
|
*
|
||||||
@ -1007,14 +1007,14 @@ tcp_recv(struct tcp_pcb *pcb,
|
|||||||
* has been successfully delivered to the remote host.
|
* has been successfully delivered to the remote host.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_sent(struct tcp_pcb *pcb,
|
tcp_sent(struct tcp_pcb *pcb,
|
||||||
err_t (* sent)(void *arg, struct tcp_pcb *tpcb, u16_t len))
|
err_t (* sent)(void *arg, struct tcp_pcb *tpcb, u16_t len))
|
||||||
{
|
{
|
||||||
pcb->sent = sent;
|
pcb->sent = sent;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_err():
|
* tcp_err():
|
||||||
*
|
*
|
||||||
@ -1022,14 +1022,14 @@ tcp_sent(struct tcp_pcb *pcb,
|
|||||||
* has occured on the connection.
|
* has occured on the connection.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_err(struct tcp_pcb *pcb,
|
tcp_err(struct tcp_pcb *pcb,
|
||||||
void (* errf)(void *arg, err_t err))
|
void (* errf)(void *arg, err_t err))
|
||||||
{
|
{
|
||||||
pcb->errf = errf;
|
pcb->errf = errf;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_accept():
|
* tcp_accept():
|
||||||
*
|
*
|
||||||
@ -1037,7 +1037,7 @@ tcp_err(struct tcp_pcb *pcb,
|
|||||||
* LISTENing connection has been connected to another host.
|
* LISTENing connection has been connected to another host.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_accept(struct tcp_pcb *pcb,
|
tcp_accept(struct tcp_pcb *pcb,
|
||||||
err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err))
|
err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err))
|
||||||
@ -1046,7 +1046,7 @@ tcp_accept(struct tcp_pcb *pcb,
|
|||||||
}
|
}
|
||||||
#endif /* LWIP_CALLBACK_API */
|
#endif /* LWIP_CALLBACK_API */
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_poll():
|
* tcp_poll():
|
||||||
*
|
*
|
||||||
@ -1055,7 +1055,7 @@ tcp_accept(struct tcp_pcb *pcb,
|
|||||||
* timer interval, which is called twice a second.
|
* timer interval, which is called twice a second.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_poll(struct tcp_pcb *pcb,
|
tcp_poll(struct tcp_pcb *pcb,
|
||||||
err_t (* poll)(void *arg, struct tcp_pcb *tpcb), u8_t interval)
|
err_t (* poll)(void *arg, struct tcp_pcb *tpcb), u8_t interval)
|
||||||
@ -1065,14 +1065,14 @@ tcp_poll(struct tcp_pcb *pcb,
|
|||||||
#endif /* LWIP_CALLBACK_API */
|
#endif /* LWIP_CALLBACK_API */
|
||||||
pcb->pollinterval = interval;
|
pcb->pollinterval = interval;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_pcb_purge():
|
* tcp_pcb_purge():
|
||||||
*
|
*
|
||||||
* Purges a TCP PCB. Removes any buffered data and frees the buffer memory.
|
* Purges a TCP PCB. Removes any buffered data and frees the buffer memory.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_pcb_purge(struct tcp_pcb *pcb)
|
tcp_pcb_purge(struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
@ -1107,14 +1107,14 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
|
|||||||
NULL;
|
NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_pcb_remove():
|
* tcp_pcb_remove():
|
||||||
*
|
*
|
||||||
* Purges the PCB and removes it from a PCB list. Any delayed ACKs are sent first.
|
* Purges the PCB and removes it from a PCB list. Any delayed ACKs are sent first.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb)
|
tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
@ -1133,14 +1133,14 @@ tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb)
|
|||||||
|
|
||||||
LWIP_ASSERT("tcp_pcb_remove: tcp_pcbs_sane()", tcp_pcbs_sane());
|
LWIP_ASSERT("tcp_pcb_remove: tcp_pcbs_sane()", tcp_pcbs_sane());
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_next_iss():
|
* tcp_next_iss():
|
||||||
*
|
*
|
||||||
* Calculates a new initial sequence number for new connections.
|
* Calculates a new initial sequence number for new connections.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
u32_t
|
u32_t
|
||||||
tcp_next_iss(void)
|
tcp_next_iss(void)
|
||||||
{
|
{
|
||||||
@ -1149,7 +1149,7 @@ tcp_next_iss(void)
|
|||||||
iss += tcp_ticks; /* XXX */
|
iss += tcp_ticks; /* XXX */
|
||||||
return iss;
|
return iss;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG
|
#if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG
|
||||||
void
|
void
|
||||||
tcp_debug_print(struct tcp_hdr *tcphdr)
|
tcp_debug_print(struct tcp_hdr *tcphdr)
|
||||||
@ -1181,7 +1181,7 @@ tcp_debug_print(struct tcp_hdr *tcphdr)
|
|||||||
ntohs(tcphdr->chksum), ntohs(tcphdr->urgp)));
|
ntohs(tcphdr->chksum), ntohs(tcphdr->urgp)));
|
||||||
LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n"));
|
LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n"));
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_debug_print_state(enum tcp_state s)
|
tcp_debug_print_state(enum tcp_state s)
|
||||||
{
|
{
|
||||||
@ -1222,7 +1222,7 @@ tcp_debug_print_state(enum tcp_state s)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_debug_print_flags(u8_t flags)
|
tcp_debug_print_flags(u8_t flags)
|
||||||
{
|
{
|
||||||
@ -1251,7 +1251,7 @@ tcp_debug_print_flags(u8_t flags)
|
|||||||
LWIP_DEBUGF(TCP_DEBUG, ("CWR "));
|
LWIP_DEBUGF(TCP_DEBUG, ("CWR "));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_debug_print_pcbs(void)
|
tcp_debug_print_pcbs(void)
|
||||||
{
|
{
|
||||||
@ -1278,7 +1278,7 @@ tcp_debug_print_pcbs(void)
|
|||||||
tcp_debug_print_state(pcb->state);
|
tcp_debug_print_state(pcb->state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
int
|
int
|
||||||
tcp_pcbs_sane(void)
|
tcp_pcbs_sane(void)
|
||||||
{
|
{
|
||||||
@ -1295,7 +1295,7 @@ tcp_pcbs_sane(void)
|
|||||||
}
|
}
|
||||||
#endif /* TCP_DEBUG */
|
#endif /* TCP_DEBUG */
|
||||||
#endif /* LWIP_TCP */
|
#endif /* LWIP_TCP */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* tcp_input.c
|
/* tcp_input.c
|
||||||
*
|
*
|
||||||
* The input processing functions of TCP.
|
* The input processing functions of TCP.
|
||||||
@ -45,7 +45,7 @@
|
|||||||
* tcp_process() -> tcp_receive() (-> application).
|
* tcp_process() -> tcp_receive() (-> application).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "lwip/def.h"
|
#include "lwip/def.h"
|
||||||
@ -85,7 +85,7 @@ static void tcp_parseopt(struct tcp_pcb *pcb);
|
|||||||
static err_t tcp_listen_input(struct tcp_pcb_listen *pcb);
|
static err_t tcp_listen_input(struct tcp_pcb_listen *pcb);
|
||||||
static err_t tcp_timewait_input(struct tcp_pcb *pcb);
|
static err_t tcp_timewait_input(struct tcp_pcb *pcb);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* tcp_input:
|
/* tcp_input:
|
||||||
*
|
*
|
||||||
* The initial input processing of TCP. It verifies the TCP header, demultiplexes
|
* The initial input processing of TCP. It verifies the TCP header, demultiplexes
|
||||||
@ -93,7 +93,7 @@ static err_t tcp_timewait_input(struct tcp_pcb *pcb);
|
|||||||
* the TCP finite state machine. This function is called by the IP layer (in
|
* the TCP finite state machine. This function is called by the IP layer (in
|
||||||
* ip_input()).
|
* ip_input()).
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_input(struct pbuf *p, struct netif *inp)
|
tcp_input(struct pbuf *p, struct netif *inp)
|
||||||
{
|
{
|
||||||
@ -398,13 +398,13 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
LWIP_ASSERT("tcp_input: tcp_pcbs_sane()", tcp_pcbs_sane());
|
LWIP_ASSERT("tcp_input: tcp_pcbs_sane()", tcp_pcbs_sane());
|
||||||
PERF_STOP("tcp_input");
|
PERF_STOP("tcp_input");
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* tcp_listen_input():
|
/* tcp_listen_input():
|
||||||
*
|
*
|
||||||
* Called by tcp_input() when a segment arrives for a listening
|
* Called by tcp_input() when a segment arrives for a listening
|
||||||
* connection.
|
* connection.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static err_t
|
static err_t
|
||||||
tcp_listen_input(struct tcp_pcb_listen *pcb)
|
tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||||
{
|
{
|
||||||
@ -465,13 +465,13 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
|||||||
}
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* tcp_timewait_input():
|
/* tcp_timewait_input():
|
||||||
*
|
*
|
||||||
* Called by tcp_input() when a segment arrives for a connection in
|
* Called by tcp_input() when a segment arrives for a connection in
|
||||||
* TIME_WAIT.
|
* TIME_WAIT.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static err_t
|
static err_t
|
||||||
tcp_timewait_input(struct tcp_pcb *pcb)
|
tcp_timewait_input(struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
@ -483,7 +483,7 @@ tcp_timewait_input(struct tcp_pcb *pcb)
|
|||||||
}
|
}
|
||||||
return tcp_output(pcb);
|
return tcp_output(pcb);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* tcp_process
|
/* tcp_process
|
||||||
*
|
*
|
||||||
* Implements the TCP state machine. Called by tcp_input. In some
|
* Implements the TCP state machine. Called by tcp_input. In some
|
||||||
@ -491,7 +491,7 @@ tcp_timewait_input(struct tcp_pcb *pcb)
|
|||||||
* argument will be freed by the caller (tcp_input()) unless the
|
* argument will be freed by the caller (tcp_input()) unless the
|
||||||
* recv_data pointer in the pcb is set.
|
* recv_data pointer in the pcb is set.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static err_t
|
static err_t
|
||||||
tcp_process(struct tcp_pcb *pcb)
|
tcp_process(struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
@ -650,7 +650,7 @@ tcp_process(struct tcp_pcb *pcb)
|
|||||||
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* tcp_receive:
|
/* tcp_receive:
|
||||||
*
|
*
|
||||||
* Called by tcp_process. Checks if the given segment is an ACK for outstanding
|
* Called by tcp_process. Checks if the given segment is an ACK for outstanding
|
||||||
@ -662,7 +662,7 @@ tcp_process(struct tcp_pcb *pcb)
|
|||||||
* If the incoming segment constitutes an ACK for a segment that was used for RTT
|
* If the incoming segment constitutes an ACK for a segment that was used for RTT
|
||||||
* estimation, the RTT is estimated here as well.
|
* estimation, the RTT is estimated here as well.
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
tcp_receive(struct tcp_pcb *pcb)
|
tcp_receive(struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
@ -1158,7 +1158,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* tcp_parseopt:
|
* tcp_parseopt:
|
||||||
*
|
*
|
||||||
@ -1166,7 +1166,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
|||||||
* from uIP with only small changes.)
|
* from uIP with only small changes.)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
tcp_parseopt(struct tcp_pcb *pcb)
|
tcp_parseopt(struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
@ -1208,5 +1208,5 @@ tcp_parseopt(struct tcp_pcb *pcb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* LWIP_TCP */
|
#endif /* LWIP_TCP */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|||||||
@ -35,13 +35,13 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* tcp_output.c
|
/* tcp_output.c
|
||||||
*
|
*
|
||||||
* The output functions of TCP.
|
* The output functions of TCP.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "lwip/def.h"
|
#include "lwip/def.h"
|
||||||
@ -64,14 +64,14 @@
|
|||||||
static void tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb);
|
static void tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb);
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags)
|
tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags)
|
||||||
{
|
{
|
||||||
return tcp_enqueue(pcb, NULL, 0, flags, 1, NULL, 0);
|
return tcp_enqueue(pcb, NULL, 0, flags, 1, NULL, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t copy)
|
tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t copy)
|
||||||
{
|
{
|
||||||
@ -90,7 +90,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t copy)
|
|||||||
return ERR_CONN;
|
return ERR_CONN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
||||||
u8_t flags, u8_t copy,
|
u8_t flags, u8_t copy,
|
||||||
@ -338,7 +338,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
|||||||
LWIP_DEBUGF(TCP_QLEN_DEBUG | DBG_STATE, ("tcp_enqueue: %d (with mem err)\n", pcb->snd_queuelen));
|
LWIP_DEBUGF(TCP_QLEN_DEBUG | DBG_STATE, ("tcp_enqueue: %d (with mem err)\n", pcb->snd_queuelen));
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* find out what we can send and send it */
|
/* find out what we can send and send it */
|
||||||
err_t
|
err_t
|
||||||
tcp_output(struct tcp_pcb *pcb)
|
tcp_output(struct tcp_pcb *pcb)
|
||||||
@ -468,7 +468,7 @@ tcp_output(struct tcp_pcb *pcb)
|
|||||||
}
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
|
tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
@ -526,7 +526,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
|
|||||||
ip_output(seg->p, &(pcb->local_ip), &(pcb->remote_ip), pcb->ttl, pcb->tos,
|
ip_output(seg->p, &(pcb->local_ip), &(pcb->remote_ip), pcb->ttl, pcb->tos,
|
||||||
IP_PROTO_TCP);
|
IP_PROTO_TCP);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_rst(u32_t seqno, u32_t ackno,
|
tcp_rst(u32_t seqno, u32_t ackno,
|
||||||
struct ip_addr *local_ip, struct ip_addr *remote_ip,
|
struct ip_addr *local_ip, struct ip_addr *remote_ip,
|
||||||
@ -560,7 +560,7 @@ tcp_rst(u32_t seqno, u32_t ackno,
|
|||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_rst: seqno %lu ackno %lu.\n", seqno, ackno));
|
LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_rst: seqno %lu ackno %lu.\n", seqno, ackno));
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_rexmit(struct tcp_pcb *pcb)
|
tcp_rexmit(struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
@ -590,7 +590,7 @@ tcp_rexmit(struct tcp_pcb *pcb)
|
|||||||
tcp_output(pcb);
|
tcp_output(pcb);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
tcp_keepalive(struct tcp_pcb *pcb)
|
tcp_keepalive(struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -35,13 +35,13 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* udp.c
|
/* udp.c
|
||||||
*
|
*
|
||||||
* The code for the User Datagram Protocol UDP.
|
* The code for the User Datagram Protocol UDP.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#include "lwip/opt.h"
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
#include "lwip/def.h"
|
#include "lwip/def.h"
|
||||||
@ -64,20 +64,20 @@ struct udp_pcb *udp_pcbs = NULL;
|
|||||||
|
|
||||||
static struct udp_pcb *pcb_cache = NULL;
|
static struct udp_pcb *pcb_cache = NULL;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
udp_init(void)
|
udp_init(void)
|
||||||
{
|
{
|
||||||
udp_pcbs = pcb_cache = NULL;
|
udp_pcbs = pcb_cache = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/* udp_lookup:
|
/* udp_lookup:
|
||||||
*
|
*
|
||||||
* An experimental feature that will be changed in future versions. Do
|
* An experimental feature that will be changed in future versions. Do
|
||||||
* not depend on it yet...
|
* not depend on it yet...
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#ifdef LWIP_DEBUG
|
#ifdef LWIP_DEBUG
|
||||||
u8_t
|
u8_t
|
||||||
udp_lookup(struct ip_hdr *iphdr, struct netif *inp)
|
udp_lookup(struct ip_hdr *iphdr, struct netif *inp)
|
||||||
@ -718,7 +718,7 @@ udp_disconnect(struct udp_pcb *pcb)
|
|||||||
{
|
{
|
||||||
pcb->flags &= ~UDP_FLAGS_CONNECTED;
|
pcb->flags &= ~UDP_FLAGS_CONNECTED;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
udp_recv(struct udp_pcb *pcb,
|
udp_recv(struct udp_pcb *pcb,
|
||||||
void (* recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p,
|
void (* recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p,
|
||||||
@ -777,7 +777,7 @@ udp_new(void) {
|
|||||||
|
|
||||||
return pcb;
|
return pcb;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#if UDP_DEBUG
|
#if UDP_DEBUG
|
||||||
int
|
int
|
||||||
udp_debug_print(struct udp_hdr *udphdr)
|
udp_debug_print(struct udp_hdr *udphdr)
|
||||||
@ -793,7 +793,7 @@ udp_debug_print(struct udp_hdr *udphdr)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* UDP_DEBUG */
|
#endif /* UDP_DEBUG */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#endif /* LWIP_UDP */
|
#endif /* LWIP_UDP */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@
|
|||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
#ifndef __LWIP_PBUF_H__
|
#ifndef __LWIP_PBUF_H__
|
||||||
#define __LWIP_PBUF_H__
|
#define __LWIP_PBUF_H__
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ static void ethernetif_input(struct netif *netif);
|
|||||||
static err_t ethernetif_output(struct netif *netif, struct pbuf *p,
|
static err_t ethernetif_output(struct netif *netif, struct pbuf *p,
|
||||||
struct ip_addr *ipaddr);
|
struct ip_addr *ipaddr);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
low_level_init(struct netif *netif)
|
low_level_init(struct netif *netif)
|
||||||
{
|
{
|
||||||
@ -87,7 +87,7 @@ low_level_init(struct netif *netif)
|
|||||||
|
|
||||||
/* Do whatever else is needed to initialize interface. */
|
/* Do whatever else is needed to initialize interface. */
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* low_level_output():
|
* low_level_output():
|
||||||
*
|
*
|
||||||
@ -96,7 +96,7 @@ low_level_init(struct netif *netif)
|
|||||||
* might be chained.
|
* might be chained.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
static err_t
|
static err_t
|
||||||
low_level_output(struct ethernetif *ethernetif, struct pbuf *p)
|
low_level_output(struct ethernetif *ethernetif, struct pbuf *p)
|
||||||
@ -120,7 +120,7 @@ low_level_output(struct ethernetif *ethernetif, struct pbuf *p)
|
|||||||
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* low_level_input():
|
* low_level_input():
|
||||||
*
|
*
|
||||||
@ -128,7 +128,7 @@ low_level_output(struct ethernetif *ethernetif, struct pbuf *p)
|
|||||||
* packet from the interface into the pbuf.
|
* packet from the interface into the pbuf.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static struct pbuf *
|
static struct pbuf *
|
||||||
low_level_input(struct ethernetif *ethernetif)
|
low_level_input(struct ethernetif *ethernetif)
|
||||||
{
|
{
|
||||||
@ -165,7 +165,7 @@ low_level_input(struct ethernetif *ethernetif)
|
|||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* ethernetif_output():
|
* ethernetif_output():
|
||||||
*
|
*
|
||||||
@ -174,7 +174,7 @@ low_level_input(struct ethernetif *ethernetif)
|
|||||||
* do the actuall transmission of the packet.
|
* do the actuall transmission of the packet.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static err_t
|
static err_t
|
||||||
ethernetif_output(struct netif *netif, struct pbuf *p,
|
ethernetif_output(struct netif *netif, struct pbuf *p,
|
||||||
struct ip_addr *ipaddr)
|
struct ip_addr *ipaddr)
|
||||||
@ -264,7 +264,7 @@ ethernetif_output(struct netif *netif, struct pbuf *p,
|
|||||||
return low_level_output(ethernetif, p);
|
return low_level_output(ethernetif, p);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* ethernetif_input():
|
* ethernetif_input():
|
||||||
*
|
*
|
||||||
@ -274,7 +274,7 @@ ethernetif_output(struct netif *netif, struct pbuf *p,
|
|||||||
* interface.
|
* interface.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
ethernetif_input(struct netif *netif)
|
ethernetif_input(struct netif *netif)
|
||||||
{
|
{
|
||||||
@ -314,14 +314,14 @@ ethernetif_input(struct netif *netif)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
static void
|
static void
|
||||||
arp_timer(void *arg)
|
arp_timer(void *arg)
|
||||||
{
|
{
|
||||||
arp_tmr();
|
arp_tmr();
|
||||||
sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);
|
sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
/*
|
/*
|
||||||
* ethernetif_init():
|
* ethernetif_init():
|
||||||
*
|
*
|
||||||
@ -330,7 +330,7 @@ arp_timer(void *arg)
|
|||||||
* actual setup of the hardware.
|
* actual setup of the hardware.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
ethernetif_init(struct netif *netif)
|
ethernetif_init(struct netif *netif)
|
||||||
{
|
{
|
||||||
@ -350,4 +350,4 @@ ethernetif_init(struct netif *netif)
|
|||||||
|
|
||||||
sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);
|
sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|||||||
@ -40,13 +40,23 @@
|
|||||||
#include "lwip/tcp.h"
|
#include "lwip/tcp.h"
|
||||||
#include "lwip/ip.h"
|
#include "lwip/ip.h"
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
static void
|
||||||
|
loopif_input( void * arg )
|
||||||
|
{
|
||||||
|
struct netif *netif = (struct netif *)( ((void **)arg)[ 0 ] );
|
||||||
|
struct pbuf *r = (struct pbuf *)( ((void **)arg)[ 1 ] );
|
||||||
|
|
||||||
|
mem_free( arg );
|
||||||
|
netif -> input( r, netif );
|
||||||
|
}
|
||||||
|
|
||||||
static err_t
|
static err_t
|
||||||
loopif_output(struct netif *netif, struct pbuf *p,
|
loopif_output(struct netif *netif, struct pbuf *p,
|
||||||
struct ip_addr *ipaddr)
|
struct ip_addr *ipaddr)
|
||||||
{
|
{
|
||||||
struct pbuf *q, *r;
|
struct pbuf *q, *r;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
void **arg;
|
||||||
|
|
||||||
#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP)
|
#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP)
|
||||||
tcpdump(p);
|
tcpdump(p);
|
||||||
@ -60,21 +70,42 @@ loopif_output(struct netif *netif, struct pbuf *p,
|
|||||||
memcpy(ptr, q->payload, q->len);
|
memcpy(ptr, q->payload, q->len);
|
||||||
ptr += q->len;
|
ptr += q->len;
|
||||||
}
|
}
|
||||||
netif->input(r, netif);
|
|
||||||
|
arg = mem_malloc( sizeof( void *[2]));
|
||||||
|
if( NULL == arg ) {
|
||||||
|
return ERR_MEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
arg[0] = netif;
|
||||||
|
arg[1] = r;
|
||||||
|
/**
|
||||||
|
* workaround (patch #1779) to try to prevent bug #2595:
|
||||||
|
* When connecting to "localhost" with the loopif interface,
|
||||||
|
* tcp_output doesn't get the opportunity to finnish sending the
|
||||||
|
* segment before tcp_process gets it, resulting in tcp_process
|
||||||
|
* referencing pcb->unacked-> which still is NULL.
|
||||||
|
*
|
||||||
|
* TODO: Is there still a race condition here? Leon
|
||||||
|
*/
|
||||||
|
sys_timeout( 1, loopif_input, arg );
|
||||||
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
err_t
|
err_t
|
||||||
loopif_init(struct netif *netif)
|
loopif_init(struct netif *netif)
|
||||||
{
|
{
|
||||||
netif->name[0] = 'l';
|
netif->name[0] = 'l';
|
||||||
netif->name[1] = 'o';
|
netif->name[1] = 'o';
|
||||||
|
#if 0 /** TODO: I think this should be enabled, or not? Leon */
|
||||||
|
netif->input = loopif_input;
|
||||||
|
#endif
|
||||||
netif->output = loopif_output;
|
netif->output = loopif_output;
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user