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;
struct dhcp_msg {
u8_t op, htype, hlen, hops;
u8_t xid[4];
u16_t secs, flags;
u8_t ciaddr[4];
u8_t yiaddr[4];
u8_t siaddr[4];
u8_t giaddr[4];
u8_t chaddr[16];
uint8_t op, htype, hlen, hops;
uint8_t xid[4];
uint16_t secs, flags;
uint8_t ciaddr[4];
uint8_t yiaddr[4];
uint8_t siaddr[4];
uint8_t giaddr[4];
uint8_t chaddr[16];
#ifndef UIP_CONF_DHCP_LIGHT
u8_t sname[64];
u8_t file[128];
uint8_t sname[64];
uint8_t file[128];
#endif
u8_t options[312];
uint8_t options[312];
};
#define BOOTP_BROADCAST 0x8000
@ -90,11 +90,11 @@ struct dhcp_msg {
#define DHCP_OPTION_REQ_LIST 55
#define DHCP_OPTION_END 255
static u32_t xid;
static const u8_t magic_cookie[4] = {99, 130, 83, 99};
static uint32_t xid;
static const uint8_t magic_cookie[4] = {99, 130, 83, 99};
/*---------------------------------------------------------------------------*/
static u8_t *
add_msg_type(u8_t *optptr, u8_t type)
static uint8_t *
add_msg_type(uint8_t *optptr, uint8_t type)
{
*optptr++ = DHCP_OPTION_MSG_TYPE;
*optptr++ = 1;
@ -102,8 +102,8 @@ add_msg_type(u8_t *optptr, u8_t type)
return optptr;
}
/*---------------------------------------------------------------------------*/
static u8_t *
add_server_id(u8_t *optptr)
static uint8_t *
add_server_id(uint8_t *optptr)
{
*optptr++ = DHCP_OPTION_SERVER_ID;
*optptr++ = 4;
@ -111,8 +111,8 @@ add_server_id(u8_t *optptr)
return optptr + 4;
}
/*---------------------------------------------------------------------------*/
static u8_t *
add_req_ipaddr(u8_t *optptr)
static uint8_t *
add_req_ipaddr(uint8_t *optptr)
{
*optptr++ = DHCP_OPTION_REQ_IPADDR;
*optptr++ = 4;
@ -120,8 +120,8 @@ add_req_ipaddr(u8_t *optptr)
return optptr + 4;
}
/*---------------------------------------------------------------------------*/
static u8_t *
add_req_options(u8_t *optptr)
static uint8_t *
add_req_options(uint8_t *optptr)
{
*optptr++ = DHCP_OPTION_REQ_LIST;
*optptr++ = 3;
@ -131,8 +131,8 @@ add_req_options(u8_t *optptr)
return optptr;
}
/*---------------------------------------------------------------------------*/
static u8_t *
add_end(u8_t *optptr)
static uint8_t *
add_end(uint8_t *optptr)
{
*optptr++ = DHCP_OPTION_END;
return optptr;
@ -166,7 +166,7 @@ create_msg(CC_REGISTER_ARG struct dhcp_msg *m)
static void
send_discover(void)
{
u8_t *end;
uint8_t *end;
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
create_msg(m);
@ -175,13 +175,13 @@ send_discover(void)
end = add_req_options(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
send_request(void)
{
u8_t *end;
uint8_t *end;
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
create_msg(m);
@ -191,14 +191,14 @@ send_request(void)
end = add_req_ipaddr(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
parse_options(u8_t *optptr, int len)
static uint8_t
parse_options(uint8_t *optptr, int len)
{
u8_t *end = optptr + len;
u8_t type = 0;
uint8_t *end = optptr + len;
uint8_t type = 0;
while(optptr < end) {
switch(*optptr) {
@ -229,7 +229,7 @@ parse_options(u8_t *optptr, int len)
return type;
}
/*---------------------------------------------------------------------------*/
static u8_t
static uint8_t
parse_msg(void)
{
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
@ -250,8 +250,8 @@ static int
msg_for_me(void)
{
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
u8_t *optptr = &m->options[4];
u8_t *end = (u8_t*)uip_appdata + uip_datalen();
uint8_t *optptr = &m->options[4];
uint8_t *end = (uint8_t*)uip_appdata + uip_datalen();
if(m->op == DHCP_REPLY &&
memcmp(m->xid, &xid, sizeof(xid)) == 0 &&
@ -340,7 +340,7 @@ PT_THREAD(handle_dhcp(process_event_t ev, void *data))
dhcpc_configured(&s);
#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))
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;
struct uip_udp_conn *conn;
struct etimer etimer;
u32_t ticks;
uint32_t ticks;
const void *mac_addr;
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 netmask;
uip_ipaddr_t dnsaddr;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -50,7 +50,7 @@
#if DEBUG
#include <stdio.h>
#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])
#else
#define PRINTF(...)

View File

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

View File

@ -72,12 +72,12 @@
#define DEBUG 0
#if DEBUG
/* 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>
#define PRINTF(...) printf(__VA_ARGS__)
#define PRINTFI(...) 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 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")
@ -192,14 +192,14 @@ extern struct sicslowpan_nh_compressor SICSLOWPAN_NH_COMPRESSOR;
* We initialize it to the beginning of the rime buffer, then
* 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
* (fragment headers, IPV6 or HC1, HC2, and HC1 and HC2 non compressed
* fields).
*/
static u8_t rime_hdr_len;
static uint8_t rime_hdr_len;
/**
* 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
* 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
* 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
@ -377,7 +377,7 @@ addr_context_lookup_by_prefix(uip_ipaddr_t *ipaddr)
/*--------------------------------------------------------------------*/
/** \brief find the context with the given number */
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 */
#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;
PRINTF("IPHC: remove 12 b of both source & dest with prefix 0xFOB\n");
*(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) +
(u8_t)((UIP_HTONS(UIP_UDP_BUF->destport) -
(uint8_t)((UIP_HTONS(UIP_UDP_BUF->destport) -
SICSLOWPAN_UDP_4_BIT_PORT_MIN));
hc06_ptr += 2;
} 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");
memcpy(hc06_ptr + 1, &UIP_UDP_BUF->srcport, 2);
*(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));
hc06_ptr += 4;
} 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;
PRINTF("IPHC: remove 8 bits of source with prefix 0xF0, leave dest. hch: %i\n", *hc06_ptr);
*(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));
memcpy(hc06_ptr + 2, &UIP_UDP_BUF->destport, 2);
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_PORTS] =
(u8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) -
(uint8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) -
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);
rime_hdr_len += SICSLOWPAN_HC1_HC_UDP_HDR_LEN;
uncomp_hdr_len += UIP_UDPH_LEN;

View File

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

View File

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

View File

@ -57,7 +57,7 @@
*
* \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.
@ -77,11 +77,11 @@ void slipdev_char_put(u8_t c);
* \retval 0 If no 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);
u8_t slipdev_send(void);
u16_t slipdev_poll(void);
uint8_t slipdev_send(void);
uint16_t slipdev_poll(void);
#endif /* __SLIPDEV_H__ */

View File

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

View File

@ -35,7 +35,7 @@
#include "uip.h"
int tcpdump_format(u8_t *packet, u16_t packetlen,
char *printbuf, u16_t printbuflen);
int tcpdump_format(uint8_t *packet, uint16_t packetlen,
char *printbuf, uint16_t printbuflen);
#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.
*/
struct listenport {
u16_t port;
uint16_t port;
struct process *p;
};
@ -109,9 +109,9 @@ enum {
/* Called on IP packet output. */
#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)
{
int ret;
@ -124,14 +124,14 @@ tcpip_output(uip_lladdr_t *a)
}
void
tcpip_set_outputfunc(u8_t (*f)(uip_lladdr_t *))
tcpip_set_outputfunc(uint8_t (*f)(uip_lladdr_t *))
{
outputfunc = f;
}
#else
static u8_t (* outputfunc)(void);
u8_t
static uint8_t (* outputfunc)(void);
uint8_t
tcpip_output(void)
{
if(outputfunc != NULL) {
@ -142,7 +142,7 @@ tcpip_output(void)
}
void
tcpip_set_outputfunc(u8_t (*f)(void))
tcpip_set_outputfunc(uint8_t (*f)(void))
{
outputfunc = f;
}
@ -226,7 +226,7 @@ packet_input(void)
#if UIP_TCP
#if UIP_ACTIVE_OPEN
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;
@ -245,7 +245,7 @@ tcp_connect(uip_ipaddr_t *ripaddr, u16_t port, void *appstate)
#endif /* UIP_ACTIVE_OPEN */
/*---------------------------------------------------------------------------*/
void
tcp_unlisten(u16_t port)
tcp_unlisten(uint16_t port)
{
static unsigned char i;
struct listenport *l;
@ -263,7 +263,7 @@ tcp_unlisten(u16_t port)
}
/*---------------------------------------------------------------------------*/
void
tcp_listen(u16_t port)
tcp_listen(uint16_t port)
{
static unsigned char i;
struct listenport *l;
@ -306,7 +306,7 @@ udp_attach(struct uip_udp_conn *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;
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 *
udp_broadcast_new(u16_t port, void *appstate)
udp_broadcast_new(uint16_t port, void *appstate)
{
uip_ipaddr_t addr;
struct uip_udp_conn *conn;
@ -343,7 +343,7 @@ udp_broadcast_new(u16_t port, void *appstate)
#endif /* UIP_UDP */
/*---------------------------------------------------------------------------*/
#if UIP_CONF_ICMP6
u8_t
uint8_t
icmp6_new(void *appstate) {
if(uip_icmp6_conns.appstate.p == PROCESS_NONE) {
uip_icmp6_conns.appstate.p = PROCESS_CURRENT();
@ -354,7 +354,7 @@ icmp6_new(void *appstate) {
}
void
tcpip_icmp6_call(u8_t type)
tcpip_icmp6_call(uint8_t type)
{
if(uip_icmp6_conns.appstate.p != PROCESS_NONE) {
/* 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.
*
*/
CCIF void tcp_listen(u16_t port);
CCIF void tcp_listen(uint16_t 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.
*
*/
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.
@ -165,7 +165,7 @@ CCIF void tcp_unlisten(u16_t port);
* 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);
/**
@ -226,7 +226,7 @@ void udp_attach(struct uip_udp_conn *conn,
* \return A pointer to the newly created connection, or NULL if
* 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);
/**
@ -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
* 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.
@ -302,14 +302,14 @@ CCIF extern process_event_t tcpip_icmp6_event;
* If an application registers here, it will be polled with a
* 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
* If an application registered as an ICMPv6 listener (with
* 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*/
/** @} */
@ -341,11 +341,11 @@ CCIF void tcpip_input(void);
* The eventual parameter is the MAC address of the destination.
*/
#if UIP_CONF_IPV6
u8_t tcpip_output(uip_lladdr_t *);
void tcpip_set_outputfunc(u8_t (* f)(uip_lladdr_t *));
uint8_t tcpip_output(uip_lladdr_t *);
void tcpip_set_outputfunc(uint8_t (* f)(uip_lladdr_t *));
#else
u8_t tcpip_output(void);
void tcpip_set_outputfunc(u8_t (* f)(void));
uint8_t tcpip_output(void);
void tcpip_set_outputfunc(uint8_t (* f)(void));
#endif
/**

View File

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

View File

@ -62,7 +62,7 @@ uaodv_rt_init(void)
/*---------------------------------------------------------------------------*/
struct uaodv_rt_entry *
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;

View File

@ -47,14 +47,14 @@ struct uaodv_rt_entry {
struct uaodv_rt_entry *next;
uip_ipaddr_t dest;
uip_ipaddr_t nexthop;
u32_t hseqno; /* In host byte order! */
u8_t hop_count;
u8_t is_bad; /* Only one bit is used. */
uint32_t hseqno; /* In host byte order! */
uint8_t hop_count;
uint8_t is_bad; /* Only one bit is used. */
};
struct uaodv_rt_entry *
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(uip_ipaddr_t *dest);
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;
/* 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)
{
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
static struct {
uip_ipaddr_t orig;
u32_t id;
uint32_t id;
} fwcache[NFWCACHE];
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;
return fwcache[n].id == *id && uip_ipaddr_cmp(&fwcache[n].orig, orig);
}
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;
fwcache[n].id = *id;
@ -206,7 +206,7 @@ send_rreq(uip_ipaddr_t *addr)
/*---------------------------------------------------------------------------*/
static void
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;
@ -225,7 +225,7 @@ send_rrep(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop, uip_ipaddr_t *orig,
}
/*---------------------------------------------------------------------------*/
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;
@ -284,17 +284,17 @@ handle_incoming_rreq(void)
#ifdef AODV_BAD_HOP_EXTENSION
if(uip_len > (sizeof(*rm) + 2)) {
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(;
(u8_t *)ext < end;
ext = (void *)((u8_t *)ext + ext->length + 2)) {
u8_t *eend = (u8_t *)ext + ext->length;
(uint8_t *)ext < end;
ext = (void *)((uint8_t *)ext + ext->length + 2)) {
uint8_t *eend = (uint8_t *)ext + ext->length;
if(eend > end)
eend = end;
if(ext->type == RREQ_BAD_HOP_EXT) {
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)) {
print_debug("BAD_HOP drop\n");
return;
@ -330,7 +330,7 @@ handle_incoming_rreq(void)
}
if (fw != NULL) {
u32_t net_seqno;
uint32_t net_seqno;
print_debug("RREQ for known route\n");
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,
fw->hop_count + 1);
} 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");
uip_ipaddr_copy(&dest_addr, &rm->dest_addr);
@ -381,7 +381,7 @@ handle_incoming_rrep(void)
/* Useless HELLO message? */
if(uip_ipaddr_cmp(&BUF->destipaddr, &uip_broadcast_addr)) {
#ifdef AODV_RESPOND_TO_HELLOS
u32_t net_seqno;
uint32_t net_seqno;
#ifdef CC2420_RADIO
int ret = cc2420_check_remote(uip_udp_sender()->u16[1]);
@ -518,7 +518,7 @@ static enum {
} command;
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
uaodv_bad_dest(uip_ipaddr_t *dest)

View File

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

View File

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

View File

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

View File

@ -50,7 +50,7 @@
#if DEBUG
#include <stdio.h>
#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])
#else
#define PRINTF(...)
@ -75,7 +75,7 @@ void
uip_icmp6_echo_request_input(void)
{
#if UIP_CONF_IPV6_RPL
u8_t temp_ext_len;
uint8_t temp_ext_len;
#endif /* UIP_CONF_IPV6_RPL */
/*
* we send an echo reply. It is trivial if there was no extension
@ -159,7 +159,7 @@ uip_icmp6_echo_request_input(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*/
if (uip_ext_len) {

View File

@ -99,7 +99,7 @@
/** \brief ICMPv6 Error message constant part */
typedef struct uip_icmp6_error{
u32_t param;
uint32_t param;
} uip_icmp6_error;
/** \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
*/
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

View File

@ -154,7 +154,7 @@ uip_nd6_ns_input(void)
PRINTF("\n");
UIP_STAT(++uip_stat.nd6.recv);
u8_t flags;
uint8_t flags;
#if UIP_CONF_IPV6_CHECKS
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
* but it works. Be careful though, do not use tests such as is_router == 1
*/
u8_t is_llchange = 0;
u8_t is_router = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_ROUTER));
u8_t is_solicited =
uint8_t is_llchange = 0;
uint8_t is_router = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_ROUTER));
uint8_t is_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));
#if UIP_CONF_IPV6_CHECKS

View File

@ -55,7 +55,7 @@
struct neighbor_entry {
uip_ipaddr_t ipaddr;
struct uip_neighbor_addr addr;
u8_t time;
uint8_t time;
};
static struct neighbor_entry entries[ENTRIES];
@ -86,7 +86,7 @@ void
uip_neighbor_add(uip_ipaddr_t *ipaddr, struct uip_neighbor_addr *addr)
{
int i, oldest;
u8_t oldest_time;
uint8_t oldest_time;
/* 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],

View File

@ -196,7 +196,7 @@ uip_over_mesh_make_announced_gateway(void)
const static struct trickle_callbacks trickle_call = {gateway_announce_recv};
/*---------------------------------------------------------------------------*/
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",
@ -215,7 +215,7 @@ uip_over_mesh_init(u16_t channels)
route_set_lifetime(30);
}
/*---------------------------------------------------------------------------*/
u8_t
uint8_t
uip_over_mesh_send(void)
{
rimeaddr_t receiver;

View File

@ -45,8 +45,8 @@
#include "net/uip-fw.h"
#include "net/rime.h"
void uip_over_mesh_init(u16_t channels);
u8_t uip_over_mesh_send(void);
void uip_over_mesh_init(uint16_t channels);
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(rimeaddr_t *gw);

View File

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

View File

@ -40,7 +40,7 @@
#include "contiki-conf.h"
extern u16_t uip_slen;
extern uint16_t uip_slen;
#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
urgent data (out-of-band data), if
present. */
u16_t uip_urglen, uip_surglen;
uint16_t uip_urglen, uip_surglen;
#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,
depending on the maximum packet
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
and the application program. */
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];
/* The uip_conns array holds all TCP
connections. */
u16_t uip_listenports[UIP_LISTENPORTS];
uint16_t uip_listenports[UIP_LISTENPORTS];
/* The uip_listenports list all currently
listning ports. */
#if UIP_UDP
@ -163,24 +163,24 @@ struct uip_udp_conn *uip_udp_conn;
struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];
#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
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. */
#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. */
#endif /* UIP_ACTIVE_OPEN || UIP_UDP */
/* Temporary variables. */
u8_t uip_acc32[4];
static u8_t c, opt;
static u16_t tmp16;
uint8_t uip_acc32[4];
static uint8_t c, opt;
static uint16_t tmp16;
/* Structures and definitions. */
#define TCP_FIN 0x01
@ -238,7 +238,7 @@ void uip_log(char *msg);
#if ! UIP_ARCH_ADD32
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[2] = op32[2] + (op16 >> 8);
@ -268,12 +268,12 @@ uip_add32(u8_t *op32, u16_t op16)
#if ! UIP_ARCH_CHKSUM
/*---------------------------------------------------------------------------*/
static u16_t
chksum(u16_t sum, const u8_t *data, u16_t len)
static uint16_t
chksum(uint16_t sum, const uint8_t *data, uint16_t len)
{
u16_t t;
const u8_t *dataptr;
const u8_t *last_byte;
uint16_t t;
const uint8_t *dataptr;
const uint8_t *last_byte;
dataptr = data;
last_byte = data + len - 1;
@ -299,17 +299,17 @@ chksum(u16_t sum, const u8_t *data, u16_t len)
return sum;
}
/*---------------------------------------------------------------------------*/
u16_t
uip_chksum(u16_t *data, u16_t len)
uint16_t
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
u16_t
uint16_t
uip_ipchksum(void)
{
u16_t sum;
uint16_t sum;
sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN);
DEBUG_PRINTF("uip_ipchksum: sum 0x%04x\n", sum);
@ -317,16 +317,16 @@ uip_ipchksum(void)
}
#endif
/*---------------------------------------------------------------------------*/
static u16_t
upper_layer_chksum(u8_t proto)
static uint16_t
upper_layer_chksum(uint8_t proto)
{
u16_t upper_layer_len;
u16_t sum;
uint16_t upper_layer_len;
uint16_t sum;
#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 */
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 */
/* First sum pseudoheader. */
@ -334,7 +334,7 @@ upper_layer_chksum(u8_t proto)
/* IP protocol and length fields. This addition cannot carry. */
sum = upper_layer_len + proto;
/* 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 = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN],
@ -344,7 +344,7 @@ upper_layer_chksum(u8_t proto)
}
/*---------------------------------------------------------------------------*/
#if UIP_CONF_IPV6
u16_t
uint16_t
uip_icmp6chksum(void)
{
return upper_layer_chksum(UIP_PROTO_ICMP6);
@ -352,14 +352,14 @@ uip_icmp6chksum(void)
}
#endif /* UIP_CONF_IPV6 */
/*---------------------------------------------------------------------------*/
u16_t
uint16_t
uip_tcpchksum(void)
{
return upper_layer_chksum(UIP_PROTO_TCP);
}
/*---------------------------------------------------------------------------*/
#if UIP_UDP_CHECKSUMS
u16_t
uint16_t
uip_udpchksum(void)
{
return upper_layer_chksum(UIP_PROTO_UDP);
@ -396,7 +396,7 @@ uip_init(void)
/*---------------------------------------------------------------------------*/
#if UIP_ACTIVE_OPEN
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;
@ -462,7 +462,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
/*---------------------------------------------------------------------------*/
#if UIP_UDP
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;
@ -507,7 +507,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
#endif /* UIP_UDP */
/*---------------------------------------------------------------------------*/
void
uip_unlisten(u16_t port)
uip_unlisten(uint16_t port)
{
for(c = 0; c < UIP_LISTENPORTS; ++c) {
if(uip_listenports[c] == port) {
@ -518,7 +518,7 @@ uip_unlisten(u16_t port)
}
/*---------------------------------------------------------------------------*/
void
uip_listen(u16_t port)
uip_listen(uint16_t port)
{
for(c = 0; c < UIP_LISTENPORTS; ++c) {
if(uip_listenports[c] == 0) {
@ -532,22 +532,22 @@ uip_listen(u16_t port)
#if UIP_REASSEMBLY && !UIP_CONF_IPV6
#define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN)
static u8_t uip_reassbuf[UIP_REASS_BUFSIZE];
static u8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)];
static const u8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f,
static uint8_t uip_reassbuf[UIP_REASS_BUFSIZE];
static uint8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)];
static const uint8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f,
0x0f, 0x07, 0x03, 0x01};
static u16_t uip_reasslen;
static u8_t uip_reassflags;
static uint16_t uip_reasslen;
static uint8_t uip_reassflags;
#define UIP_REASS_FLAG_LASTFRAG 0x01
static u8_t uip_reasstmr;
static uint8_t uip_reasstmr;
#define IP_MF 0x20
static u8_t
static uint8_t
uip_reass(void)
{
u16_t offset, len;
u16_t i;
uint16_t offset, len;
uint16_t i;
/* If ip_reasstmr is zero, no packet is present in the buffer, so we
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
right amount of bits. */
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;
}
@ -661,7 +661,7 @@ uip_reass(void)
#endif /* UIP_REASSEMBLY */
/*---------------------------------------------------------------------------*/
static void
uip_add_rcv_nxt(u16_t n)
uip_add_rcv_nxt(uint16_t n)
{
uip_add32(uip_conn->rcv_nxt, n);
uip_conn->rcv_nxt[0] = uip_acc32[0];
@ -671,7 +671,7 @@ uip_add_rcv_nxt(u16_t n)
}
/*---------------------------------------------------------------------------*/
void
uip_process(u8_t flag)
uip_process(uint8_t flag)
{
register struct uip_conn *uip_connr = uip_conn;
@ -1143,7 +1143,7 @@ uip_process(u8_t flag)
/* Calculate the ICMP checksum. */
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
original packet. */
@ -1156,7 +1156,7 @@ uip_process(u8_t flag)
size of the IP header (20) = 56. */
uip_len = 36 + UIP_IPH_LEN;
ICMPBUF->len[0] = 0;
ICMPBUF->len[1] = (u8_t)uip_len;
ICMPBUF->len[1] = (uint8_t)uip_len;
ICMPBUF->ttl = UIP_TTL;
ICMPBUF->proto = UIP_PROTO_ICMP;
@ -1386,8 +1386,8 @@ uip_process(u8_t flag)
} else if(opt == TCP_OPT_MSS &&
uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) {
/* An MSS option with the right option length. */
tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
(u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];
tmp16 = ((uint16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
(uint16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];
uip_connr->initialmss = uip_connr->mss =
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
"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 ||
tmp16 == 0) {
tmp16 = uip_connr->initialmss;
@ -1938,14 +1938,14 @@ uip_process(u8_t flag)
return;
}
/*---------------------------------------------------------------------------*/
u16_t
uip_htons(u16_t val)
uint16_t
uip_htons(uint16_t val)
{
return UIP_HTONS(val);
}
u32_t
uip_htonl(u32_t val)
uint32_t
uip_htonl(uint32_t val)
{
return UIP_HTONL(val);
}

View File

@ -62,17 +62,17 @@
*/
#if UIP_CONF_IPV6
typedef union uip_ip6addr_t {
u8_t u8[16]; /* Initializer, must come first!!! */
u16_t u16[8];
uint8_t u8[16]; /* Initializer, must come first!!! */
uint16_t u16[8];
} uip_ip6addr_t;
typedef uip_ip6addr_t uip_ipaddr_t;
#else /* UIP_CONF_IPV6 */
typedef union uip_ip4addr_t {
u8_t u8[4]; /* Initializer, must come first!!! */
u16_t u16[2];
uint8_t u8[4]; /* Initializer, must come first!!! */
uint16_t u16[2];
#if 0
u32_t u32;
uint32_t u32;
#endif
} uip_ip4addr_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 */
typedef struct uip_802154_shortaddr {
u8_t addr[2];
uint8_t addr[2];
} uip_802154_shortaddr;
/** \brief 64 bit 802.15.4 address */
typedef struct uip_802154_longaddr {
u8_t addr[8];
uint8_t addr[8];
} uip_802154_longaddr;
/** \brief 802.11 address */
typedef struct uip_80211_addr {
u8_t addr[6];
uint8_t addr[6];
} uip_80211_addr;
/** \brief 802.3 address */
typedef struct uip_eth_addr {
u8_t addr[6];
uint8_t addr[6];
} 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.
*/
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.
*/
void uip_listen(u16_t port);
void uip_listen(uint16_t 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.
*/
void uip_unlisten(u16_t port);
void uip_unlisten(uint16_t port);
/**
* 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.
*
*/
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
* 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.
@ -1043,10 +1043,10 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
*/
#if !UIP_CONF_IPV6
#define uip_ipaddr_maskcmp(addr1, addr2, mask) \
(((((u16_t *)addr1)[0] & ((u16_t *)mask)[0]) == \
(((u16_t *)addr2)[0] & ((u16_t *)mask)[0])) && \
((((u16_t *)addr1)[1] & ((u16_t *)mask)[1]) == \
(((u16_t *)addr2)[1] & ((u16_t *)mask)[1])))
(((((uint16_t *)addr1)[0] & ((uint16_t *)mask)[0]) == \
(((uint16_t *)addr2)[0] & ((uint16_t *)mask)[0])) && \
((((uint16_t *)addr1)[1] & ((uint16_t *)mask)[1]) == \
(((uint16_t *)addr2)[1] & ((uint16_t *)mask)[1])))
#else
#define uip_ipaddr_prefixcmp(addr1, addr2, length) (memcmp(addr1, addr2, length>>3) == 0)
#endif
@ -1095,8 +1095,8 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
* \hideinitializer
*/
#define uip_ipaddr_mask(dest, src, mask) do { \
((u16_t *)dest)[0] = ((u16_t *)src)[0] & ((u16_t *)mask)[0]; \
((u16_t *)dest)[1] = ((u16_t *)src)[1] & ((u16_t *)mask)[1]; \
((uint16_t *)dest)[0] = ((uint16_t *)src)[0] & ((uint16_t *)mask)[0]; \
((uint16_t *)dest)[1] = ((uint16_t *)src)[1] & ((uint16_t *)mask)[1]; \
} while(0)
/**
@ -1107,7 +1107,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
* Example:
\code
uip_ipaddr_t ipaddr;
u8_t octet;
uint8_t octet;
uip_ipaddr(&ipaddr, 1,2,3,4);
octet = uip_ipaddr1(&ipaddr);
@ -1127,7 +1127,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
* Example:
\code
uip_ipaddr_t ipaddr;
u8_t octet;
uint8_t octet;
uip_ipaddr(&ipaddr, 1,2,3,4);
octet = uip_ipaddr2(&ipaddr);
@ -1147,7 +1147,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
* Example:
\code
uip_ipaddr_t ipaddr;
u8_t octet;
uint8_t octet;
uip_ipaddr(&ipaddr, 1,2,3,4);
octet = uip_ipaddr3(&ipaddr);
@ -1167,7 +1167,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
* Example:
\code
uip_ipaddr_t ipaddr;
u8_t octet;
uint8_t octet;
uip_ipaddr(&ipaddr, 1,2,3,4);
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_HTONL(n) (n)
# else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
# define UIP_HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8))
# define UIP_HTONL(n) (((u32_t)UIP_HTONS(n) << 16) | UIP_HTONS((u32_t)(n) >> 16))
# define UIP_HTONS(n) (uint16_t)((((uint16_t) (n)) << 8) | (((uint16_t) (n)) >> 8))
# define UIP_HTONL(n) (((uint32_t)UIP_HTONS(n) << 16) | UIP_HTONS((uint32_t)(n) >> 16))
# endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
#else
#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.
*/
#ifndef uip_htons
CCIF u16_t uip_htons(u16_t val);
CCIF uint16_t uip_htons(uint16_t val);
#endif /* uip_htons */
#ifndef uip_ntohs
#define uip_ntohs uip_htons
#endif
#ifndef uip_htonl
CCIF u32_t uip_htonl(u32_t val);
CCIF uint32_t uip_htonl(uint32_t val);
#endif /* uip_htonl */
#ifndef uip_ntohl
#define uip_ntohl uip_htonl
@ -1233,7 +1233,7 @@ CCIF u32_t uip_htonl(u32_t val);
CCIF extern void *uip_appdata;
#if UIP_URGDATA > 0
/* u8_t *uip_urgdata:
/* uint8_t *uip_urgdata:
*
* This pointer points to any urgent data that has been received. Only
* present if compiled with support for urgent data (UIP_URGDATA).
@ -1265,16 +1265,16 @@ extern void *uip_urgdata;
* packet.
*
*/
CCIF extern u16_t uip_len;
CCIF extern uint16_t uip_len;
/**
* The length of the extension headers
*/
extern u8_t uip_ext_len;
extern uint8_t uip_ext_len;
/** @} */
#if UIP_URGDATA > 0
extern u16_t uip_urglen, uip_surglen;
extern uint16_t uip_urglen, uip_surglen;
#endif /* UIP_URGDATA > 0 */
@ -1291,27 +1291,27 @@ extern u16_t uip_urglen, uip_surglen;
struct uip_conn {
uip_ipaddr_t ripaddr; /**< The IP address of the remote host. */
u16_t lport; /**< The local TCP port, in network byte order. */
u16_t rport; /**< The local remote TCP port, in network byte
uint16_t lport; /**< The local TCP port, in network byte order. */
uint16_t rport; /**< The local remote TCP port, in network byte
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. */
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. */
u16_t len; /**< Length of the data that was previously sent. */
u16_t mss; /**< Current maximum segment size for the
uint16_t len; /**< Length of the data that was previously sent. */
uint16_t mss; /**< Current maximum segment size for the
connection. */
u16_t initialmss; /**< Initial maximum segment size for the
uint16_t initialmss; /**< Initial maximum segment size for the
connection. */
u8_t sa; /**< Retransmission time-out calculation state
uint8_t sa; /**< Retransmission time-out calculation state
variable. */
u8_t sv; /**< Retransmission time-out calculation state
uint8_t sv; /**< Retransmission time-out calculation state
variable. */
u8_t rto; /**< Retransmission time-out. */
u8_t tcpstateflags; /**< TCP state and flags. */
u8_t timer; /**< The retransmission timer. */
u8_t nrtx; /**< The number of retransmissions for the last
uint8_t rto; /**< Retransmission time-out. */
uint8_t tcpstateflags; /**< TCP state and flags. */
uint8_t timer; /**< The retransmission timer. */
uint8_t nrtx; /**< The number of retransmissions for the last
segment sent. */
/** 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.
*/
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 {
uip_ipaddr_t ripaddr; /**< The IP address of the remote peer. */
u16_t lport; /**< The local port number in network byte order. */
u16_t rport; /**< The remote port number in network byte order. */
u8_t ttl; /**< Default time-to-live. */
uint16_t lport; /**< The local port number in network byte order. */
uint16_t rport; /**< The remote port number in network byte order. */
uint8_t ttl; /**< Default time-to-live. */
/** The application state. */
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
* that are defined in this file. Please read below for more
* 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
before calling the application callback. The UIP_ACKDATA,
@ -1518,14 +1518,14 @@ CCIF extern u8_t uip_flags;
* \retval 1: drop pkt
* \retval 2: ICMP error message to send
*/
/*static u8_t
/*static uint8_t
uip_ext_hdr_options_process(); */
/* uip_process(flag):
*
* 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()
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 {
#if UIP_CONF_IPV6
/* IPv6 header. */
u8_t vtc,
uint8_t vtc,
tcflow;
u16_t flow;
u8_t len[2];
u8_t proto, ttl;
uint16_t flow;
uint8_t len[2];
uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr;
#else /* UIP_CONF_IPV6 */
/* IPv4 header. */
u8_t vhl,
uint8_t vhl,
tos,
len[2],
ipid[2],
ipoffset[2],
ttl,
proto;
u16_t ipchksum;
uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */
/* TCP header. */
u16_t srcport,
uint16_t srcport,
destport;
u8_t seqno[4],
uint8_t seqno[4],
ackno[4],
tcpoffset,
flags,
wnd[2];
u16_t tcpchksum;
u8_t urgp[2];
u8_t optdata[4];
uint16_t tcpchksum;
uint8_t urgp[2];
uint8_t optdata[4];
};
/* The ICMP and IP headers. */
struct uip_icmpip_hdr {
#if UIP_CONF_IPV6
/* IPv6 header. */
u8_t vtc,
uint8_t vtc,
tcf;
u16_t flow;
u8_t len[2];
u8_t proto, ttl;
uint16_t flow;
uint8_t len[2];
uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr;
#else /* UIP_CONF_IPV6 */
/* IPv4 header. */
u8_t vhl,
uint8_t vhl,
tos,
len[2],
ipid[2],
ipoffset[2],
ttl,
proto;
u16_t ipchksum;
uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */
/* ICMP header. */
u8_t type, icode;
u16_t icmpchksum;
uint8_t type, icode;
uint16_t icmpchksum;
#if !UIP_CONF_IPV6
u16_t id, seqno;
u8_t payload[1];
uint16_t id, seqno;
uint8_t payload[1];
#endif /* !UIP_CONF_IPV6 */
};
@ -1636,30 +1636,30 @@ struct uip_icmpip_hdr {
struct uip_udpip_hdr {
#if UIP_CONF_IPV6
/* IPv6 header. */
u8_t vtc,
uint8_t vtc,
tcf;
u16_t flow;
u8_t len[2];
u8_t proto, ttl;
uint16_t flow;
uint8_t len[2];
uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr;
#else /* UIP_CONF_IPV6 */
/* IP header. */
u8_t vhl,
uint8_t vhl,
tos,
len[2],
ipid[2],
ipoffset[2],
ttl,
proto;
u16_t ipchksum;
uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */
/* UDP header. */
u16_t srcport,
uint16_t srcport,
destport;
u16_t udplen;
u16_t udpchksum;
uint16_t udplen;
uint16_t udpchksum;
};
/*
@ -1671,22 +1671,22 @@ struct uip_udpip_hdr {
struct uip_ip_hdr {
#if UIP_CONF_IPV6
/* IPV6 header */
u8_t vtc;
u8_t tcflow;
u16_t flow;
u8_t len[2];
u8_t proto, ttl;
uint8_t vtc;
uint8_t tcflow;
uint16_t flow;
uint8_t len[2];
uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr;
#else /* UIP_CONF_IPV6 */
/* IPV4 header */
u8_t vhl,
uint8_t vhl,
tos,
len[2],
ipid[2],
ipoffset[2],
ttl,
proto;
u16_t ipchksum;
uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */
};
@ -1714,20 +1714,20 @@ struct uip_ip_hdr {
*/
/* common header part */
typedef struct uip_ext_hdr {
u8_t next;
u8_t len;
uint8_t next;
uint8_t len;
} uip_ext_hdr;
/* Hop by Hop option header */
typedef struct uip_hbho_hdr {
u8_t next;
u8_t len;
uint8_t next;
uint8_t len;
} uip_hbho_hdr;
/* destination option header */
typedef struct uip_desto_hdr {
u8_t next;
u8_t len;
uint8_t next;
uint8_t len;
} uip_desto_hdr;
/* We do not define structures for PAD1 and PADN options */
@ -1741,18 +1741,18 @@ typedef struct uip_desto_hdr {
* parse the 4 first bytes
*/
typedef struct uip_routing_hdr {
u8_t next;
u8_t len;
u8_t routing_type;
u8_t seg_left;
uint8_t next;
uint8_t len;
uint8_t routing_type;
uint8_t seg_left;
} uip_routing_hdr;
/* fragmentation header */
typedef struct uip_frag_hdr {
u8_t next;
u8_t res;
u16_t offsetresmore;
u32_t id;
uint8_t next;
uint8_t res;
uint16_t offsetresmore;
uint32_t id;
} 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
*/
typedef struct uip_ext_hdr_opt {
u8_t type;
u8_t len;
uint8_t type;
uint8_t len;
} uip_ext_hdr_opt;
/* PADN option */
typedef struct uip_ext_hdr_opt_padn {
u8_t opt_type;
u8_t opt_len;
uint8_t opt_type;
uint8_t opt_len;
} uip_ext_hdr_opt_padn;
#if UIP_CONF_IPV6_RPL
/* RPL option */
typedef struct uip_ext_hdr_opt_rpl {
u8_t opt_type;
u8_t opt_len;
u8_t flags;
u8_t instance;
u16_t senderrank;
uint8_t opt_type;
uint8_t opt_len;
uint8_t flags;
uint8_t instance;
uint16_t senderrank;
} uip_ext_hdr_opt_rpl;
#endif /* UIP_CONF_IPV6_RPL */
/* TCP header */
struct uip_tcp_hdr {
u16_t srcport;
u16_t destport;
u8_t seqno[4];
u8_t ackno[4];
u8_t tcpoffset;
u8_t flags;
u8_t wnd[2];
u16_t tcpchksum;
u8_t urgp[2];
u8_t optdata[4];
uint16_t srcport;
uint16_t destport;
uint8_t seqno[4];
uint8_t ackno[4];
uint8_t tcpoffset;
uint8_t flags;
uint8_t wnd[2];
uint16_t tcpchksum;
uint8_t urgp[2];
uint8_t optdata[4];
};
/* The ICMP headers. */
struct uip_icmp_hdr {
u8_t type, icode;
u16_t icmpchksum;
uint8_t type, icode;
uint16_t icmpchksum;
#if !UIP_CONF_IPV6
u16_t id, seqno;
uint16_t id, seqno;
#endif /* !UIP_CONF_IPV6 */
};
/* The UDP headers. */
struct uip_udp_hdr {
u16_t srcport;
u16_t destport;
u16_t udplen;
u16_t udpchksum;
uint16_t srcport;
uint16_t destport;
uint16_t udplen;
uint16_t udpchksum;
};
@ -1863,7 +1863,7 @@ struct uip_udp_hdr {
*
* When processing extension headers, we should record somehow which one we
* 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
*/
#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.
*/
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.
@ -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
* buffer.
*/
u16_t uip_ipchksum(void);
uint16_t uip_ipchksum(void);
/**
* 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
* 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.
@ -2181,14 +2181,14 @@ u16_t uip_tcpchksum(void);
* \return The UDP checksum of the UDP segment in uip_buf and pointed
* to by uip_appdata.
*/
u16_t uip_udpchksum(void);
uint16_t uip_udpchksum(void);
/**
* Calculate the ICMP checksum of the 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__ */

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
* 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 */
u8_t uip_ext_bitmap = 0;
uint8_t uip_ext_bitmap = 0;
/**
* \brief length of the extension headers read. updated each time we process
* a header
*/
u8_t uip_ext_len = 0;
uint8_t uip_ext_len = 0;
/** \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
/* The uip_urgdata pointer points to urgent data (out-of-band data), if present */
void *uip_urgdata;
u16_t uip_urglen, uip_surglen;
uint16_t uip_urglen, uip_surglen;
#endif /* UIP_URGDATA > 0 */
/* 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
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). */
struct uip_conn *uip_conn;
/* Temporary variables. */
#if (UIP_TCP || UIP_UDP)
static u8_t c;
static uint8_t c;
#endif
#if UIP_ACTIVE_OPEN || UIP_UDP
/* 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 */
/** @} */
@ -234,15 +234,15 @@ static u16_t lastport;
struct uip_conn uip_conns[UIP_CONNS];
/* 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. */
static u8_t iss[4];
static uint8_t iss[4];
/* Temporary variables. */
u8_t uip_acc32[4];
static u8_t opt;
static u16_t tmp16;
uint8_t uip_acc32[4];
static uint8_t opt;
static uint16_t tmp16;
#endif /* UIP_TCP */
/** @} */
@ -268,7 +268,7 @@ struct uip_icmp6_conn uip_icmp6_conns;
/*---------------------------------------------------------------------------*/
#if (!UIP_ARCH_ADD32 && UIP_TCP)
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[2] = op32[2] + (op16 >> 8);
@ -298,12 +298,12 @@ uip_add32(u8_t *op32, u16_t op16)
#if ! UIP_ARCH_CHKSUM
/*---------------------------------------------------------------------------*/
static u16_t
chksum(u16_t sum, const u8_t *data, u16_t len)
static uint16_t
chksum(uint16_t sum, const uint8_t *data, uint16_t len)
{
u16_t t;
const u8_t *dataptr;
const u8_t *last_byte;
uint16_t t;
const uint8_t *dataptr;
const uint8_t *last_byte;
dataptr = data;
last_byte = data + len - 1;
@ -329,17 +329,17 @@ chksum(u16_t sum, const u8_t *data, u16_t len)
return sum;
}
/*---------------------------------------------------------------------------*/
u16_t
uip_chksum(u16_t *data, u16_t len)
uint16_t
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
u16_t
uint16_t
uip_ipchksum(void)
{
u16_t sum;
uint16_t sum;
sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN);
PRINTF("uip_ipchksum: sum 0x%04x\n", sum);
@ -347,8 +347,8 @@ uip_ipchksum(void)
}
#endif
/*---------------------------------------------------------------------------*/
static u16_t
upper_layer_chksum(u8_t proto)
static uint16_t
upper_layer_chksum(uint8_t proto)
{
/* gcc 4.4.0 - 4.6.1 (maybe 4.3...) with -Os on 8 bit CPUS incorrectly compiles:
* int bar (int);
@ -359,10 +359,10 @@ upper_layer_chksum(u8_t proto)
* upper_layer_len triggers this bug unless it is declared volatile.
* See https://sourceforge.net/apps/mantisbt/contiki/view.php?id=3
*/
volatile u16_t upper_layer_len;
u16_t sum;
volatile uint16_t upper_layer_len;
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,
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. */
sum = upper_layer_len + proto;
/* 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 = 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);
}
/*---------------------------------------------------------------------------*/
u16_t
uint16_t
uip_icmp6chksum(void)
{
return upper_layer_chksum(UIP_PROTO_ICMP6);
@ -388,7 +388,7 @@ uip_icmp6chksum(void)
}
/*---------------------------------------------------------------------------*/
#if UIP_TCP
u16_t
uint16_t
uip_tcpchksum(void)
{
return upper_layer_chksum(UIP_PROTO_TCP);
@ -396,7 +396,7 @@ uip_tcpchksum(void)
#endif /* UIP_TCP */
/*---------------------------------------------------------------------------*/
#if UIP_UDP && UIP_UDP_CHECKSUMS
u16_t
uint16_t
uip_udpchksum(void)
{
return upper_layer_chksum(UIP_PROTO_UDP);
@ -432,7 +432,7 @@ uip_init(void)
/*---------------------------------------------------------------------------*/
#if UIP_TCP && UIP_ACTIVE_OPEN
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;
@ -528,7 +528,7 @@ remove_ext_hdr(void)
/*---------------------------------------------------------------------------*/
#if UIP_UDP
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;
@ -573,7 +573,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
/*---------------------------------------------------------------------------*/
#if UIP_TCP
void
uip_unlisten(u16_t port)
uip_unlisten(uint16_t port)
{
for(c = 0; c < UIP_LISTENPORTS; ++c) {
if(uip_listenports[c] == port) {
@ -584,7 +584,7 @@ uip_unlisten(u16_t port)
}
/*---------------------------------------------------------------------------*/
void
uip_listen(u16_t port)
uip_listen(uint16_t port)
{
for(c = 0; c < UIP_LISTENPORTS; ++c) {
if(uip_listenports[c] == 0) {
@ -599,15 +599,15 @@ uip_listen(u16_t port)
#if UIP_CONF_IPV6_REASSEMBLY
#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 */
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};
static u16_t uip_reasslen;
static u8_t uip_reassflags;
static uint16_t uip_reasslen;
static uint8_t uip_reassflags;
#define UIP_REASS_FLAG_LASTFRAG 0x01
#define UIP_REASS_FLAG_FIRSTFRAG 0x02
@ -625,19 +625,19 @@ static u8_t uip_reassflags;
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
in all the fragments */
#define IP_MF 0x0001
static u16_t
static uint16_t
uip_reass(void)
{
u16_t offset=0;
u16_t len;
u16_t i;
uint16_t offset=0;
uint16_t len;
uint16_t i;
/* If ip_reasstmr is zero, no packet is present in the buffer */
/* 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
right amount of bits. */
if(uip_reassbitmap[uip_reasslen >> 6] !=
(u8_t)~bitmap_bits[(uip_reasslen >> 3) & 7]) {
(uint8_t)~bitmap_bits[(uip_reasslen >> 3) & 7]) {
return 0;
}
@ -813,7 +813,7 @@ uip_reass_over(void)
/*---------------------------------------------------------------------------*/
#if UIP_TCP
static void
uip_add_rcv_nxt(u16_t n)
uip_add_rcv_nxt(uint16_t n)
{
uip_add32(uip_conn->rcv_nxt, n);
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
*/
static u8_t
static uint8_t
ext_hdr_options_process(void)
{
/*
@ -887,7 +887,7 @@ ext_hdr_options_process(void)
}
case 0x80:
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;
}
/* in the cases were we did not discard, update ext_opt* */
@ -901,7 +901,7 @@ ext_hdr_options_process(void)
/*---------------------------------------------------------------------------*/
void
uip_process(u8_t flag)
uip_process(uint8_t flag)
{
#if UIP_TCP
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
* 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.protoerr);
UIP_LOG("ip6: unrecognized header");
@ -1721,8 +1721,8 @@ uip_process(u8_t flag)
} else if(opt == TCP_OPT_MSS &&
uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) {
/* An MSS option with the right option length. */
tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
(u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];
tmp16 = ((uint16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
(uint16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];
uip_connr->initialmss = uip_connr->mss =
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
"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 ||
tmp16 == 0) {
tmp16 = uip_connr->initialmss;
@ -2269,14 +2269,14 @@ uip_process(u8_t flag)
return;
}
/*---------------------------------------------------------------------------*/
u16_t
uip_htons(u16_t val)
uint16_t
uip_htons(uint16_t val)
{
return UIP_HTONS(val);
}
u32_t
uip_htonl(u32_t val)
uint32_t
uip_htonl(uint32_t val)
{
return UIP_HTONL(val);
}

View File

@ -81,7 +81,7 @@
*
* \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.
@ -102,7 +102,7 @@ void uip_add32(u8_t *op32, u16_t op16);
*
* \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.
@ -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
* buffer.
*/
u16_t uip_ipchksum(void);
uint16_t uip_ipchksum(void);
/**
* 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
* 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 uip_eth_hdr ethhdr;
u16_t hwtype;
u16_t protocol;
u8_t hwlen;
u8_t protolen;
u16_t opcode;
uint16_t hwtype;
uint16_t protocol;
uint8_t hwlen;
uint8_t protolen;
uint16_t opcode;
struct uip_eth_addr shwaddr;
uip_ipaddr_t sipaddr;
struct uip_eth_addr dhwaddr;
@ -79,14 +79,14 @@ struct arp_hdr {
struct ethip_hdr {
struct uip_eth_hdr ethhdr;
/* IP header. */
u8_t vhl,
uint8_t vhl,
tos,
len[2],
ipid[2],
ipoffset[2],
ttl,
proto;
u16_t ipchksum;
uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
};
@ -98,19 +98,19 @@ struct ethip_hdr {
struct arp_entry {
uip_ipaddr_t ipaddr;
struct uip_eth_addr ethaddr;
u8_t time;
uint8_t time;
};
static const struct uip_eth_addr broadcast_ethaddr =
{{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 uip_ipaddr_t ipaddr;
static u8_t i, c;
static uint8_t i, c;
static u8_t arptime;
static u8_t tmpage;
static uint8_t arptime;
static uint8_t tmpage;
#define BUF ((struct arp_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_addr dest;
struct uip_eth_addr src;
u16_t type;
uint16_t type;
};
#define UIP_ETHTYPE_ARP 0x0806

View File

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