Added the const keyword to functions that use the tcpip_set_outputfunc(), which now takes a const argument

This commit is contained in:
Adam Dunkels 2013-11-18 23:26:37 +01:00
parent f9cb6ec2fa
commit 469884171a
6 changed files with 15 additions and 14 deletions

View File

@ -98,7 +98,7 @@ static unsigned long lasttime;
#endif #endif
static void do_send(void); static void do_send(void);
uint8_t tapdev_send(uip_lladdr_t *lladdr); uint8_t tapdev_send(const uip_lladdr_t *lladdr);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int
@ -371,7 +371,8 @@ do_send(void)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uint8_t tapdev_send(uip_lladdr_t *lladdr) uint8_t
tapdev_send(const uip_lladdr_t *lladdr)
{ {
/* /*
* If L3 dest is multicast, build L2 multicast address * If L3 dest is multicast, build L2 multicast address

View File

@ -39,7 +39,7 @@
#include "contiki-net.h" #include "contiki-net.h"
void tapdev_init(void); void tapdev_init(void);
uint8_t tapdev_send(uip_lladdr_t *lladdr); uint8_t tapdev_send(const uip_lladdr_t *lladdr);
uint16_t tapdev_poll(void); uint16_t tapdev_poll(void);
void tapdev_do_send(void); void tapdev_do_send(void);
void tapdev_exit(void); //math void tapdev_exit(void); //math

View File

@ -185,7 +185,7 @@ init(void)
/* Nothing to do here */ /* Nothing to do here */
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uint8_t wfall_send(uip_lladdr_t *lladdr); uint8_t wfall_send(const uip_lladdr_t *lladdr);
#if FALLBACK_HAS_ETHERNET_HEADERS #if FALLBACK_HAS_ETHERNET_HEADERS
#undef IPBUF #undef IPBUF
#define IPBUF ((struct uip_tcpip_hdr *)&uip_buf[14]) #define IPBUF ((struct uip_tcpip_hdr *)&uip_buf[14])
@ -708,7 +708,7 @@ wfall_poll(void)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
uint8_t uint8_t
wpcap_send(uip_lladdr_t *lladdr) wpcap_send(const uip_lladdr_t *lladdr)
{ {
if(lladdr == NULL) { if(lladdr == NULL) {
/* the dest must be multicast*/ /* the dest must be multicast*/
@ -745,7 +745,7 @@ return 0;
} }
#ifdef UIP_FALLBACK_INTERFACE #ifdef UIP_FALLBACK_INTERFACE
uint8_t uint8_t
wfall_send(uip_lladdr_t *lladdr) wfall_send(const uip_lladdr_t *lladdr)
{ {
#if FALLBACK_HAS_ETHERNET_HEADERS #if FALLBACK_HAS_ETHERNET_HEADERS
//make room for ethernet header //make room for ethernet header

View File

@ -39,8 +39,8 @@ void wpcap_init(void);
uint16_t wpcap_poll(void); uint16_t wpcap_poll(void);
uint16_t wfall_poll(void); uint16_t wfall_poll(void);
#if UIP_CONF_IPV6 #if UIP_CONF_IPV6
uint8_t wpcap_send(uip_lladdr_t *lladdr); uint8_t wpcap_send(const uip_lladdr_t *lladdr);
uint8_t wfall_send(uip_lladdr_t *lladdr); uint8_t wfall_send(const uip_lladdr_t *lladdr);
#else #else
void wpcap_send(void); void wpcap_send(void);
#endif #endif

View File

@ -55,9 +55,9 @@ PROCESS(tcpip_process, "tcpip dummy");
AUTOSTART_PROCESSES(&uip6_bridge); AUTOSTART_PROCESSES(&uip6_bridge);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static uint8_t (* outputfunc)(uip_lladdr_t *a); static uint8_t (* outputfunc)(const uip_lladdr_t *a);
uint8_t uint8_t
tcpip_output(uip_lladdr_t *a) tcpip_output(const uip_lladdr_t *a)
{ {
if(outputfunc != NULL) { if(outputfunc != NULL) {
outputfunc(a); outputfunc(a);
@ -73,7 +73,7 @@ tcpip_ipv6_output(void)
{ {
} }
void void
tcpip_set_outputfunc(uint8_t (*f)(uip_lladdr_t *)) tcpip_set_outputfunc(uint8_t (*f)(const uip_lladdr_t *))
{ {
outputfunc = f; outputfunc = f;
} }

View File

@ -57,9 +57,9 @@ PROCESS(tcpip_process, "tcpip dummy");
AUTOSTART_PROCESSES(&uip6_bridge); AUTOSTART_PROCESSES(&uip6_bridge);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static uint8_t (* outputfunc)(uip_lladdr_t *a); static uint8_t (* outputfunc)(const uip_lladdr_t *a);
uint8_t uint8_t
tcpip_output(uip_lladdr_t *a) tcpip_output(const uip_lladdr_t *a)
{ {
if(outputfunc != NULL) { if(outputfunc != NULL) {
leds_on(LEDS_GREEN); leds_on(LEDS_GREEN);
@ -76,7 +76,7 @@ tcpip_ipv6_output(void)
{ {
} }
void void
tcpip_set_outputfunc(uint8_t (*f)(uip_lladdr_t *)) tcpip_set_outputfunc(uint8_t (*f)(const uip_lladdr_t *))
{ {
outputfunc = f; outputfunc = f;
} }