Converted deprecated uIP types in the network stack to standard C99 names (in stdint.h)

This commit is contained in:
Nicholas J Humfrey 2012-02-17 22:45:13 +00:00
parent 022d7193d1
commit 3fe55673d3
39 changed files with 572 additions and 572 deletions

View file

@ -46,19 +46,19 @@
static struct dhcpc_state s; static struct dhcpc_state s;
struct dhcp_msg { struct dhcp_msg {
u8_t op, htype, hlen, hops; uint8_t op, htype, hlen, hops;
u8_t xid[4]; uint8_t xid[4];
u16_t secs, flags; uint16_t secs, flags;
u8_t ciaddr[4]; uint8_t ciaddr[4];
u8_t yiaddr[4]; uint8_t yiaddr[4];
u8_t siaddr[4]; uint8_t siaddr[4];
u8_t giaddr[4]; uint8_t giaddr[4];
u8_t chaddr[16]; uint8_t chaddr[16];
#ifndef UIP_CONF_DHCP_LIGHT #ifndef UIP_CONF_DHCP_LIGHT
u8_t sname[64]; uint8_t sname[64];
u8_t file[128]; uint8_t file[128];
#endif #endif
u8_t options[312]; uint8_t options[312];
}; };
#define BOOTP_BROADCAST 0x8000 #define BOOTP_BROADCAST 0x8000
@ -90,11 +90,11 @@ struct dhcp_msg {
#define DHCP_OPTION_REQ_LIST 55 #define DHCP_OPTION_REQ_LIST 55
#define DHCP_OPTION_END 255 #define DHCP_OPTION_END 255
static u32_t xid; static uint32_t xid;
static const u8_t magic_cookie[4] = {99, 130, 83, 99}; static const uint8_t magic_cookie[4] = {99, 130, 83, 99};
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static u8_t * static uint8_t *
add_msg_type(u8_t *optptr, u8_t type) add_msg_type(uint8_t *optptr, uint8_t type)
{ {
*optptr++ = DHCP_OPTION_MSG_TYPE; *optptr++ = DHCP_OPTION_MSG_TYPE;
*optptr++ = 1; *optptr++ = 1;
@ -102,8 +102,8 @@ add_msg_type(u8_t *optptr, u8_t type)
return optptr; return optptr;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static u8_t * static uint8_t *
add_server_id(u8_t *optptr) add_server_id(uint8_t *optptr)
{ {
*optptr++ = DHCP_OPTION_SERVER_ID; *optptr++ = DHCP_OPTION_SERVER_ID;
*optptr++ = 4; *optptr++ = 4;
@ -111,8 +111,8 @@ add_server_id(u8_t *optptr)
return optptr + 4; return optptr + 4;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static u8_t * static uint8_t *
add_req_ipaddr(u8_t *optptr) add_req_ipaddr(uint8_t *optptr)
{ {
*optptr++ = DHCP_OPTION_REQ_IPADDR; *optptr++ = DHCP_OPTION_REQ_IPADDR;
*optptr++ = 4; *optptr++ = 4;
@ -120,8 +120,8 @@ add_req_ipaddr(u8_t *optptr)
return optptr + 4; return optptr + 4;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static u8_t * static uint8_t *
add_req_options(u8_t *optptr) add_req_options(uint8_t *optptr)
{ {
*optptr++ = DHCP_OPTION_REQ_LIST; *optptr++ = DHCP_OPTION_REQ_LIST;
*optptr++ = 3; *optptr++ = 3;
@ -131,8 +131,8 @@ add_req_options(u8_t *optptr)
return optptr; return optptr;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static u8_t * static uint8_t *
add_end(u8_t *optptr) add_end(uint8_t *optptr)
{ {
*optptr++ = DHCP_OPTION_END; *optptr++ = DHCP_OPTION_END;
return optptr; return optptr;
@ -166,7 +166,7 @@ create_msg(CC_REGISTER_ARG struct dhcp_msg *m)
static void static void
send_discover(void) send_discover(void)
{ {
u8_t *end; uint8_t *end;
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
create_msg(m); create_msg(m);
@ -175,13 +175,13 @@ send_discover(void)
end = add_req_options(end); end = add_req_options(end);
end = add_end(end); end = add_end(end);
uip_send(uip_appdata, (int)(end - (u8_t *)uip_appdata)); uip_send(uip_appdata, (int)(end - (uint8_t *)uip_appdata));
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
send_request(void) send_request(void)
{ {
u8_t *end; uint8_t *end;
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
create_msg(m); create_msg(m);
@ -191,14 +191,14 @@ send_request(void)
end = add_req_ipaddr(end); end = add_req_ipaddr(end);
end = add_end(end); end = add_end(end);
uip_send(uip_appdata, (int)(end - (u8_t *)uip_appdata)); uip_send(uip_appdata, (int)(end - (uint8_t *)uip_appdata));
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static u8_t static uint8_t
parse_options(u8_t *optptr, int len) parse_options(uint8_t *optptr, int len)
{ {
u8_t *end = optptr + len; uint8_t *end = optptr + len;
u8_t type = 0; uint8_t type = 0;
while(optptr < end) { while(optptr < end) {
switch(*optptr) { switch(*optptr) {
@ -229,7 +229,7 @@ parse_options(u8_t *optptr, int len)
return type; return type;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static u8_t static uint8_t
parse_msg(void) parse_msg(void)
{ {
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
@ -250,8 +250,8 @@ static int
msg_for_me(void) msg_for_me(void)
{ {
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
u8_t *optptr = &m->options[4]; uint8_t *optptr = &m->options[4];
u8_t *end = (u8_t*)uip_appdata + uip_datalen(); uint8_t *end = (uint8_t*)uip_appdata + uip_datalen();
if(m->op == DHCP_REPLY && if(m->op == DHCP_REPLY &&
memcmp(m->xid, &xid, sizeof(xid)) == 0 && memcmp(m->xid, &xid, sizeof(xid)) == 0 &&
@ -340,7 +340,7 @@ PT_THREAD(handle_dhcp(process_event_t ev, void *data))
dhcpc_configured(&s); dhcpc_configured(&s);
#define MAX_TICKS (~((clock_time_t)0) / 2) #define MAX_TICKS (~((clock_time_t)0) / 2)
#define MAX_TICKS32 (~((u32_t)0)) #define MAX_TICKS32 (~((uint32_t)0))
#define IMIN(a, b) ((a) < (b) ? (a) : (b)) #define IMIN(a, b) ((a) < (b) ? (a) : (b))
if((uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1]))*CLOCK_SECOND/2 if((uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1]))*CLOCK_SECOND/2

View file

@ -38,13 +38,13 @@ struct dhcpc_state {
char state; char state;
struct uip_udp_conn *conn; struct uip_udp_conn *conn;
struct etimer etimer; struct etimer etimer;
u32_t ticks; uint32_t ticks;
const void *mac_addr; const void *mac_addr;
int mac_len; int mac_len;
u8_t serverid[4]; uint8_t serverid[4];
u16_t lease_time[2]; uint16_t lease_time[2];
uip_ipaddr_t ipaddr; uip_ipaddr_t ipaddr;
uip_ipaddr_t netmask; uip_ipaddr_t netmask;
uip_ipaddr_t dnsaddr; uip_ipaddr_t dnsaddr;

View file

@ -48,27 +48,27 @@
#define FLAGS_BROADCASTDATA 0x4000 #define FLAGS_BROADCASTDATA 0x4000
struct hc_hdr { struct hc_hdr {
u16_t flagsport; uint16_t flagsport;
uip_ipaddr_t srcipaddr; uip_ipaddr_t srcipaddr;
}; };
struct udpip_hdr { struct udpip_hdr {
/* IP header. */ /* IP header. */
u8_t vhl, uint8_t vhl,
tos, tos,
len[2], len[2],
ipid[2], ipid[2],
ipoffset[2], ipoffset[2],
ttl, ttl,
proto; proto;
u16_t ipchksum; uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr; uip_ipaddr_t srcipaddr, destipaddr;
/* UDP header. */ /* UDP header. */
u16_t srcport, uint16_t srcport,
destport; destport;
u16_t udplen; uint16_t udplen;
u16_t udpchksum; uint16_t udpchksum;
}; };
#include <stdio.h> #include <stdio.h>
@ -100,7 +100,7 @@ hc_init(void)
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int
hc_compress(u8_t *buf, int len) hc_compress(uint8_t *buf, int len)
{ {
struct hc_hdr *hdr; struct hc_hdr *hdr;
struct udpip_hdr *uhdr; struct udpip_hdr *uhdr;
@ -162,7 +162,7 @@ hc_compress(u8_t *buf, int len)
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int
hc_inflate(u8_t *buf, int len) hc_inflate(uint8_t *buf, int len)
{ {
struct udpip_hdr *uhdr; struct udpip_hdr *uhdr;
struct hc_hdr *hdr; struct hc_hdr *hdr;

View file

@ -43,8 +43,8 @@
#include "net/uip.h" #include "net/uip.h"
void hc_init(void); void hc_init(void);
int hc_compress(u8_t *buf, int len); int hc_compress(uint8_t *buf, int len);
int hc_inflate(u8_t *buf, int len); int hc_inflate(uint8_t *buf, int len);
#define HC_HLEN 6 #define HC_HLEN 6

View file

@ -70,15 +70,15 @@
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
buf_setup(struct psock_buf *buf, buf_setup(struct psock_buf *buf,
u8_t *bufptr, u16_t bufsize) uint8_t *bufptr, uint16_t bufsize)
{ {
buf->ptr = bufptr; buf->ptr = bufptr;
buf->left = bufsize; buf->left = bufsize;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static u8_t static uint8_t
buf_bufdata(struct psock_buf *buf, u16_t len, buf_bufdata(struct psock_buf *buf, uint16_t len,
u8_t **dataptr, u16_t *datalen) uint8_t **dataptr, uint16_t *datalen)
{ {
if(*datalen < buf->left) { if(*datalen < buf->left) {
memcpy(buf->ptr, *dataptr, *datalen); memcpy(buf->ptr, *dataptr, *datalen);
@ -104,11 +104,11 @@ buf_bufdata(struct psock_buf *buf, u16_t len,
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static u8_t static uint8_t
buf_bufto(CC_REGISTER_ARG struct psock_buf *buf, u8_t endmarker, buf_bufto(CC_REGISTER_ARG struct psock_buf *buf, uint8_t endmarker,
CC_REGISTER_ARG u8_t **dataptr, CC_REGISTER_ARG u16_t *datalen) CC_REGISTER_ARG uint8_t **dataptr, CC_REGISTER_ARG uint16_t *datalen)
{ {
u8_t c; uint8_t c;
while(buf->left > 0 && *datalen > 0) { while(buf->left > 0 && *datalen > 0) {
c = *buf->ptr = **dataptr; c = *buf->ptr = **dataptr;
++*dataptr; ++*dataptr;
@ -233,7 +233,7 @@ PT_THREAD(psock_generator_send(CC_REGISTER_ARG struct psock *s,
PT_END(&s->psockpt); PT_END(&s->psockpt);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
u16_t uint16_t
psock_datalen(struct psock *psock) psock_datalen(struct psock *psock)
{ {
return psock->bufsize - psock->buf.left; return psock->bufsize - psock->buf.left;
@ -272,7 +272,7 @@ PT_THREAD(psock_readto(CC_REGISTER_ARG struct psock *psock, unsigned char c))
if(psock->readlen == 0) { if(psock->readlen == 0) {
PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock)); PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock));
psock->state = STATE_READ; psock->state = STATE_READ;
psock->readptr = (u8_t *)uip_appdata; psock->readptr = (uint8_t *)uip_appdata;
psock->readlen = uip_datalen(); psock->readlen = uip_datalen();
} }
} while((buf_bufto(&psock->buf, c, } while((buf_bufto(&psock->buf, c,
@ -300,7 +300,7 @@ PT_THREAD(psock_readbuf_len(CC_REGISTER_ARG struct psock *psock, uint16_t len))
if(psock->readlen == 0) { if(psock->readlen == 0) {
PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock)); PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock));
psock->state = STATE_READ; psock->state = STATE_READ;
psock->readptr = (u8_t *)uip_appdata; psock->readptr = (uint8_t *)uip_appdata;
psock->readlen = uip_datalen(); psock->readlen = uip_datalen();
} }
} while(buf_bufdata(&psock->buf, psock->bufsize, } while(buf_bufdata(&psock->buf, psock->bufsize,

View file

@ -100,7 +100,7 @@
* *
*/ */
struct psock_buf { struct psock_buf {
u8_t *ptr; uint8_t *ptr;
unsigned short left; unsigned short left;
}; };
@ -114,14 +114,14 @@ struct psock {
struct pt pt, psockpt; /* Protothreads - one that's using the psock struct pt pt, psockpt; /* Protothreads - one that's using the psock
functions, and one that runs inside the functions, and one that runs inside the
psock functions. */ psock functions. */
const u8_t *sendptr; /* Pointer to the next data to be sent. */ const uint8_t *sendptr; /* Pointer to the next data to be sent. */
u8_t *readptr; /* Pointer to the next data to be read. */ uint8_t *readptr; /* Pointer to the next data to be read. */
uint8_t *bufptr; /* Pointer to the buffer used for buffering uint8_t *bufptr; /* Pointer to the buffer used for buffering
incoming data. */ incoming data. */
u16_t sendlen; /* The number of bytes left to be sent. */ uint16_t sendlen; /* The number of bytes left to be sent. */
u16_t readlen; /* The number of bytes left to be read. */ uint16_t readlen; /* The number of bytes left to be read. */
struct psock_buf buf; /* The structure holding the state of the struct psock_buf buf; /* The structure holding the state of the
input buffer. */ input buffer. */
@ -304,7 +304,7 @@ PT_THREAD(psock_readto(struct psock *psock, unsigned char c));
*/ */
#define PSOCK_DATALEN(psock) psock_datalen(psock) #define PSOCK_DATALEN(psock) psock_datalen(psock)
u16_t psock_datalen(struct psock *psock); uint16_t psock_datalen(struct psock *psock);
/** /**
* Exit the protosocket's protothread. * Exit the protosocket's protothread.

View file

@ -101,8 +101,8 @@ PROCESS_THREAD(resolv_process, ev, data)
/** \internal The DNS message header. */ /** \internal The DNS message header. */
struct dns_hdr { struct dns_hdr {
u16_t id; uint16_t id;
u8_t flags1, flags2; uint8_t flags1, flags2;
#define DNS_FLAG1_RESPONSE 0x80 #define DNS_FLAG1_RESPONSE 0x80
#define DNS_FLAG1_OPCODE_STATUS 0x10 #define DNS_FLAG1_OPCODE_STATUS 0x10
#define DNS_FLAG1_OPCODE_INVERSE 0x08 #define DNS_FLAG1_OPCODE_INVERSE 0x08
@ -114,21 +114,21 @@ struct dns_hdr {
#define DNS_FLAG2_ERR_MASK 0x0f #define DNS_FLAG2_ERR_MASK 0x0f
#define DNS_FLAG2_ERR_NONE 0x00 #define DNS_FLAG2_ERR_NONE 0x00
#define DNS_FLAG2_ERR_NAME 0x03 #define DNS_FLAG2_ERR_NAME 0x03
u16_t numquestions; uint16_t numquestions;
u16_t numanswers; uint16_t numanswers;
u16_t numauthrr; uint16_t numauthrr;
u16_t numextrarr; uint16_t numextrarr;
}; };
/** \internal The DNS answer message structure. */ /** \internal The DNS answer message structure. */
struct dns_answer { struct dns_answer {
/* DNS answer record starts with either a domain name or a pointer /* DNS answer record starts with either a domain name or a pointer
to a name already present somewhere in the packet. */ to a name already present somewhere in the packet. */
u16_t type; uint16_t type;
u16_t class; uint16_t class;
u16_t ttl[2]; uint16_t ttl[2];
u16_t len; uint16_t len;
u8_t ipaddr[4]; uint8_t ipaddr[4];
}; };
struct namemap { struct namemap {
@ -137,11 +137,11 @@ struct namemap {
#define STATE_ASKING 2 #define STATE_ASKING 2
#define STATE_DONE 3 #define STATE_DONE 3
#define STATE_ERROR 4 #define STATE_ERROR 4
u8_t state; uint8_t state;
u8_t tmr; uint8_t tmr;
u8_t retries; uint8_t retries;
u8_t seqno; uint8_t seqno;
u8_t err; uint8_t err;
char name[32]; char name[32];
uip_ipaddr_t ipaddr; uip_ipaddr_t ipaddr;
}; };
@ -155,7 +155,7 @@ struct namemap {
static struct namemap names[RESOLV_ENTRIES]; static struct namemap names[RESOLV_ENTRIES];
static u8_t seqno; static uint8_t seqno;
static struct uip_udp_conn *resolv_conn = NULL; static struct uip_udp_conn *resolv_conn = NULL;
@ -276,8 +276,8 @@ newdata(void)
unsigned char *nameptr; unsigned char *nameptr;
struct dns_answer *ans; struct dns_answer *ans;
struct dns_hdr *hdr; struct dns_hdr *hdr;
static u8_t nquestions, nanswers; static uint8_t nquestions, nanswers;
static u8_t i; static uint8_t i;
register struct namemap *namemapptr; register struct namemap *namemapptr;
hdr = (struct dns_hdr *)uip_appdata; hdr = (struct dns_hdr *)uip_appdata;
@ -293,7 +293,7 @@ newdata(void)
/* The ID in the DNS header should be our entry into the name /* The ID in the DNS header should be our entry into the name
table. */ table. */
i = (u8_t)uip_htons(hdr->id); i = (uint8_t)uip_htons(hdr->id);
namemapptr = &names[i]; namemapptr = &names[i];
if(i < RESOLV_ENTRIES && if(i < RESOLV_ENTRIES &&
namemapptr->state == STATE_ASKING) { namemapptr->state == STATE_ASKING) {
@ -311,8 +311,8 @@ newdata(void)
/* We only care about the question(s) and the answers. The authrr /* We only care about the question(s) and the answers. The authrr
and the extrarr are simply discarded. */ and the extrarr are simply discarded. */
nquestions = (u8_t)uip_htons(hdr->numquestions); nquestions = (uint8_t)uip_htons(hdr->numquestions);
nanswers = (u8_t)uip_htons(hdr->numanswers); nanswers = (uint8_t)uip_htons(hdr->numanswers);
/* Skip the name in the question. XXX: This should really be /* Skip the name in the question. XXX: This should really be
checked agains the name in the question, to be sure that they checked agains the name in the question, to be sure that they
@ -417,8 +417,8 @@ PROCESS_THREAD(resolv_process, ev, data)
void void
resolv_query(const char *name) resolv_query(const char *name)
{ {
static u8_t i; static uint8_t i;
static u8_t lseq, lseqi; static uint8_t lseq, lseqi;
register struct namemap *nameptr; register struct namemap *nameptr;
lseq = lseqi = 0; lseq = lseqi = 0;
@ -466,7 +466,7 @@ resolv_query(const char *name)
uip_ipaddr_t * uip_ipaddr_t *
resolv_lookup(const char *name) resolv_lookup(const char *name)
{ {
static u8_t i; static uint8_t i;
struct namemap *nameptr; struct namemap *nameptr;
/* Walk through the list to see if the name is in there. If it is /* Walk through the list to see if the name is in there. If it is

View file

@ -50,7 +50,7 @@
#if DEBUG #if DEBUG
#include <stdio.h> #include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__) #define PRINTF(...) printf(__VA_ARGS__)
#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) #define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15])
#define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5])
#else #else
#define PRINTF(...) #define PRINTF(...)

View file

@ -59,7 +59,7 @@ const rimeaddr_t rimeaddr_null = { { 0, 0, 0, 0, 0, 0, 0, 0 } };
void void
rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *src) rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *src)
{ {
u8_t i; uint8_t i;
for(i = 0; i < RIMEADDR_SIZE; i++) { for(i = 0; i < RIMEADDR_SIZE; i++) {
dest->u8[i] = src->u8[i]; dest->u8[i] = src->u8[i];
} }
@ -68,7 +68,7 @@ rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *src)
int int
rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2) rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2)
{ {
u8_t i; uint8_t i;
for(i = 0; i < RIMEADDR_SIZE; i++) { for(i = 0; i < RIMEADDR_SIZE; i++) {
if(addr1->u8[i] != addr2->u8[i]) { if(addr1->u8[i] != addr2->u8[i]) {
return 0; return 0;

View file

@ -72,12 +72,12 @@
#define DEBUG 0 #define DEBUG 0
#if DEBUG #if DEBUG
/* PRINTFI and PRINTFO are defined for input and output to debug one without changing the timing of the other */ /* PRINTFI and PRINTFO are defined for input and output to debug one without changing the timing of the other */
u8_t p; uint8_t p;
#include <stdio.h> #include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__) #define PRINTF(...) printf(__VA_ARGS__)
#define PRINTFI(...) printf(__VA_ARGS__) #define PRINTFI(...) printf(__VA_ARGS__)
#define PRINTFO(...) printf(__VA_ARGS__) #define PRINTFO(...) printf(__VA_ARGS__)
#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) #define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15])
#define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",lladdr->addr[0], lladdr->addr[1], lladdr->addr[2], lladdr->addr[3],lladdr->addr[4], lladdr->addr[5],lladdr->addr[6], lladdr->addr[7]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",lladdr->addr[0], lladdr->addr[1], lladdr->addr[2], lladdr->addr[3],lladdr->addr[4], lladdr->addr[5],lladdr->addr[6], lladdr->addr[7])
#define PRINTPACKETBUF() PRINTF("RIME buffer: "); for(p = 0; p < packetbuf_datalen(); p++){PRINTF("%.2X", *(rime_ptr + p));} PRINTF("\n") #define PRINTPACKETBUF() PRINTF("RIME buffer: "); for(p = 0; p < packetbuf_datalen(); p++){PRINTF("%.2X", *(rime_ptr + p));} PRINTF("\n")
#define PRINTUIPBUF() PRINTF("UIP buffer: "); for(p = 0; p < uip_len; p++){PRINTF("%.2X", uip_buf[p]);}PRINTF("\n") #define PRINTUIPBUF() PRINTF("UIP buffer: "); for(p = 0; p < uip_len; p++){PRINTF("%.2X", uip_buf[p]);}PRINTF("\n")
@ -192,14 +192,14 @@ extern struct sicslowpan_nh_compressor SICSLOWPAN_NH_COMPRESSOR;
* We initialize it to the beginning of the rime buffer, then * We initialize it to the beginning of the rime buffer, then
* access different fields by updating the offset rime_hdr_len. * access different fields by updating the offset rime_hdr_len.
*/ */
static u8_t *rime_ptr; static uint8_t *rime_ptr;
/** /**
* rime_hdr_len is the total length of (the processed) 6lowpan headers * rime_hdr_len is the total length of (the processed) 6lowpan headers
* (fragment headers, IPV6 or HC1, HC2, and HC1 and HC2 non compressed * (fragment headers, IPV6 or HC1, HC2, and HC1 and HC2 non compressed
* fields). * fields).
*/ */
static u8_t rime_hdr_len; static uint8_t rime_hdr_len;
/** /**
* The length of the payload in the Rime buffer. * The length of the payload in the Rime buffer.
@ -207,13 +207,13 @@ static u8_t rime_hdr_len;
* headers (can be the IP payload if the IP header only is compressed * headers (can be the IP payload if the IP header only is compressed
* or the UDP payload if the UDP header is also compressed) * or the UDP payload if the UDP header is also compressed)
*/ */
static u8_t rime_payload_len; static uint8_t rime_payload_len;
/** /**
* uncomp_hdr_len is the length of the headers before compression (if HC2 * uncomp_hdr_len is the length of the headers before compression (if HC2
* is used this includes the UDP header in addition to the IP header). * is used this includes the UDP header in addition to the IP header).
*/ */
static u8_t uncomp_hdr_len; static uint8_t uncomp_hdr_len;
/** @} */ /** @} */
#if SICSLOWPAN_CONF_FRAG #if SICSLOWPAN_CONF_FRAG
@ -377,7 +377,7 @@ addr_context_lookup_by_prefix(uip_ipaddr_t *ipaddr)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
/** \brief find the context with the given number */ /** \brief find the context with the given number */
static struct sicslowpan_addr_context* static struct sicslowpan_addr_context*
addr_context_lookup_by_number(u8_t number) addr_context_lookup_by_number(uint8_t number)
{ {
/* Remove code to avoid warnings and save flash if no context is used */ /* Remove code to avoid warnings and save flash if no context is used */
#if SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 0 #if SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 0
@ -712,9 +712,9 @@ compress_hdr_hc06(rimeaddr_t *rime_destaddr)
*hc06_ptr = SICSLOWPAN_NHC_UDP_CS_P_11; *hc06_ptr = SICSLOWPAN_NHC_UDP_CS_P_11;
PRINTF("IPHC: remove 12 b of both source & dest with prefix 0xFOB\n"); PRINTF("IPHC: remove 12 b of both source & dest with prefix 0xFOB\n");
*(hc06_ptr + 1) = *(hc06_ptr + 1) =
(u8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) - (uint8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) -
SICSLOWPAN_UDP_4_BIT_PORT_MIN) << 4) + SICSLOWPAN_UDP_4_BIT_PORT_MIN) << 4) +
(u8_t)((UIP_HTONS(UIP_UDP_BUF->destport) - (uint8_t)((UIP_HTONS(UIP_UDP_BUF->destport) -
SICSLOWPAN_UDP_4_BIT_PORT_MIN)); SICSLOWPAN_UDP_4_BIT_PORT_MIN));
hc06_ptr += 2; hc06_ptr += 2;
} else if((UIP_HTONS(UIP_UDP_BUF->destport) & 0xff00) == SICSLOWPAN_UDP_8_BIT_PORT_MIN) { } else if((UIP_HTONS(UIP_UDP_BUF->destport) & 0xff00) == SICSLOWPAN_UDP_8_BIT_PORT_MIN) {
@ -723,7 +723,7 @@ compress_hdr_hc06(rimeaddr_t *rime_destaddr)
PRINTF("IPHC: leave source, remove 8 bits of dest with prefix 0xF0\n"); PRINTF("IPHC: leave source, remove 8 bits of dest with prefix 0xF0\n");
memcpy(hc06_ptr + 1, &UIP_UDP_BUF->srcport, 2); memcpy(hc06_ptr + 1, &UIP_UDP_BUF->srcport, 2);
*(hc06_ptr + 3) = *(hc06_ptr + 3) =
(u8_t)((UIP_HTONS(UIP_UDP_BUF->destport) - (uint8_t)((UIP_HTONS(UIP_UDP_BUF->destport) -
SICSLOWPAN_UDP_8_BIT_PORT_MIN)); SICSLOWPAN_UDP_8_BIT_PORT_MIN));
hc06_ptr += 4; hc06_ptr += 4;
} else if((UIP_HTONS(UIP_UDP_BUF->srcport) & 0xff00) == SICSLOWPAN_UDP_8_BIT_PORT_MIN) { } else if((UIP_HTONS(UIP_UDP_BUF->srcport) & 0xff00) == SICSLOWPAN_UDP_8_BIT_PORT_MIN) {
@ -731,7 +731,7 @@ compress_hdr_hc06(rimeaddr_t *rime_destaddr)
*hc06_ptr = SICSLOWPAN_NHC_UDP_CS_P_10; *hc06_ptr = SICSLOWPAN_NHC_UDP_CS_P_10;
PRINTF("IPHC: remove 8 bits of source with prefix 0xF0, leave dest. hch: %i\n", *hc06_ptr); PRINTF("IPHC: remove 8 bits of source with prefix 0xF0, leave dest. hch: %i\n", *hc06_ptr);
*(hc06_ptr + 1) = *(hc06_ptr + 1) =
(u8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) - (uint8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) -
SICSLOWPAN_UDP_8_BIT_PORT_MIN)); SICSLOWPAN_UDP_8_BIT_PORT_MIN));
memcpy(hc06_ptr + 2, &UIP_UDP_BUF->destport, 2); memcpy(hc06_ptr + 2, &UIP_UDP_BUF->destport, 2);
hc06_ptr += 4; hc06_ptr += 4;
@ -1147,9 +1147,9 @@ compress_hdr_hc1(rimeaddr_t *rime_destaddr)
RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_TTL] = UIP_IP_BUF->ttl; RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_TTL] = UIP_IP_BUF->ttl;
RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_PORTS] = RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_PORTS] =
(u8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) - (uint8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) -
SICSLOWPAN_UDP_PORT_MIN) << 4) + SICSLOWPAN_UDP_PORT_MIN) << 4) +
(u8_t)((UIP_HTONS(UIP_UDP_BUF->destport) - SICSLOWPAN_UDP_PORT_MIN)); (uint8_t)((UIP_HTONS(UIP_UDP_BUF->destport) - SICSLOWPAN_UDP_PORT_MIN));
memcpy(&RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_CHKSUM], &UIP_UDP_BUF->udpchksum, 2); memcpy(&RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_CHKSUM], &UIP_UDP_BUF->udpchksum, 2);
rime_hdr_len += SICSLOWPAN_HC1_HC_UDP_HDR_LEN; rime_hdr_len += SICSLOWPAN_HC1_HC_UDP_HDR_LEN;
uncomp_hdr_len += UIP_UDPH_LEN; uncomp_hdr_len += UIP_UDPH_LEN;

View file

@ -183,9 +183,9 @@
* offset field is just not used * offset field is just not used
*/ */
/* struct sicslowpan_frag_hdr { */ /* struct sicslowpan_frag_hdr { */
/* u16_t dispatch_size; */ /* uint16_t dispatch_size; */
/* u16_t tag; */ /* uint16_t tag; */
/* u8_t offset; */ /* uint8_t offset; */
/* }; */ /* }; */
/** /**
@ -197,21 +197,21 @@
* structure * structure
*/ */
/* struct sicslowpan_hc1_hdr { */ /* struct sicslowpan_hc1_hdr { */
/* u8_t dispatch; */ /* uint8_t dispatch; */
/* u8_t encoding; */ /* uint8_t encoding; */
/* u8_t ttl; */ /* uint8_t ttl; */
/* }; */ /* }; */
/** /**
* \brief HC1 followed by HC_UDP * \brief HC1 followed by HC_UDP
*/ */
/* struct sicslowpan_hc1_hc_udp_hdr { */ /* struct sicslowpan_hc1_hc_udp_hdr { */
/* u8_t dispatch; */ /* uint8_t dispatch; */
/* u8_t hc1_encoding; */ /* uint8_t hc1_encoding; */
/* u8_t hc_udp_encoding; */ /* uint8_t hc_udp_encoding; */
/* u8_t ttl; */ /* uint8_t ttl; */
/* u8_t ports; */ /* uint8_t ports; */
/* u16_t udpchksum; */ /* uint16_t udpchksum; */
/* }; */ /* }; */
/** /**
@ -219,9 +219,9 @@
* each context can have upto 8 bytes * each context can have upto 8 bytes
*/ */
struct sicslowpan_addr_context { struct sicslowpan_addr_context {
u8_t used; /* possibly use as prefix-length */ uint8_t used; /* possibly use as prefix-length */
u8_t number; uint8_t number;
u8_t prefix[8]; uint8_t prefix[8];
}; };
/** /**
@ -248,7 +248,7 @@ struct sicslowpan_addr_context {
* compressed multicast address is known. It is true * compressed multicast address is known. It is true
* if the 9-bit group is the all nodes or all routers * if the 9-bit group is the all nodes or all routers
* group. * group.
* \param a is typed u8_t * * \param a is typed uint8_t *
*/ */
#define sicslowpan_is_mcast_addr_decompressable(a) \ #define sicslowpan_is_mcast_addr_decompressable(a) \
(((*a & 0x01) == 0) && \ (((*a & 0x01) == 0) && \

View file

@ -76,10 +76,10 @@
#define SLIP_ESC_END 0334 #define SLIP_ESC_END 0334
#define SLIP_ESC_ESC 0335 #define SLIP_ESC_ESC 0335
static u8_t slip_buf[UIP_BUFSIZE]; static uint8_t slip_buf[UIP_BUFSIZE];
static u16_t len, tmplen; static uint16_t len, tmplen;
static u8_t lastc; static uint8_t lastc;
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
/** /**
@ -93,12 +93,12 @@ static u8_t lastc;
* \return This function will always return UIP_FW_OK. * \return This function will always return UIP_FW_OK.
*/ */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
u8_t uint8_t
slipdev_send(void) slipdev_send(void)
{ {
u16_t i; uint16_t i;
u8_t *ptr; uint8_t *ptr;
u8_t c; uint8_t c;
slipdev_char_put(SLIP_END); slipdev_char_put(SLIP_END);
@ -140,10 +140,10 @@ slipdev_send(void)
* zero if no packet is available. * zero if no packet is available.
*/ */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
u16_t uint16_t
slipdev_poll(void) slipdev_poll(void)
{ {
u8_t c; uint8_t c;
while(slipdev_char_poll(&c)) { while(slipdev_char_poll(&c)) {
switch(c) { switch(c) {

View file

@ -57,7 +57,7 @@
* *
* \param c The character to be put on the serial device. * \param c The character to be put on the serial device.
*/ */
void slipdev_char_put(u8_t c); void slipdev_char_put(uint8_t c);
/** /**
* Poll the serial device for a character. * Poll the serial device for a character.
@ -77,11 +77,11 @@ void slipdev_char_put(u8_t c);
* \retval 0 If no character is available. * \retval 0 If no character is available.
* \retval Non-zero If a character is available. * \retval Non-zero If a character is available.
*/ */
u8_t slipdev_char_poll(u8_t *c); uint8_t slipdev_char_poll(uint8_t *c);
void slipdev_init(void); void slipdev_init(void);
u8_t slipdev_send(void); uint8_t slipdev_send(void);
u16_t slipdev_poll(void); uint16_t slipdev_poll(void);
#endif /* __SLIPDEV_H__ */ #endif /* __SLIPDEV_H__ */

View file

@ -38,15 +38,15 @@
struct ip_hdr { struct ip_hdr {
/* IP header. */ /* IP header. */
u8_t vhl, uint8_t vhl,
tos, tos,
len[2], len[2],
ipid[2], ipid[2],
ipoffset[2], ipoffset[2],
ttl, ttl,
proto; proto;
u16_t ipchksum; uint16_t ipchksum;
u8_t srcipaddr[4], uint8_t srcipaddr[4],
destipaddr[4]; destipaddr[4];
}; };
@ -60,27 +60,27 @@
struct tcpip_hdr { struct tcpip_hdr {
/* IP header. */ /* IP header. */
u8_t vhl, uint8_t vhl,
tos, tos,
len[2], len[2],
ipid[2], ipid[2],
ipoffset[2], ipoffset[2],
ttl, ttl,
proto; proto;
u16_t ipchksum; uint16_t ipchksum;
u8_t srcipaddr[4], uint8_t srcipaddr[4],
destipaddr[4]; destipaddr[4];
/* TCP header. */ /* TCP header. */
u16_t srcport, uint16_t srcport,
destport; destport;
u8_t seqno[4], uint8_t seqno[4],
ackno[4], ackno[4],
tcpoffset, tcpoffset,
flags, flags,
wnd[2]; wnd[2];
u16_t tcpchksum; uint16_t tcpchksum;
u8_t urgp[2]; uint8_t urgp[2];
u8_t optdata[4]; uint8_t optdata[4];
}; };
#define ICMP_ECHO_REPLY 0 #define ICMP_ECHO_REPLY 0
@ -88,43 +88,43 @@ struct tcpip_hdr {
struct icmpip_hdr { struct icmpip_hdr {
/* IP header. */ /* IP header. */
u8_t vhl, uint8_t vhl,
tos, tos,
len[2], len[2],
ipid[2], ipid[2],
ipoffset[2], ipoffset[2],
ttl, ttl,
proto; proto;
u16_t ipchksum; uint16_t ipchksum;
u8_t srcipaddr[4], uint8_t srcipaddr[4],
destipaddr[4]; destipaddr[4];
/* The ICMP and IP headers. */ /* The ICMP and IP headers. */
/* ICMP (echo) header. */ /* ICMP (echo) header. */
u8_t type, icode; uint8_t type, icode;
u16_t icmpchksum; uint16_t icmpchksum;
u16_t id, seqno; uint16_t id, seqno;
}; };
/* The UDP and IP headers. */ /* The UDP and IP headers. */
struct udpip_hdr { struct udpip_hdr {
/* IP header. */ /* IP header. */
u8_t vhl, uint8_t vhl,
tos, tos,
len[2], len[2],
ipid[2], ipid[2],
ipoffset[2], ipoffset[2],
ttl, ttl,
proto; proto;
u16_t ipchksum; uint16_t ipchksum;
u8_t srcipaddr[4], uint8_t srcipaddr[4],
destipaddr[4]; destipaddr[4];
/* UDP header. */ /* UDP header. */
u16_t srcport, uint16_t srcport,
destport; destport;
u16_t udplen; uint16_t udplen;
u16_t udpchksum; uint16_t udpchksum;
}; };
#define ETHBUF ((struct eth_hdr *)&packet[0]) #define ETHBUF ((struct eth_hdr *)&packet[0])
@ -158,10 +158,10 @@ tcpflags(unsigned char flags, char *flagsstr)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static char * CC_FASTCALL static char * CC_FASTCALL
n(u16_t num, char *ptr) n(uint16_t num, char *ptr)
{ {
u16_t d; uint16_t d;
u8_t a, f; uint8_t a, f;
if(num == 0) { if(num == 0) {
*ptr = '0'; *ptr = '0';
@ -195,8 +195,8 @@ s(char *str, char *ptr)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int
tcpdump_format(u8_t *packet, u16_t packetlen, tcpdump_format(uint8_t *packet, uint16_t packetlen,
char *buf, u16_t buflen) char *buf, uint16_t buflen)
{ {
char flags[8]; char flags[8];
if(IPBUF->proto == UIP_PROTO_ICMP) { if(IPBUF->proto == UIP_PROTO_ICMP) {

View file

@ -35,7 +35,7 @@
#include "uip.h" #include "uip.h"
int tcpdump_format(u8_t *packet, u16_t packetlen, int tcpdump_format(uint8_t *packet, uint16_t packetlen,
char *printbuf, u16_t printbuflen); char *printbuf, uint16_t printbuflen);
#endif /* __TCPDUMP_H__ */ #endif /* __TCPDUMP_H__ */

View file

@ -90,7 +90,7 @@ extern struct etimer uip_reass_timer;
* \internal Structure for holding a TCP port and a process ID. * \internal Structure for holding a TCP port and a process ID.
*/ */
struct listenport { struct listenport {
u16_t port; uint16_t port;
struct process *p; struct process *p;
}; };
@ -109,9 +109,9 @@ enum {
/* Called on IP packet output. */ /* Called on IP packet output. */
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
static u8_t (* outputfunc)(uip_lladdr_t *a); static uint8_t (* outputfunc)(uip_lladdr_t *a);
u8_t uint8_t
tcpip_output(uip_lladdr_t *a) tcpip_output(uip_lladdr_t *a)
{ {
int ret; int ret;
@ -124,14 +124,14 @@ tcpip_output(uip_lladdr_t *a)
} }
void void
tcpip_set_outputfunc(u8_t (*f)(uip_lladdr_t *)) tcpip_set_outputfunc(uint8_t (*f)(uip_lladdr_t *))
{ {
outputfunc = f; outputfunc = f;
} }
#else #else
static u8_t (* outputfunc)(void); static uint8_t (* outputfunc)(void);
u8_t uint8_t
tcpip_output(void) tcpip_output(void)
{ {
if(outputfunc != NULL) { if(outputfunc != NULL) {
@ -142,7 +142,7 @@ tcpip_output(void)
} }
void void
tcpip_set_outputfunc(u8_t (*f)(void)) tcpip_set_outputfunc(uint8_t (*f)(void))
{ {
outputfunc = f; outputfunc = f;
} }
@ -226,7 +226,7 @@ packet_input(void)
#if UIP_TCP #if UIP_TCP
#if UIP_ACTIVE_OPEN #if UIP_ACTIVE_OPEN
struct uip_conn * struct uip_conn *
tcp_connect(uip_ipaddr_t *ripaddr, u16_t port, void *appstate) tcp_connect(uip_ipaddr_t *ripaddr, uint16_t port, void *appstate)
{ {
struct uip_conn *c; struct uip_conn *c;
@ -245,7 +245,7 @@ tcp_connect(uip_ipaddr_t *ripaddr, u16_t port, void *appstate)
#endif /* UIP_ACTIVE_OPEN */ #endif /* UIP_ACTIVE_OPEN */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
tcp_unlisten(u16_t port) tcp_unlisten(uint16_t port)
{ {
static unsigned char i; static unsigned char i;
struct listenport *l; struct listenport *l;
@ -263,7 +263,7 @@ tcp_unlisten(u16_t port)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
tcp_listen(u16_t port) tcp_listen(uint16_t port)
{ {
static unsigned char i; static unsigned char i;
struct listenport *l; struct listenport *l;
@ -306,7 +306,7 @@ udp_attach(struct uip_udp_conn *conn,
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
struct uip_udp_conn * struct uip_udp_conn *
udp_new(const uip_ipaddr_t *ripaddr, u16_t port, void *appstate) udp_new(const uip_ipaddr_t *ripaddr, uint16_t port, void *appstate)
{ {
struct uip_udp_conn *c; struct uip_udp_conn *c;
uip_udp_appstate_t *s; uip_udp_appstate_t *s;
@ -324,7 +324,7 @@ udp_new(const uip_ipaddr_t *ripaddr, u16_t port, void *appstate)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
struct uip_udp_conn * struct uip_udp_conn *
udp_broadcast_new(u16_t port, void *appstate) udp_broadcast_new(uint16_t port, void *appstate)
{ {
uip_ipaddr_t addr; uip_ipaddr_t addr;
struct uip_udp_conn *conn; struct uip_udp_conn *conn;
@ -343,7 +343,7 @@ udp_broadcast_new(u16_t port, void *appstate)
#endif /* UIP_UDP */ #endif /* UIP_UDP */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_CONF_ICMP6 #if UIP_CONF_ICMP6
u8_t uint8_t
icmp6_new(void *appstate) { icmp6_new(void *appstate) {
if(uip_icmp6_conns.appstate.p == PROCESS_NONE) { if(uip_icmp6_conns.appstate.p == PROCESS_NONE) {
uip_icmp6_conns.appstate.p = PROCESS_CURRENT(); uip_icmp6_conns.appstate.p = PROCESS_CURRENT();
@ -354,7 +354,7 @@ icmp6_new(void *appstate) {
} }
void void
tcpip_icmp6_call(u8_t type) tcpip_icmp6_call(uint8_t type)
{ {
if(uip_icmp6_conns.appstate.p != PROCESS_NONE) { if(uip_icmp6_conns.appstate.p != PROCESS_NONE) {
/* XXX: This is a hack that needs to be updated. Passing a pointer (&type) /* XXX: This is a hack that needs to be updated. Passing a pointer (&type)

View file

@ -126,7 +126,7 @@ CCIF void tcp_attach(struct uip_conn *conn,
* \param port The port number in network byte order. * \param port The port number in network byte order.
* *
*/ */
CCIF void tcp_listen(u16_t port); CCIF void tcp_listen(uint16_t port);
/** /**
* Close a listening TCP port. * Close a listening TCP port.
@ -140,7 +140,7 @@ CCIF void tcp_listen(u16_t port);
* \param port The port number in network byte order. * \param port The port number in network byte order.
* *
*/ */
CCIF void tcp_unlisten(u16_t port); CCIF void tcp_unlisten(uint16_t port);
/** /**
* Open a TCP connection to the specified IP address and port. * Open a TCP connection to the specified IP address and port.
@ -165,7 +165,7 @@ CCIF void tcp_unlisten(u16_t port);
* memory could not be allocated for the connection. * memory could not be allocated for the connection.
* *
*/ */
CCIF struct uip_conn *tcp_connect(uip_ipaddr_t *ripaddr, u16_t port, CCIF struct uip_conn *tcp_connect(uip_ipaddr_t *ripaddr, uint16_t port,
void *appstate); void *appstate);
/** /**
@ -226,7 +226,7 @@ void udp_attach(struct uip_udp_conn *conn,
* \return A pointer to the newly created connection, or NULL if * \return A pointer to the newly created connection, or NULL if
* memory could not be allocated for the connection. * memory could not be allocated for the connection.
*/ */
CCIF struct uip_udp_conn *udp_new(const uip_ipaddr_t *ripaddr, u16_t port, CCIF struct uip_udp_conn *udp_new(const uip_ipaddr_t *ripaddr, uint16_t port,
void *appstate); void *appstate);
/** /**
@ -241,7 +241,7 @@ CCIF struct uip_udp_conn *udp_new(const uip_ipaddr_t *ripaddr, u16_t port,
* \return A pointer to the newly created connection, or NULL if * \return A pointer to the newly created connection, or NULL if
* memory could not be allocated for the connection. * memory could not be allocated for the connection.
*/ */
struct uip_udp_conn *udp_broadcast_new(u16_t port, void *appstate); struct uip_udp_conn *udp_broadcast_new(uint16_t port, void *appstate);
/** /**
* Bind a UDP connection to a local port. * Bind a UDP connection to a local port.
@ -302,14 +302,14 @@ CCIF extern process_event_t tcpip_icmp6_event;
* If an application registers here, it will be polled with a * If an application registers here, it will be polled with a
* process_post_synch every time an ICMPv6 packet is received. * process_post_synch every time an ICMPv6 packet is received.
*/ */
u8_t icmp6_new(void *appstate); uint8_t icmp6_new(void *appstate);
/** /**
* This function is called at reception of an ICMPv6 packet * This function is called at reception of an ICMPv6 packet
* If an application registered as an ICMPv6 listener (with * If an application registered as an ICMPv6 listener (with
* icmp6_new), it will be called through a process_post_synch() * icmp6_new), it will be called through a process_post_synch()
*/ */
void tcpip_icmp6_call(u8_t type); void tcpip_icmp6_call(uint8_t type);
#endif /*UIP_CONF_ICMP6*/ #endif /*UIP_CONF_ICMP6*/
/** @} */ /** @} */
@ -341,11 +341,11 @@ CCIF void tcpip_input(void);
* The eventual parameter is the MAC address of the destination. * The eventual parameter is the MAC address of the destination.
*/ */
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
u8_t tcpip_output(uip_lladdr_t *); uint8_t tcpip_output(uip_lladdr_t *);
void tcpip_set_outputfunc(u8_t (* f)(uip_lladdr_t *)); void tcpip_set_outputfunc(uint8_t (* f)(uip_lladdr_t *));
#else #else
u8_t tcpip_output(void); uint8_t tcpip_output(void);
void tcpip_set_outputfunc(u8_t (* f)(void)); void tcpip_set_outputfunc(uint8_t (* f)(void));
#endif #endif
/** /**

View file

@ -54,17 +54,17 @@ struct uaodv_rtentry {
uip_ipaddr_t dest_addr; uip_ipaddr_t dest_addr;
uip_ipaddr_t next_hop; uip_ipaddr_t next_hop;
uip_ipaddr_t precursors[NUM_PRECURSORS]; uip_ipaddr_t precursors[NUM_PRECURSORS];
u32_t dest_seqno; uint32_t dest_seqno;
u16_t lifetime; uint16_t lifetime;
u8_t dest_seqno_flag; uint8_t dest_seqno_flag;
u8_t route_flags; uint8_t route_flags;
u8_t hop_count; uint8_t hop_count;
}; };
#endif #endif
/* Generic AODV message */ /* Generic AODV message */
struct uaodv_msg { struct uaodv_msg {
u8_t type; uint8_t type;
}; };
/* AODV RREQ message */ /* AODV RREQ message */
@ -76,15 +76,15 @@ struct uaodv_msg {
#define UAODV_RREQ_UNKSEQNO (1 << 3) #define UAODV_RREQ_UNKSEQNO (1 << 3)
struct uaodv_msg_rreq { struct uaodv_msg_rreq {
u8_t type; uint8_t type;
u8_t flags; uint8_t flags;
u8_t reserved; uint8_t reserved;
u8_t hop_count; uint8_t hop_count;
u32_t rreq_id; uint32_t rreq_id;
uip_ipaddr_t dest_addr; uip_ipaddr_t dest_addr;
u32_t dest_seqno; uint32_t dest_seqno;
uip_ipaddr_t orig_addr; uip_ipaddr_t orig_addr;
u32_t orig_seqno; uint32_t orig_seqno;
}; };
/* AODV RREP message */ /* AODV RREP message */
@ -93,14 +93,14 @@ struct uaodv_msg_rreq {
#define UAODV_RREP_ACK (1 << 6) #define UAODV_RREP_ACK (1 << 6)
struct uaodv_msg_rrep { struct uaodv_msg_rrep {
u8_t type; uint8_t type;
u8_t flags; uint8_t flags;
u8_t prefix_sz; /* prefix_sz:5 */ uint8_t prefix_sz; /* prefix_sz:5 */
u8_t hop_count; uint8_t hop_count;
uip_ipaddr_t dest_addr; uip_ipaddr_t dest_addr;
u32_t dest_seqno; uint32_t dest_seqno;
uip_ipaddr_t orig_addr; uip_ipaddr_t orig_addr;
u32_t lifetime; uint32_t lifetime;
}; };
/* AODV RERR message */ /* AODV RERR message */
@ -109,13 +109,13 @@ struct uaodv_msg_rrep {
#define UAODV_RERR_UNKNOWN (1 << 6) /* Non standard extension /bg. */ #define UAODV_RERR_UNKNOWN (1 << 6) /* Non standard extension /bg. */
struct uaodv_msg_rerr { struct uaodv_msg_rerr {
u8_t type; uint8_t type;
u8_t flags; uint8_t flags;
u8_t reserved; uint8_t reserved;
u8_t dest_count; uint8_t dest_count;
struct { struct {
uip_ipaddr_t addr; uip_ipaddr_t addr;
u32_t seqno; uint32_t seqno;
} unreach[1]; } unreach[1];
}; };
@ -123,23 +123,23 @@ struct uaodv_msg_rerr {
#define UAODV_RREP_ACK_TYPE 4 #define UAODV_RREP_ACK_TYPE 4
struct uaodv_msg_rrep_ack { struct uaodv_msg_rrep_ack {
u8_t type; uint8_t type;
u8_t reserved; uint8_t reserved;
}; };
#define RREP_HELLO_INTERVAL_EXT 1 /* Per RFC 3561. */ #define RREP_HELLO_INTERVAL_EXT 1 /* Per RFC 3561. */
#define RREQ_BAD_HOP_EXT 101 /* Non standard extension /bg */ #define RREQ_BAD_HOP_EXT 101 /* Non standard extension /bg */
struct uaodv_extension { struct uaodv_extension {
u8_t type; uint8_t type;
u8_t length; uint8_t length;
/* u8_t value[length]; */ /* uint8_t value[length]; */
}; };
struct uaodv_bad_hop_ext { struct uaodv_bad_hop_ext {
u8_t type; uint8_t type;
u8_t length; uint8_t length;
u8_t unused1, unused2; uint8_t unused1, unused2;
uip_ipaddr_t addrs[1]; uip_ipaddr_t addrs[1];
}; };

View file

@ -62,7 +62,7 @@ uaodv_rt_init(void)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
struct uaodv_rt_entry * struct uaodv_rt_entry *
uaodv_rt_add(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop, uaodv_rt_add(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop,
unsigned hop_count, const u32_t *seqno) unsigned hop_count, const uint32_t *seqno)
{ {
struct uaodv_rt_entry *e; struct uaodv_rt_entry *e;

View file

@ -47,14 +47,14 @@ struct uaodv_rt_entry {
struct uaodv_rt_entry *next; struct uaodv_rt_entry *next;
uip_ipaddr_t dest; uip_ipaddr_t dest;
uip_ipaddr_t nexthop; uip_ipaddr_t nexthop;
u32_t hseqno; /* In host byte order! */ uint32_t hseqno; /* In host byte order! */
u8_t hop_count; uint8_t hop_count;
u8_t is_bad; /* Only one bit is used. */ uint8_t is_bad; /* Only one bit is used. */
}; };
struct uaodv_rt_entry * struct uaodv_rt_entry *
uaodv_rt_add(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop, uaodv_rt_add(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop,
unsigned hop_count, const u32_t *seqno); unsigned hop_count, const uint32_t *seqno);
struct uaodv_rt_entry *uaodv_rt_lookup_any(uip_ipaddr_t *dest); struct uaodv_rt_entry *uaodv_rt_lookup_any(uip_ipaddr_t *dest);
struct uaodv_rt_entry *uaodv_rt_lookup(uip_ipaddr_t *dest); struct uaodv_rt_entry *uaodv_rt_lookup(uip_ipaddr_t *dest);
void uaodv_rt_remove(struct uaodv_rt_entry *e); void uaodv_rt_remove(struct uaodv_rt_entry *e);

View file

@ -62,9 +62,9 @@ PROCESS(uaodv_process, "uAODV");
static struct uip_udp_conn *bcastconn, *unicastconn; static struct uip_udp_conn *bcastconn, *unicastconn;
/* Compare sequence numbers as per RFC 3561. */ /* Compare sequence numbers as per RFC 3561. */
#define SCMP32(a, b) ((s32_t)((a) - (b))) #define SCMP32(a, b) ((int32_t)((a) - (b)))
static CC_INLINE u32_t static CC_INLINE uint32_t
last_known_seqno(uip_ipaddr_t *host) last_known_seqno(uip_ipaddr_t *host)
{ {
struct uaodv_rt_entry *route = uaodv_rt_lookup_any(host); struct uaodv_rt_entry *route = uaodv_rt_lookup_any(host);
@ -76,24 +76,24 @@ last_known_seqno(uip_ipaddr_t *host)
} }
static u32_t rreq_id, my_hseqno; /* In host byte order! */ static uint32_t rreq_id, my_hseqno; /* In host byte order! */
#define NFWCACHE 16 #define NFWCACHE 16
static struct { static struct {
uip_ipaddr_t orig; uip_ipaddr_t orig;
u32_t id; uint32_t id;
} fwcache[NFWCACHE]; } fwcache[NFWCACHE];
static CC_INLINE int static CC_INLINE int
fwc_lookup(const uip_ipaddr_t *orig, const u32_t *id) fwc_lookup(const uip_ipaddr_t *orig, const uint32_t *id)
{ {
unsigned n = (orig->u8[2] + orig->u8[3]) % NFWCACHE; unsigned n = (orig->u8[2] + orig->u8[3]) % NFWCACHE;
return fwcache[n].id == *id && uip_ipaddr_cmp(&fwcache[n].orig, orig); return fwcache[n].id == *id && uip_ipaddr_cmp(&fwcache[n].orig, orig);
} }
static CC_INLINE void static CC_INLINE void
fwc_add(const uip_ipaddr_t *orig, const u32_t *id) fwc_add(const uip_ipaddr_t *orig, const uint32_t *id)
{ {
unsigned n = (orig->u8[2] + orig->u8[3]) % NFWCACHE; unsigned n = (orig->u8[2] + orig->u8[3]) % NFWCACHE;
fwcache[n].id = *id; fwcache[n].id = *id;
@ -206,7 +206,7 @@ send_rreq(uip_ipaddr_t *addr)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
send_rrep(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop, uip_ipaddr_t *orig, send_rrep(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop, uip_ipaddr_t *orig,
u32_t *seqno, unsigned hop_count) uint32_t *seqno, unsigned hop_count)
{ {
struct uaodv_msg_rrep *rm = (struct uaodv_msg_rrep *)uip_appdata; struct uaodv_msg_rrep *rm = (struct uaodv_msg_rrep *)uip_appdata;
@ -225,7 +225,7 @@ send_rrep(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop, uip_ipaddr_t *orig,
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
send_rerr(uip_ipaddr_t *addr, u32_t *seqno) send_rerr(uip_ipaddr_t *addr, uint32_t *seqno)
{ {
struct uaodv_msg_rerr *rm = (struct uaodv_msg_rerr *)uip_appdata; struct uaodv_msg_rerr *rm = (struct uaodv_msg_rerr *)uip_appdata;
@ -284,17 +284,17 @@ handle_incoming_rreq(void)
#ifdef AODV_BAD_HOP_EXTENSION #ifdef AODV_BAD_HOP_EXTENSION
if(uip_len > (sizeof(*rm) + 2)) { if(uip_len > (sizeof(*rm) + 2)) {
struct uaodv_bad_hop_ext *ext = (void *)(uip_appdata + sizeof(*rm)); struct uaodv_bad_hop_ext *ext = (void *)(uip_appdata + sizeof(*rm));
u8_t *end = uip_appdata + uip_len; uint8_t *end = uip_appdata + uip_len;
for(; for(;
(u8_t *)ext < end; (uint8_t *)ext < end;
ext = (void *)((u8_t *)ext + ext->length + 2)) { ext = (void *)((uint8_t *)ext + ext->length + 2)) {
u8_t *eend = (u8_t *)ext + ext->length; uint8_t *eend = (uint8_t *)ext + ext->length;
if(eend > end) if(eend > end)
eend = end; eend = end;
if(ext->type == RREQ_BAD_HOP_EXT) { if(ext->type == RREQ_BAD_HOP_EXT) {
uip_ipaddr_t *a; uip_ipaddr_t *a;
for(a = ext->addrs; (u8_t *)a < eend; a++) { for(a = ext->addrs; (uint8_t *)a < eend; a++) {
if(uip_ipaddr_cmp(a, &uip_hostaddr)) { if(uip_ipaddr_cmp(a, &uip_hostaddr)) {
print_debug("BAD_HOP drop\n"); print_debug("BAD_HOP drop\n");
return; return;
@ -330,7 +330,7 @@ handle_incoming_rreq(void)
} }
if (fw != NULL) { if (fw != NULL) {
u32_t net_seqno; uint32_t net_seqno;
print_debug("RREQ for known route\n"); print_debug("RREQ for known route\n");
uip_ipaddr_copy(&dest_addr, &rm->dest_addr); uip_ipaddr_copy(&dest_addr, &rm->dest_addr);
@ -339,7 +339,7 @@ handle_incoming_rreq(void)
send_rrep(&dest_addr, &rt->nexthop, &orig_addr, &net_seqno, send_rrep(&dest_addr, &rt->nexthop, &orig_addr, &net_seqno,
fw->hop_count + 1); fw->hop_count + 1);
} else if(uip_ipaddr_cmp(&rm->dest_addr, &uip_hostaddr)) { } else if(uip_ipaddr_cmp(&rm->dest_addr, &uip_hostaddr)) {
u32_t net_seqno; uint32_t net_seqno;
print_debug("RREQ for our address\n"); print_debug("RREQ for our address\n");
uip_ipaddr_copy(&dest_addr, &rm->dest_addr); uip_ipaddr_copy(&dest_addr, &rm->dest_addr);
@ -381,7 +381,7 @@ handle_incoming_rrep(void)
/* Useless HELLO message? */ /* Useless HELLO message? */
if(uip_ipaddr_cmp(&BUF->destipaddr, &uip_broadcast_addr)) { if(uip_ipaddr_cmp(&BUF->destipaddr, &uip_broadcast_addr)) {
#ifdef AODV_RESPOND_TO_HELLOS #ifdef AODV_RESPOND_TO_HELLOS
u32_t net_seqno; uint32_t net_seqno;
#ifdef CC2420_RADIO #ifdef CC2420_RADIO
int ret = cc2420_check_remote(uip_udp_sender()->u16[1]); int ret = cc2420_check_remote(uip_udp_sender()->u16[1]);
@ -518,7 +518,7 @@ static enum {
} command; } command;
static uip_ipaddr_t bad_dest; static uip_ipaddr_t bad_dest;
static u32_t bad_seqno; /* In network byte order! */ static uint32_t bad_seqno; /* In network byte order! */
void void
uaodv_bad_dest(uip_ipaddr_t *dest) uaodv_bad_dest(uip_ipaddr_t *dest)

View file

@ -194,8 +194,8 @@ typedef struct uip_ds6_prefix {
uip_ipaddr_t ipaddr; uip_ipaddr_t ipaddr;
uint8_t length; uint8_t length;
uint8_t advertise; uint8_t advertise;
u32_t vlifetime; uint32_t vlifetime;
u32_t plifetime; uint32_t plifetime;
uint8_t l_a_reserved; /**< on-link and autonomous flags + 6 reserved bits */ uint8_t l_a_reserved; /**< on-link and autonomous flags + 6 reserved bits */
} uip_ds6_prefix_t; } uip_ds6_prefix_t;
#else /* UIP_CONF_ROUTER */ #else /* UIP_CONF_ROUTER */

View file

@ -76,45 +76,45 @@ static struct uip_fw_netif *defaultnetif = NULL;
struct tcpip_hdr { struct tcpip_hdr {
/* IP header. */ /* IP header. */
u8_t vhl, uint8_t vhl,
tos; tos;
u16_t len, uint16_t len,
ipid, ipid,
ipoffset; ipoffset;
u8_t ttl, uint8_t ttl,
proto; proto;
u16_t ipchksum; uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr; uip_ipaddr_t srcipaddr, destipaddr;
/* TCP header. */ /* TCP header. */
u16_t srcport, uint16_t srcport,
destport; destport;
u8_t seqno[4], uint8_t seqno[4],
ackno[4], ackno[4],
tcpoffset, tcpoffset,
flags, flags,
wnd[2]; wnd[2];
u16_t tcpchksum; uint16_t tcpchksum;
u8_t urgp[2]; uint8_t urgp[2];
u8_t optdata[4]; uint8_t optdata[4];
}; };
struct icmpip_hdr { struct icmpip_hdr {
/* IP header. */ /* IP header. */
u8_t vhl, uint8_t vhl,
tos, tos,
len[2], len[2],
ipid[2], ipid[2],
ipoffset[2], ipoffset[2],
ttl, ttl,
proto; proto;
u16_t ipchksum; uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr; uip_ipaddr_t srcipaddr, destipaddr;
/* ICMP (echo) header. */ /* ICMP (echo) header. */
u8_t type, icode; uint8_t type, icode;
u16_t icmpchksum; uint16_t icmpchksum;
u16_t id, seqno; uint16_t id, seqno;
u8_t payload[1]; uint8_t payload[1];
}; };
/* ICMP ECHO. */ /* ICMP ECHO. */
@ -138,20 +138,20 @@ struct icmpip_hdr {
* duplicate packets. * duplicate packets.
*/ */
struct fwcache_entry { struct fwcache_entry {
u16_t timer; uint16_t timer;
uip_ipaddr_t srcipaddr; uip_ipaddr_t srcipaddr;
uip_ipaddr_t destipaddr; uip_ipaddr_t destipaddr;
u16_t ipid; uint16_t ipid;
u8_t proto; uint8_t proto;
u8_t unused; uint8_t unused;
#if notdef #if notdef
u16_t payload[2]; uint16_t payload[2];
#endif #endif
#if UIP_REASSEMBLY > 0 #if UIP_REASSEMBLY > 0
u16_t len, offset; uint16_t len, offset;
#endif #endif
}; };
@ -242,7 +242,7 @@ time_exceeded(void)
/* Calculate the ICMP checksum. */ /* Calculate the ICMP checksum. */
ICMPBUF->icmpchksum = 0; ICMPBUF->icmpchksum = 0;
ICMPBUF->icmpchksum = ~uip_chksum((u16_t *)&(ICMPBUF->type), 36); ICMPBUF->icmpchksum = ~uip_chksum((uint16_t *)&(ICMPBUF->type), 36);
/* Set the IP destination address to be the source address of the /* Set the IP destination address to be the source address of the
original packet. */ original packet. */
@ -255,7 +255,7 @@ time_exceeded(void)
IP header (20) = 56. */ IP header (20) = 56. */
uip_len = 56; uip_len = 56;
ICMPBUF->len[0] = 0; ICMPBUF->len[0] = 0;
ICMPBUF->len[1] = (u8_t)uip_len; ICMPBUF->len[1] = (uint8_t)uip_len;
/* Fill in the other fields in the IP header. */ /* Fill in the other fields in the IP header. */
ICMPBUF->vhl = 0x45; ICMPBUF->vhl = 0x45;
@ -351,7 +351,7 @@ find_netif(void)
* function is passed unmodified as a return value. * function is passed unmodified as a return value.
*/ */
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
u8_t uint8_t
uip_fw_output(void) uip_fw_output(void)
{ {
struct uip_fw_netif *netif; struct uip_fw_netif *netif;
@ -400,7 +400,7 @@ uip_fw_output(void)
* the packet should be processed locally. * the packet should be processed locally.
*/ */
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
u8_t uint8_t
uip_fw_forward(void) uip_fw_forward(void)
{ {
struct fwcache_entry *fw; struct fwcache_entry *fw;

View file

@ -56,7 +56,7 @@ struct uip_fw_netif {
linked in a list. */ linked in a list. */
uip_ipaddr_t ipaddr; /**< The IP address of this interface. */ uip_ipaddr_t ipaddr; /**< The IP address of this interface. */
uip_ipaddr_t netmask; /**< The netmask of the interface. */ uip_ipaddr_t netmask; /**< The netmask of the interface. */
u8_t (* output)(void); uint8_t (* output)(void);
/**< A pointer to the function that /**< A pointer to the function that
sends a packet. */ sends a packet. */
}; };
@ -93,8 +93,8 @@ struct uip_fw_netif {
* \hideinitializer * \hideinitializer
*/ */
#define uip_fw_setipaddr(netif, addr) \ #define uip_fw_setipaddr(netif, addr) \
do { (netif)->ipaddr[0] = ((u16_t *)(addr))[0]; \ do { (netif)->ipaddr[0] = ((uint16_t *)(addr))[0]; \
(netif)->ipaddr[1] = ((u16_t *)(addr))[1]; } while(0) (netif)->ipaddr[1] = ((uint16_t *)(addr))[1]; } while(0)
/** /**
* Set the netmask of a network interface. * Set the netmask of a network interface.
* *
@ -105,12 +105,12 @@ struct uip_fw_netif {
* \hideinitializer * \hideinitializer
*/ */
#define uip_fw_setnetmask(netif, addr) \ #define uip_fw_setnetmask(netif, addr) \
do { (netif)->netmask[0] = ((u16_t *)(addr))[0]; \ do { (netif)->netmask[0] = ((uint16_t *)(addr))[0]; \
(netif)->netmask[1] = ((u16_t *)(addr))[1]; } while(0) (netif)->netmask[1] = ((uint16_t *)(addr))[1]; } while(0)
void uip_fw_init(void); void uip_fw_init(void);
u8_t uip_fw_forward(void); uint8_t uip_fw_forward(void);
u8_t uip_fw_output(void); uint8_t uip_fw_output(void);
void uip_fw_register(struct uip_fw_netif *netif); void uip_fw_register(struct uip_fw_netif *netif);
void uip_fw_default(struct uip_fw_netif *netif); void uip_fw_default(struct uip_fw_netif *netif);
void uip_fw_periodic(void); void uip_fw_periodic(void);

View file

@ -50,7 +50,7 @@
#if DEBUG #if DEBUG
#include <stdio.h> #include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__) #define PRINTF(...) printf(__VA_ARGS__)
#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) #define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15])
#define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",lladdr->addr[0], lladdr->addr[1], lladdr->addr[2], lladdr->addr[3],lladdr->addr[4], lladdr->addr[5]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",lladdr->addr[0], lladdr->addr[1], lladdr->addr[2], lladdr->addr[3],lladdr->addr[4], lladdr->addr[5])
#else #else
#define PRINTF(...) #define PRINTF(...)
@ -75,7 +75,7 @@ void
uip_icmp6_echo_request_input(void) uip_icmp6_echo_request_input(void)
{ {
#if UIP_CONF_IPV6_RPL #if UIP_CONF_IPV6_RPL
u8_t temp_ext_len; uint8_t temp_ext_len;
#endif /* UIP_CONF_IPV6_RPL */ #endif /* UIP_CONF_IPV6_RPL */
/* /*
* we send an echo reply. It is trivial if there was no extension * we send an echo reply. It is trivial if there was no extension
@ -159,7 +159,7 @@ uip_icmp6_echo_request_input(void)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
uip_icmp6_error_output(u8_t type, u8_t code, u32_t param) { uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param) {
/* check if originating packet is not an ICMP error*/ /* check if originating packet is not an ICMP error*/
if (uip_ext_len) { if (uip_ext_len) {

View file

@ -99,7 +99,7 @@
/** \brief ICMPv6 Error message constant part */ /** \brief ICMPv6 Error message constant part */
typedef struct uip_icmp6_error{ typedef struct uip_icmp6_error{
u32_t param; uint32_t param;
} uip_icmp6_error; } uip_icmp6_error;
/** \name ICMPv6 RFC4443 Message processing and sending */ /** \name ICMPv6 RFC4443 Message processing and sending */
@ -120,7 +120,7 @@ uip_icmp6_echo_request_input(void);
* \param type 32 bit parameter of the error message, semantic depends on error * \param type 32 bit parameter of the error message, semantic depends on error
*/ */
void void
uip_icmp6_error_output(u8_t type, u8_t code, u32_t param); uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param);
/** /**
* \brief Send an icmpv6 message * \brief Send an icmpv6 message

View file

@ -154,7 +154,7 @@ uip_nd6_ns_input(void)
PRINTF("\n"); PRINTF("\n");
UIP_STAT(++uip_stat.nd6.recv); UIP_STAT(++uip_stat.nd6.recv);
u8_t flags; uint8_t flags;
#if UIP_CONF_IPV6_CHECKS #if UIP_CONF_IPV6_CHECKS
if((UIP_IP_BUF->ttl != UIP_ND6_HOP_LIMIT) || if((UIP_IP_BUF->ttl != UIP_ND6_HOP_LIMIT) ||
@ -403,11 +403,11 @@ uip_nd6_na_input(void)
* booleans. the three last one are not 0 or 1 but 0 or 0x80, 0x40, 0x20 * booleans. the three last one are not 0 or 1 but 0 or 0x80, 0x40, 0x20
* but it works. Be careful though, do not use tests such as is_router == 1 * but it works. Be careful though, do not use tests such as is_router == 1
*/ */
u8_t is_llchange = 0; uint8_t is_llchange = 0;
u8_t is_router = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_ROUTER)); uint8_t is_router = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_ROUTER));
u8_t is_solicited = uint8_t is_solicited =
((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_SOLICITED)); ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_SOLICITED));
u8_t is_override = uint8_t is_override =
((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_OVERRIDE)); ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_OVERRIDE));
#if UIP_CONF_IPV6_CHECKS #if UIP_CONF_IPV6_CHECKS

View file

@ -55,7 +55,7 @@
struct neighbor_entry { struct neighbor_entry {
uip_ipaddr_t ipaddr; uip_ipaddr_t ipaddr;
struct uip_neighbor_addr addr; struct uip_neighbor_addr addr;
u8_t time; uint8_t time;
}; };
static struct neighbor_entry entries[ENTRIES]; static struct neighbor_entry entries[ENTRIES];
@ -86,7 +86,7 @@ void
uip_neighbor_add(uip_ipaddr_t *ipaddr, struct uip_neighbor_addr *addr) uip_neighbor_add(uip_ipaddr_t *ipaddr, struct uip_neighbor_addr *addr)
{ {
int i, oldest; int i, oldest;
u8_t oldest_time; uint8_t oldest_time;
/* printf("Adding neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n", /* printf("Adding neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n",
addr->addr.addr[0], addr->addr.addr[1], addr->addr.addr[2], addr->addr.addr[3], addr->addr.addr[0], addr->addr.addr[1], addr->addr.addr[2], addr->addr.addr[3],

View file

@ -196,7 +196,7 @@ uip_over_mesh_make_announced_gateway(void)
const static struct trickle_callbacks trickle_call = {gateway_announce_recv}; const static struct trickle_callbacks trickle_call = {gateway_announce_recv};
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
uip_over_mesh_init(u16_t channels) uip_over_mesh_init(uint16_t channels)
{ {
PRINTF("Our address is %d.%d (%d.%d.%d.%d)\n", PRINTF("Our address is %d.%d (%d.%d.%d.%d)\n",
@ -215,7 +215,7 @@ uip_over_mesh_init(u16_t channels)
route_set_lifetime(30); route_set_lifetime(30);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
u8_t uint8_t
uip_over_mesh_send(void) uip_over_mesh_send(void)
{ {
rimeaddr_t receiver; rimeaddr_t receiver;

View file

@ -45,8 +45,8 @@
#include "net/uip-fw.h" #include "net/uip-fw.h"
#include "net/rime.h" #include "net/rime.h"
void uip_over_mesh_init(u16_t channels); void uip_over_mesh_init(uint16_t channels);
u8_t uip_over_mesh_send(void); uint8_t uip_over_mesh_send(void);
void uip_over_mesh_set_gateway_netif(struct uip_fw_netif *netif); void uip_over_mesh_set_gateway_netif(struct uip_fw_netif *netif);
void uip_over_mesh_set_gateway(rimeaddr_t *gw); void uip_over_mesh_set_gateway(rimeaddr_t *gw);

View file

@ -49,7 +49,7 @@ void
uip_split_output(void) uip_split_output(void)
{ {
#if UIP_TCP #if UIP_TCP
u16_t tcplen, len1, len2; uint16_t tcplen, len1, len2;
/* We only try to split maximum sized TCP segments. */ /* We only try to split maximum sized TCP segments. */
if(BUF->proto == UIP_PROTO_TCP && if(BUF->proto == UIP_PROTO_TCP &&
@ -111,7 +111,7 @@ uip_split_output(void)
#endif /* UIP_CONF_IPV6 */ #endif /* UIP_CONF_IPV6 */
/* uip_appdata += len1;*/ /* uip_appdata += len1;*/
memcpy(uip_appdata, (u8_t *)uip_appdata + len1, len2); memcpy(uip_appdata, (uint8_t *)uip_appdata + len1, len2);
uip_add32(BUF->seqno, len1); uip_add32(BUF->seqno, len1);
BUF->seqno[0] = uip_acc32[0]; BUF->seqno[0] = uip_acc32[0];

View file

@ -40,7 +40,7 @@
#include "contiki-conf.h" #include "contiki-conf.h"
extern u16_t uip_slen; extern uint16_t uip_slen;
#include "net/uip-udp-packet.h" #include "net/uip-udp-packet.h"

View file

@ -138,15 +138,15 @@ void *uip_sappdata; /* The uip_appdata pointer points to
void *uip_urgdata; /* The uip_urgdata pointer points to void *uip_urgdata; /* The uip_urgdata pointer points to
urgent data (out-of-band data), if urgent data (out-of-band data), if
present. */ present. */
u16_t uip_urglen, uip_surglen; uint16_t uip_urglen, uip_surglen;
#endif /* UIP_URGDATA > 0 */ #endif /* UIP_URGDATA > 0 */
u16_t uip_len, uip_slen; uint16_t uip_len, uip_slen;
/* The uip_len is either 8 or 16 bits, /* The uip_len is either 8 or 16 bits,
depending on the maximum packet depending on the maximum packet
size. */ size. */
u8_t uip_flags; /* The uip_flags variable is used for uint8_t uip_flags; /* The uip_flags variable is used for
communication between the TCP/IP stack communication between the TCP/IP stack
and the application program. */ and the application program. */
struct uip_conn *uip_conn; /* uip_conn always points to the current struct uip_conn *uip_conn; /* uip_conn always points to the current
@ -155,7 +155,7 @@ struct uip_conn *uip_conn; /* uip_conn always points to the current
struct uip_conn uip_conns[UIP_CONNS]; struct uip_conn uip_conns[UIP_CONNS];
/* The uip_conns array holds all TCP /* The uip_conns array holds all TCP
connections. */ connections. */
u16_t uip_listenports[UIP_LISTENPORTS]; uint16_t uip_listenports[UIP_LISTENPORTS];
/* The uip_listenports list all currently /* The uip_listenports list all currently
listning ports. */ listning ports. */
#if UIP_UDP #if UIP_UDP
@ -163,24 +163,24 @@ struct uip_udp_conn *uip_udp_conn;
struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS]; struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];
#endif /* UIP_UDP */ #endif /* UIP_UDP */
static u16_t ipid; /* Ths ipid variable is an increasing static uint16_t ipid; /* Ths ipid variable is an increasing
number that is used for the IP ID number that is used for the IP ID
field. */ field. */
void uip_setipid(u16_t id) { ipid = id; } void uip_setipid(uint16_t id) { ipid = id; }
static u8_t iss[4]; /* The iss variable is used for the TCP static uint8_t iss[4]; /* The iss variable is used for the TCP
initial sequence number. */ initial sequence number. */
#if UIP_ACTIVE_OPEN || UIP_UDP #if UIP_ACTIVE_OPEN || UIP_UDP
static u16_t lastport; /* Keeps track of the last port used for static uint16_t lastport; /* Keeps track of the last port used for
a new connection. */ a new connection. */
#endif /* UIP_ACTIVE_OPEN || UIP_UDP */ #endif /* UIP_ACTIVE_OPEN || UIP_UDP */
/* Temporary variables. */ /* Temporary variables. */
u8_t uip_acc32[4]; uint8_t uip_acc32[4];
static u8_t c, opt; static uint8_t c, opt;
static u16_t tmp16; static uint16_t tmp16;
/* Structures and definitions. */ /* Structures and definitions. */
#define TCP_FIN 0x01 #define TCP_FIN 0x01
@ -238,7 +238,7 @@ void uip_log(char *msg);
#if ! UIP_ARCH_ADD32 #if ! UIP_ARCH_ADD32
void void
uip_add32(u8_t *op32, u16_t op16) uip_add32(uint8_t *op32, uint16_t op16)
{ {
uip_acc32[3] = op32[3] + (op16 & 0xff); uip_acc32[3] = op32[3] + (op16 & 0xff);
uip_acc32[2] = op32[2] + (op16 >> 8); uip_acc32[2] = op32[2] + (op16 >> 8);
@ -268,12 +268,12 @@ uip_add32(u8_t *op32, u16_t op16)
#if ! UIP_ARCH_CHKSUM #if ! UIP_ARCH_CHKSUM
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static u16_t static uint16_t
chksum(u16_t sum, const u8_t *data, u16_t len) chksum(uint16_t sum, const uint8_t *data, uint16_t len)
{ {
u16_t t; uint16_t t;
const u8_t *dataptr; const uint8_t *dataptr;
const u8_t *last_byte; const uint8_t *last_byte;
dataptr = data; dataptr = data;
last_byte = data + len - 1; last_byte = data + len - 1;
@ -299,17 +299,17 @@ chksum(u16_t sum, const u8_t *data, u16_t len)
return sum; return sum;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
u16_t uint16_t
uip_chksum(u16_t *data, u16_t len) uip_chksum(uint16_t *data, uint16_t len)
{ {
return uip_htons(chksum(0, (u8_t *)data, len)); return uip_htons(chksum(0, (uint8_t *)data, len));
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#ifndef UIP_ARCH_IPCHKSUM #ifndef UIP_ARCH_IPCHKSUM
u16_t uint16_t
uip_ipchksum(void) uip_ipchksum(void)
{ {
u16_t sum; uint16_t sum;
sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN); sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN);
DEBUG_PRINTF("uip_ipchksum: sum 0x%04x\n", sum); DEBUG_PRINTF("uip_ipchksum: sum 0x%04x\n", sum);
@ -317,16 +317,16 @@ uip_ipchksum(void)
} }
#endif #endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static u16_t static uint16_t
upper_layer_chksum(u8_t proto) upper_layer_chksum(uint8_t proto)
{ {
u16_t upper_layer_len; uint16_t upper_layer_len;
u16_t sum; uint16_t sum;
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]); upper_layer_len = (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]);
#else /* UIP_CONF_IPV6 */ #else /* UIP_CONF_IPV6 */
upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN; upper_layer_len = (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN;
#endif /* UIP_CONF_IPV6 */ #endif /* UIP_CONF_IPV6 */
/* First sum pseudoheader. */ /* First sum pseudoheader. */
@ -334,7 +334,7 @@ upper_layer_chksum(u8_t proto)
/* IP protocol and length fields. This addition cannot carry. */ /* IP protocol and length fields. This addition cannot carry. */
sum = upper_layer_len + proto; sum = upper_layer_len + proto;
/* Sum IP source and destination addresses. */ /* Sum IP source and destination addresses. */
sum = chksum(sum, (u8_t *)&BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); sum = chksum(sum, (uint8_t *)&BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t));
/* Sum TCP header and data. */ /* Sum TCP header and data. */
sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN], sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN],
@ -344,7 +344,7 @@ upper_layer_chksum(u8_t proto)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
u16_t uint16_t
uip_icmp6chksum(void) uip_icmp6chksum(void)
{ {
return upper_layer_chksum(UIP_PROTO_ICMP6); return upper_layer_chksum(UIP_PROTO_ICMP6);
@ -352,14 +352,14 @@ uip_icmp6chksum(void)
} }
#endif /* UIP_CONF_IPV6 */ #endif /* UIP_CONF_IPV6 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
u16_t uint16_t
uip_tcpchksum(void) uip_tcpchksum(void)
{ {
return upper_layer_chksum(UIP_PROTO_TCP); return upper_layer_chksum(UIP_PROTO_TCP);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_UDP_CHECKSUMS #if UIP_UDP_CHECKSUMS
u16_t uint16_t
uip_udpchksum(void) uip_udpchksum(void)
{ {
return upper_layer_chksum(UIP_PROTO_UDP); return upper_layer_chksum(UIP_PROTO_UDP);
@ -396,7 +396,7 @@ uip_init(void)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_ACTIVE_OPEN #if UIP_ACTIVE_OPEN
struct uip_conn * struct uip_conn *
uip_connect(uip_ipaddr_t *ripaddr, u16_t rport) uip_connect(uip_ipaddr_t *ripaddr, uint16_t rport)
{ {
register struct uip_conn *conn, *cconn; register struct uip_conn *conn, *cconn;
@ -462,7 +462,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_UDP #if UIP_UDP
struct uip_udp_conn * struct uip_udp_conn *
uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport) uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport)
{ {
register struct uip_udp_conn *conn; register struct uip_udp_conn *conn;
@ -507,7 +507,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
#endif /* UIP_UDP */ #endif /* UIP_UDP */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
uip_unlisten(u16_t port) uip_unlisten(uint16_t port)
{ {
for(c = 0; c < UIP_LISTENPORTS; ++c) { for(c = 0; c < UIP_LISTENPORTS; ++c) {
if(uip_listenports[c] == port) { if(uip_listenports[c] == port) {
@ -518,7 +518,7 @@ uip_unlisten(u16_t port)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
uip_listen(u16_t port) uip_listen(uint16_t port)
{ {
for(c = 0; c < UIP_LISTENPORTS; ++c) { for(c = 0; c < UIP_LISTENPORTS; ++c) {
if(uip_listenports[c] == 0) { if(uip_listenports[c] == 0) {
@ -532,22 +532,22 @@ uip_listen(u16_t port)
#if UIP_REASSEMBLY && !UIP_CONF_IPV6 #if UIP_REASSEMBLY && !UIP_CONF_IPV6
#define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN) #define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN)
static u8_t uip_reassbuf[UIP_REASS_BUFSIZE]; static uint8_t uip_reassbuf[UIP_REASS_BUFSIZE];
static u8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)]; static uint8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)];
static const u8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f, static const uint8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f,
0x0f, 0x07, 0x03, 0x01}; 0x0f, 0x07, 0x03, 0x01};
static u16_t uip_reasslen; static uint16_t uip_reasslen;
static u8_t uip_reassflags; static uint8_t uip_reassflags;
#define UIP_REASS_FLAG_LASTFRAG 0x01 #define UIP_REASS_FLAG_LASTFRAG 0x01
static u8_t uip_reasstmr; static uint8_t uip_reasstmr;
#define IP_MF 0x20 #define IP_MF 0x20
static u8_t static uint8_t
uip_reass(void) uip_reass(void)
{ {
u16_t offset, len; uint16_t offset, len;
u16_t i; uint16_t i;
/* If ip_reasstmr is zero, no packet is present in the buffer, so we /* If ip_reasstmr is zero, no packet is present in the buffer, so we
write the IP header of the fragment into the reassembly write the IP header of the fragment into the reassembly
@ -633,7 +633,7 @@ uip_reass(void)
/* Check the last byte in the bitmap. It should contain just the /* Check the last byte in the bitmap. It should contain just the
right amount of bits. */ right amount of bits. */
if(uip_reassbitmap[uip_reasslen / (8 * 8)] != if(uip_reassbitmap[uip_reasslen / (8 * 8)] !=
(u8_t)~bitmap_bits[uip_reasslen / 8 & 7]) { (uint8_t)~bitmap_bits[uip_reasslen / 8 & 7]) {
goto nullreturn; goto nullreturn;
} }
@ -661,7 +661,7 @@ uip_reass(void)
#endif /* UIP_REASSEMBLY */ #endif /* UIP_REASSEMBLY */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
uip_add_rcv_nxt(u16_t n) uip_add_rcv_nxt(uint16_t n)
{ {
uip_add32(uip_conn->rcv_nxt, n); uip_add32(uip_conn->rcv_nxt, n);
uip_conn->rcv_nxt[0] = uip_acc32[0]; uip_conn->rcv_nxt[0] = uip_acc32[0];
@ -671,7 +671,7 @@ uip_add_rcv_nxt(u16_t n)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
uip_process(u8_t flag) uip_process(uint8_t flag)
{ {
register struct uip_conn *uip_connr = uip_conn; register struct uip_conn *uip_connr = uip_conn;
@ -1143,7 +1143,7 @@ uip_process(u8_t flag)
/* Calculate the ICMP checksum. */ /* Calculate the ICMP checksum. */
ICMPBUF->icmpchksum = 0; ICMPBUF->icmpchksum = 0;
ICMPBUF->icmpchksum = ~uip_chksum((u16_t *)&(ICMPBUF->type), 36); ICMPBUF->icmpchksum = ~uip_chksum((uint16_t *)&(ICMPBUF->type), 36);
/* Set the IP destination address to be the source address of the /* Set the IP destination address to be the source address of the
original packet. */ original packet. */
@ -1156,7 +1156,7 @@ uip_process(u8_t flag)
size of the IP header (20) = 56. */ size of the IP header (20) = 56. */
uip_len = 36 + UIP_IPH_LEN; uip_len = 36 + UIP_IPH_LEN;
ICMPBUF->len[0] = 0; ICMPBUF->len[0] = 0;
ICMPBUF->len[1] = (u8_t)uip_len; ICMPBUF->len[1] = (uint8_t)uip_len;
ICMPBUF->ttl = UIP_TTL; ICMPBUF->ttl = UIP_TTL;
ICMPBUF->proto = UIP_PROTO_ICMP; ICMPBUF->proto = UIP_PROTO_ICMP;
@ -1386,8 +1386,8 @@ uip_process(u8_t flag)
} else if(opt == TCP_OPT_MSS && } else if(opt == TCP_OPT_MSS &&
uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) { uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) {
/* An MSS option with the right option length. */ /* An MSS option with the right option length. */
tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) | tmp16 = ((uint16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
(u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c]; (uint16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];
uip_connr->initialmss = uip_connr->mss = uip_connr->initialmss = uip_connr->mss =
tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16; tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;
@ -1675,7 +1675,7 @@ uip_process(u8_t flag)
and the application will retransmit it. This is called the and the application will retransmit it. This is called the
"persistent timer" and uses the retransmission mechanim. "persistent timer" and uses the retransmission mechanim.
*/ */
tmp16 = ((u16_t)BUF->wnd[0] << 8) + (u16_t)BUF->wnd[1]; tmp16 = ((uint16_t)BUF->wnd[0] << 8) + (uint16_t)BUF->wnd[1];
if(tmp16 > uip_connr->initialmss || if(tmp16 > uip_connr->initialmss ||
tmp16 == 0) { tmp16 == 0) {
tmp16 = uip_connr->initialmss; tmp16 = uip_connr->initialmss;
@ -1938,14 +1938,14 @@ uip_process(u8_t flag)
return; return;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
u16_t uint16_t
uip_htons(u16_t val) uip_htons(uint16_t val)
{ {
return UIP_HTONS(val); return UIP_HTONS(val);
} }
u32_t uint32_t
uip_htonl(u32_t val) uip_htonl(uint32_t val)
{ {
return UIP_HTONL(val); return UIP_HTONL(val);
} }

View file

@ -62,17 +62,17 @@
*/ */
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
typedef union uip_ip6addr_t { typedef union uip_ip6addr_t {
u8_t u8[16]; /* Initializer, must come first!!! */ uint8_t u8[16]; /* Initializer, must come first!!! */
u16_t u16[8]; uint16_t u16[8];
} uip_ip6addr_t; } uip_ip6addr_t;
typedef uip_ip6addr_t uip_ipaddr_t; typedef uip_ip6addr_t uip_ipaddr_t;
#else /* UIP_CONF_IPV6 */ #else /* UIP_CONF_IPV6 */
typedef union uip_ip4addr_t { typedef union uip_ip4addr_t {
u8_t u8[4]; /* Initializer, must come first!!! */ uint8_t u8[4]; /* Initializer, must come first!!! */
u16_t u16[2]; uint16_t u16[2];
#if 0 #if 0
u32_t u32; uint32_t u32;
#endif #endif
} uip_ip4addr_t; } uip_ip4addr_t;
typedef uip_ip4addr_t uip_ipaddr_t; typedef uip_ip4addr_t uip_ipaddr_t;
@ -83,21 +83,21 @@ typedef uip_ip4addr_t uip_ipaddr_t;
/** \brief 16 bit 802.15.4 address */ /** \brief 16 bit 802.15.4 address */
typedef struct uip_802154_shortaddr { typedef struct uip_802154_shortaddr {
u8_t addr[2]; uint8_t addr[2];
} uip_802154_shortaddr; } uip_802154_shortaddr;
/** \brief 64 bit 802.15.4 address */ /** \brief 64 bit 802.15.4 address */
typedef struct uip_802154_longaddr { typedef struct uip_802154_longaddr {
u8_t addr[8]; uint8_t addr[8];
} uip_802154_longaddr; } uip_802154_longaddr;
/** \brief 802.11 address */ /** \brief 802.11 address */
typedef struct uip_80211_addr { typedef struct uip_80211_addr {
u8_t addr[6]; uint8_t addr[6];
} uip_80211_addr; } uip_80211_addr;
/** \brief 802.3 address */ /** \brief 802.3 address */
typedef struct uip_eth_addr { typedef struct uip_eth_addr {
u8_t addr[6]; uint8_t addr[6];
} uip_eth_addr; } uip_eth_addr;
@ -245,7 +245,7 @@ void uip_init(void);
* *
* This function may be used at boot time to set the initial ip_id. * This function may be used at boot time to set the initial ip_id.
*/ */
void uip_setipid(u16_t id); void uip_setipid(uint16_t id);
/** @} */ /** @} */
@ -512,7 +512,7 @@ CCIF extern uip_buf_t uip_aligned_buf;
* *
* \param port A 16-bit port number in network byte order. * \param port A 16-bit port number in network byte order.
*/ */
void uip_listen(u16_t port); void uip_listen(uint16_t port);
/** /**
* Stop listening to the specified port. * Stop listening to the specified port.
@ -526,7 +526,7 @@ void uip_listen(u16_t port);
* *
* \param port A 16-bit port number in network byte order. * \param port A 16-bit port number in network byte order.
*/ */
void uip_unlisten(u16_t port); void uip_unlisten(uint16_t port);
/** /**
* Connect to a remote host using TCP. * Connect to a remote host using TCP.
@ -560,7 +560,7 @@ void uip_unlisten(u16_t port);
* or NULL if no connection could be allocated. * or NULL if no connection could be allocated.
* *
*/ */
struct uip_conn *uip_connect(uip_ipaddr_t *ripaddr, u16_t port); struct uip_conn *uip_connect(uip_ipaddr_t *ripaddr, uint16_t port);
@ -828,7 +828,7 @@ CCIF void uip_send(const void *data, int len);
* \return The uip_udp_conn structure for the new connection, or NULL * \return The uip_udp_conn structure for the new connection, or NULL
* if no connection could be allocated. * if no connection could be allocated.
*/ */
struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport); struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport);
/** /**
* Remove a UDP connection. * Remove a UDP connection.
@ -1043,10 +1043,10 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
*/ */
#if !UIP_CONF_IPV6 #if !UIP_CONF_IPV6
#define uip_ipaddr_maskcmp(addr1, addr2, mask) \ #define uip_ipaddr_maskcmp(addr1, addr2, mask) \
(((((u16_t *)addr1)[0] & ((u16_t *)mask)[0]) == \ (((((uint16_t *)addr1)[0] & ((uint16_t *)mask)[0]) == \
(((u16_t *)addr2)[0] & ((u16_t *)mask)[0])) && \ (((uint16_t *)addr2)[0] & ((uint16_t *)mask)[0])) && \
((((u16_t *)addr1)[1] & ((u16_t *)mask)[1]) == \ ((((uint16_t *)addr1)[1] & ((uint16_t *)mask)[1]) == \
(((u16_t *)addr2)[1] & ((u16_t *)mask)[1]))) (((uint16_t *)addr2)[1] & ((uint16_t *)mask)[1])))
#else #else
#define uip_ipaddr_prefixcmp(addr1, addr2, length) (memcmp(addr1, addr2, length>>3) == 0) #define uip_ipaddr_prefixcmp(addr1, addr2, length) (memcmp(addr1, addr2, length>>3) == 0)
#endif #endif
@ -1095,8 +1095,8 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
* \hideinitializer * \hideinitializer
*/ */
#define uip_ipaddr_mask(dest, src, mask) do { \ #define uip_ipaddr_mask(dest, src, mask) do { \
((u16_t *)dest)[0] = ((u16_t *)src)[0] & ((u16_t *)mask)[0]; \ ((uint16_t *)dest)[0] = ((uint16_t *)src)[0] & ((uint16_t *)mask)[0]; \
((u16_t *)dest)[1] = ((u16_t *)src)[1] & ((u16_t *)mask)[1]; \ ((uint16_t *)dest)[1] = ((uint16_t *)src)[1] & ((uint16_t *)mask)[1]; \
} while(0) } while(0)
/** /**
@ -1107,7 +1107,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
* Example: * Example:
\code \code
uip_ipaddr_t ipaddr; uip_ipaddr_t ipaddr;
u8_t octet; uint8_t octet;
uip_ipaddr(&ipaddr, 1,2,3,4); uip_ipaddr(&ipaddr, 1,2,3,4);
octet = uip_ipaddr1(&ipaddr); octet = uip_ipaddr1(&ipaddr);
@ -1127,7 +1127,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
* Example: * Example:
\code \code
uip_ipaddr_t ipaddr; uip_ipaddr_t ipaddr;
u8_t octet; uint8_t octet;
uip_ipaddr(&ipaddr, 1,2,3,4); uip_ipaddr(&ipaddr, 1,2,3,4);
octet = uip_ipaddr2(&ipaddr); octet = uip_ipaddr2(&ipaddr);
@ -1147,7 +1147,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
* Example: * Example:
\code \code
uip_ipaddr_t ipaddr; uip_ipaddr_t ipaddr;
u8_t octet; uint8_t octet;
uip_ipaddr(&ipaddr, 1,2,3,4); uip_ipaddr(&ipaddr, 1,2,3,4);
octet = uip_ipaddr3(&ipaddr); octet = uip_ipaddr3(&ipaddr);
@ -1167,7 +1167,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
* Example: * Example:
\code \code
uip_ipaddr_t ipaddr; uip_ipaddr_t ipaddr;
u8_t octet; uint8_t octet;
uip_ipaddr(&ipaddr, 1,2,3,4); uip_ipaddr(&ipaddr, 1,2,3,4);
octet = uip_ipaddr4(&ipaddr); octet = uip_ipaddr4(&ipaddr);
@ -1193,8 +1193,8 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
# define UIP_HTONS(n) (n) # define UIP_HTONS(n) (n)
# define UIP_HTONL(n) (n) # define UIP_HTONL(n) (n)
# else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */ # else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
# define UIP_HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8)) # define UIP_HTONS(n) (uint16_t)((((uint16_t) (n)) << 8) | (((uint16_t) (n)) >> 8))
# define UIP_HTONL(n) (((u32_t)UIP_HTONS(n) << 16) | UIP_HTONS((u32_t)(n) >> 16)) # define UIP_HTONL(n) (((uint32_t)UIP_HTONS(n) << 16) | UIP_HTONS((uint32_t)(n) >> 16))
# endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */ # endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
#else #else
#error "UIP_HTONS already defined!" #error "UIP_HTONS already defined!"
@ -1208,14 +1208,14 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
* network byte order, use the UIP_HTONS() macro instead. * network byte order, use the UIP_HTONS() macro instead.
*/ */
#ifndef uip_htons #ifndef uip_htons
CCIF u16_t uip_htons(u16_t val); CCIF uint16_t uip_htons(uint16_t val);
#endif /* uip_htons */ #endif /* uip_htons */
#ifndef uip_ntohs #ifndef uip_ntohs
#define uip_ntohs uip_htons #define uip_ntohs uip_htons
#endif #endif
#ifndef uip_htonl #ifndef uip_htonl
CCIF u32_t uip_htonl(u32_t val); CCIF uint32_t uip_htonl(uint32_t val);
#endif /* uip_htonl */ #endif /* uip_htonl */
#ifndef uip_ntohl #ifndef uip_ntohl
#define uip_ntohl uip_htonl #define uip_ntohl uip_htonl
@ -1233,7 +1233,7 @@ CCIF u32_t uip_htonl(u32_t val);
CCIF extern void *uip_appdata; CCIF extern void *uip_appdata;
#if UIP_URGDATA > 0 #if UIP_URGDATA > 0
/* u8_t *uip_urgdata: /* uint8_t *uip_urgdata:
* *
* This pointer points to any urgent data that has been received. Only * This pointer points to any urgent data that has been received. Only
* present if compiled with support for urgent data (UIP_URGDATA). * present if compiled with support for urgent data (UIP_URGDATA).
@ -1265,16 +1265,16 @@ extern void *uip_urgdata;
* packet. * packet.
* *
*/ */
CCIF extern u16_t uip_len; CCIF extern uint16_t uip_len;
/** /**
* The length of the extension headers * The length of the extension headers
*/ */
extern u8_t uip_ext_len; extern uint8_t uip_ext_len;
/** @} */ /** @} */
#if UIP_URGDATA > 0 #if UIP_URGDATA > 0
extern u16_t uip_urglen, uip_surglen; extern uint16_t uip_urglen, uip_surglen;
#endif /* UIP_URGDATA > 0 */ #endif /* UIP_URGDATA > 0 */
@ -1291,27 +1291,27 @@ extern u16_t uip_urglen, uip_surglen;
struct uip_conn { struct uip_conn {
uip_ipaddr_t ripaddr; /**< The IP address of the remote host. */ uip_ipaddr_t ripaddr; /**< The IP address of the remote host. */
u16_t lport; /**< The local TCP port, in network byte order. */ uint16_t lport; /**< The local TCP port, in network byte order. */
u16_t rport; /**< The local remote TCP port, in network byte uint16_t rport; /**< The local remote TCP port, in network byte
order. */ order. */
u8_t rcv_nxt[4]; /**< The sequence number that we expect to uint8_t rcv_nxt[4]; /**< The sequence number that we expect to
receive next. */ receive next. */
u8_t snd_nxt[4]; /**< The sequence number that was last sent by uint8_t snd_nxt[4]; /**< The sequence number that was last sent by
us. */ us. */
u16_t len; /**< Length of the data that was previously sent. */ uint16_t len; /**< Length of the data that was previously sent. */
u16_t mss; /**< Current maximum segment size for the uint16_t mss; /**< Current maximum segment size for the
connection. */ connection. */
u16_t initialmss; /**< Initial maximum segment size for the uint16_t initialmss; /**< Initial maximum segment size for the
connection. */ connection. */
u8_t sa; /**< Retransmission time-out calculation state uint8_t sa; /**< Retransmission time-out calculation state
variable. */ variable. */
u8_t sv; /**< Retransmission time-out calculation state uint8_t sv; /**< Retransmission time-out calculation state
variable. */ variable. */
u8_t rto; /**< Retransmission time-out. */ uint8_t rto; /**< Retransmission time-out. */
u8_t tcpstateflags; /**< TCP state and flags. */ uint8_t tcpstateflags; /**< TCP state and flags. */
u8_t timer; /**< The retransmission timer. */ uint8_t timer; /**< The retransmission timer. */
u8_t nrtx; /**< The number of retransmissions for the last uint8_t nrtx; /**< The number of retransmissions for the last
segment sent. */ segment sent. */
/** The application state. */ /** The application state. */
@ -1340,7 +1340,7 @@ CCIF extern struct uip_conn uip_conns[UIP_CONNS];
/** /**
* 4-byte array used for the 32-bit sequence number calculations. * 4-byte array used for the 32-bit sequence number calculations.
*/ */
extern u8_t uip_acc32[4]; extern uint8_t uip_acc32[4];
/** @} */ /** @} */
/** /**
@ -1348,9 +1348,9 @@ extern u8_t uip_acc32[4];
*/ */
struct uip_udp_conn { struct uip_udp_conn {
uip_ipaddr_t ripaddr; /**< The IP address of the remote peer. */ uip_ipaddr_t ripaddr; /**< The IP address of the remote peer. */
u16_t lport; /**< The local port number in network byte order. */ uint16_t lport; /**< The local port number in network byte order. */
u16_t rport; /**< The remote port number in network byte order. */ uint16_t rport; /**< The remote port number in network byte order. */
u8_t ttl; /**< Default time-to-live. */ uint8_t ttl; /**< Default time-to-live. */
/** The application state. */ /** The application state. */
uip_udp_appstate_t appstate; uip_udp_appstate_t appstate;
@ -1467,13 +1467,13 @@ struct uip_stats {
/* u8_t uip_flags: /* uint8_t uip_flags:
* *
* When the application is called, uip_flags will contain the flags * When the application is called, uip_flags will contain the flags
* that are defined in this file. Please read below for more * that are defined in this file. Please read below for more
* information. * information.
*/ */
CCIF extern u8_t uip_flags; CCIF extern uint8_t uip_flags;
/* The following flags may be set in the global variable uip_flags /* The following flags may be set in the global variable uip_flags
before calling the application callback. The UIP_ACKDATA, before calling the application callback. The UIP_ACKDATA,
@ -1518,14 +1518,14 @@ CCIF extern u8_t uip_flags;
* \retval 1: drop pkt * \retval 1: drop pkt
* \retval 2: ICMP error message to send * \retval 2: ICMP error message to send
*/ */
/*static u8_t /*static uint8_t
uip_ext_hdr_options_process(); */ uip_ext_hdr_options_process(); */
/* uip_process(flag): /* uip_process(flag):
* *
* The actual uIP function which does all the work. * The actual uIP function which does all the work.
*/ */
void uip_process(u8_t flag); void uip_process(uint8_t flag);
/* The following flags are passed as an argument to the uip_process() /* The following flags are passed as an argument to the uip_process()
function. They are used to distinguish between the two cases where function. They are used to distinguish between the two cases where
@ -1567,67 +1567,67 @@ void uip_process(u8_t flag);
struct uip_tcpip_hdr { struct uip_tcpip_hdr {
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
/* IPv6 header. */ /* IPv6 header. */
u8_t vtc, uint8_t vtc,
tcflow; tcflow;
u16_t flow; uint16_t flow;
u8_t len[2]; uint8_t len[2];
u8_t proto, ttl; uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr; uip_ip6addr_t srcipaddr, destipaddr;
#else /* UIP_CONF_IPV6 */ #else /* UIP_CONF_IPV6 */
/* IPv4 header. */ /* IPv4 header. */
u8_t vhl, uint8_t vhl,
tos, tos,
len[2], len[2],
ipid[2], ipid[2],
ipoffset[2], ipoffset[2],
ttl, ttl,
proto; proto;
u16_t ipchksum; uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr; uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */ #endif /* UIP_CONF_IPV6 */
/* TCP header. */ /* TCP header. */
u16_t srcport, uint16_t srcport,
destport; destport;
u8_t seqno[4], uint8_t seqno[4],
ackno[4], ackno[4],
tcpoffset, tcpoffset,
flags, flags,
wnd[2]; wnd[2];
u16_t tcpchksum; uint16_t tcpchksum;
u8_t urgp[2]; uint8_t urgp[2];
u8_t optdata[4]; uint8_t optdata[4];
}; };
/* The ICMP and IP headers. */ /* The ICMP and IP headers. */
struct uip_icmpip_hdr { struct uip_icmpip_hdr {
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
/* IPv6 header. */ /* IPv6 header. */
u8_t vtc, uint8_t vtc,
tcf; tcf;
u16_t flow; uint16_t flow;
u8_t len[2]; uint8_t len[2];
u8_t proto, ttl; uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr; uip_ip6addr_t srcipaddr, destipaddr;
#else /* UIP_CONF_IPV6 */ #else /* UIP_CONF_IPV6 */
/* IPv4 header. */ /* IPv4 header. */
u8_t vhl, uint8_t vhl,
tos, tos,
len[2], len[2],
ipid[2], ipid[2],
ipoffset[2], ipoffset[2],
ttl, ttl,
proto; proto;
u16_t ipchksum; uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr; uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */ #endif /* UIP_CONF_IPV6 */
/* ICMP header. */ /* ICMP header. */
u8_t type, icode; uint8_t type, icode;
u16_t icmpchksum; uint16_t icmpchksum;
#if !UIP_CONF_IPV6 #if !UIP_CONF_IPV6
u16_t id, seqno; uint16_t id, seqno;
u8_t payload[1]; uint8_t payload[1];
#endif /* !UIP_CONF_IPV6 */ #endif /* !UIP_CONF_IPV6 */
}; };
@ -1636,30 +1636,30 @@ struct uip_icmpip_hdr {
struct uip_udpip_hdr { struct uip_udpip_hdr {
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
/* IPv6 header. */ /* IPv6 header. */
u8_t vtc, uint8_t vtc,
tcf; tcf;
u16_t flow; uint16_t flow;
u8_t len[2]; uint8_t len[2];
u8_t proto, ttl; uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr; uip_ip6addr_t srcipaddr, destipaddr;
#else /* UIP_CONF_IPV6 */ #else /* UIP_CONF_IPV6 */
/* IP header. */ /* IP header. */
u8_t vhl, uint8_t vhl,
tos, tos,
len[2], len[2],
ipid[2], ipid[2],
ipoffset[2], ipoffset[2],
ttl, ttl,
proto; proto;
u16_t ipchksum; uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr; uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */ #endif /* UIP_CONF_IPV6 */
/* UDP header. */ /* UDP header. */
u16_t srcport, uint16_t srcport,
destport; destport;
u16_t udplen; uint16_t udplen;
u16_t udpchksum; uint16_t udpchksum;
}; };
/* /*
@ -1671,22 +1671,22 @@ struct uip_udpip_hdr {
struct uip_ip_hdr { struct uip_ip_hdr {
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
/* IPV6 header */ /* IPV6 header */
u8_t vtc; uint8_t vtc;
u8_t tcflow; uint8_t tcflow;
u16_t flow; uint16_t flow;
u8_t len[2]; uint8_t len[2];
u8_t proto, ttl; uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr; uip_ip6addr_t srcipaddr, destipaddr;
#else /* UIP_CONF_IPV6 */ #else /* UIP_CONF_IPV6 */
/* IPV4 header */ /* IPV4 header */
u8_t vhl, uint8_t vhl,
tos, tos,
len[2], len[2],
ipid[2], ipid[2],
ipoffset[2], ipoffset[2],
ttl, ttl,
proto; proto;
u16_t ipchksum; uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr; uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */ #endif /* UIP_CONF_IPV6 */
}; };
@ -1714,20 +1714,20 @@ struct uip_ip_hdr {
*/ */
/* common header part */ /* common header part */
typedef struct uip_ext_hdr { typedef struct uip_ext_hdr {
u8_t next; uint8_t next;
u8_t len; uint8_t len;
} uip_ext_hdr; } uip_ext_hdr;
/* Hop by Hop option header */ /* Hop by Hop option header */
typedef struct uip_hbho_hdr { typedef struct uip_hbho_hdr {
u8_t next; uint8_t next;
u8_t len; uint8_t len;
} uip_hbho_hdr; } uip_hbho_hdr;
/* destination option header */ /* destination option header */
typedef struct uip_desto_hdr { typedef struct uip_desto_hdr {
u8_t next; uint8_t next;
u8_t len; uint8_t len;
} uip_desto_hdr; } uip_desto_hdr;
/* We do not define structures for PAD1 and PADN options */ /* We do not define structures for PAD1 and PADN options */
@ -1741,18 +1741,18 @@ typedef struct uip_desto_hdr {
* parse the 4 first bytes * parse the 4 first bytes
*/ */
typedef struct uip_routing_hdr { typedef struct uip_routing_hdr {
u8_t next; uint8_t next;
u8_t len; uint8_t len;
u8_t routing_type; uint8_t routing_type;
u8_t seg_left; uint8_t seg_left;
} uip_routing_hdr; } uip_routing_hdr;
/* fragmentation header */ /* fragmentation header */
typedef struct uip_frag_hdr { typedef struct uip_frag_hdr {
u8_t next; uint8_t next;
u8_t res; uint8_t res;
u16_t offsetresmore; uint16_t offsetresmore;
u32_t id; uint32_t id;
} uip_frag_hdr; } uip_frag_hdr;
/* /*
@ -1760,57 +1760,57 @@ typedef struct uip_frag_hdr {
* it contains type an length, which is true for all options but PAD1 * it contains type an length, which is true for all options but PAD1
*/ */
typedef struct uip_ext_hdr_opt { typedef struct uip_ext_hdr_opt {
u8_t type; uint8_t type;
u8_t len; uint8_t len;
} uip_ext_hdr_opt; } uip_ext_hdr_opt;
/* PADN option */ /* PADN option */
typedef struct uip_ext_hdr_opt_padn { typedef struct uip_ext_hdr_opt_padn {
u8_t opt_type; uint8_t opt_type;
u8_t opt_len; uint8_t opt_len;
} uip_ext_hdr_opt_padn; } uip_ext_hdr_opt_padn;
#if UIP_CONF_IPV6_RPL #if UIP_CONF_IPV6_RPL
/* RPL option */ /* RPL option */
typedef struct uip_ext_hdr_opt_rpl { typedef struct uip_ext_hdr_opt_rpl {
u8_t opt_type; uint8_t opt_type;
u8_t opt_len; uint8_t opt_len;
u8_t flags; uint8_t flags;
u8_t instance; uint8_t instance;
u16_t senderrank; uint16_t senderrank;
} uip_ext_hdr_opt_rpl; } uip_ext_hdr_opt_rpl;
#endif /* UIP_CONF_IPV6_RPL */ #endif /* UIP_CONF_IPV6_RPL */
/* TCP header */ /* TCP header */
struct uip_tcp_hdr { struct uip_tcp_hdr {
u16_t srcport; uint16_t srcport;
u16_t destport; uint16_t destport;
u8_t seqno[4]; uint8_t seqno[4];
u8_t ackno[4]; uint8_t ackno[4];
u8_t tcpoffset; uint8_t tcpoffset;
u8_t flags; uint8_t flags;
u8_t wnd[2]; uint8_t wnd[2];
u16_t tcpchksum; uint16_t tcpchksum;
u8_t urgp[2]; uint8_t urgp[2];
u8_t optdata[4]; uint8_t optdata[4];
}; };
/* The ICMP headers. */ /* The ICMP headers. */
struct uip_icmp_hdr { struct uip_icmp_hdr {
u8_t type, icode; uint8_t type, icode;
u16_t icmpchksum; uint16_t icmpchksum;
#if !UIP_CONF_IPV6 #if !UIP_CONF_IPV6
u16_t id, seqno; uint16_t id, seqno;
#endif /* !UIP_CONF_IPV6 */ #endif /* !UIP_CONF_IPV6 */
}; };
/* The UDP headers. */ /* The UDP headers. */
struct uip_udp_hdr { struct uip_udp_hdr {
u16_t srcport; uint16_t srcport;
u16_t destport; uint16_t destport;
u16_t udplen; uint16_t udplen;
u16_t udpchksum; uint16_t udpchksum;
}; };
@ -1863,7 +1863,7 @@ struct uip_udp_hdr {
* *
* When processing extension headers, we should record somehow which one we * When processing extension headers, we should record somehow which one we
* see, because you cannot have twice the same header, except for destination * see, because you cannot have twice the same header, except for destination
* We store all this in one u8_t bitmap one bit for each header expected. The * We store all this in one uint8_t bitmap one bit for each header expected. The
* order in the bitmap is the order recommended in RFC2460 * order in the bitmap is the order recommended in RFC2460
*/ */
#define UIP_EXT_HDR_BITMAP_HBHO 0x01 #define UIP_EXT_HDR_BITMAP_HBHO 0x01
@ -2148,7 +2148,7 @@ CCIF extern uip_lladdr_t uip_lladdr;
* *
* \return The Internet checksum of the buffer. * \return The Internet checksum of the buffer.
*/ */
u16_t uip_chksum(u16_t *buf, u16_t len); uint16_t uip_chksum(uint16_t *buf, uint16_t len);
/** /**
* Calculate the IP header checksum of the packet header in uip_buf. * Calculate the IP header checksum of the packet header in uip_buf.
@ -2159,7 +2159,7 @@ u16_t uip_chksum(u16_t *buf, u16_t len);
* \return The IP header checksum of the IP header in the uip_buf * \return The IP header checksum of the IP header in the uip_buf
* buffer. * buffer.
*/ */
u16_t uip_ipchksum(void); uint16_t uip_ipchksum(void);
/** /**
* Calculate the TCP checksum of the packet in uip_buf and uip_appdata. * Calculate the TCP checksum of the packet in uip_buf and uip_appdata.
@ -2170,7 +2170,7 @@ u16_t uip_ipchksum(void);
* \return The TCP checksum of the TCP segment in uip_buf and pointed * \return The TCP checksum of the TCP segment in uip_buf and pointed
* to by uip_appdata. * to by uip_appdata.
*/ */
u16_t uip_tcpchksum(void); uint16_t uip_tcpchksum(void);
/** /**
* Calculate the UDP checksum of the packet in uip_buf and uip_appdata. * Calculate the UDP checksum of the packet in uip_buf and uip_appdata.
@ -2181,14 +2181,14 @@ u16_t uip_tcpchksum(void);
* \return The UDP checksum of the UDP segment in uip_buf and pointed * \return The UDP checksum of the UDP segment in uip_buf and pointed
* to by uip_appdata. * to by uip_appdata.
*/ */
u16_t uip_udpchksum(void); uint16_t uip_udpchksum(void);
/** /**
* Calculate the ICMP checksum of the packet in uip_buf. * Calculate the ICMP checksum of the packet in uip_buf.
* *
* \return The ICMP checksum of the ICMP packet in uip_buf * \return The ICMP checksum of the ICMP packet in uip_buf
*/ */
u16_t uip_icmp6chksum(void); uint16_t uip_icmp6chksum(void);
#endif /* __UIP_H__ */ #endif /* __UIP_H__ */

View file

@ -125,16 +125,16 @@ uip_lladdr_t uip_lladdr = {{0x00,0x06,0x98,0x00,0x02,0x32}};
* field in the header before the fragmentation header, hence we need a pointer * field in the header before the fragmentation header, hence we need a pointer
* to this field. * to this field.
*/ */
u8_t *uip_next_hdr; uint8_t *uip_next_hdr;
/** \brief bitmap we use to record which IPv6 headers we have already seen */ /** \brief bitmap we use to record which IPv6 headers we have already seen */
u8_t uip_ext_bitmap = 0; uint8_t uip_ext_bitmap = 0;
/** /**
* \brief length of the extension headers read. updated each time we process * \brief length of the extension headers read. updated each time we process
* a header * a header
*/ */
u8_t uip_ext_len = 0; uint8_t uip_ext_len = 0;
/** \brief length of the header options read */ /** \brief length of the header options read */
u8_t uip_ext_opt_offset = 0; uint8_t uip_ext_opt_offset = 0;
/** @} */ /** @} */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -176,11 +176,11 @@ void *uip_sappdata;
#if UIP_URGDATA > 0 #if UIP_URGDATA > 0
/* The uip_urgdata pointer points to urgent data (out-of-band data), if present */ /* The uip_urgdata pointer points to urgent data (out-of-band data), if present */
void *uip_urgdata; void *uip_urgdata;
u16_t uip_urglen, uip_surglen; uint16_t uip_urglen, uip_surglen;
#endif /* UIP_URGDATA > 0 */ #endif /* UIP_URGDATA > 0 */
/* The uip_len is either 8 or 16 bits, depending on the maximum packet size.*/ /* The uip_len is either 8 or 16 bits, depending on the maximum packet size.*/
u16_t uip_len, uip_slen; uint16_t uip_len, uip_slen;
/** @} */ /** @} */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -189,19 +189,19 @@ u16_t uip_len, uip_slen;
/* The uip_flags variable is used for communication between the TCP/IP stack /* The uip_flags variable is used for communication between the TCP/IP stack
and the application program. */ and the application program. */
u8_t uip_flags; uint8_t uip_flags;
/* uip_conn always points to the current connection (set to NULL for UDP). */ /* uip_conn always points to the current connection (set to NULL for UDP). */
struct uip_conn *uip_conn; struct uip_conn *uip_conn;
/* Temporary variables. */ /* Temporary variables. */
#if (UIP_TCP || UIP_UDP) #if (UIP_TCP || UIP_UDP)
static u8_t c; static uint8_t c;
#endif #endif
#if UIP_ACTIVE_OPEN || UIP_UDP #if UIP_ACTIVE_OPEN || UIP_UDP
/* Keeps track of the last port used for a new connection. */ /* Keeps track of the last port used for a new connection. */
static u16_t lastport; static uint16_t lastport;
#endif /* UIP_ACTIVE_OPEN || UIP_UDP */ #endif /* UIP_ACTIVE_OPEN || UIP_UDP */
/** @} */ /** @} */
@ -234,15 +234,15 @@ static u16_t lastport;
struct uip_conn uip_conns[UIP_CONNS]; struct uip_conn uip_conns[UIP_CONNS];
/* The uip_listenports list all currently listning ports. */ /* The uip_listenports list all currently listning ports. */
u16_t uip_listenports[UIP_LISTENPORTS]; uint16_t uip_listenports[UIP_LISTENPORTS];
/* The iss variable is used for the TCP initial sequence number. */ /* The iss variable is used for the TCP initial sequence number. */
static u8_t iss[4]; static uint8_t iss[4];
/* Temporary variables. */ /* Temporary variables. */
u8_t uip_acc32[4]; uint8_t uip_acc32[4];
static u8_t opt; static uint8_t opt;
static u16_t tmp16; static uint16_t tmp16;
#endif /* UIP_TCP */ #endif /* UIP_TCP */
/** @} */ /** @} */
@ -268,7 +268,7 @@ struct uip_icmp6_conn uip_icmp6_conns;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if (!UIP_ARCH_ADD32 && UIP_TCP) #if (!UIP_ARCH_ADD32 && UIP_TCP)
void void
uip_add32(u8_t *op32, u16_t op16) uip_add32(uint8_t *op32, uint16_t op16)
{ {
uip_acc32[3] = op32[3] + (op16 & 0xff); uip_acc32[3] = op32[3] + (op16 & 0xff);
uip_acc32[2] = op32[2] + (op16 >> 8); uip_acc32[2] = op32[2] + (op16 >> 8);
@ -298,12 +298,12 @@ uip_add32(u8_t *op32, u16_t op16)
#if ! UIP_ARCH_CHKSUM #if ! UIP_ARCH_CHKSUM
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static u16_t static uint16_t
chksum(u16_t sum, const u8_t *data, u16_t len) chksum(uint16_t sum, const uint8_t *data, uint16_t len)
{ {
u16_t t; uint16_t t;
const u8_t *dataptr; const uint8_t *dataptr;
const u8_t *last_byte; const uint8_t *last_byte;
dataptr = data; dataptr = data;
last_byte = data + len - 1; last_byte = data + len - 1;
@ -329,17 +329,17 @@ chksum(u16_t sum, const u8_t *data, u16_t len)
return sum; return sum;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
u16_t uint16_t
uip_chksum(u16_t *data, u16_t len) uip_chksum(uint16_t *data, uint16_t len)
{ {
return uip_htons(chksum(0, (u8_t *)data, len)); return uip_htons(chksum(0, (uint8_t *)data, len));
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#ifndef UIP_ARCH_IPCHKSUM #ifndef UIP_ARCH_IPCHKSUM
u16_t uint16_t
uip_ipchksum(void) uip_ipchksum(void)
{ {
u16_t sum; uint16_t sum;
sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN); sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN);
PRINTF("uip_ipchksum: sum 0x%04x\n", sum); PRINTF("uip_ipchksum: sum 0x%04x\n", sum);
@ -347,8 +347,8 @@ uip_ipchksum(void)
} }
#endif #endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static u16_t static uint16_t
upper_layer_chksum(u8_t proto) upper_layer_chksum(uint8_t proto)
{ {
/* gcc 4.4.0 - 4.6.1 (maybe 4.3...) with -Os on 8 bit CPUS incorrectly compiles: /* gcc 4.4.0 - 4.6.1 (maybe 4.3...) with -Os on 8 bit CPUS incorrectly compiles:
* int bar (int); * int bar (int);
@ -359,10 +359,10 @@ upper_layer_chksum(u8_t proto)
* upper_layer_len triggers this bug unless it is declared volatile. * upper_layer_len triggers this bug unless it is declared volatile.
* See https://sourceforge.net/apps/mantisbt/contiki/view.php?id=3 * See https://sourceforge.net/apps/mantisbt/contiki/view.php?id=3
*/ */
volatile u16_t upper_layer_len; volatile uint16_t upper_layer_len;
u16_t sum; uint16_t sum;
upper_layer_len = (((u16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1] - uip_ext_len); upper_layer_len = (((uint16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1] - uip_ext_len);
PRINTF("Upper layer checksum len: %d from: %d\n", upper_layer_len, PRINTF("Upper layer checksum len: %d from: %d\n", upper_layer_len,
UIP_IPH_LEN + UIP_LLH_LEN + uip_ext_len); UIP_IPH_LEN + UIP_LLH_LEN + uip_ext_len);
@ -371,7 +371,7 @@ upper_layer_chksum(u8_t proto)
/* IP protocol and length fields. This addition cannot carry. */ /* IP protocol and length fields. This addition cannot carry. */
sum = upper_layer_len + proto; sum = upper_layer_len + proto;
/* Sum IP source and destination addresses. */ /* Sum IP source and destination addresses. */
sum = chksum(sum, (u8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); sum = chksum(sum, (uint8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t));
/* Sum TCP header and data. */ /* Sum TCP header and data. */
sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN + uip_ext_len], sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN + uip_ext_len],
@ -380,7 +380,7 @@ upper_layer_chksum(u8_t proto)
return (sum == 0) ? 0xffff : uip_htons(sum); return (sum == 0) ? 0xffff : uip_htons(sum);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
u16_t uint16_t
uip_icmp6chksum(void) uip_icmp6chksum(void)
{ {
return upper_layer_chksum(UIP_PROTO_ICMP6); return upper_layer_chksum(UIP_PROTO_ICMP6);
@ -388,7 +388,7 @@ uip_icmp6chksum(void)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_TCP #if UIP_TCP
u16_t uint16_t
uip_tcpchksum(void) uip_tcpchksum(void)
{ {
return upper_layer_chksum(UIP_PROTO_TCP); return upper_layer_chksum(UIP_PROTO_TCP);
@ -396,7 +396,7 @@ uip_tcpchksum(void)
#endif /* UIP_TCP */ #endif /* UIP_TCP */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_UDP && UIP_UDP_CHECKSUMS #if UIP_UDP && UIP_UDP_CHECKSUMS
u16_t uint16_t
uip_udpchksum(void) uip_udpchksum(void)
{ {
return upper_layer_chksum(UIP_PROTO_UDP); return upper_layer_chksum(UIP_PROTO_UDP);
@ -432,7 +432,7 @@ uip_init(void)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_TCP && UIP_ACTIVE_OPEN #if UIP_TCP && UIP_ACTIVE_OPEN
struct uip_conn * struct uip_conn *
uip_connect(uip_ipaddr_t *ripaddr, u16_t rport) uip_connect(uip_ipaddr_t *ripaddr, uint16_t rport)
{ {
register struct uip_conn *conn, *cconn; register struct uip_conn *conn, *cconn;
@ -528,7 +528,7 @@ remove_ext_hdr(void)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_UDP #if UIP_UDP
struct uip_udp_conn * struct uip_udp_conn *
uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport) uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport)
{ {
register struct uip_udp_conn *conn; register struct uip_udp_conn *conn;
@ -573,7 +573,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_TCP #if UIP_TCP
void void
uip_unlisten(u16_t port) uip_unlisten(uint16_t port)
{ {
for(c = 0; c < UIP_LISTENPORTS; ++c) { for(c = 0; c < UIP_LISTENPORTS; ++c) {
if(uip_listenports[c] == port) { if(uip_listenports[c] == port) {
@ -584,7 +584,7 @@ uip_unlisten(u16_t port)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
uip_listen(u16_t port) uip_listen(uint16_t port)
{ {
for(c = 0; c < UIP_LISTENPORTS; ++c) { for(c = 0; c < UIP_LISTENPORTS; ++c) {
if(uip_listenports[c] == 0) { if(uip_listenports[c] == 0) {
@ -599,15 +599,15 @@ uip_listen(u16_t port)
#if UIP_CONF_IPV6_REASSEMBLY #if UIP_CONF_IPV6_REASSEMBLY
#define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN) #define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN)
static u8_t uip_reassbuf[UIP_REASS_BUFSIZE]; static uint8_t uip_reassbuf[UIP_REASS_BUFSIZE];
static u8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)]; static uint8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)];
/*the first byte of an IP fragment is aligned on an 8-byte boundary */ /*the first byte of an IP fragment is aligned on an 8-byte boundary */
static const u8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f, static const uint8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f,
0x0f, 0x07, 0x03, 0x01}; 0x0f, 0x07, 0x03, 0x01};
static u16_t uip_reasslen; static uint16_t uip_reasslen;
static u8_t uip_reassflags; static uint8_t uip_reassflags;
#define UIP_REASS_FLAG_LASTFRAG 0x01 #define UIP_REASS_FLAG_LASTFRAG 0x01
#define UIP_REASS_FLAG_FIRSTFRAG 0x02 #define UIP_REASS_FLAG_FIRSTFRAG 0x02
@ -625,19 +625,19 @@ static u8_t uip_reassflags;
struct etimer uip_reass_timer; /* timer for reassembly */ struct etimer uip_reass_timer; /* timer for reassembly */
u8_t uip_reass_on; /* equal to 1 if we are currently reassembling a packet */ uint8_t uip_reass_on; /* equal to 1 if we are currently reassembling a packet */
static u32_t uip_id; /* For every packet that is to be fragmented, the source static uint32_t uip_id; /* For every packet that is to be fragmented, the source
node generates an Identification value that is present node generates an Identification value that is present
in all the fragments */ in all the fragments */
#define IP_MF 0x0001 #define IP_MF 0x0001
static u16_t static uint16_t
uip_reass(void) uip_reass(void)
{ {
u16_t offset=0; uint16_t offset=0;
u16_t len; uint16_t len;
u16_t i; uint16_t i;
/* If ip_reasstmr is zero, no packet is present in the buffer */ /* If ip_reasstmr is zero, no packet is present in the buffer */
/* We first write the unfragmentable part of IP header into the reassembly /* We first write the unfragmentable part of IP header into the reassembly
@ -753,7 +753,7 @@ uip_reass(void)
/* Check the last byte in the bitmap. It should contain just the /* Check the last byte in the bitmap. It should contain just the
right amount of bits. */ right amount of bits. */
if(uip_reassbitmap[uip_reasslen >> 6] != if(uip_reassbitmap[uip_reasslen >> 6] !=
(u8_t)~bitmap_bits[(uip_reasslen >> 3) & 7]) { (uint8_t)~bitmap_bits[(uip_reasslen >> 3) & 7]) {
return 0; return 0;
} }
@ -813,7 +813,7 @@ uip_reass_over(void)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_TCP #if UIP_TCP
static void static void
uip_add_rcv_nxt(u16_t n) uip_add_rcv_nxt(uint16_t n)
{ {
uip_add32(uip_conn->rcv_nxt, n); uip_add32(uip_conn->rcv_nxt, n);
uip_conn->rcv_nxt[0] = uip_acc32[0]; uip_conn->rcv_nxt[0] = uip_acc32[0];
@ -827,7 +827,7 @@ uip_add_rcv_nxt(u16_t n)
/** /**
* \brief Process the options in Destination and Hop By Hop extension headers * \brief Process the options in Destination and Hop By Hop extension headers
*/ */
static u8_t static uint8_t
ext_hdr_options_process(void) ext_hdr_options_process(void)
{ {
/* /*
@ -887,7 +887,7 @@ ext_hdr_options_process(void)
} }
case 0x80: case 0x80:
uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION,
(u32_t)UIP_IPH_LEN + uip_ext_len + uip_ext_opt_offset); (uint32_t)UIP_IPH_LEN + uip_ext_len + uip_ext_opt_offset);
return 2; return 2;
} }
/* in the cases were we did not discard, update ext_opt* */ /* in the cases were we did not discard, update ext_opt* */
@ -901,7 +901,7 @@ ext_hdr_options_process(void)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
uip_process(u8_t flag) uip_process(uint8_t flag)
{ {
#if UIP_TCP #if UIP_TCP
register struct uip_conn *uip_connr = uip_conn; register struct uip_conn *uip_connr = uip_conn;
@ -1342,7 +1342,7 @@ uip_process(u8_t flag)
* RFC 2460 send error message parameterr problem, code unrecognized * RFC 2460 send error message parameterr problem, code unrecognized
* next header, pointing to the next header field * next header, pointing to the next header field
*/ */
uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_NEXTHEADER, (u32_t)(uip_next_hdr - (uint8_t *)UIP_IP_BUF)); uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_NEXTHEADER, (uint32_t)(uip_next_hdr - (uint8_t *)UIP_IP_BUF));
UIP_STAT(++uip_stat.ip.drop); UIP_STAT(++uip_stat.ip.drop);
UIP_STAT(++uip_stat.ip.protoerr); UIP_STAT(++uip_stat.ip.protoerr);
UIP_LOG("ip6: unrecognized header"); UIP_LOG("ip6: unrecognized header");
@ -1721,8 +1721,8 @@ uip_process(u8_t flag)
} else if(opt == TCP_OPT_MSS && } else if(opt == TCP_OPT_MSS &&
uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) { uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) {
/* An MSS option with the right option length. */ /* An MSS option with the right option length. */
tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) | tmp16 = ((uint16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
(u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c]; (uint16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];
uip_connr->initialmss = uip_connr->mss = uip_connr->initialmss = uip_connr->mss =
tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16; tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;
@ -2015,7 +2015,7 @@ uip_process(u8_t flag)
and the application will retransmit it. This is called the and the application will retransmit it. This is called the
"persistent timer" and uses the retransmission mechanim. "persistent timer" and uses the retransmission mechanim.
*/ */
tmp16 = ((u16_t)UIP_TCP_BUF->wnd[0] << 8) + (u16_t)UIP_TCP_BUF->wnd[1]; tmp16 = ((uint16_t)UIP_TCP_BUF->wnd[0] << 8) + (uint16_t)UIP_TCP_BUF->wnd[1];
if(tmp16 > uip_connr->initialmss || if(tmp16 > uip_connr->initialmss ||
tmp16 == 0) { tmp16 == 0) {
tmp16 = uip_connr->initialmss; tmp16 = uip_connr->initialmss;
@ -2269,14 +2269,14 @@ uip_process(u8_t flag)
return; return;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
u16_t uint16_t
uip_htons(u16_t val) uip_htons(uint16_t val)
{ {
return UIP_HTONS(val); return UIP_HTONS(val);
} }
u32_t uint32_t
uip_htonl(u32_t val) uip_htonl(uint32_t val)
{ {
return UIP_HTONL(val); return UIP_HTONL(val);
} }

View file

@ -81,7 +81,7 @@
* *
* \param op16 A 16-bit integer in host byte order. * \param op16 A 16-bit integer in host byte order.
*/ */
void uip_add32(u8_t *op32, u16_t op16); void uip_add32(uint8_t *op32, uint16_t op16);
/** /**
* Calculate the Internet checksum over a buffer. * Calculate the Internet checksum over a buffer.
@ -102,7 +102,7 @@ void uip_add32(u8_t *op32, u16_t op16);
* *
* \return The Internet checksum of the buffer. * \return The Internet checksum of the buffer.
*/ */
u16_t uip_chksum(u16_t *buf, u16_t len); uint16_t uip_chksum(uint16_t *buf, uint16_t len);
/** /**
* Calculate the IP header checksum of the packet header in uip_buf. * Calculate the IP header checksum of the packet header in uip_buf.
@ -113,7 +113,7 @@ u16_t uip_chksum(u16_t *buf, u16_t len);
* \return The IP header checksum of the IP header in the uip_buf * \return The IP header checksum of the IP header in the uip_buf
* buffer. * buffer.
*/ */
u16_t uip_ipchksum(void); uint16_t uip_ipchksum(void);
/** /**
* Calculate the TCP checksum of the packet in uip_buf and uip_appdata. * Calculate the TCP checksum of the packet in uip_buf and uip_appdata.
@ -128,9 +128,9 @@ u16_t uip_ipchksum(void);
* \return The TCP checksum of the TCP segment in uip_buf and pointed * \return The TCP checksum of the TCP segment in uip_buf and pointed
* to by uip_appdata. * to by uip_appdata.
*/ */
u16_t uip_tcpchksum(void); uint16_t uip_tcpchksum(void);
u16_t uip_udpchksum(void); uint16_t uip_udpchksum(void);
/** @} */ /** @} */
/** @} */ /** @} */

View file

@ -65,11 +65,11 @@
struct arp_hdr { struct arp_hdr {
struct uip_eth_hdr ethhdr; struct uip_eth_hdr ethhdr;
u16_t hwtype; uint16_t hwtype;
u16_t protocol; uint16_t protocol;
u8_t hwlen; uint8_t hwlen;
u8_t protolen; uint8_t protolen;
u16_t opcode; uint16_t opcode;
struct uip_eth_addr shwaddr; struct uip_eth_addr shwaddr;
uip_ipaddr_t sipaddr; uip_ipaddr_t sipaddr;
struct uip_eth_addr dhwaddr; struct uip_eth_addr dhwaddr;
@ -79,14 +79,14 @@ struct arp_hdr {
struct ethip_hdr { struct ethip_hdr {
struct uip_eth_hdr ethhdr; struct uip_eth_hdr ethhdr;
/* IP header. */ /* IP header. */
u8_t vhl, uint8_t vhl,
tos, tos,
len[2], len[2],
ipid[2], ipid[2],
ipoffset[2], ipoffset[2],
ttl, ttl,
proto; proto;
u16_t ipchksum; uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr; uip_ipaddr_t srcipaddr, destipaddr;
}; };
@ -98,19 +98,19 @@ struct ethip_hdr {
struct arp_entry { struct arp_entry {
uip_ipaddr_t ipaddr; uip_ipaddr_t ipaddr;
struct uip_eth_addr ethaddr; struct uip_eth_addr ethaddr;
u8_t time; uint8_t time;
}; };
static const struct uip_eth_addr broadcast_ethaddr = static const struct uip_eth_addr broadcast_ethaddr =
{{0xff,0xff,0xff,0xff,0xff,0xff}}; {{0xff,0xff,0xff,0xff,0xff,0xff}};
static const u16_t broadcast_ipaddr[2] = {0xffff,0xffff}; static const uint16_t broadcast_ipaddr[2] = {0xffff,0xffff};
static struct arp_entry arp_table[UIP_ARPTAB_SIZE]; static struct arp_entry arp_table[UIP_ARPTAB_SIZE];
static uip_ipaddr_t ipaddr; static uip_ipaddr_t ipaddr;
static u8_t i, c; static uint8_t i, c;
static u8_t arptime; static uint8_t arptime;
static u8_t tmpage; static uint8_t tmpage;
#define BUF ((struct arp_hdr *)&uip_buf[0]) #define BUF ((struct arp_hdr *)&uip_buf[0])
#define IPBUF ((struct ethip_hdr *)&uip_buf[0]) #define IPBUF ((struct ethip_hdr *)&uip_buf[0])

View file

@ -63,7 +63,7 @@ CCIF extern struct uip_eth_addr uip_ethaddr;
struct uip_eth_hdr { struct uip_eth_hdr {
struct uip_eth_addr dest; struct uip_eth_addr dest;
struct uip_eth_addr src; struct uip_eth_addr src;
u16_t type; uint16_t type;
}; };
#define UIP_ETHTYPE_ARP 0x0806 #define UIP_ETHTYPE_ARP 0x0806

View file

@ -644,8 +644,8 @@ void uip_log(char *msg);
#define UIP_APPCALL httpd_appcall #define UIP_APPCALL httpd_appcall
struct httpd_state { struct httpd_state {
u8_t state; uint8_t state;
u16_t count; uint16_t count;
char *dataptr; char *dataptr;
char *script; char *script;
}; };