Made constant addresses const

This commit is contained in:
adamdunkels 2009-03-23 16:22:02 +00:00
parent 143bf11548
commit 21e0900d18
4 changed files with 16 additions and 13 deletions

View file

@ -33,7 +33,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: mesh.c,v 1.15 2009/03/12 21:58:21 adamdunkels Exp $ * $Id: mesh.c,v 1.16 2009/03/23 16:22:02 adamdunkels Exp $
*/ */
/** /**
@ -62,8 +62,9 @@
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
data_packet_received(struct multihop_conn *multihop, rimeaddr_t *from, data_packet_received(struct multihop_conn *multihop,
rimeaddr_t *prevhop, uint8_t hops) const rimeaddr_t *from,
const rimeaddr_t *prevhop, uint8_t hops)
{ {
struct mesh_conn *c = (struct mesh_conn *) struct mesh_conn *c = (struct mesh_conn *)
((char *)multihop - offsetof(struct mesh_conn, multihop)); ((char *)multihop - offsetof(struct mesh_conn, multihop));
@ -74,8 +75,10 @@ data_packet_received(struct multihop_conn *multihop, rimeaddr_t *from,
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static rimeaddr_t * static rimeaddr_t *
data_packet_forward(struct multihop_conn *multihop, rimeaddr_t *originator, data_packet_forward(struct multihop_conn *multihop,
rimeaddr_t *dest, rimeaddr_t *prevhop, uint8_t hops) const rimeaddr_t *originator,
const rimeaddr_t *dest,
const rimeaddr_t *prevhop, uint8_t hops)
{ {
struct route_entry *rt; struct route_entry *rt;

View file

@ -49,7 +49,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: mesh.h,v 1.13 2009/03/12 21:58:21 adamdunkels Exp $ * $Id: mesh.h,v 1.14 2009/03/23 16:22:02 adamdunkels Exp $
*/ */
/** /**
@ -73,7 +73,7 @@ struct mesh_conn;
*/ */
struct mesh_callbacks { struct mesh_callbacks {
/** Called when a packet is received. */ /** Called when a packet is received. */
void (* recv)(struct mesh_conn *c, rimeaddr_t *from, uint8_t hops); void (* recv)(struct mesh_conn *c, const rimeaddr_t *from, uint8_t hops);
/** Called when a packet, sent with mesh_send(), is actually transmitted. */ /** Called when a packet, sent with mesh_send(), is actually transmitted. */
void (* sent)(struct mesh_conn *c); void (* sent)(struct mesh_conn *c);
/** Called when a packet, sent with mesh_send(), times out and is dropped. */ /** Called when a packet, sent with mesh_send(), times out and is dropped. */

View file

@ -33,7 +33,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: route.c,v 1.12 2008/02/24 22:05:27 adamdunkels Exp $ * $Id: route.c,v 1.13 2009/03/23 16:22:02 adamdunkels Exp $
*/ */
/** /**
@ -96,7 +96,7 @@ route_init(void)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int
route_add(rimeaddr_t *dest, rimeaddr_t *nexthop, route_add(const rimeaddr_t *dest, const rimeaddr_t *nexthop,
uint8_t hop_count, uint8_t seqno) uint8_t hop_count, uint8_t seqno)
{ {
struct route_entry *e; struct route_entry *e;
@ -126,7 +126,7 @@ route_add(rimeaddr_t *dest, rimeaddr_t *nexthop,
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
struct route_entry * struct route_entry *
route_lookup(rimeaddr_t *dest) route_lookup(const rimeaddr_t *dest)
{ {
struct route_entry *e; struct route_entry *e;

View file

@ -39,7 +39,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: route.h,v 1.8 2008/02/24 22:05:27 adamdunkels Exp $ * $Id: route.h,v 1.9 2009/03/23 16:22:02 adamdunkels Exp $
*/ */
/** /**
@ -64,9 +64,9 @@ struct route_entry {
}; };
void route_init(void); void route_init(void);
int route_add(rimeaddr_t *dest, rimeaddr_t *nexthop, int route_add(const rimeaddr_t *dest, const rimeaddr_t *nexthop,
uint8_t hop_count, uint8_t seqno); uint8_t hop_count, uint8_t seqno);
struct route_entry *route_lookup(rimeaddr_t *dest); struct route_entry *route_lookup(const rimeaddr_t *dest);
void route_remove(struct route_entry *e); void route_remove(struct route_entry *e);
void route_flush_all(void); void route_flush_all(void);
void route_set_lifetime(int seconds); void route_set_lifetime(int seconds);