++ Bugfixes:
+ 2008-12-19 Simon Goldschmidt
+ * many files: patch #6699: fixed some warnings on platform where sizeof(int) == 2
+
2008-12-10 Tamas Somogyi, Frédéric Bernon
* sockets.c: fixed bug #25051: lwip_recvfrom problem with udp: fromaddr and
port uses deleted netbuf.
LWIP_ASSERT("conn->state == NETCONN_WRITE", (conn->state == NETCONN_WRITE));
dataptr = (u8_t*)conn->write_msg->msg.w.dataptr + conn->write_offset;
- if ((conn->write_msg->msg.w.len - conn->write_offset > 0xffff)) { /* max_u16_t */
+ if ((conn->write_msg->msg.w.len - conn->write_offset > (int)0xffff)) { /* max_u16_t */
len = 0xffff;
#if LWIP_TCPIP_CORE_LOCKING
conn->write_delayed = 1;
case TCPIP_MSG_TIMEOUT:
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: TIMEOUT %p\n", (void *)msg));
-
- if(msg->msg.tmo.msecs != 0xffffffff)
- sys_timeout (msg->msg.tmo.msecs, msg->msg.tmo.h, msg->msg.tmo.arg);
- else
- sys_untimeout (msg->msg.tmo.h, msg->msg.tmo.arg);
+ sys_timeout(msg->msg.tmo.msecs, msg->msg.tmo.h, msg->msg.tmo.arg);
+ memp_free(MEMP_TCPIP_MSG_API, msg);
+ break;
+ case TCPIP_MSG_UNTIMEOUT:
+ LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: UNTIMEOUT %p\n", (void *)msg));
+ sys_untimeout(msg->msg.tmo.h, msg->msg.tmo.arg);
memp_free(MEMP_TCPIP_MSG_API, msg);
break;
return ERR_VAL;
}
+/**
+ * call sys_timeout in tcpip_thread
+ *
+ * @param msec time in miliseconds for timeout
+ * @param h function to be called on timeout
+ * @param arg argument to pass to timeout function h
+ * @return ERR_MEM on memory error, ERR_OK otherwise
+ */
err_t
tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
{
return ERR_VAL;
}
+/**
+ * call sys_untimeout in tcpip_thread
+ *
+ * @param msec time in miliseconds for timeout
+ * @param h function to be called on timeout
+ * @param arg argument to pass to timeout function h
+ * @return ERR_MEM on memory error, ERR_OK otherwise
+ */
+err_t
+tcpip_untimeout(u32_t msecs, sys_timeout_handler h, void *arg)
+{
+ struct tcpip_msg *msg;
+
+ if (mbox != SYS_MBOX_NULL) {
+ msg = memp_malloc(MEMP_TCPIP_MSG_API);
+ if (msg == NULL) {
+ return ERR_MEM;
+ }
+
+ msg->type = TCPIP_MSG_UNTIMEOUT;
+ msg->msg.tmo.msecs = msecs;
+ msg->msg.tmo.h = h;
+ msg->msg.tmo.arg = arg;
+ sys_mbox_post(mbox, msg);
+ return ERR_OK;
+ }
+ return ERR_VAL;
+}
+
#if LWIP_NETCONN
/**
* Call the lower part of a netconn_* function
inet_aton(const char *cp, struct in_addr *addr)
{
u32_t val;
- int base, n, c;
+ u8_t base;
+ char c;
u32_t parts[4];
u32_t *pp = parts;
* Concoct the address according to
* the number of parts specified.
*/
- n = pp - parts + 1;
- switch (n) {
+ switch (pp - parts + 1) {
case 0:
return (0); /* initial nondigit */
}
/* add deferred carry bits */
acc = (acc >> 16) + (acc & 0x0000ffffUL);
- if ((acc & 0xffff0000) != 0) {
+ if ((acc & 0xffff0000UL) != 0) {
acc = (acc >> 16) + (acc & 0x0000ffffUL);
}
/* This maybe a little confusing: reorder sum using htons()
/* Parse the TCP MSS option, if present. */
if(TCPH_HDRLEN(tcphdr) > 0x5) {
- for(c = 0; c < (TCPH_HDRLEN(tcphdr) - 5) << 2 ;) {
+ for(c = 0; c < ((TCPH_HDRLEN(tcphdr) - 5) << 2) ;) {
opt = opts[c];
if (opt == 0x00) {
/* End of options. */
}
LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
("udp_bind: bound to %"U16_F".%"U16_F".%"U16_F".%"U16_F", port %"U16_F"\n",
- (u16_t)(ntohl(pcb->local_ip.addr) >> 24 & 0xff),
- (u16_t)(ntohl(pcb->local_ip.addr) >> 16 & 0xff),
- (u16_t)(ntohl(pcb->local_ip.addr) >> 8 & 0xff),
+ (u16_t)((ntohl(pcb->local_ip.addr) >> 24) & 0xff),
+ (u16_t)((ntohl(pcb->local_ip.addr) >> 16) & 0xff),
+ (u16_t)((ntohl(pcb->local_ip.addr) >> 8) & 0xff),
(u16_t)(ntohl(pcb->local_ip.addr) & 0xff), pcb->local_port));
return ERR_OK;
}
#endif
LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
("udp_connect: connected to %"U16_F".%"U16_F".%"U16_F".%"U16_F",port %"U16_F"\n",
- (u16_t)(ntohl(pcb->remote_ip.addr) >> 24 & 0xff),
- (u16_t)(ntohl(pcb->remote_ip.addr) >> 16 & 0xff),
- (u16_t)(ntohl(pcb->remote_ip.addr) >> 8 & 0xff),
+ (u16_t)((ntohl(pcb->remote_ip.addr) >> 24) & 0xff),
+ (u16_t)((ntohl(pcb->remote_ip.addr) >> 16) & 0xff),
+ (u16_t)((ntohl(pcb->remote_ip.addr) >> 8) & 0xff),
(u16_t)(ntohl(pcb->remote_ip.addr) & 0xff), pcb->remote_port));
/* Insert UDP PCB into the list of active UDP PCBs. */
#define TCP_OOSEQ_TIMEOUT 6U /* x RTO */
#ifndef TCP_MSL
-#define TCP_MSL 60000U /* The maximum segment lifetime in milliseconds */
+#define TCP_MSL 60000UL /* The maximum segment lifetime in milliseconds */
#endif
/* Keepalive values, compliant with RFC 1122. Don't change this unless you know what you're doing */
err_t mem_free_callback(void *m);
err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
-#define tcpip_untimeout(h, arg) tcpip_timeout(0xffffffff, h, arg)
+err_t tcpip_untimeout(u32_t msecs, sys_timeout_handler h, void *arg);
enum tcpip_msg_type {
#if LWIP_NETCONN
TCPIP_MSG_NETIFAPI,
#endif /* LWIP_NETIF_API */
TCPIP_MSG_CALLBACK,
- TCPIP_MSG_TIMEOUT
+ TCPIP_MSG_TIMEOUT,
+ TCPIP_MSG_UNTIMEOUT
};
struct tcpip_msg {