diff --git a/core/net/rime/mesh.c b/core/net/rime/mesh.c index 3cc5e9032..3c8b510c2 100644 --- a/core/net/rime/mesh.c +++ b/core/net/rime/mesh.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: mesh.c,v 1.10 2007/12/05 13:40:26 adamdunkels Exp $ + * $Id: mesh.c,v 1.11 2008/01/08 07:55:56 adamdunkels Exp $ */ /** @@ -68,13 +68,13 @@ struct data_hdr { /*---------------------------------------------------------------------------*/ static void -data_packet_received(struct mh_conn *mh, rimeaddr_t *from) +data_packet_received(struct mh_conn *mh, rimeaddr_t *from, u8_t hops) { struct mesh_conn *c = (struct mesh_conn *) ((char *)mh - offsetof(struct mesh_conn, mh)); if(c->cb->recv) { - c->cb->recv(c, from); + c->cb->recv(c, from, hops); } } /*---------------------------------------------------------------------------*/ @@ -82,9 +82,6 @@ static rimeaddr_t * data_packet_forward(struct mh_conn *mh, rimeaddr_t *originator, rimeaddr_t *dest, rimeaddr_t *prevhop, u8_t hops) { - struct mesh_conn *c = (struct mesh_conn *) - ((char *)mh - offsetof(struct mesh_conn, mh)); - struct route_entry *rt; rt = route_lookup(dest); diff --git a/core/net/rime/mesh.h b/core/net/rime/mesh.h index e67116c27..985236f0e 100644 --- a/core/net/rime/mesh.h +++ b/core/net/rime/mesh.h @@ -49,7 +49,7 @@ * * This file is part of the Contiki operating system. * - * $Id: mesh.h,v 1.9 2007/12/17 09:14:08 adamdunkels Exp $ + * $Id: mesh.h,v 1.10 2008/01/08 07:55:56 adamdunkels Exp $ */ /** @@ -73,7 +73,7 @@ struct mesh_conn; */ struct mesh_callbacks { /** Called when a packet is received. */ - void (* recv)(struct mesh_conn *c, rimeaddr_t *from); + void (* recv)(struct mesh_conn *c, rimeaddr_t *from, u8_t hops); /** Called when a packet, sent with mesh_send(), is actually transmitted. */ void (* sent)(struct mesh_conn *c); /** Called when a packet, sent with mesh_send(), times out and is dropped. */ diff --git a/core/net/rime/mh.c b/core/net/rime/mh.c index a10216e6b..aef94295b 100644 --- a/core/net/rime/mh.c +++ b/core/net/rime/mh.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: mh.c,v 1.6 2007/12/05 13:40:34 adamdunkels Exp $ + * $Id: mh.c,v 1.7 2008/01/08 07:55:56 adamdunkels Exp $ */ /** @@ -79,7 +79,7 @@ data_packet_received(struct uc_conn *uc, rimeaddr_t *from) PRINTF("for us!\n"); rimebuf_hdrreduce(sizeof(struct data_hdr)); if(c->cb->recv) { - c->cb->recv(c, &msg->originator); + c->cb->recv(c, &msg->originator, msg->hops); } } else { nexthop = NULL; @@ -132,7 +132,7 @@ mh_send(struct mh_conn *c, rimeaddr_t *to) hdr = rimebuf_hdrptr(); rimeaddr_copy(&hdr->dest, to); rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr); - hdr->hops = 0; + hdr->hops = 1; uc_send(&c->c, nexthop); } return 1; diff --git a/core/net/rime/mh.h b/core/net/rime/mh.h index caa8da44f..82c94933c 100644 --- a/core/net/rime/mh.h +++ b/core/net/rime/mh.h @@ -48,7 +48,7 @@ * * This file is part of the Contiki operating system. * - * $Id: mh.h,v 1.3 2007/11/28 19:55:27 adamdunkels Exp $ + * $Id: mh.h,v 1.4 2008/01/08 07:55:56 adamdunkels Exp $ */ /** @@ -67,7 +67,7 @@ struct mh_conn; struct mh_callbacks { - void (* recv)(struct mh_conn *ptr, rimeaddr_t *sender); + void (* recv)(struct mh_conn *ptr, rimeaddr_t *sender, u8_t hops); rimeaddr_t *(* forward)(struct mh_conn *ptr, rimeaddr_t *originator, rimeaddr_t *dest, diff --git a/core/net/rime/rmh.c b/core/net/rime/rmh.c index 2d621655c..cc4005764 100644 --- a/core/net/rime/rmh.c +++ b/core/net/rime/rmh.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rmh.c,v 1.4 2007/12/05 13:25:07 adamdunkels Exp $ + * $Id: rmh.c,v 1.5 2008/01/08 07:55:56 adamdunkels Exp $ */ /** @@ -78,7 +78,7 @@ received(struct ruc_conn *uc, rimeaddr_t *from, u8_t seqno) PRINTF("for us!\n"); rimebuf_hdrreduce(sizeof(struct data_hdr)); if(c->cb->recv) { - c->cb->recv(c, &msg->originator); + c->cb->recv(c, &msg->originator, msg->hops); } } else { nexthop = NULL; @@ -148,7 +148,7 @@ rmh_send(struct rmh_conn *c, rimeaddr_t *to, u8_t num_rexmit, u8_t max_hops) hdr = rimebuf_hdrptr(); rimeaddr_copy(&hdr->dest, to); rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr); - hdr->hops = 0; + hdr->hops = 1; hdr->max_rexmits = num_rexmit; ruc_send(&c->c, nexthop, num_rexmit); } diff --git a/core/net/rime/rmh.h b/core/net/rime/rmh.h index 73dbcb6db..151cb14ce 100644 --- a/core/net/rime/rmh.h +++ b/core/net/rime/rmh.h @@ -48,7 +48,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rmh.h,v 1.2 2007/11/28 20:00:07 adamdunkels Exp $ + * $Id: rmh.h,v 1.3 2008/01/08 07:55:56 adamdunkels Exp $ */ /** @@ -67,7 +67,7 @@ struct rmh_conn; struct rmh_callbacks { - void (* recv)(struct rmh_conn *ptr, rimeaddr_t *sender); + void (* recv)(struct rmh_conn *ptr, rimeaddr_t *sender, u8_t hops); rimeaddr_t *(* forward)(struct rmh_conn *ptr, rimeaddr_t *originator, rimeaddr_t *dest,