Merge branch 'master' of ssh://contiki.git.sourceforge.net/gitroot/contiki/contiki
Conflicts: apps/er-coap-06/er-coap-06-engine.c apps/er-coap-06/er-coap-06-observing.c apps/er-coap-06/er-coap-06-separate.c apps/er-coap-06/er-coap-06-transactions.c apps/er-coap-06/er-coap-06.c Removed er-coap-06.
This commit is contained in:
commit
de82815186
|
@ -21,11 +21,22 @@ ifeq ($(DEFINES),)
|
|||
endif
|
||||
endif
|
||||
|
||||
ifndef HOST_OS
|
||||
ifeq ($(OS),Windows_NT)
|
||||
## TODO: detect more specific Windows set-ups,
|
||||
## e.g. CygWin, MingW, VisualC, Watcom, Interix
|
||||
$(warning Windows (NT) detected.)
|
||||
HOST_OS := Windows
|
||||
else
|
||||
HOST_OS := $(shell uname)
|
||||
endif
|
||||
endif
|
||||
|
||||
usage:
|
||||
@echo "make MAKETARGETS... [TARGET=(TARGET)] [savetarget] [targets]"
|
||||
|
||||
targets:
|
||||
@ls -1 $(CONTIKI)/platform | grep -v CVS
|
||||
@ls -1 $(CONTIKI)/platform $(TARGETDIRS) | grep -v CVS
|
||||
|
||||
savetarget:
|
||||
-@rm -f Makefile.target
|
||||
|
@ -109,7 +120,7 @@ endif
|
|||
|
||||
### Include target makefile (TODO Unsafe?)
|
||||
|
||||
target_makefile := $(wildcard ${realpath $(CONTIKI)}/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)})
|
||||
target_makefile := $(wildcard $(CONTIKI)/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)})
|
||||
|
||||
# Check if the target makefile exists, and create the object directory if necessary.
|
||||
ifeq ($(strip $(target_makefile)),)
|
||||
|
|
|
@ -25,10 +25,10 @@ static const char *prompt = "contiki> ";
|
|||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
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';
|
||||
|
|
|
@ -104,18 +104,18 @@ static const char *err_msgs[] =
|
|||
#define UDPDATASIZE 32
|
||||
|
||||
struct codeprop_udphdr {
|
||||
u16_t id;
|
||||
u16_t type;
|
||||
uint16_t id;
|
||||
uint16_t type;
|
||||
#define TYPE_DATA 0x0001
|
||||
#define TYPE_NACK 0x0002
|
||||
u16_t addr;
|
||||
u16_t len;
|
||||
u8_t data[UDPDATASIZE];
|
||||
uint16_t addr;
|
||||
uint16_t len;
|
||||
uint8_t data[UDPDATASIZE];
|
||||
};
|
||||
|
||||
struct codeprop_tcphdr {
|
||||
u16_t len;
|
||||
u16_t pad;
|
||||
uint16_t len;
|
||||
uint16_t pad;
|
||||
};
|
||||
|
||||
static void uipcall(void *state);
|
||||
|
@ -123,19 +123,19 @@ static void uipcall(void *state);
|
|||
PROCESS(codeprop_process, "Code propagator");
|
||||
|
||||
struct codeprop_state {
|
||||
u8_t state;
|
||||
uint8_t state;
|
||||
#define STATE_NONE 0
|
||||
#define STATE_RECEIVING_TCPDATA 1
|
||||
#define STATE_RECEIVING_UDPDATA 2
|
||||
#define STATE_SENDING_UDPDATA 3
|
||||
u16_t count;
|
||||
u16_t addr;
|
||||
u16_t len;
|
||||
u16_t id;
|
||||
uint16_t count;
|
||||
uint16_t addr;
|
||||
uint16_t len;
|
||||
uint16_t id;
|
||||
struct etimer sendtimer;
|
||||
struct timer nacktimer, timer, starttimer;
|
||||
u8_t received;
|
||||
u8_t send_counter;
|
||||
uint8_t received;
|
||||
uint8_t send_counter;
|
||||
struct pt tcpthread_pt;
|
||||
struct pt udpthread_pt;
|
||||
struct pt recv_udpthread_pt;
|
||||
|
@ -198,10 +198,10 @@ PROCESS_THREAD(codeprop_process, ev, data)
|
|||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------*/
|
||||
static u16_t
|
||||
static uint16_t
|
||||
send_udpdata(struct codeprop_udphdr *uh)
|
||||
{
|
||||
u16_t len;
|
||||
uint16_t len;
|
||||
|
||||
uh->type = UIP_HTONS(TYPE_DATA);
|
||||
uh->addr = uip_htons(s.addr);
|
||||
|
@ -367,7 +367,7 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
|||
static
|
||||
PT_THREAD(recv_tcpthread(struct pt *pt))
|
||||
{
|
||||
u8_t *dataptr;
|
||||
uint8_t *dataptr;
|
||||
struct codeprop_tcphdr *th;
|
||||
int datalen = uip_datalen();
|
||||
PT_BEGIN(pt);
|
||||
|
|
|
@ -104,13 +104,13 @@ void codeprop_set_rate(clock_time_t time);
|
|||
#define UDPDATASIZE 32
|
||||
|
||||
struct codeprop_udphdr {
|
||||
u16_t id;
|
||||
u16_t type;
|
||||
uint16_t id;
|
||||
uint16_t type;
|
||||
#define TYPE_DATA 0x0001
|
||||
#define TYPE_NACK 0x0002
|
||||
u16_t addr;
|
||||
u16_t len;
|
||||
u8_t data[UDPDATASIZE];
|
||||
uint16_t addr;
|
||||
uint16_t len;
|
||||
uint8_t data[UDPDATASIZE];
|
||||
};
|
||||
|
||||
static void uipcall(void *state);
|
||||
|
@ -118,19 +118,19 @@ static void uipcall(void *state);
|
|||
PROCESS(codeprop_process, "Code propagator");
|
||||
|
||||
struct codeprop_state {
|
||||
u8_t state;
|
||||
uint8_t state;
|
||||
#define STATE_NONE 0
|
||||
#define STATE_RECEIVING_TCPDATA 1
|
||||
#define STATE_RECEIVING_UDPDATA 2
|
||||
#define STATE_SENDING_UDPDATA 3
|
||||
u16_t count;
|
||||
u16_t addr;
|
||||
u16_t len;
|
||||
u16_t id;
|
||||
uint16_t count;
|
||||
uint16_t addr;
|
||||
uint16_t len;
|
||||
uint16_t id;
|
||||
struct etimer sendtimer;
|
||||
struct timer nacktimer, timer, starttimer;
|
||||
u8_t received;
|
||||
u8_t send_counter;
|
||||
uint8_t received;
|
||||
uint8_t send_counter;
|
||||
struct pt tcpthread_pt;
|
||||
struct pt udpthread_pt;
|
||||
struct pt recv_udpthread_pt;
|
||||
|
@ -199,10 +199,10 @@ PROCESS_THREAD(codeprop_process, ev, data)
|
|||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------*/
|
||||
static u16_t
|
||||
static uint16_t
|
||||
send_udpdata(struct codeprop_udphdr *uh)
|
||||
{
|
||||
u16_t len;
|
||||
uint16_t len;
|
||||
|
||||
uh->type = UIP_HTONS(TYPE_DATA);
|
||||
uh->addr = uip_htons(s.addr);
|
||||
|
@ -360,7 +360,7 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
|||
static
|
||||
PT_THREAD(recv_tcpthread(struct pt *pt))
|
||||
{
|
||||
u8_t *dataptr;
|
||||
uint8_t *dataptr;
|
||||
struct codeprop_tcphdr *th;
|
||||
int datalen = uip_datalen();
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
#define CODEPROP_DATA_PORT 6510
|
||||
|
||||
struct codeprop_tcphdr {
|
||||
u16_t len;
|
||||
u16_t pad;
|
||||
uint16_t len;
|
||||
uint16_t pad;
|
||||
};
|
||||
|
||||
PROCESS_NAME(codeprop_process);
|
||||
|
|
|
@ -50,8 +50,8 @@ PROCESS(tcp_loader_process, "TCP loader");
|
|||
|
||||
static
|
||||
struct codeprop_state {
|
||||
u16_t addr;
|
||||
u16_t len;
|
||||
uint16_t addr;
|
||||
uint16_t len;
|
||||
struct pt tcpthread_pt;
|
||||
} s;
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@ PROCESS(tcp_loader_process, "TCP loader");
|
|||
|
||||
static
|
||||
struct codeprop_state {
|
||||
u16_t addr;
|
||||
u16_t len;
|
||||
uint16_t addr;
|
||||
uint16_t len;
|
||||
struct pt tcpthread_pt;
|
||||
} s;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ set_statustext(char *text)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static char *
|
||||
makebyte(u8_t byte, char *str)
|
||||
makebyte(uint8_t byte, char *str)
|
||||
{
|
||||
if(byte >= 100) {
|
||||
*str++ = (byte / 100 ) % 10 + '0';
|
||||
|
|
|
@ -52,9 +52,9 @@ struct smtp_state {
|
|||
char *from;
|
||||
char *subject;
|
||||
char *msg;
|
||||
u8_t msgwidth;
|
||||
u8_t msgheight;
|
||||
u8_t line;
|
||||
uint8_t msgwidth;
|
||||
uint8_t msgheight;
|
||||
uint8_t line;
|
||||
};
|
||||
|
||||
static struct smtp_state s;
|
||||
|
@ -209,7 +209,7 @@ smtp_configure(char *lhostname, uip_ipaddr_t *server)
|
|||
/*---------------------------------------------------------------------------*/
|
||||
unsigned char
|
||||
smtp_send(char *to, char *cc, char *from, char *subject,
|
||||
char *msg, u8_t msgwidth, u8_t msgheight)
|
||||
char *msg, uint8_t msgwidth, uint8_t msgheight)
|
||||
{
|
||||
struct uip_conn *conn;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ void smtp_configure(char *localhostname, uip_ipaddr_t *smtpserver);
|
|||
|
||||
unsigned char smtp_send(char *to, char *cc, char *from,
|
||||
char *subject, char *msg,
|
||||
u8_t msgwidth, u8_t msgheight);
|
||||
uint8_t msgwidth, uint8_t msgheight);
|
||||
|
||||
void smtp_appcall(void *state);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#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 PRINTBITS(buf,len) { \
|
||||
int i,j=0; \
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#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(...)
|
||||
|
|
|
@ -46,7 +46,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(...)
|
||||
|
|
|
@ -63,7 +63,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(...)
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#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 PRINTBITS(buf,len) { \
|
||||
int i,j=0; \
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#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(...)
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#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(...)
|
||||
|
|
|
@ -53,7 +53,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(...)
|
||||
|
|
|
@ -49,7 +49,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(...)
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#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(...)
|
||||
|
|
|
@ -674,7 +674,7 @@ ftpc_connected(void *connection)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
ftpc_data(u8_t *data, u16_t len)
|
||||
ftpc_data(uint8_t *data, uint16_t len)
|
||||
{
|
||||
if(data == NULL) {
|
||||
show_statustext("Download complete", "");
|
||||
|
|
|
@ -52,7 +52,7 @@ struct ftp_dataconn {
|
|||
#define CONNTYPE_LIST 0
|
||||
#define CONNTYPE_FILE 1
|
||||
|
||||
u16_t port;
|
||||
uint16_t port;
|
||||
|
||||
unsigned char filenameptr;
|
||||
char filename[MAX_FILENAMELEN];
|
||||
|
@ -128,7 +128,7 @@ ftpc_init(void)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void *
|
||||
ftpc_connect(uip_ipaddr_t *ipaddr, u16_t port)
|
||||
ftpc_connect(uip_ipaddr_t *ipaddr, uint16_t port)
|
||||
{
|
||||
struct ftp_connection *c;
|
||||
|
||||
|
@ -212,8 +212,8 @@ handle_input(struct ftp_connection *c)
|
|||
static void
|
||||
newdata(struct ftp_connection *c)
|
||||
{
|
||||
u16_t i;
|
||||
u8_t d;
|
||||
uint16_t i;
|
||||
uint8_t d;
|
||||
|
||||
for(i = 0; i < uip_datalen(); ++i) {
|
||||
d = ((char *)uip_appdata)[i];
|
||||
|
@ -268,17 +268,17 @@ acked(struct ftp_connection *c)
|
|||
static void
|
||||
senddata(struct ftp_connection *c)
|
||||
{
|
||||
u16_t len;
|
||||
uint16_t len;
|
||||
|
||||
switch(c->state) {
|
||||
case STATE_SEND_USER:
|
||||
len = 5 + (u16_t)strlen(ftpc_username()) + 2;
|
||||
len = 5 + (uint16_t)strlen(ftpc_username()) + 2;
|
||||
strcpy(uip_appdata, "USER ");
|
||||
strncpy((char *)uip_appdata + 5, ftpc_username(), uip_mss() - 5 - 2);
|
||||
strcpy((char *)uip_appdata + len - 2, "\r\n");
|
||||
break;
|
||||
case STATE_SEND_PASS:
|
||||
len = 5 + (u16_t)strlen(ftpc_password()) + 2;
|
||||
len = 5 + (uint16_t)strlen(ftpc_password()) + 2;
|
||||
strcpy(uip_appdata, "PASS ");
|
||||
strncpy((char *)uip_appdata + 5, ftpc_password(), uip_mss() - 5 - 2);
|
||||
strcpy((char *)uip_appdata + len - 2, "\r\n");
|
||||
|
@ -290,7 +290,7 @@ senddata(struct ftp_connection *c)
|
|||
(c->dataconn.port) & 0xff);
|
||||
break;
|
||||
case STATE_SEND_OPTIONS:
|
||||
len = (u16_t)strlen(options.commands[c->optionsptr]);
|
||||
len = (uint16_t)strlen(options.commands[c->optionsptr]);
|
||||
strcpy(uip_appdata, options.commands[c->optionsptr]);
|
||||
break;
|
||||
case STATE_SEND_NLST:
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
void ftpc_init(void);
|
||||
|
||||
void *ftpc_connect(uip_ipaddr_t *ipaddr, u16_t port);
|
||||
void *ftpc_connect(uip_ipaddr_t *ipaddr, uint16_t port);
|
||||
char ftpc_list(void *connection);
|
||||
void ftpc_cwd(void *connection, char *dir);
|
||||
void ftpc_cdup(void *connection);
|
||||
|
@ -63,6 +63,6 @@ void ftpc_closed(void);
|
|||
void ftpc_aborted(void);
|
||||
void ftpc_timedout(void);
|
||||
void ftpc_list_file(char *filename);
|
||||
void ftpc_data(u8_t *data, u16_t len);
|
||||
void ftpc_data(uint8_t *data, uint16_t len);
|
||||
|
||||
#endif /* __FTPC_H__ */
|
||||
|
|
|
@ -73,7 +73,7 @@ static void makestrings(void);
|
|||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static char *
|
||||
makebyte(u8_t byte, char *str)
|
||||
makebyte(uint8_t byte, char *str)
|
||||
{
|
||||
if(byte >= 100) {
|
||||
*str++ = (byte / 100 ) % 10 + '0';
|
||||
|
|
|
@ -42,7 +42,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(...)
|
||||
|
@ -56,9 +56,9 @@
|
|||
#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
|
||||
static struct etimer ping6_periodic_timer;
|
||||
static u8_t count = 0;
|
||||
static uint8_t count = 0;
|
||||
static char command[20];
|
||||
static u16_t addr[8];
|
||||
static uint16_t addr[8];
|
||||
uip_ipaddr_t dest_addr;
|
||||
|
||||
PROCESS(ping6_process, "PING6 process");
|
||||
|
@ -66,7 +66,7 @@ AUTOSTART_PROCESSES(&ping6_process);
|
|||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static u8_t
|
||||
static uint8_t
|
||||
ping6handler(process_event_t ev, process_data_t data)
|
||||
{
|
||||
if(count == 0){
|
||||
|
@ -130,8 +130,8 @@ ping6handler(process_event_t ev, process_data_t data)
|
|||
|
||||
|
||||
uip_len = UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN + UIP_IPH_LEN + PING6_DATALEN;
|
||||
UIP_IP_BUF->len[0] = (u8_t)((uip_len - 40) >> 8);
|
||||
UIP_IP_BUF->len[1] = (u8_t)((uip_len - 40) & 0x00FF);
|
||||
UIP_IP_BUF->len[0] = (uint8_t)((uip_len - 40) >> 8);
|
||||
UIP_IP_BUF->len[1] = (uint8_t)((uip_len - 40) & 0x00FF);
|
||||
|
||||
UIP_ICMP_BUF->icmpchksum = 0;
|
||||
UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum();
|
||||
|
@ -157,7 +157,7 @@ ping6handler(process_event_t ev, process_data_t data)
|
|||
PROCESS_THREAD(ping6_process, ev, data)
|
||||
{
|
||||
|
||||
u8_t cont = 1;
|
||||
uint8_t cont = 1;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
PRINTF("In Process PING6\n");
|
||||
|
|
|
@ -30,7 +30,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(...)
|
||||
|
|
|
@ -20,7 +20,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(...)
|
||||
|
@ -420,10 +420,10 @@ handle_incoming_data(void)
|
|||
int error=NO_ERROR;
|
||||
char buf[MAX_PAYLOAD_LEN];
|
||||
|
||||
PRINTF("uip_datalen received %u \n",(u16_t)uip_datalen());
|
||||
PRINTF("uip_datalen received %u \n",(uint16_t)uip_datalen());
|
||||
|
||||
char* data = (char *)uip_appdata + uip_ext_len;
|
||||
u16_t datalen = uip_datalen() - uip_ext_len;
|
||||
uint16_t datalen = uip_datalen() - uip_ext_len;
|
||||
|
||||
int data_size = 0;
|
||||
|
||||
|
|
|
@ -7,7 +7,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(...)
|
||||
|
|
|
@ -13,7 +13,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(...)
|
||||
|
|
|
@ -15,7 +15,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(...)
|
||||
|
|
|
@ -330,7 +330,7 @@ send_udp_packet(struct uip_udp_conn *conn)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
parse_incoming_packet(const u8_t *buf, int len)
|
||||
parse_incoming_packet(const uint8_t *buf, int len)
|
||||
{
|
||||
int numregs;
|
||||
int flags;
|
||||
|
|
|
@ -85,8 +85,8 @@ send_ping(uip_ipaddr_t *dest_addr)
|
|||
|
||||
uip_len = UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN +
|
||||
UIP_IPH_LEN + PING_DATALEN;
|
||||
UIP_IP_BUF->len[0] = (u8_t)((uip_len - 40) >> 8);
|
||||
UIP_IP_BUF->len[1] = (u8_t)((uip_len - 40) & 0x00ff);
|
||||
UIP_IP_BUF->len[0] = (uint8_t)((uip_len - 40) >> 8);
|
||||
UIP_IP_BUF->len[1] = (uint8_t)((uip_len - 40) & 0x00ff);
|
||||
|
||||
UIP_ICMP_BUF->icmpchksum = 0;
|
||||
UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum();
|
||||
|
@ -116,11 +116,11 @@ send_ping(uip_ipaddr_t *dest_addr)
|
|||
UIP_ICMP_BUF->seqno = uip_htons(seqno++);
|
||||
|
||||
uip_len = UIP_ICMPH_LEN + UIP_IPH_LEN + PING_DATALEN;
|
||||
UIP_IP_BUF->len[0] = (u8_t)((uip_len) >> 8);
|
||||
UIP_IP_BUF->len[1] = (u8_t)((uip_len) & 0x00ff);
|
||||
UIP_IP_BUF->len[0] = (uint8_t)((uip_len) >> 8);
|
||||
UIP_IP_BUF->len[1] = (uint8_t)((uip_len) & 0x00ff);
|
||||
|
||||
UIP_ICMP_BUF->icmpchksum = 0;
|
||||
UIP_ICMP_BUF->icmpchksum = ~uip_chksum((u16_t *)&(UIP_ICMP_BUF->type),
|
||||
UIP_ICMP_BUF->icmpchksum = ~uip_chksum((uint16_t *)&(UIP_ICMP_BUF->type),
|
||||
UIP_ICMPH_LEN + PING_DATALEN);
|
||||
|
||||
/* Calculate IP checksum. */
|
||||
|
|
|
@ -123,7 +123,7 @@ sent_mesh(struct mesh_conn *c)
|
|||
{
|
||||
}
|
||||
static void
|
||||
recv_mesh(struct mesh_conn *c, const rimeaddr_t *from, u8_t hops)
|
||||
recv_mesh(struct mesh_conn *c, const rimeaddr_t *from, uint8_t hops)
|
||||
{
|
||||
struct rime_ping_msg ping;
|
||||
char buf[64];
|
||||
|
|
|
@ -293,7 +293,7 @@ PROCESS_THREAD(shell_send_process, ev, data)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
recv_collect(const rimeaddr_t *originator, u8_t seqno, u8_t hops)
|
||||
recv_collect(const rimeaddr_t *originator, uint8_t seqno, uint8_t hops)
|
||||
{
|
||||
struct collect_msg collect_msg;
|
||||
char *dataptr;
|
||||
|
|
|
@ -82,7 +82,7 @@ telnet_text_output(struct telnet_state *s, char *text1, char *text2)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
telnet_newdata(struct telnet_state *s, char *data, u16_t len)
|
||||
telnet_newdata(struct telnet_state *s, char *data, uint16_t len)
|
||||
{
|
||||
shell_output(&tcpsend_command, data, len, "", 0);
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ shell_wget_init(void)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
webclient_datahandler(char *data, u16_t len)
|
||||
webclient_datahandler(char *data, uint16_t len)
|
||||
{
|
||||
if(len == 0) {
|
||||
running = 0;
|
||||
|
|
|
@ -152,7 +152,7 @@ static void
|
|||
connect(void)
|
||||
{
|
||||
uip_ipaddr_t addr, *addrptr;
|
||||
u16_t port;
|
||||
uint16_t port;
|
||||
char *cptr;
|
||||
struct uip_conn *conn;
|
||||
|
||||
|
@ -310,7 +310,7 @@ telnet_timedout(struct telnet_state *s)
|
|||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
telnet_newdata(struct telnet_state *s, char *data, u16_t len)
|
||||
telnet_newdata(struct telnet_state *s, char *data, uint16_t len)
|
||||
{
|
||||
petsciiconv_topetscii(data, len);
|
||||
data[len] = 0;
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#define FLAG_ABORT 2
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
unsigned char
|
||||
telnet_send(struct telnet_state *s, char *text, u16_t len)
|
||||
telnet_send(struct telnet_state *s, char *text, uint16_t len)
|
||||
{
|
||||
if(s->text != NULL) {
|
||||
return 1;
|
||||
|
@ -104,7 +104,7 @@ senddata(struct telnet_state *s)
|
|||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
struct telnet_state *
|
||||
telnet_connect(struct telnet_state *s, uip_ipaddr_t *addr, u16_t port)
|
||||
telnet_connect(struct telnet_state *s, uip_ipaddr_t *addr, uint16_t port)
|
||||
{
|
||||
struct uip_conn *conn;
|
||||
|
||||
|
|
|
@ -39,16 +39,16 @@
|
|||
struct telnet_state {
|
||||
unsigned char flags;
|
||||
char *text;
|
||||
u16_t textlen;
|
||||
u16_t sentlen;
|
||||
uint16_t textlen;
|
||||
uint16_t sentlen;
|
||||
};
|
||||
|
||||
/*DISPATCHER_UIPCALL(telnet_app, s);*/
|
||||
void telnet_app(void *s);
|
||||
unsigned char telnet_send(struct telnet_state *s, char *text, u16_t len);
|
||||
unsigned char telnet_send(struct telnet_state *s, char *text, uint16_t len);
|
||||
unsigned char telnet_close(struct telnet_state *s);
|
||||
unsigned char telnet_abort(struct telnet_state *s);
|
||||
struct telnet_state *telnet_connect(struct telnet_state *s, uip_ipaddr_t *addr, u16_t port);
|
||||
struct telnet_state *telnet_connect(struct telnet_state *s, uip_ipaddr_t *addr, uint16_t port);
|
||||
|
||||
|
||||
/* Callbacks, implemented by the caller. */
|
||||
|
@ -57,5 +57,5 @@ void telnet_closed(struct telnet_state *s);
|
|||
void telnet_sent(struct telnet_state *s);
|
||||
void telnet_aborted(struct telnet_state *s);
|
||||
void telnet_timedout(struct telnet_state *s);
|
||||
void telnet_newdata(struct telnet_state *s, char *data, u16_t len);
|
||||
void telnet_newdata(struct telnet_state *s, char *data, uint16_t len);
|
||||
#endif /* __TELNET_H__ */
|
||||
|
|
|
@ -66,7 +66,7 @@ struct telnetd_state {
|
|||
char buf[TELNETD_CONF_LINELEN + 1];
|
||||
char bufptr;
|
||||
uint16_t numsent;
|
||||
u8_t state;
|
||||
uint8_t state;
|
||||
#define STATE_NORMAL 0
|
||||
#define STATE_IAC 1
|
||||
#define STATE_WILL 2
|
||||
|
@ -239,7 +239,7 @@ senddata(void)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
get_char(u8_t c)
|
||||
get_char(uint8_t c)
|
||||
{
|
||||
PRINTF("telnetd: get_char '%c' %d %d\n", c, c, s.bufptr);
|
||||
|
||||
|
@ -264,7 +264,7 @@ get_char(u8_t c)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
sendopt(u8_t option, u8_t value)
|
||||
sendopt(uint8_t option, uint8_t value)
|
||||
{
|
||||
char line[4];
|
||||
line[0] = (char)TELNET_IAC;
|
||||
|
@ -278,8 +278,8 @@ sendopt(u8_t option, u8_t value)
|
|||
static void
|
||||
newdata(void)
|
||||
{
|
||||
u16_t len;
|
||||
u8_t c;
|
||||
uint16_t len;
|
||||
uint8_t c;
|
||||
uint8_t *ptr;
|
||||
|
||||
len = uip_datalen();
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "net/uip_arch.h"
|
||||
|
||||
/* Pointer to the bitmap area in memory. */
|
||||
extern u8_t vnc_draw_bitmap[];
|
||||
extern uint8_t vnc_draw_bitmap[];
|
||||
|
||||
/* Initialize the vnc-draw module. */
|
||||
void vnc_draw_init(void);
|
||||
|
@ -48,14 +48,14 @@ void vnc_draw_init(void);
|
|||
given by the "data" argument and the length of data is given by the
|
||||
"datalen" argument. The data format is one pixel per byte in bgr233
|
||||
format (bbgggrrr). */
|
||||
void vnc_draw_pixelline(u16_t x, u16_t y,
|
||||
u8_t *data, u16_t datalen);
|
||||
void vnc_draw_pixelline(uint16_t x, uint16_t y,
|
||||
uint8_t *data, uint16_t datalen);
|
||||
|
||||
/* The following functions should return the x and y coordinates and
|
||||
the width and height of the viewport. */
|
||||
u16_t vnc_draw_viewport_x(void);
|
||||
u16_t vnc_draw_viewport_y(void);
|
||||
u16_t vnc_draw_viewport_w(void);
|
||||
u16_t vnc_draw_viewport_h(void);
|
||||
uint16_t vnc_draw_viewport_x(void);
|
||||
uint16_t vnc_draw_viewport_y(void);
|
||||
uint16_t vnc_draw_viewport_w(void);
|
||||
uint16_t vnc_draw_viewport_h(void);
|
||||
|
||||
#endif /* __VNC_DRAW_H__ */
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#define RFB_SERVER_VERSION_STRING rfb_server_version_string
|
||||
|
||||
/* "RFB 003.003" */
|
||||
static u8_t rfb_server_version_string[12] =
|
||||
static uint8_t rfb_server_version_string[12] =
|
||||
{82,70,66,32,48,48,51,46,48,48,51,10};
|
||||
|
||||
#if 0
|
||||
|
@ -77,7 +77,7 @@ vnc_viewer_close(void)
|
|||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
vnc_viewer_connect(u16_t *server, u8_t display)
|
||||
vnc_viewer_connect(uint16_t *server, uint8_t display)
|
||||
{
|
||||
struct uip_conn *conn;
|
||||
|
||||
|
@ -96,10 +96,10 @@ vnc_viewer_connect(u16_t *server, u8_t display)
|
|||
static void
|
||||
senddata(void)
|
||||
{
|
||||
register u8_t *dataptr;
|
||||
u16_t dataleft;
|
||||
register uint8_t *dataptr;
|
||||
uint16_t dataleft;
|
||||
|
||||
dataptr = (u8_t *)uip_appdata;
|
||||
dataptr = (uint8_t *)uip_appdata;
|
||||
|
||||
switch(vs->sendmsg) {
|
||||
case VNC_SEND_VERSION:
|
||||
|
@ -115,7 +115,7 @@ senddata(void)
|
|||
case VNC_SEND_CINIT:
|
||||
PRINTF(("Sending CINIT\n"));
|
||||
/* Send one byte of client init. */
|
||||
*(u8_t *)dataptr = 1;
|
||||
*(uint8_t *)dataptr = 1;
|
||||
uip_send(uip_appdata, 1);
|
||||
break;
|
||||
case VNC_SEND_PFMT:
|
||||
|
@ -144,10 +144,10 @@ senddata(void)
|
|||
dataptr += sizeof(struct rfb_set_encodings);
|
||||
dataptr[0] = dataptr[1] = dataptr[2] = 0;
|
||||
dataptr[3] = RFB_ENC_RAW;
|
||||
/* ((u8_t *)dataptr + sizeof(struct rfb_set_encodings))[4] =
|
||||
((u8_t *)dataptr + sizeof(struct rfb_set_encodings))[5] =
|
||||
((u8_t *)dataptr + sizeof(struct rfb_set_encodings))[6] = 0;
|
||||
((u8_t *)dataptr + sizeof(struct rfb_set_encodings))[7] = RFB_ENC_RRE;*/
|
||||
/* ((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[4] =
|
||||
((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[5] =
|
||||
((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[6] = 0;
|
||||
((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[7] = RFB_ENC_RRE;*/
|
||||
uip_send(uip_appdata, sizeof(struct rfb_set_encodings) + 4);
|
||||
break;
|
||||
case VNC_SEND_UPDATERQ:
|
||||
|
@ -230,7 +230,7 @@ senddata(void)
|
|||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
buffer_data(u8_t *data, u16_t datalen)
|
||||
buffer_data(uint8_t *data, uint16_t datalen)
|
||||
{
|
||||
PRINTF(("Buffering %d bytes of data\n", datalen));
|
||||
|
||||
|
@ -254,11 +254,11 @@ clearbuffer(void)
|
|||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Returns: the amount of bytes actually read. */
|
||||
static u16_t
|
||||
recv_rectstate(u8_t *dataptr, u16_t datalen)
|
||||
static uint16_t
|
||||
recv_rectstate(uint8_t *dataptr, uint16_t datalen)
|
||||
{
|
||||
u16_t pixels;
|
||||
u16_t pixelsleft;
|
||||
uint16_t pixels;
|
||||
uint16_t pixelsleft;
|
||||
|
||||
switch(vs->rectstate) {
|
||||
case VNC_RECTSTATE_RAW:
|
||||
|
@ -309,7 +309,7 @@ recv_rectstate(u8_t *dataptr, u16_t datalen)
|
|||
rect can be drawn. */
|
||||
static unsigned short
|
||||
recv_update_rect(CC_REGISTER_ARG struct rfb_fb_update_rect_hdr *rhdr,
|
||||
u16_t dataleft)
|
||||
uint16_t dataleft)
|
||||
{
|
||||
struct rfb_rre_hdr *rrehdr;
|
||||
|
||||
|
@ -319,7 +319,7 @@ recv_update_rect(CC_REGISTER_ARG struct rfb_fb_update_rect_hdr *rhdr,
|
|||
rhdr->encoding[2]) == 0) {
|
||||
switch(rhdr->encoding[3]) {
|
||||
case RFB_ENC_RAW:
|
||||
vs->rectstateleft = (u32_t)uip_htons(rhdr->rect.w) * (u32_t)uip_htons(rhdr->rect.h);
|
||||
vs->rectstateleft = (uint32_t)uip_htons(rhdr->rect.w) * (uint32_t)uip_htons(rhdr->rect.h);
|
||||
vs->rectstate = VNC_RECTSTATE_RAW;
|
||||
vs->rectstatex0 = vs->rectstatex = uip_htons(rhdr->rect.x);
|
||||
vs->rectstatey0 = vs->rectstatey = uip_htons(rhdr->rect.y);
|
||||
|
@ -330,14 +330,14 @@ recv_update_rect(CC_REGISTER_ARG struct rfb_fb_update_rect_hdr *rhdr,
|
|||
break;
|
||||
|
||||
case RFB_ENC_RRE:
|
||||
rrehdr = (struct rfb_rre_hdr *)((u8_t *)rhdr +
|
||||
rrehdr = (struct rfb_rre_hdr *)((uint8_t *)rhdr +
|
||||
sizeof(struct rfb_fb_update_rect_hdr));
|
||||
PRINTF(("Received RRE subrects %d (%d)\n",
|
||||
(uip_htons(rrehdr->subrects[1]) << 16) +
|
||||
uip_htons(rrehdr->subrects[0]),
|
||||
rrehdr->bgpixel));
|
||||
vs->rectstateleft = ((u32_t)(uip_htons(rrehdr->subrects[1]) << 16) +
|
||||
(u32_t)uip_htons(rrehdr->subrects[0]));
|
||||
vs->rectstateleft = ((uint32_t)(uip_htons(rrehdr->subrects[1]) << 16) +
|
||||
(uint32_t)uip_htons(rrehdr->subrects[0]));
|
||||
vs->rectstate = VNC_RECTSTATE_RRE;
|
||||
|
||||
break;
|
||||
|
@ -363,8 +363,8 @@ recv_update_rect(CC_REGISTER_ARG struct rfb_fb_update_rect_hdr *rhdr,
|
|||
* incoming message and returns the number of bytes of data that is to
|
||||
* be expected.
|
||||
*/
|
||||
static u16_t
|
||||
identify_data(CC_REGISTER_ARG u8_t *data, u16_t datalen)
|
||||
static uint16_t
|
||||
identify_data(CC_REGISTER_ARG uint8_t *data, uint16_t datalen)
|
||||
{
|
||||
switch(vs->waitmsg) {
|
||||
case VNC_WAIT_VERSION:
|
||||
|
@ -405,7 +405,7 @@ identify_data(CC_REGISTER_ARG u8_t *data, u16_t datalen)
|
|||
|
||||
default:
|
||||
uip_abort();
|
||||
PRINTF(("Weird message type received (%d)\n", *(u8_t *)uip_appdata));
|
||||
PRINTF(("Weird message type received (%d)\n", *(uint8_t *)uip_appdata));
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
@ -425,7 +425,7 @@ identify_data(CC_REGISTER_ARG u8_t *data, u16_t datalen)
|
|||
* Handles the data.
|
||||
*/
|
||||
static unsigned short
|
||||
handle_data(CC_REGISTER_ARG u8_t *data, u16_t datalen)
|
||||
handle_data(CC_REGISTER_ARG uint8_t *data, uint16_t datalen)
|
||||
{
|
||||
|
||||
switch(vs->waitmsg) {
|
||||
|
@ -461,7 +461,7 @@ handle_data(CC_REGISTER_ARG u8_t *data, u16_t datalen)
|
|||
uip_htons(((struct rfb_server_init *)data)->height),
|
||||
((struct rfb_server_init *)data)->format.bps,
|
||||
((struct rfb_server_init *)data)->format.depth,
|
||||
((u8_t *)data + sizeof(struct rfb_server_init))));*/
|
||||
((uint8_t *)data + sizeof(struct rfb_server_init))));*/
|
||||
vs->w = uip_htons(((struct rfb_server_init *)data)->width);
|
||||
vs->h = uip_htons(((struct rfb_server_init *)data)->height);
|
||||
vs->sendmsg = VNC_SEND_PFMT;
|
||||
|
@ -490,7 +490,7 @@ handle_data(CC_REGISTER_ARG u8_t *data, u16_t datalen)
|
|||
break;
|
||||
|
||||
default:
|
||||
PRINTF(("Weird message type received (%d)\n", *(u8_t *)data));
|
||||
PRINTF(("Weird message type received (%d)\n", *(uint8_t *)data));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -525,15 +525,15 @@ handle_data(CC_REGISTER_ARG u8_t *data, u16_t datalen)
|
|||
* care of the next time this function is invoked (i.e., for the next
|
||||
* incoming data chunk).
|
||||
*/
|
||||
static u8_t
|
||||
static uint8_t
|
||||
newdata(void)
|
||||
{
|
||||
u16_t datalen;
|
||||
u16_t readlen;
|
||||
u8_t *dataptr;
|
||||
uint16_t datalen;
|
||||
uint16_t readlen;
|
||||
uint8_t *dataptr;
|
||||
|
||||
datalen = uip_datalen();
|
||||
dataptr = (u8_t *)uip_appdata;
|
||||
dataptr = (uint8_t *)uip_appdata;
|
||||
|
||||
PRINTF(("newdata: %d bytes\n", datalen));
|
||||
|
||||
|
@ -558,7 +558,7 @@ newdata(void)
|
|||
sequence for the data that is left in the incoming chunk. */
|
||||
datalen -= vs->bufferleft;
|
||||
dataptr += vs->bufferleft;
|
||||
buffer_data((u8_t *)uip_appdata, vs->bufferleft);
|
||||
buffer_data((uint8_t *)uip_appdata, vs->bufferleft);
|
||||
handle_data(vs->buffer, vs->buffersize);
|
||||
clearbuffer();
|
||||
} else { /* datalen < vs->bufferleft */
|
||||
|
@ -710,9 +710,9 @@ vnc_viewer_appcall(void * nullptr)
|
|||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
vnc_viewer_post_event(u8_t type,
|
||||
u16_t data1, u16_t data2,
|
||||
u16_t data3, u16_t data4)
|
||||
vnc_viewer_post_event(uint8_t type,
|
||||
uint16_t data1, uint16_t data2,
|
||||
uint16_t data3, uint16_t data4)
|
||||
{
|
||||
register struct vnc_event *ev;
|
||||
struct vnc_event *ev0;
|
||||
|
|
|
@ -39,12 +39,12 @@
|
|||
|
||||
struct vnc_viewer_state;
|
||||
|
||||
/*typedef unsigned long u32_t;*/
|
||||
/*typedef unsigned long uint32_t;*/
|
||||
|
||||
void vnc_viewer_init(void);
|
||||
void vnc_viewer_appcall(void *nullptr);
|
||||
|
||||
void vnc_viewer_connect(u16_t *server, u8_t display);
|
||||
void vnc_viewer_connect(uint16_t *server, uint8_t display);
|
||||
void vnc_viewer_close(void);
|
||||
|
||||
/* Callback: redraws the VNC viewer bitmap area. */
|
||||
|
@ -63,9 +63,9 @@ void vnc_viewer_refresh(void);
|
|||
#define VNC_VIEWER_POST_UPDATERQ_EVENT(x1,y1,x2,y2) \
|
||||
vnc_viewer_post_event(VNC_UPDATERQ_EVENT, x1, y1, x2, y2)
|
||||
|
||||
void vnc_viewer_post_event(u8_t event,
|
||||
u16_t data1, u16_t data2,
|
||||
u16_t data3, u16_t data4);
|
||||
void vnc_viewer_post_event(uint8_t event,
|
||||
uint16_t data1, uint16_t data2,
|
||||
uint16_t data3, uint16_t data4);
|
||||
|
||||
/* UIP_APPCALL: the name of the application function. This function
|
||||
must return void and take no arguments (i.e., C type "void
|
||||
|
@ -75,22 +75,22 @@ void vnc_viewer_post_event(u8_t event,
|
|||
#endif
|
||||
|
||||
struct vnc_key_event {
|
||||
u8_t down;
|
||||
u16_t key;
|
||||
uint8_t down;
|
||||
uint16_t key;
|
||||
};
|
||||
|
||||
struct vnc_pointer_event {
|
||||
u8_t buttonmask;
|
||||
u16_t x, y;
|
||||
uint8_t buttonmask;
|
||||
uint16_t x, y;
|
||||
};
|
||||
|
||||
struct vnc_updaterq_event {
|
||||
u16_t x, y;
|
||||
u16_t w, h;
|
||||
uint16_t x, y;
|
||||
uint16_t w, h;
|
||||
};
|
||||
|
||||
struct vnc_event {
|
||||
u8_t type;
|
||||
uint8_t type;
|
||||
union {
|
||||
struct vnc_key_event key;
|
||||
struct vnc_pointer_event ptr;
|
||||
|
@ -133,34 +133,34 @@ enum vnc_rectstate {
|
|||
};
|
||||
|
||||
struct vnc_viewer_state {
|
||||
u8_t close;
|
||||
u16_t w, h;
|
||||
uint8_t close;
|
||||
uint16_t w, h;
|
||||
|
||||
u8_t sendmsg;
|
||||
uint8_t sendmsg;
|
||||
|
||||
u8_t waitmsg;
|
||||
uint8_t waitmsg;
|
||||
|
||||
u16_t rectsleft;
|
||||
uint16_t rectsleft;
|
||||
|
||||
u8_t rectstate;
|
||||
u32_t rectstateleft;
|
||||
u16_t rectstatex, rectstatey;
|
||||
u16_t rectstateh, rectstatew;
|
||||
u16_t rectstatex0, rectstatey0;
|
||||
u16_t rectstatex2, rectstatey2;
|
||||
uint8_t rectstate;
|
||||
uint32_t rectstateleft;
|
||||
uint16_t rectstatex, rectstatey;
|
||||
uint16_t rectstateh, rectstatew;
|
||||
uint16_t rectstatex0, rectstatey0;
|
||||
uint16_t rectstatex2, rectstatey2;
|
||||
|
||||
|
||||
u16_t eventptr_acked;
|
||||
u16_t eventptr_unacked;
|
||||
u16_t eventptr_next;
|
||||
uint16_t eventptr_acked;
|
||||
uint16_t eventptr_unacked;
|
||||
uint16_t eventptr_next;
|
||||
#define VNC_EVENTQUEUE_SIZE 32
|
||||
struct vnc_event event_queue[VNC_EVENTQUEUE_SIZE];
|
||||
|
||||
|
||||
u16_t bufferleft;
|
||||
u16_t buffersize;
|
||||
uint16_t bufferleft;
|
||||
uint16_t buffersize;
|
||||
#define VNC_BUFFERSIZE 64
|
||||
u8_t buffer[VNC_BUFFERSIZE];
|
||||
uint8_t buffer[VNC_BUFFERSIZE];
|
||||
};
|
||||
|
||||
extern static struct vnc_viewer_state vnc_viewer_state;
|
||||
|
@ -173,25 +173,25 @@ extern static struct vnc_viewer_state vnc_viewer_state;
|
|||
|
||||
/* Generic rectangle - x, y coordinates, width and height. */
|
||||
struct rfb_rect {
|
||||
u16_t x;
|
||||
u16_t y;
|
||||
u16_t w;
|
||||
u16_t h;
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
uint16_t w;
|
||||
uint16_t h;
|
||||
};
|
||||
|
||||
/* Pixel format definition. */
|
||||
struct rfb_pixel_format {
|
||||
u8_t bps; /* Bits per pixel: 8, 16 or 32. */
|
||||
u8_t depth; /* Color depth: 8-32 */
|
||||
u8_t endian; /* 1 - big endian (motorola), 0 - little endian
|
||||
uint8_t bps; /* Bits per pixel: 8, 16 or 32. */
|
||||
uint8_t depth; /* Color depth: 8-32 */
|
||||
uint8_t endian; /* 1 - big endian (motorola), 0 - little endian
|
||||
(x86) */
|
||||
u8_t truecolor; /* 1 - true color is used, 0 - true color is not used. */
|
||||
uint8_t truecolor; /* 1 - true color is used, 0 - true color is not used. */
|
||||
|
||||
/* The following fields are only used if true color is used. */
|
||||
u16_t red_max, green_max, blue_max;
|
||||
u8_t red_shift, green_shift, blue_shift;
|
||||
u8_t pad1;
|
||||
u16_t pad2;
|
||||
uint16_t red_max, green_max, blue_max;
|
||||
uint8_t red_shift, green_shift, blue_shift;
|
||||
uint8_t pad1;
|
||||
uint16_t pad2;
|
||||
};
|
||||
|
||||
|
||||
|
@ -234,94 +234,94 @@ struct rfb_pixel_format {
|
|||
/* Server to client messages. */
|
||||
|
||||
struct rfb_server_init {
|
||||
u16_t width;
|
||||
u16_t height;
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
struct rfb_pixel_format format;
|
||||
u8_t namelength[4];
|
||||
uint8_t namelength[4];
|
||||
/* Followed by name. */
|
||||
};
|
||||
|
||||
struct rfb_fb_update {
|
||||
u8_t type;
|
||||
u8_t pad;
|
||||
u16_t rects; /* Number of rectanges (struct rfb_fb_update_rect_hdr +
|
||||
uint8_t type;
|
||||
uint8_t pad;
|
||||
uint16_t rects; /* Number of rectanges (struct rfb_fb_update_rect_hdr +
|
||||
data) that follows. */
|
||||
};
|
||||
|
||||
struct rfb_fb_update_rect_hdr {
|
||||
struct rfb_rect rect;
|
||||
u8_t encoding[4];
|
||||
uint8_t encoding[4];
|
||||
};
|
||||
|
||||
struct rfb_copy_rect {
|
||||
u16_t srcx;
|
||||
u16_t srcy;
|
||||
uint16_t srcx;
|
||||
uint16_t srcy;
|
||||
};
|
||||
|
||||
struct rfb_rre_hdr {
|
||||
u16_t subrects[2]; /* Number of subrectangles (struct
|
||||
uint16_t subrects[2]; /* Number of subrectangles (struct
|
||||
rfb_rre_subrect) to follow. */
|
||||
u8_t bgpixel;
|
||||
uint8_t bgpixel;
|
||||
};
|
||||
|
||||
struct rfb_rre_subrect {
|
||||
u8_t pixel;
|
||||
uint8_t pixel;
|
||||
struct rfb_rect rect;
|
||||
};
|
||||
|
||||
struct rfb_corre_rect {
|
||||
u8_t x;
|
||||
u8_t y;
|
||||
u8_t w;
|
||||
u8_t h;
|
||||
uint8_t x;
|
||||
uint8_t y;
|
||||
uint8_t w;
|
||||
uint8_t h;
|
||||
};
|
||||
|
||||
/* Client to server messages. */
|
||||
|
||||
struct rfb_set_pixel_format {
|
||||
u8_t type;
|
||||
u8_t pad;
|
||||
u16_t pad2;
|
||||
uint8_t type;
|
||||
uint8_t pad;
|
||||
uint16_t pad2;
|
||||
struct rfb_pixel_format format;
|
||||
};
|
||||
|
||||
struct rfb_fix_colormap_entries {
|
||||
u8_t type;
|
||||
u8_t pad;
|
||||
u16_t firstcolor;
|
||||
u16_t colors;
|
||||
uint8_t type;
|
||||
uint8_t pad;
|
||||
uint16_t firstcolor;
|
||||
uint16_t colors;
|
||||
};
|
||||
|
||||
struct rfb_set_encodings {
|
||||
u8_t type;
|
||||
u8_t pad;
|
||||
u16_t encodings;
|
||||
uint8_t type;
|
||||
uint8_t pad;
|
||||
uint16_t encodings;
|
||||
};
|
||||
|
||||
struct rfb_fb_update_request {
|
||||
u8_t type;
|
||||
u8_t incremental;
|
||||
u16_t x;
|
||||
u16_t y;
|
||||
u16_t w;
|
||||
u16_t h;
|
||||
uint8_t type;
|
||||
uint8_t incremental;
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
uint16_t w;
|
||||
uint16_t h;
|
||||
};
|
||||
|
||||
struct rfb_key_event {
|
||||
u8_t type;
|
||||
u8_t down;
|
||||
u16_t pad;
|
||||
u8_t key[4];
|
||||
uint8_t type;
|
||||
uint8_t down;
|
||||
uint16_t pad;
|
||||
uint8_t key[4];
|
||||
};
|
||||
|
||||
#define RFB_BUTTON_MASK1 1
|
||||
#define RFB_BUTTON_MASK2 2
|
||||
#define RFB_BUTTON_MASK3 4
|
||||
struct rfb_pointer_event {
|
||||
u8_t type;
|
||||
u8_t buttonmask;
|
||||
u16_t x;
|
||||
u16_t y;
|
||||
uint8_t type;
|
||||
uint8_t buttonmask;
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
};
|
||||
|
||||
#endif /* __VNC_VIEWER_H__ */
|
||||
|
|
|
@ -125,7 +125,7 @@ static void
|
|||
connect(void)
|
||||
{
|
||||
uip_ipaddr_t addr, *addrptr;
|
||||
u16_t port;
|
||||
uint16_t port;
|
||||
char *cptr;
|
||||
|
||||
/* Find the first space character in host and put a zero there
|
||||
|
|
|
@ -553,11 +553,11 @@ parse_tag(void)
|
|||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static u16_t
|
||||
parse_word(char *data, u8_t dlen)
|
||||
static uint16_t
|
||||
parse_word(char *data, uint8_t dlen)
|
||||
{
|
||||
static u8_t i;
|
||||
static u8_t len;
|
||||
static uint8_t i;
|
||||
static uint8_t len;
|
||||
unsigned char c;
|
||||
|
||||
len = dlen;
|
||||
|
@ -825,15 +825,15 @@ parse_word(char *data, u8_t dlen)
|
|||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
htmlparser_parse(char *data, u16_t datalen)
|
||||
htmlparser_parse(char *data, uint16_t datalen)
|
||||
{
|
||||
u16_t plen;
|
||||
uint16_t plen;
|
||||
|
||||
while(datalen > 0) {
|
||||
if(datalen > 255) {
|
||||
plen = parse_word(data, 255);
|
||||
} else {
|
||||
plen = parse_word(data, (u8_t)datalen);
|
||||
plen = parse_word(data, (uint8_t)datalen);
|
||||
}
|
||||
datalen -= plen;
|
||||
data += plen;
|
||||
|
|
|
@ -73,7 +73,7 @@ void htmlparser_renderstate(unsigned char state);
|
|||
|
||||
/* Functions. */
|
||||
void htmlparser_init(void);
|
||||
void htmlparser_parse(char *data, u16_t len);
|
||||
void htmlparser_parse(char *data, uint16_t len);
|
||||
|
||||
|
||||
#endif /* __HTMLPARSER_H__ */
|
||||
|
|
|
@ -58,18 +58,18 @@
|
|||
#define ISO_space 0x20
|
||||
|
||||
struct webclient_state {
|
||||
u8_t timer;
|
||||
u8_t state;
|
||||
u8_t httpflag;
|
||||
uint8_t timer;
|
||||
uint8_t state;
|
||||
uint8_t httpflag;
|
||||
|
||||
u16_t port;
|
||||
uint16_t port;
|
||||
char host[40];
|
||||
char file[WWW_CONF_MAX_URLLEN];
|
||||
u16_t getrequestptr;
|
||||
u16_t getrequestleft;
|
||||
uint16_t getrequestptr;
|
||||
uint16_t getrequestleft;
|
||||
|
||||
char httpheaderline[200];
|
||||
u16_t httpheaderlineptr;
|
||||
uint16_t httpheaderlineptr;
|
||||
|
||||
char mimetype[32];
|
||||
};
|
||||
|
@ -117,8 +117,8 @@ init_connection(void)
|
|||
sizeof(http_crnl) - 1 +
|
||||
sizeof(http_host) - 1 +
|
||||
sizeof(http_crnl) - 1 +
|
||||
(u16_t)strlen(http_user_agent_fields) +
|
||||
(u16_t)strlen(s.file) + (u16_t)strlen(s.host);
|
||||
(uint16_t)strlen(http_user_agent_fields) +
|
||||
(uint16_t)strlen(s.file) + (uint16_t)strlen(s.host);
|
||||
s.getrequestptr = 0;
|
||||
|
||||
s.httpheaderlineptr = 0;
|
||||
|
@ -131,7 +131,7 @@ webclient_close(void)
|
|||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
unsigned char
|
||||
webclient_get(const char *host, u16_t port, const char *file)
|
||||
webclient_get(const char *host, uint16_t port, const char *file)
|
||||
{
|
||||
uip_ipaddr_t addr;
|
||||
struct uip_conn *conn;
|
||||
|
@ -212,7 +212,7 @@ window_copy(int curptr, const char *data, unsigned char datalen)
|
|||
static void
|
||||
senddata(void)
|
||||
{
|
||||
u16_t len;
|
||||
uint16_t len;
|
||||
int curptr;
|
||||
|
||||
if(s.getrequestleft > 0) {
|
||||
|
@ -246,7 +246,7 @@ senddata(void)
|
|||
static void
|
||||
acked(void)
|
||||
{
|
||||
u16_t len;
|
||||
uint16_t len;
|
||||
|
||||
if(s.getrequestleft > 0) {
|
||||
len = s.getrequestleft > uip_mss()?
|
||||
|
@ -257,8 +257,8 @@ acked(void)
|
|||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static u16_t
|
||||
parse_statusline(u16_t len)
|
||||
static uint16_t
|
||||
parse_statusline(uint16_t len)
|
||||
{
|
||||
char *cptr;
|
||||
|
||||
|
@ -324,8 +324,8 @@ casecmp(char *str1, const char *str2, char len)
|
|||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static u16_t
|
||||
parse_headers(u16_t len)
|
||||
static uint16_t
|
||||
parse_headers(uint16_t len)
|
||||
{
|
||||
char *cptr;
|
||||
static unsigned char i;
|
||||
|
@ -393,7 +393,7 @@ parse_headers(u16_t len)
|
|||
static void
|
||||
newdata(void)
|
||||
{
|
||||
u16_t len;
|
||||
uint16_t len;
|
||||
|
||||
len = uip_datalen();
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
/* Callback functions that have to be implemented by the application
|
||||
program. */
|
||||
struct webclient_state;
|
||||
void webclient_datahandler(char *data, u16_t len);
|
||||
void webclient_datahandler(char *data, uint16_t len);
|
||||
void webclient_connected(void);
|
||||
void webclient_timedout(void);
|
||||
void webclient_aborted(void);
|
||||
|
@ -52,7 +52,7 @@ void webclient_closed(void);
|
|||
|
||||
/* Functions. */
|
||||
void webclient_init(void);
|
||||
unsigned char webclient_get(const char *host, u16_t port, const char *file);
|
||||
unsigned char webclient_get(const char *host, uint16_t port, const char *file);
|
||||
void webclient_close(void);
|
||||
|
||||
void webclient_appcall(void *state);
|
||||
|
|
|
@ -553,7 +553,7 @@ PROCESS_THREAD(www_process, ev, data)
|
|||
* text entry widget in the browser window).
|
||||
*/
|
||||
static void
|
||||
set_url(char *host, u16_t port, char *file)
|
||||
set_url(char *host, uint16_t port, char *file)
|
||||
{
|
||||
char *urlptr;
|
||||
|
||||
|
@ -636,7 +636,7 @@ webclient_connected(void)
|
|||
* has arrived.
|
||||
*/
|
||||
void
|
||||
webclient_datahandler(char *data, u16_t len)
|
||||
webclient_datahandler(char *data, uint16_t len)
|
||||
{
|
||||
if(len > 0) {
|
||||
if(strcmp(webclient_mimetype(), http_texthtml) == 0) {
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
/* Line endings in git repository are LF instead of CR-LF ? */
|
||||
/*
|
||||
* This file includes functions that are called by the web server
|
||||
* scripts. The functions takes no argument, and the return value is
|
||||
|
@ -185,19 +184,38 @@ static unsigned short
|
|||
generate_header(void *arg)
|
||||
{
|
||||
unsigned short numprinted=0;
|
||||
|
||||
#if WEBSERVER_CONF_HEADER_W3C
|
||||
#define _MSS1 100
|
||||
static const char httpd_cgi_headerw[] HTTPD_STRING_ATTR = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
|
||||
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_headerw);
|
||||
#endif
|
||||
|
||||
#if WEBSERVER_CONF_HEADER_ICON
|
||||
#define _MSS2 105
|
||||
static const char httpd_cgi_header1[] HTTPD_STRING_ATTR = "<html><head><title>Contiki-nano</title><link rel=\"icon\" href=\"favicon.gif\" type=\"image/gif\"></head><body>";
|
||||
#ifdef WEBSERVER_CONF_PAGETITLE
|
||||
static const char httpd_cgi_header1[] HTTPD_STRING_ATTR = "<html><head><title>%s</title><link rel=\"icon\" href=\"favicon.gif\" type=\"image/gif\"></head><body>";
|
||||
#else
|
||||
static const char httpd_cgi_header1[] HTTPD_STRING_ATTR = "<html><head><title>Contiki-Nano</title><link rel=\"icon\" href=\"favicon.gif\" type=\"image/gif\"></head><body>";
|
||||
#endif
|
||||
#else
|
||||
#define _MSS2 52
|
||||
static const char httpd_cgi_header1[] HTTPD_STRING_ATTR = "<html><head><title>Contiki-nano</title></head><body>";
|
||||
#ifdef WEBSERVER_CONF_PAGETITLE
|
||||
static const char httpd_cgi_header1[] HTTPD_STRING_ATTR = "<html><head><title>%s</title></head><body>";
|
||||
#else
|
||||
static const char httpd_cgi_header1[] HTTPD_STRING_ATTR = "<html><head><title>Contiki-Nano</title></head><body>";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WEBSERVER_CONF_PAGETITLE
|
||||
#define WAD ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])->destipaddr.u8
|
||||
{ char buf[40];
|
||||
WEBSERVER_CONF_PAGETITLE;
|
||||
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_header1,buf);
|
||||
}
|
||||
#else
|
||||
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_header1);
|
||||
#endif
|
||||
|
||||
#if WEBSERVER_CONF_HEADER_MENU
|
||||
#define _MSS3 32
|
||||
|
@ -273,7 +291,7 @@ generate_file_stats(void *arg)
|
|||
static const char httpd_cgi_filestat3[] HTTPD_STRING_ATTR = "%5u";
|
||||
char tmp[20];
|
||||
struct httpd_fsdata_file_noconst *f,fram;
|
||||
u16_t i;
|
||||
uint16_t i;
|
||||
unsigned short numprinted;
|
||||
/* Transfer arg from whichever flash that contains the html file to RAM */
|
||||
httpd_fs_cpy(&tmp, s->u.ptr, 20);
|
||||
|
@ -538,7 +556,7 @@ generate_sensor_readings(void *arg)
|
|||
static const char httpd_cgi_sensor2[] HTTPD_STRING_ATTR = "<em>Battery :</em> %s\n";
|
||||
// static const char httpd_cgi_sensr12[] HTTPD_STRING_ATTR = "<em>Temperature:</em> %s <em>Battery:</em> %s<br>";
|
||||
static const char httpd_cgi_sensor3[] HTTPD_STRING_ATTR = "<em>Uptime :</em> %02d:%02d:%02d\n";
|
||||
static const char httpd_cgi_sensor3d[] HTTPD_STRING_ATTR = "<em>Uptime :</em> %u days %02u:%02u:%02u/n";
|
||||
static const char httpd_cgi_sensor3d[] HTTPD_STRING_ATTR = "<em>Uptime :</em> %u days %02u:%02u:%02u\n";
|
||||
// static const char httpd_cgi_sensor4[] HTTPD_STRING_ATTR = "<em>Sleeping time :</em> %02d:%02d:%02d (%d%%)<br>";
|
||||
|
||||
numprinted=0;
|
||||
|
@ -624,7 +642,17 @@ uint8_t c;
|
|||
numprinted =httpd_snprintf((char *)uip_appdata, uip_mss(), httpd_cgi_sensor0,(unsigned int) (seconds-last_tempupdate));
|
||||
}
|
||||
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor1, sensor_temperature);
|
||||
#if CONTIKI_TARGET_REDBEE_ECONOTAG
|
||||
/* Econotag at 3v55 with 10 ohms to LiFePO4 battery: 3680mv usb 3106 battery (meter 3.08). Take 3500 as breakpoint for USB connected */
|
||||
static const char httpd_cgi_sensor2u[] HTTPD_STRING_ATTR = "<em>Vcc (USB) :</em> %s\n";
|
||||
if(adc_reading[8]<1404) {
|
||||
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor2u, sensor_extvoltage);
|
||||
} else {
|
||||
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor2, sensor_extvoltage);
|
||||
}
|
||||
#else
|
||||
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor2, sensor_extvoltage);
|
||||
#endif
|
||||
// numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensr12, sensor_temperature,sensor_extvoltage);
|
||||
|
||||
#if RADIOSTATS
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "httpd-fsdata.c"
|
||||
|
||||
#if WEBSERVER_CONF_FILESTATS==1
|
||||
u16_t httpd_filecount[HTTPD_FS_NUMFILES];
|
||||
uint16_t httpd_filecount[HTTPD_FS_NUMFILES];
|
||||
#endif
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void *
|
||||
|
@ -52,7 +52,7 @@ httpd_fs_get_root()
|
|||
return (void *)HTTPD_FS_ROOT;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
u16_t
|
||||
uint16_t
|
||||
httpd_fs_get_size()
|
||||
{
|
||||
return HTTPD_FS_SIZE;
|
||||
|
@ -62,7 +62,7 @@ uint16_t
|
|||
httpd_fs_open(const char *name, struct httpd_fs_file *file)
|
||||
{
|
||||
#if WEBSERVER_CONF_FILESTATS
|
||||
u16_t i = 0;
|
||||
uint16_t i = 0;
|
||||
#endif
|
||||
struct httpd_fsdata_file_noconst *f,fram;
|
||||
|
||||
|
@ -105,7 +105,7 @@ void
|
|||
httpd_fs_init(void)
|
||||
{
|
||||
#if WEBSERVER_CONF_FILESTATS==1
|
||||
u16_t i;
|
||||
uint16_t i;
|
||||
for(i = 0; i < HTTPD_FS_NUMFILES; i++) {
|
||||
httpd_filecount[i] = 0;
|
||||
}
|
||||
|
@ -113,11 +113,11 @@ httpd_fs_init(void)
|
|||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#if WEBSERVER_CONF_FILESTATS && 0
|
||||
u16_t
|
||||
uint16_t
|
||||
httpd_fs_count(char *name)
|
||||
{
|
||||
struct httpd_fsdata_file_noconst *f;
|
||||
u16_t i;
|
||||
uint16_t i;
|
||||
|
||||
i = 0;
|
||||
for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;
|
||||
|
|
|
@ -44,8 +44,8 @@ struct httpd_fs_file {
|
|||
uint16_t httpd_fs_open(const char *name, struct httpd_fs_file *file);
|
||||
|
||||
#if WEBSERVER_CONF_FILESTATS
|
||||
extern u16_t httpd_filecount[];
|
||||
u16_t httpd_fs_count(char *name);
|
||||
extern uint16_t httpd_filecount[];
|
||||
uint16_t httpd_fs_count(char *name);
|
||||
void* httpd_fs_get_root(void);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
%! header
|
||||
<h4>Addresses</h4>
|
||||
<p>Addresses<br>
|
||||
%! addresses
|
||||
<h4>Neighbors</h4>
|
||||
<p>Neighbors<br>
|
||||
%! neighbors
|
||||
<h4>Routes</h4>
|
||||
<p>Routes<br>
|
||||
%! routes
|
||||
<h4>Sensors</h4>
|
||||
<p>Sensors<br>
|
||||
%! sensors
|
||||
%! file-stats .
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*********Generated by contiki/tools/makefsdata on 2011-09-10*********/
|
||||
/*********Generated by contiki/tools/makefsdata on 2012-02-21*********/
|
||||
|
||||
|
||||
const char data_404_html[86] HTTPD_STRING_ATTR = {
|
||||
|
@ -48,24 +48,23 @@ const char data_index_shtml[120] HTTPD_STRING_ATTR = {
|
|||
0x21, 0x0a, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d,
|
||||
0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2e};
|
||||
|
||||
const char data_status_shtml[158] HTTPD_STRING_ATTR = {
|
||||
const char data_status_shtml[150] HTTPD_STRING_ATTR = {
|
||||
/* /status.shtml */
|
||||
0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x00,
|
||||
0x25, 0x21, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x0a,
|
||||
0x3c, 0x68, 0x34, 0x3e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
|
||||
0x73, 0x65, 0x73, 0x3c, 0x2f, 0x68, 0x34, 0x3e, 0x0a, 0x25,
|
||||
0x21, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65,
|
||||
0x73, 0x0a, 0x3c, 0x68, 0x34, 0x3e, 0x4e, 0x65, 0x69, 0x67,
|
||||
0x68, 0x62, 0x6f, 0x72, 0x73, 0x3c, 0x2f, 0x68, 0x34, 0x3e,
|
||||
0x0a, 0x25, 0x21, 0x20, 0x6e, 0x65, 0x69, 0x67, 0x68, 0x62,
|
||||
0x6f, 0x72, 0x73, 0x0a, 0x3c, 0x68, 0x34, 0x3e, 0x52, 0x6f,
|
||||
0x75, 0x74, 0x65, 0x73, 0x3c, 0x2f, 0x68, 0x34, 0x3e, 0x0a,
|
||||
0x25, 0x21, 0x20, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x0a,
|
||||
0x3c, 0x68, 0x34, 0x3e, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72,
|
||||
0x73, 0x3c, 0x2f, 0x68, 0x34, 0x3e, 0x0a, 0x25, 0x21, 0x20,
|
||||
0x73, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x73, 0x0a, 0x25, 0x21,
|
||||
0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74,
|
||||
0x73, 0x20, 0x2e, 0x0a};
|
||||
0x3c, 0x70, 0x3e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
|
||||
0x65, 0x73, 0x3c, 0x62, 0x72, 0x3e, 0x0a, 0x25, 0x21, 0x20,
|
||||
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x0a,
|
||||
0x3c, 0x70, 0x3e, 0x4e, 0x65, 0x69, 0x67, 0x68, 0x62, 0x6f,
|
||||
0x72, 0x73, 0x3c, 0x62, 0x72, 0x3e, 0x0a, 0x25, 0x21, 0x20,
|
||||
0x6e, 0x65, 0x69, 0x67, 0x68, 0x62, 0x6f, 0x72, 0x73, 0x0a,
|
||||
0x3c, 0x70, 0x3e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x3c,
|
||||
0x62, 0x72, 0x3e, 0x0a, 0x25, 0x21, 0x20, 0x72, 0x6f, 0x75,
|
||||
0x74, 0x65, 0x73, 0x0a, 0x3c, 0x70, 0x3e, 0x53, 0x65, 0x6e,
|
||||
0x73, 0x6f, 0x72, 0x73, 0x3c, 0x62, 0x72, 0x3e, 0x0a, 0x25,
|
||||
0x21, 0x20, 0x73, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x73, 0x0a,
|
||||
0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74,
|
||||
0x61, 0x74, 0x73, 0x20, 0x2e, 0x0a};
|
||||
|
||||
const char data_tcp_shtml[227] HTTPD_STRING_ATTR = {
|
||||
/* /tcp.shtml */
|
||||
|
@ -101,7 +100,7 @@ struct httpd_fsdata_file {
|
|||
const char *data; //offset to coffee file data
|
||||
const int len; //length of file data
|
||||
#if HTTPD_FS_STATISTICS == 1 //not enabled since list is in PROGMEM
|
||||
u16_t count; //storage for file statistics
|
||||
uint16_t count; //storage for file statistics
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
|
@ -113,4 +112,4 @@ const struct httpd_fsdata_file file_tcp_shtml[] HTTPD_STRING_ATTR ={{ fi
|
|||
|
||||
#define HTTPD_FS_ROOT file_tcp_shtml
|
||||
#define HTTPD_FS_NUMFILES 5
|
||||
#define HTTPD_FS_SIZE 759
|
||||
#define HTTPD_FS_SIZE 751
|
||||
|
|
|
@ -44,7 +44,7 @@ struct httpd_fsdata_file {
|
|||
const int len;
|
||||
#ifdef HTTPD_FS_STATISTICS
|
||||
#if HTTPD_FS_STATISTICS == 1
|
||||
u16_t count;
|
||||
uint16_t count;
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
};
|
||||
|
@ -56,7 +56,7 @@ struct httpd_fsdata_file_noconst {
|
|||
int len;
|
||||
#ifdef HTTPD_FS_STATISTICS
|
||||
#if HTTPD_FS_STATISTICS == 1
|
||||
u16_t count;
|
||||
uint16_t count;
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
};
|
||||
|
|
|
@ -49,6 +49,18 @@
|
|||
* The advertised MSS is easily seen in wireshark.
|
||||
* Some example set a small MSS by default. rpl-border-router for example uses a receive window of 60.
|
||||
*/
|
||||
|
||||
/* Titles of web pages served with the !header cgi can be configured to show characteristics of the node.
|
||||
* For example "CD1A:3456" to show the node id and clock time of last access.
|
||||
* Change this line and rebuild to make indentifiable instances.
|
||||
* Undefine to reduce program size, giving "Contiki-Nano" title on all pages.
|
||||
* WAD indexes into the uip destaddr field, which contains the address that we responded to.
|
||||
*/
|
||||
#define WEBSERVER_CONF_PAGETITLE sprintf(buf,"[%02x%02x]",WAD[14],WAD[15]);
|
||||
//#define WEBSERVER_CONF_PAGETITLE sprintf(buf,"Nano[%02x%02x%02x]",WAD[13],WAD[14],WAD[15]);
|
||||
//#define WEBSERVER_CONF_PAGETITLE sprintf(buf,"Nano[%02x%02x...%02x%02x]",WAD[0],WAD[1],WAD[14],WAD[15]);
|
||||
//#define WEBSERVER_CONF_PAGETITLE sprintf(buf,"%2x%02x...%2x%02x [%lu]",WAD[0],WAD[1],WAD[14],WAD[15],clock_seconds());
|
||||
|
||||
#ifndef WEBSERVER_CONF_NANO
|
||||
#if CONTIKI_TARGET_SKY || CONTIKI_TARGET_STK500
|
||||
#define WEBSERVER_CONF_NANO 1
|
||||
|
|
|
@ -41,14 +41,14 @@
|
|||
#include "httpd-fsdata.c"
|
||||
|
||||
#if HTTPD_FS_STATISTICS
|
||||
static u16_t count[HTTPD_FS_NUMFILES];
|
||||
static uint16_t count[HTTPD_FS_NUMFILES];
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static u8_t
|
||||
static uint8_t
|
||||
httpd_fs_strcmp(const char *str1, const char *str2)
|
||||
{
|
||||
u8_t i;
|
||||
uint8_t i;
|
||||
i = 0;
|
||||
|
||||
loop:
|
||||
|
@ -70,7 +70,7 @@ int
|
|||
httpd_fs_open(const char *name, struct httpd_fs_file *file)
|
||||
{
|
||||
#if HTTPD_FS_STATISTICS
|
||||
u16_t i = 0;
|
||||
uint16_t i = 0;
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
struct httpd_fsdata_file_noconst *f;
|
||||
|
||||
|
@ -98,7 +98,7 @@ void
|
|||
httpd_fs_init(void)
|
||||
{
|
||||
#if HTTPD_FS_STATISTICS
|
||||
u16_t i;
|
||||
uint16_t i;
|
||||
for(i = 0; i < HTTPD_FS_NUMFILES; i++) {
|
||||
count[i] = 0;
|
||||
}
|
||||
|
@ -106,11 +106,11 @@ httpd_fs_init(void)
|
|||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#if HTTPD_FS_STATISTICS
|
||||
u16_t
|
||||
uint16_t
|
||||
httpd_fs_count(char *name)
|
||||
{
|
||||
struct httpd_fsdata_file_noconst *f;
|
||||
u16_t i;
|
||||
uint16_t i;
|
||||
|
||||
i = 0;
|
||||
for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;
|
||||
|
|
|
@ -50,7 +50,7 @@ int httpd_fs_open(const char *name, struct httpd_fs_file *file);
|
|||
|
||||
#ifdef HTTPD_FS_STATISTICS
|
||||
#if HTTPD_FS_STATISTICS == 1
|
||||
u16_t httpd_fs_count(char *name);
|
||||
uint16_t httpd_fs_count(char *name);
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ struct httpd_fsdata_file {
|
|||
const int len;
|
||||
#ifdef HTTPD_FS_STATISTICS
|
||||
#if HTTPD_FS_STATISTICS == 1
|
||||
u16_t count;
|
||||
uint16_t count;
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
};
|
||||
|
@ -56,7 +56,7 @@ struct httpd_fsdata_file_noconst {
|
|||
int len;
|
||||
#ifdef HTTPD_FS_STATISTICS
|
||||
#if HTTPD_FS_STATISTICS == 1
|
||||
u16_t count;
|
||||
uint16_t count;
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
};
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
*
|
||||
* This file is part of the Contiki VNC server
|
||||
*
|
||||
* $Id: ctk-vncfont.c,v 1.1 2006/06/17 22:41:16 adamdunkels Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -37,13 +36,12 @@
|
|||
#define o 0x01 /* 1001 0010 */
|
||||
#define X 0x02 /* 1111 0110 */
|
||||
|
||||
#ifdef WITH_AVR
|
||||
#ifdef __AVR__
|
||||
#include <avr/pgmspace.h>
|
||||
const unsigned char vncfont[] PROGMEM = {
|
||||
#else
|
||||
#define prog_char const unsigned char
|
||||
const unsigned char vncfont[] = {
|
||||
#endif
|
||||
|
||||
prog_char ctk_vncfont[] = {
|
||||
/* char 0 */
|
||||
X,o,_,_,_,_,
|
||||
o,X,_,_,_,_,
|
||||
|
|
|
@ -240,9 +240,9 @@ vnc_server_update_remove(struct vnc_server_state *vs,
|
|||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
update_area(u8_t x, u8_t y, u8_t w, u8_t h)
|
||||
update_area(uint8_t x, uint8_t y, uint8_t w, uint8_t h)
|
||||
{
|
||||
u8_t i;
|
||||
uint8_t i;
|
||||
|
||||
if(h == 0 || w == 0) {
|
||||
return;
|
||||
|
@ -266,7 +266,7 @@ update_area(u8_t x, u8_t y, u8_t w, u8_t h)
|
|||
static struct vnc_server_state *
|
||||
alloc_state(void)
|
||||
{
|
||||
u8_t i;
|
||||
uint8_t i;
|
||||
for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) {
|
||||
if(conns[i].state == VNC_DEALLOCATED) {
|
||||
return &conns[i];
|
||||
|
|
|
@ -70,14 +70,14 @@
|
|||
#define BGR(b,g,r) (((b) << 6) | (g) << 3 | (r))
|
||||
|
||||
|
||||
static const u8_t menucolor[] = {
|
||||
static const uint8_t menucolor[] = {
|
||||
BGR(3,7,7), /* Background. */
|
||||
BGR(2,6,6), /* Anti-alias font color. */
|
||||
BGR(0,0,0), /* Font color. */
|
||||
};
|
||||
|
||||
|
||||
static const u8_t activemenucolor[] = {
|
||||
static const uint8_t activemenucolor[] = {
|
||||
BGR(0,0,0), /* Background. */
|
||||
BGR(2,5,5), /* Anti-alias font color. */
|
||||
BGR(3,7,7), /* Font color. */
|
||||
|
@ -160,7 +160,7 @@ static const unsigned char iconcol_w[] =
|
|||
|
||||
|
||||
|
||||
static const u8_t * const colortheme[] =
|
||||
static const uint8_t * const colortheme[] =
|
||||
{
|
||||
backgroundcolor,
|
||||
|
||||
|
@ -193,15 +193,15 @@ static const u8_t * const colortheme[] =
|
|||
static int mouse_x, mouse_y, mouse_button;
|
||||
|
||||
#ifdef CTK_VNCSERVER_CONF_SCREEN
|
||||
static u8_t *screen = CTK_VNCSERVER_CONF_SCREEN;
|
||||
static uint8_t *screen = CTK_VNCSERVER_CONF_SCREEN;
|
||||
#else
|
||||
static u8_t screen[CHARS_WIDTH * CHARS_HEIGHT];
|
||||
static uint8_t screen[CHARS_WIDTH * CHARS_HEIGHT];
|
||||
#endif
|
||||
|
||||
#ifdef CTK_VNCSERVER_CONF_COLORSCREEN
|
||||
staitc u8_t *colorscreen = CTK_VNCSERVER_CONF_COLORSCREEN;
|
||||
staitc uint8_t *colorscreen = CTK_VNCSERVER_CONF_COLORSCREEN;
|
||||
#else
|
||||
static u8_t colorscreen[CHARS_WIDTH * CHARS_HEIGHT];
|
||||
static uint8_t colorscreen[CHARS_WIDTH * CHARS_HEIGHT];
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -214,7 +214,7 @@ struct ctk_icon *icons[MAX_ICONS];
|
|||
unsigned char
|
||||
vnc_out_add_icon(struct ctk_icon *icon)
|
||||
{
|
||||
u8_t i;
|
||||
uint8_t i;
|
||||
signed int empty;
|
||||
|
||||
empty = -1;
|
||||
|
@ -238,14 +238,14 @@ vnc_out_add_icon(struct ctk_icon *icon)
|
|||
void
|
||||
vnc_out_init(void)
|
||||
{
|
||||
u16_t i;
|
||||
uint16_t i;
|
||||
for(i = 0; i < CHARS_WIDTH * CHARS_HEIGHT; ++i) {
|
||||
screen[i] = 0x20;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vnc_out_update_screen(u8_t xpos, u8_t ypos, u8_t c, u8_t color)
|
||||
vnc_out_update_screen(uint8_t xpos, uint8_t ypos, uint8_t c, uint8_t color)
|
||||
{
|
||||
screen[xpos + ypos * CHARS_WIDTH] = c;
|
||||
colorscreen[xpos + ypos * CHARS_WIDTH] = color;
|
||||
|
@ -253,9 +253,9 @@ vnc_out_update_screen(u8_t xpos, u8_t ypos, u8_t c, u8_t color)
|
|||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
vnc_out_update_area(struct vnc_server_state *vs,
|
||||
u8_t x, u8_t y, u8_t w, u8_t h)
|
||||
uint8_t x, uint8_t y, uint8_t w, uint8_t h)
|
||||
{
|
||||
u8_t x2, y2, ax2, ay2;
|
||||
uint8_t x2, y2, ax2, ay2;
|
||||
register struct vnc_server_update *a, *b;
|
||||
|
||||
PRINTF(("update_area_connection: should update (%d:%d) (%d:%d)\n",
|
||||
|
@ -420,21 +420,21 @@ check_updates(CC_REGISTER_ARG struct vnc_server_state *vs)
|
|||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static u8_t tmp[CTK_VNCFONT_WIDTH * CTK_VNCFONT_HEIGHT];
|
||||
static uint8_t tmp[CTK_VNCFONT_WIDTH * CTK_VNCFONT_HEIGHT];
|
||||
static void
|
||||
makechar(CC_REGISTER_ARG char *ptr, u8_t x, u8_t y)
|
||||
makechar(CC_REGISTER_ARG char *ptr, uint8_t x, uint8_t y)
|
||||
{
|
||||
u8_t i, *tmpptr;
|
||||
register u8_t *colorscheme;
|
||||
uint8_t i, *tmpptr;
|
||||
register uint8_t *colorscheme;
|
||||
unsigned char *bitmap;
|
||||
u8_t b, b2;
|
||||
u8_t xmove, ymove;
|
||||
uint8_t b, b2;
|
||||
uint8_t xmove, ymove;
|
||||
unsigned char c, color;
|
||||
|
||||
color = colorscreen[x + y * CHARS_WIDTH];
|
||||
c = screen[x + y * CHARS_WIDTH];
|
||||
|
||||
colorscheme = (u8_t *)colortheme[color];
|
||||
colorscheme = (uint8_t *)colortheme[color];
|
||||
|
||||
/* First check if the character is a special icon character. These
|
||||
are to be interpreted in a special manner: the first character of
|
||||
|
@ -457,7 +457,7 @@ makechar(CC_REGISTER_ARG char *ptr, u8_t x, u8_t y)
|
|||
|
||||
if(bitmap != NULL) {
|
||||
bitmap = bitmap + ymove * 8*3;
|
||||
colorscheme = (u8_t *)colortheme[VNC_OUT_ICONCOLOR + (c >> 6)];
|
||||
colorscheme = (uint8_t *)colortheme[VNC_OUT_ICONCOLOR + (c >> 6)];
|
||||
switch(xmove) {
|
||||
case 0:
|
||||
for(i = 0; i < CTK_VNCFONT_HEIGHT; ++i) {
|
||||
|
@ -523,7 +523,7 @@ makechar(CC_REGISTER_ARG char *ptr, u8_t x, u8_t y)
|
|||
void
|
||||
vnc_out_new(CC_REGISTER_ARG struct vnc_server_state *vs)
|
||||
{
|
||||
u8_t i;
|
||||
uint8_t i;
|
||||
|
||||
vs->width = SCREEN_WIDTH;
|
||||
vs->height = SCREEN_HEIGHT;
|
||||
|
@ -545,9 +545,9 @@ void
|
|||
vnc_out_send_blank(CC_REGISTER_ARG struct vnc_server_state *vs)
|
||||
{
|
||||
register struct rfb_fb_update *umsg;
|
||||
u8_t *ptr;
|
||||
u16_t len;
|
||||
u8_t msglen;
|
||||
uint8_t *ptr;
|
||||
uint16_t len;
|
||||
uint8_t msglen;
|
||||
|
||||
vs->x = vs->y = 0;
|
||||
vs->x2 = vs->y2 = 0;
|
||||
|
@ -557,7 +557,7 @@ vnc_out_send_blank(CC_REGISTER_ARG struct vnc_server_state *vs)
|
|||
umsg->type = RFB_FB_UPDATE;
|
||||
umsg->rects = UIP_HTONS(2);
|
||||
|
||||
ptr = (u8_t *)umsg + sizeof(struct rfb_fb_update);
|
||||
ptr = (uint8_t *)umsg + sizeof(struct rfb_fb_update);
|
||||
len = sizeof(struct rfb_fb_update);
|
||||
|
||||
msglen = vnc_server_draw_rect(ptr, 0, 0,
|
||||
|
@ -590,15 +590,15 @@ static short tmpbuf[30];
|
|||
void
|
||||
vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs)
|
||||
{
|
||||
u8_t x, y, x0;
|
||||
u8_t msglen;
|
||||
u16_t len, n;
|
||||
u8_t *ptr;
|
||||
uint8_t x, y, x0;
|
||||
uint8_t msglen;
|
||||
uint16_t len, n;
|
||||
uint8_t *ptr;
|
||||
struct rfb_fb_update *umsg;
|
||||
register struct rfb_fb_update_rect_hdr *recthdr;
|
||||
struct rfb_rre_hdr *rrehdr;
|
||||
u8_t c, color, lastcolor;
|
||||
u8_t numblanks;
|
||||
uint8_t c, color, lastcolor;
|
||||
uint8_t numblanks;
|
||||
|
||||
/* First, check if we need to feed the update function with a new
|
||||
pending update. */
|
||||
|
@ -615,7 +615,7 @@ vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs)
|
|||
x0 = vs->x1;
|
||||
n = 0;
|
||||
msglen = 0;
|
||||
ptr = (u8_t *)umsg + sizeof(struct rfb_fb_update);
|
||||
ptr = (uint8_t *)umsg + sizeof(struct rfb_fb_update);
|
||||
len = sizeof(struct rfb_fb_update);
|
||||
|
||||
/* Loop over all characters that are covered by this update. */
|
||||
|
@ -741,7 +741,7 @@ vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs)
|
|||
recthdr->encoding[2] = 0;
|
||||
recthdr->encoding[3] = RFB_ENC_RAW;
|
||||
|
||||
makechar((u8_t *)recthdr +
|
||||
makechar((uint8_t *)recthdr +
|
||||
sizeof(struct rfb_fb_update_rect_hdr),
|
||||
x, y);
|
||||
}
|
||||
|
@ -837,7 +837,7 @@ void
|
|||
vnc_out_pointer_event(struct vnc_server_state *vs)
|
||||
{
|
||||
struct rfb_pointer_event *ev;
|
||||
u16_t evx, evy;
|
||||
uint16_t evx, evy;
|
||||
|
||||
ev = (struct rfb_pointer_event *)uip_appdata;
|
||||
|
||||
|
|
|
@ -51,12 +51,12 @@ void vnc_out_acked(struct vnc_server_state *vs);
|
|||
void vnc_out_poll(struct vnc_server_state *vs);
|
||||
|
||||
|
||||
void vnc_out_update_screen(u8_t x, u8_t y, u8_t c, u8_t color);
|
||||
void vnc_out_update_screen(uint8_t x, uint8_t y, uint8_t c, uint8_t color);
|
||||
char vnc_out_getkey(void);
|
||||
char vnc_out_keyavail(void);
|
||||
|
||||
void vnc_out_update_area(struct vnc_server_state *vs,
|
||||
u8_t x, u8_t y, u8_t w, u8_t h);
|
||||
uint8_t x, uint8_t y, uint8_t w, uint8_t h);
|
||||
|
||||
#include "ctk/ctk.h"
|
||||
|
||||
|
|
|
@ -65,10 +65,10 @@
|
|||
#define RFB_SERVER_VERSION_STRING rfb_server_version_string
|
||||
|
||||
/* "RFB 003.003" */
|
||||
static u8_t rfb_server_version_string[12] = {82,70,66,32,48,48,51,46,48,48,51,10};
|
||||
static uint8_t rfb_server_version_string[12] = {82,70,66,32,48,48,51,46,48,48,51,10};
|
||||
|
||||
/* uVNC */
|
||||
static u8_t uvnc_name[4] = {117,86,78,67};
|
||||
static uint8_t uvnc_name[4] = {117,86,78,67};
|
||||
#if 1
|
||||
#define PRINTF(x)
|
||||
#else
|
||||
|
@ -76,8 +76,8 @@ static u8_t uvnc_name[4] = {117,86,78,67};
|
|||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
u8_t
|
||||
vnc_server_draw_rect(u8_t *ptr, u16_t x, u16_t y, u16_t w, u16_t h, u8_t c)
|
||||
uint8_t
|
||||
vnc_server_draw_rect(uint8_t *ptr, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t c)
|
||||
{
|
||||
register struct rfb_fb_update_rect_hdr *recthdr;
|
||||
struct rfb_rre_hdr *rrehdr;
|
||||
|
@ -244,16 +244,16 @@ vnc_pointer_event(struct vnc_server_state *vs)
|
|||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static u8_t
|
||||
static uint8_t
|
||||
vnc_read_data(CC_REGISTER_ARG struct vnc_server_state *vs)
|
||||
{
|
||||
u8_t *appdata;
|
||||
u16_t len;
|
||||
uint8_t *appdata;
|
||||
uint16_t len;
|
||||
struct rfb_fb_update_request *req;
|
||||
/* u8_t niter;*/
|
||||
/* uint8_t niter;*/
|
||||
|
||||
len = uip_datalen();
|
||||
appdata = (u8_t *)uip_appdata;
|
||||
appdata = (uint8_t *)uip_appdata;
|
||||
|
||||
/* First, check if there is data left to discard since last read. */
|
||||
if(vs->readlen > 0) {
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
|
||||
|
||||
/*struct vnc_server_updatearea {
|
||||
u8_t active;
|
||||
u8_t x, y;
|
||||
u8_t w, h;
|
||||
uint8_t active;
|
||||
uint8_t x, y;
|
||||
uint8_t w, h;
|
||||
};*/
|
||||
|
||||
struct vnc_server_update {
|
||||
|
@ -49,29 +49,29 @@ struct vnc_server_update {
|
|||
#define VNC_SERVER_UPDATE_PARTS 1
|
||||
#define VNC_SERVER_UPDATE_FULL 2
|
||||
|
||||
u8_t type;
|
||||
uint8_t type;
|
||||
|
||||
u8_t x, y;
|
||||
u8_t w, h;
|
||||
uint8_t x, y;
|
||||
uint8_t w, h;
|
||||
};
|
||||
|
||||
struct vnc_server_state {
|
||||
u16_t counter;
|
||||
u8_t type;
|
||||
u8_t state;
|
||||
u16_t height, width;
|
||||
uint16_t counter;
|
||||
uint8_t type;
|
||||
uint8_t state;
|
||||
uint16_t height, width;
|
||||
|
||||
u8_t update_requested;
|
||||
uint8_t update_requested;
|
||||
|
||||
/* Variables used when sending screen updates. */
|
||||
u8_t x, y, x1, y1, x2, y2;
|
||||
u8_t w, h;
|
||||
uint8_t x, y, x1, y1, x2, y2;
|
||||
uint8_t w, h;
|
||||
|
||||
|
||||
|
||||
u16_t readlen;
|
||||
u8_t sendmsg;
|
||||
u8_t button;
|
||||
uint16_t readlen;
|
||||
uint8_t sendmsg;
|
||||
uint8_t button;
|
||||
|
||||
|
||||
struct vnc_server_update *updates_current;
|
||||
|
@ -131,30 +131,30 @@ enum {
|
|||
#include "contiki-net.h"
|
||||
|
||||
void vnc_server_send_data(struct vnc_server_state *vs);
|
||||
u8_t vnc_server_draw_rect(u8_t *ptr, u16_t x, u16_t y, u16_t w, u16_t h, u8_t c);
|
||||
uint8_t vnc_server_draw_rect(uint8_t *ptr, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t c);
|
||||
|
||||
|
||||
/* Generic rectangle - x, y coordinates, width and height. */
|
||||
struct rfb_rect {
|
||||
u16_t x;
|
||||
u16_t y;
|
||||
u16_t w;
|
||||
u16_t h;
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
uint16_t w;
|
||||
uint16_t h;
|
||||
};
|
||||
|
||||
/* Pixel format definition. */
|
||||
struct rfb_pixel_format {
|
||||
u8_t bps; /* Bits per pixel: 8, 16 or 32. */
|
||||
u8_t depth; /* Color depth: 8-32 */
|
||||
u8_t endian; /* 1 - big endian (motorola), 0 - little endian
|
||||
uint8_t bps; /* Bits per pixel: 8, 16 or 32. */
|
||||
uint8_t depth; /* Color depth: 8-32 */
|
||||
uint8_t endian; /* 1 - big endian (motorola), 0 - little endian
|
||||
(x86) */
|
||||
u8_t truecolor; /* 1 - true color is used, 0 - true color is not used. */
|
||||
uint8_t truecolor; /* 1 - true color is used, 0 - true color is not used. */
|
||||
|
||||
/* The following fields are only used if true color is used. */
|
||||
u16_t red_max, green_max, blue_max;
|
||||
u8_t red_shift, green_shift, blue_shift;
|
||||
u8_t pad1;
|
||||
u16_t pad2;
|
||||
uint16_t red_max, green_max, blue_max;
|
||||
uint8_t red_shift, green_shift, blue_shift;
|
||||
uint8_t pad1;
|
||||
uint16_t pad2;
|
||||
};
|
||||
|
||||
|
||||
|
@ -197,100 +197,100 @@ struct rfb_pixel_format {
|
|||
/* Server to client messages. */
|
||||
|
||||
struct rfb_server_init {
|
||||
u16_t width;
|
||||
u16_t height;
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
struct rfb_pixel_format format;
|
||||
u8_t namelength[4];
|
||||
uint8_t namelength[4];
|
||||
/* Followed by name. */
|
||||
};
|
||||
|
||||
struct rfb_fb_update {
|
||||
u8_t type;
|
||||
u8_t pad;
|
||||
u16_t rects; /* Number of rectanges (struct rfb_fb_update_rect_hdr +
|
||||
uint8_t type;
|
||||
uint8_t pad;
|
||||
uint16_t rects; /* Number of rectanges (struct rfb_fb_update_rect_hdr +
|
||||
data) that follows. */
|
||||
};
|
||||
|
||||
struct rfb_fb_update_rect_hdr {
|
||||
struct rfb_rect rect;
|
||||
u8_t encoding[4];
|
||||
uint8_t encoding[4];
|
||||
};
|
||||
|
||||
struct rfb_copy_rect {
|
||||
u16_t srcx;
|
||||
u16_t srcy;
|
||||
uint16_t srcx;
|
||||
uint16_t srcy;
|
||||
};
|
||||
|
||||
struct rfb_rre_hdr {
|
||||
u16_t subrects[2]; /* Number of subrectangles (struct
|
||||
uint16_t subrects[2]; /* Number of subrectangles (struct
|
||||
rfb_rre_subrect) to follow. */
|
||||
u8_t bgpixel;
|
||||
uint8_t bgpixel;
|
||||
};
|
||||
|
||||
struct rfb_rre_subrect {
|
||||
u8_t pixel;
|
||||
uint8_t pixel;
|
||||
struct rfb_rect rect;
|
||||
};
|
||||
|
||||
struct rfb_corre_rect {
|
||||
u8_t x;
|
||||
u8_t y;
|
||||
u8_t w;
|
||||
u8_t h;
|
||||
uint8_t x;
|
||||
uint8_t y;
|
||||
uint8_t w;
|
||||
uint8_t h;
|
||||
};
|
||||
|
||||
/* Client to server messages. */
|
||||
|
||||
struct rfb_set_pixel_format {
|
||||
u8_t type;
|
||||
u8_t pad;
|
||||
u16_t pad2;
|
||||
uint8_t type;
|
||||
uint8_t pad;
|
||||
uint16_t pad2;
|
||||
struct rfb_pixel_format format;
|
||||
};
|
||||
|
||||
struct rfb_fix_colormap_entries {
|
||||
u8_t type;
|
||||
u8_t pad;
|
||||
u16_t firstcolor;
|
||||
u16_t colors;
|
||||
uint8_t type;
|
||||
uint8_t pad;
|
||||
uint16_t firstcolor;
|
||||
uint16_t colors;
|
||||
};
|
||||
|
||||
struct rfb_set_encoding {
|
||||
u8_t type;
|
||||
u8_t pad;
|
||||
u16_t encodings;
|
||||
uint8_t type;
|
||||
uint8_t pad;
|
||||
uint16_t encodings;
|
||||
};
|
||||
|
||||
struct rfb_fb_update_request {
|
||||
u8_t type;
|
||||
u8_t incremental;
|
||||
u16_t x;
|
||||
u16_t y;
|
||||
u16_t w;
|
||||
u16_t h;
|
||||
uint8_t type;
|
||||
uint8_t incremental;
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
uint16_t w;
|
||||
uint16_t h;
|
||||
};
|
||||
|
||||
struct rfb_key_event {
|
||||
u8_t type;
|
||||
u8_t down;
|
||||
u16_t pad;
|
||||
u8_t key[4];
|
||||
uint8_t type;
|
||||
uint8_t down;
|
||||
uint16_t pad;
|
||||
uint8_t key[4];
|
||||
};
|
||||
|
||||
#define RFB_BUTTON_MASK1 1
|
||||
#define RFB_BUTTON_MASK2 2
|
||||
#define RFB_BUTTON_MASK3 4
|
||||
struct rfb_pointer_event {
|
||||
u8_t type;
|
||||
u8_t buttonmask;
|
||||
u16_t x;
|
||||
u16_t y;
|
||||
uint8_t type;
|
||||
uint8_t buttonmask;
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
};
|
||||
|
||||
struct rfb_client_cut_text {
|
||||
u8_t type;
|
||||
u8_t pad[3];
|
||||
u8_t len[4];
|
||||
uint8_t type;
|
||||
uint8_t pad[3];
|
||||
uint8_t len[4];
|
||||
};
|
||||
|
||||
#endif /* __VNC_SERVER_H__ */
|
||||
|
|
|
@ -51,12 +51,12 @@
|
|||
|
||||
PROCESS(slip_process, "SLIP driver");
|
||||
|
||||
u8_t slip_active;
|
||||
uint8_t slip_active;
|
||||
|
||||
#if 1
|
||||
#define SLIP_STATISTICS(statement)
|
||||
#else
|
||||
u16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop;
|
||||
uint16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop;
|
||||
#define SLIP_STATISTICS(statement) statement
|
||||
#endif
|
||||
|
||||
|
@ -81,10 +81,10 @@ enum {
|
|||
* they are discarded.
|
||||
*/
|
||||
|
||||
static u8_t state = STATE_TWOPACKETS;
|
||||
static u16_t begin, end;
|
||||
static u8_t rxbuf[RX_BUFSIZE];
|
||||
static u16_t pkt_end; /* SLIP_END tracker. */
|
||||
static uint8_t state = STATE_TWOPACKETS;
|
||||
static uint16_t begin, end;
|
||||
static uint8_t rxbuf[RX_BUFSIZE];
|
||||
static uint16_t pkt_end; /* SLIP_END tracker. */
|
||||
|
||||
static void (* input_callback)(void) = NULL;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -98,19 +98,19 @@ slip_set_input_callback(void (*c)(void))
|
|||
* was used in slip-bridge.c
|
||||
*/
|
||||
//#if WITH_UIP
|
||||
u8_t
|
||||
uint8_t
|
||||
slip_send(void)
|
||||
{
|
||||
u16_t i;
|
||||
u8_t *ptr;
|
||||
u8_t c;
|
||||
uint16_t i;
|
||||
uint8_t *ptr;
|
||||
uint8_t c;
|
||||
|
||||
slip_arch_writeb(SLIP_END);
|
||||
|
||||
ptr = &uip_buf[UIP_LLH_LEN];
|
||||
for(i = 0; i < uip_len; ++i) {
|
||||
if(i == UIP_TCPIP_HLEN) {
|
||||
ptr = (u8_t *)uip_appdata;
|
||||
ptr = (uint8_t *)uip_appdata;
|
||||
}
|
||||
c = *ptr++;
|
||||
if(c == SLIP_END) {
|
||||
|
@ -128,12 +128,12 @@ slip_send(void)
|
|||
}
|
||||
//#endif /* WITH_UIP */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
u8_t
|
||||
uint8_t
|
||||
slip_write(const void *_ptr, int len)
|
||||
{
|
||||
const u8_t *ptr = _ptr;
|
||||
u16_t i;
|
||||
u8_t c;
|
||||
const uint8_t *ptr = _ptr;
|
||||
uint16_t i;
|
||||
uint8_t c;
|
||||
|
||||
slip_arch_writeb(SLIP_END);
|
||||
|
||||
|
@ -161,8 +161,8 @@ rxbuf_init(void)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Upper half does the polling. */
|
||||
static u16_t
|
||||
slip_poll_handler(u8_t *outbuf, u16_t blen)
|
||||
static uint16_t
|
||||
slip_poll_handler(uint8_t *outbuf, uint16_t blen)
|
||||
{
|
||||
/* This is a hack and won't work across buffer edge! */
|
||||
if(rxbuf[begin] == 'C') {
|
||||
|
@ -212,7 +212,7 @@ slip_poll_handler(u8_t *outbuf, u16_t blen)
|
|||
* If pkt_end != begin it will not change again.
|
||||
*/
|
||||
if(begin != pkt_end) {
|
||||
u16_t len;
|
||||
uint16_t len;
|
||||
|
||||
if(begin < pkt_end) {
|
||||
len = pkt_end - begin;
|
||||
|
@ -275,12 +275,12 @@ PROCESS_THREAD(slip_process, ev, data)
|
|||
}
|
||||
slip_write(buf, 8);
|
||||
} else if(uip_len > 0
|
||||
&& uip_len == (((u16_t)(BUF->len[0]) << 8) + BUF->len[1])
|
||||
&& uip_len == (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1])
|
||||
&& uip_ipchksum() == 0xffff) {
|
||||
#define IP_DF 0x40
|
||||
if(BUF->ipid[0] == 0 && BUF->ipid[1] == 0 && BUF->ipoffset[0] & IP_DF) {
|
||||
static u16_t ip_id;
|
||||
u16_t nid = ip_id++;
|
||||
static uint16_t ip_id;
|
||||
uint16_t nid = ip_id++;
|
||||
BUF->ipid[0] = nid >> 8;
|
||||
BUF->ipid[1] = nid;
|
||||
nid = uip_htons(nid);
|
||||
|
|
|
@ -42,7 +42,7 @@ PROCESS_NAME(slip_process);
|
|||
/**
|
||||
* Send an IP packet from the uIP buffer with SLIP.
|
||||
*/
|
||||
u8_t slip_send(void);
|
||||
uint8_t slip_send(void);
|
||||
|
||||
/**
|
||||
* Input a SLIP byte.
|
||||
|
@ -63,13 +63,13 @@ u8_t slip_send(void);
|
|||
*/
|
||||
int slip_input_byte(unsigned char c);
|
||||
|
||||
u8_t slip_write(const void *ptr, int len);
|
||||
uint8_t slip_write(const void *ptr, int len);
|
||||
|
||||
/* Did we receive any bytes lately? */
|
||||
extern u8_t slip_active;
|
||||
extern uint8_t slip_active;
|
||||
|
||||
/* Statistics. */
|
||||
extern u16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop;
|
||||
extern uint16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop;
|
||||
|
||||
/**
|
||||
* Set a function to be called when there is activity on the SLIP
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
*/
|
||||
|
||||
/* These typedefs limits object file size! */
|
||||
typedef u16_t cle_off; /* Offset from start of file. */
|
||||
typedef u16_t cle_word;
|
||||
typedef u16_t cle_half;
|
||||
typedef uint16_t cle_off; /* Offset from start of file. */
|
||||
typedef uint16_t cle_word;
|
||||
typedef uint16_t cle_half;
|
||||
|
||||
/* Also used for address arithmetic (can't be void *). */
|
||||
#ifdef __AVR__
|
||||
|
|
|
@ -28,14 +28,12 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$Id: elfloader-avr.c,v 1.10 2009/07/16 18:02:34 dak664 Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <avr/boot.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include "dev/rs232.h"
|
||||
#include "elfloader-arch.h"
|
||||
#include "lib/mmem.h"
|
||||
#include <string.h> //memset
|
||||
|
@ -64,8 +62,8 @@
|
|||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
/*#define PRINTF(...) rs232_print_p(RS232_PORT_1, __VA_ARGS__)*/
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#include <avr/pgmspace.h>
|
||||
#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#endif
|
||||
|
@ -305,7 +303,7 @@ elfloader_arch_relocate(int fd, unsigned int sectionoffset,
|
|||
*/
|
||||
|
||||
/* new solution */
|
||||
instr[2] = (u8_t) ((int)addr) & 0xff;
|
||||
instr[2] = (uint8_t) ((int)addr) & 0xff;
|
||||
instr[3] = ((int)addr) >> 8;
|
||||
cfs_write(fd, instr, 4);
|
||||
break;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: cxmac.c,v 1.15 2010/10/03 20:37:32 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -421,7 +420,7 @@ send_packet(void)
|
|||
uint8_t strobe[MAX_STROBE_SIZE];
|
||||
int strobe_len, len;
|
||||
int is_broadcast = 0;
|
||||
int is_reliable;
|
||||
/*int is_reliable;*/
|
||||
struct encounter *e;
|
||||
struct queuebuf *packet;
|
||||
int is_already_streaming = 0;
|
||||
|
@ -450,8 +449,8 @@ send_packet(void)
|
|||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]);
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
}
|
||||
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
||||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);
|
||||
/* is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
||||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);*/
|
||||
len = NETSTACK_FRAMER.create();
|
||||
strobe_len = len + sizeof(struct cxmac_hdr);
|
||||
if(len < 0 || strobe_len > (int)sizeof(strobe)) {
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: xmac.c,v 1.60 2011/01/25 14:31:09 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -463,7 +462,7 @@ send_packet(void)
|
|||
uint8_t strobe[MAX_STROBE_SIZE];
|
||||
int strobe_len, len;
|
||||
int is_broadcast = 0;
|
||||
int is_reliable;
|
||||
/*int is_reliable; */
|
||||
struct encounter *e;
|
||||
struct queuebuf *packet;
|
||||
int is_already_streaming = 0;
|
||||
|
@ -491,8 +490,8 @@ send_packet(void)
|
|||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]);
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
}
|
||||
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
||||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);
|
||||
/* is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
||||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE); */
|
||||
|
||||
packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1);
|
||||
len = NETSTACK_FRAMER.create();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: collect.c,v 1.73 2011/01/18 16:05:53 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -126,7 +125,7 @@ struct ack_msg {
|
|||
full, incoming packets are dropped instead of being forwarded. */
|
||||
#define MAX_MAC_REXMITS 2
|
||||
#define MAX_ACK_MAC_REXMITS 5
|
||||
#define REXMIT_TIME CLOCK_SECOND * 32 / NETSTACK_RDC_CHANNEL_CHECK_RATE
|
||||
#define REXMIT_TIME (CLOCK_SECOND * 32 / NETSTACK_RDC_CHANNEL_CHECK_RATE)
|
||||
#define FORWARD_PACKET_LIFETIME_BASE REXMIT_TIME * 2
|
||||
#define MAX_SENDING_QUEUE 3 * QUEUEBUF_NUM / 4
|
||||
#define MIN_AVAILABLE_QUEUE_ENTRIES 4
|
||||
|
|
|
@ -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(...)
|
||||
|
|
|
@ -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;
|
||||
|
|
30
core/net/rpl/rpl-dag.c
Executable file → Normal file
30
core/net/rpl/rpl-dag.c
Executable file → Normal file
|
@ -99,6 +99,21 @@ MEMB(parent_memb, struct rpl_parent,
|
|||
rpl_instance_t instance_table[RPL_MAX_INSTANCES];
|
||||
rpl_instance_t *default_instance;
|
||||
|
||||
/************************************************************************/
|
||||
/* lollipop greater than function. */
|
||||
/************************************************************************/
|
||||
int rpl_lollipop_greater_than(int a, int b) {
|
||||
/* Check if we are comparing an initial value with an old value */
|
||||
if(a > RPL_LOLLIPOP_CIRCULAR_REGION && b <= RPL_LOLLIPOP_CIRCULAR_REGION) {
|
||||
return (RPL_LOLLIPOP_MAX_VALUE + 1 + b - a) > RPL_LOLLIPOP_SEQUENCE_WINDOWS;
|
||||
}
|
||||
/* Otherwise check if a > b and comparable => ok, or
|
||||
if they have wrapped and are still comparable */
|
||||
return (a > b && (a - b) < RPL_LOLLIPOP_SEQUENCE_WINDOWS) ||
|
||||
(a < b && (b - a) > (RPL_LOLLIPOP_CIRCULAR_REGION + 1-
|
||||
RPL_LOLLIPOP_SEQUENCE_WINDOWS));
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* Remove DAG parents with a rank that is at least the same as minimum_rank. */
|
||||
static void
|
||||
|
@ -161,10 +176,9 @@ should_send_dao(rpl_instance_t *instance, rpl_dio_t *dio, rpl_parent_t *p)
|
|||
if(instance->mop == RPL_MOP_NO_DOWNWARD_ROUTES) {
|
||||
return 0;
|
||||
}
|
||||
/* check if the new DTSN is more recent */
|
||||
return p == instance->current_dag->preferred_parent &&
|
||||
(RPL_LOLLIPOP_GREATER_THAN(dio->dtsn, p->dtsn) ||
|
||||
((RPL_LOLLIPOP_GREATER_THAN(p->dtsn, dio->dtsn)) &&
|
||||
RPL_LOLLIPOP_IS_INIT(dio->dtsn)));
|
||||
(rpl_lollipop_greater_than(dio->dtsn, p->dtsn));
|
||||
}
|
||||
/************************************************************************/
|
||||
static int
|
||||
|
@ -1127,18 +1141,18 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
|||
return;
|
||||
}
|
||||
|
||||
if(RPL_LOLLIPOP_GREATER_THAN(dio->version, dag->version)) {
|
||||
if(rpl_lollipop_greater_than(dio->version, dag->version)) {
|
||||
if(dag->rank == ROOT_RANK(instance)) {
|
||||
PRINTF("RPL: Root received inconsistent DIO version number\n");
|
||||
dag->version = dio->version;
|
||||
RPL_LOLLIPOP_INCREMENT(dag->version);
|
||||
rpl_reset_dio_timer(instance);
|
||||
dag->version = dio->version;
|
||||
RPL_LOLLIPOP_INCREMENT(dag->version);
|
||||
rpl_reset_dio_timer(instance);
|
||||
} else {
|
||||
global_repair(from, dag, dio);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if(RPL_LOLLIPOP_GREATER_THAN(dag->version, dio->version)) {
|
||||
if(rpl_lollipop_greater_than(dag->version, dio->version)) {
|
||||
/* The DIO sender is on an older version of the DAG. */
|
||||
PRINTF("RPL: old version received => inconsistency detected\n");
|
||||
if(dag->joined) {
|
||||
|
|
|
@ -66,11 +66,6 @@ rpl_of_t rpl_of_etx = {
|
|||
1
|
||||
};
|
||||
|
||||
#define NI_ETX_TO_RPL_ETX(etx) \
|
||||
((etx) * (RPL_DAG_MC_ETX_DIVISOR / NEIGHBOR_INFO_ETX_DIVISOR))
|
||||
#define RPL_ETX_TO_NI_ETX(etx) \
|
||||
((etx) / (RPL_DAG_MC_ETX_DIVISOR / NEIGHBOR_INFO_ETX_DIVISOR))
|
||||
|
||||
/* Reject parents that have a higher link metric than the following. */
|
||||
#define MAX_LINK_METRIC 10
|
||||
|
||||
|
@ -90,8 +85,11 @@ calculate_path_metric(rpl_parent_t *p)
|
|||
{
|
||||
if(p == NULL || (p->mc.obj.etx == 0 && p->rank > ROOT_RANK(p->dag->instance))) {
|
||||
return MAX_PATH_COST * RPL_DAG_MC_ETX_DIVISOR;
|
||||
} else {
|
||||
long etx = p->link_metric;
|
||||
etx = (etx * RPL_DAG_MC_ETX_DIVISOR) / NEIGHBOR_INFO_ETX_DIVISOR;
|
||||
return p->mc.obj.etx + (uint16_t) etx;
|
||||
}
|
||||
return p->mc.obj.etx + NI_ETX_TO_RPL_ETX(p->link_metric);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -116,7 +114,8 @@ calculate_rank(rpl_parent_t *p, rpl_rank_t base_rank)
|
|||
}
|
||||
rank_increase = NEIGHBOR_INFO_FIX2ETX(INITIAL_LINK_METRIC) * DEFAULT_MIN_HOPRANKINC;
|
||||
} else {
|
||||
rank_increase = NEIGHBOR_INFO_FIX2ETX(p->link_metric) * p->dag->instance->min_hoprankinc;
|
||||
/* multiply first, then scale down to avoid truncation effects */
|
||||
rank_increase = NEIGHBOR_INFO_FIX2ETX(p->link_metric * p->dag->instance->min_hoprankinc);
|
||||
if(base_rank == 0) {
|
||||
base_rank = p->rank;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ static void reset(rpl_dag_t *);
|
|||
static rpl_parent_t *best_parent(rpl_parent_t *, rpl_parent_t *);
|
||||
static rpl_dag_t *best_dag(rpl_dag_t *, rpl_dag_t *);
|
||||
static rpl_rank_t calculate_rank(rpl_parent_t *, rpl_rank_t);
|
||||
static void update_metric_container(rpl_dag_t *);
|
||||
static void update_metric_container(rpl_instance_t *);
|
||||
|
||||
rpl_of_t rpl_of0 = {
|
||||
reset,
|
||||
|
@ -83,7 +83,9 @@ calculate_rank(rpl_parent_t *p, rpl_rank_t base_rank)
|
|||
base_rank = p->rank;
|
||||
}
|
||||
|
||||
increment = p != NULL ? p->dag->min_hoprankinc : DEFAULT_RANK_INCREMENT;
|
||||
increment = p != NULL ?
|
||||
p->dag->instance->min_hoprankinc :
|
||||
DEFAULT_RANK_INCREMENT;
|
||||
|
||||
if((rpl_rank_t)(base_rank + increment) < base_rank) {
|
||||
PRINTF("RPL: OF0 rank %d incremented to infinite rank due to wrapping\n",
|
||||
|
@ -135,10 +137,10 @@ best_parent(rpl_parent_t *p1, rpl_parent_t *p2)
|
|||
p2->link_metric, p2->rank);
|
||||
|
||||
|
||||
r1 = DAG_RANK(p1->rank, (rpl_dag_t *)p1->dag) * NEIGHBOR_INFO_ETX_DIVISOR +
|
||||
p1->link_metric;
|
||||
r2 = DAG_RANK(p2->rank, (rpl_dag_t *)p1->dag) * NEIGHBOR_INFO_ETX_DIVISOR +
|
||||
p2->link_metric;
|
||||
r1 = DAG_RANK(p1->rank, p1->dag->instance) * NEIGHBOR_INFO_ETX_DIVISOR +
|
||||
p1->link_metric;
|
||||
r2 = DAG_RANK(p2->rank, p1->dag->instance) * NEIGHBOR_INFO_ETX_DIVISOR +
|
||||
p2->link_metric;
|
||||
/* Compare two parents by looking both and their rank and at the ETX
|
||||
for that parent. We choose the parent that has the most
|
||||
favourable combination. */
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
#else
|
||||
#define DEFAULT_MIN_HOPRANKINC RPL_CONF_MIN_HOPRANKINC
|
||||
#endif
|
||||
#define DEFAULT_MAX_RANKINC (3 * DEFAULT_MIN_HOPRANKINC)
|
||||
#define DEFAULT_MAX_RANKINC (7 * DEFAULT_MIN_HOPRANKINC)
|
||||
|
||||
#define DAG_RANK(fixpt_rank, instance) ((fixpt_rank) / (instance)->min_hoprankinc)
|
||||
|
||||
|
|
|
@ -131,19 +131,12 @@ typedef uint16_t rpl_ocp_t;
|
|||
#define RPL_LOLLIPOP_CIRCULAR_REGION 127
|
||||
#define RPL_LOLLIPOP_SEQUENCE_WINDOWS 16
|
||||
#define RPL_LOLLIPOP_INIT RPL_LOLLIPOP_MAX_VALUE - RPL_LOLLIPOP_SEQUENCE_WINDOWS + 1
|
||||
#define RPL_LOLLIPOP_INCREMENT(counter) (counter > RPL_LOLLIPOP_CIRCULAR_REGION ?\
|
||||
(counter == RPL_LOLLIPOP_MAX_VALUE ? counter=0 : ++counter):\
|
||||
(counter == RPL_LOLLIPOP_CIRCULAR_REGION ? counter=0 : ++counter))
|
||||
#define RPL_LOLLIPOP_INCREMENT(ctr) (ctr > RPL_LOLLIPOP_CIRCULAR_REGION ? \
|
||||
++ctr & RPL_LOLLIPOP_MAX_VALUE : \
|
||||
++ctr & RPL_LOLLIPOP_CIRCULAR_REGION)
|
||||
|
||||
#define RPL_LOLLIPOP_IS_INIT(counter) (counter > RPL_LOLLIPOP_CIRCULAR_REGION)
|
||||
#define RPL_LOLLIPOP_GREATER_THAN_LOCAL(A,B) (((A < B) && (RPL_LOLLIPOP_CIRCULAR_REGION + 1 - B + A < RPL_LOLLIPOP_SEQUENCE_WINDOWS)) || \
|
||||
((A > B) && (A - B < RPL_LOLLIPOP_SEQUENCE_WINDOWS)))
|
||||
#define RPL_LOLLIPOP_GREATER_THAN(A,B) ((A > RPL_LOLLIPOP_CIRCULAR_REGION )?\
|
||||
((B > RPL_LOLLIPOP_CIRCULAR_REGION )?\
|
||||
RPL_LOLLIPOP_GREATER_THAN_LOCAL(A,B):\
|
||||
0):\
|
||||
((B > RPL_LOLLIPOP_CIRCULAR_REGION )?\
|
||||
1:\
|
||||
RPL_LOLLIPOP_GREATER_THAN_LOCAL(A,B)))
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* DAG Metric Container Object Types, to be confirmed by IANA. */
|
||||
#define RPL_DAG_MC_NONE 0 /* Local identifier for empty MC */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) && \
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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__ */
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
|
|
@ -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];
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue