Changed module name to 'collect' from 'tree' to better reflect the purpose of the module, rather than the particular data structure used to implement it

This commit is contained in:
adamdunkels 2007-11-28 16:04:41 +00:00
parent 8a6309aa45
commit dca1e0e446
3 changed files with 37 additions and 37 deletions

View File

@ -2,6 +2,6 @@ CONTIKI_SOURCEFILES += rimebuf.c queuebuf.c rimeaddr.c ctimer.c rime.c \
rimestats.c ibc.c uc.c suc.c ruc.c sibc.c sabc.c abc.c nf.c \
mh.c rmh.c rucb.c polite.c ipolite.c nbh.c \
mesh.c route.c route-discovery.c \
tree.c neighbor.c \
collect.c neighbor.c \
trickle.c \
rudolph0.c rudolph1.c rudolph2.c

View File

@ -1,5 +1,5 @@
/**
* \addtogroup rimetree
* \addtogroup rimecollect
* @{
*/
@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: tree.c,v 1.17 2007/11/27 23:32:34 adamdunkels Exp $
* $Id: collect.c,v 1.1 2007/11/28 16:04:41 adamdunkels Exp $
*/
/**
@ -48,7 +48,7 @@
#include "net/rime.h"
#include "net/rime/neighbor.h"
#include "net/rime/nf.h"
#include "net/rime/tree.h"
#include "net/rime/collect.h"
#include "dev/radio-sensor.h"
@ -79,7 +79,7 @@ static struct recent_packet recent_packets[NUM_RECENT_PACKETS];
static uint8_t recent_packet_ptr;
#define SINK 0
#define RTMETRIC_MAX TREE_MAX_DEPTH
#define RTMETRIC_MAX COLLECT_MAX_DEPTH
#define MAX_HOPLIM 10
@ -96,7 +96,7 @@ static uint8_t recent_packet_ptr;
/*---------------------------------------------------------------------------*/
static void
update_rtmetric(struct tree_conn *tc)
update_rtmetric(struct collect_conn *tc)
{
struct neighbor *n;
@ -149,8 +149,8 @@ update_rtmetric(struct tree_conn *tc)
static void
node_packet_received(struct ruc_conn *c, rimeaddr_t *from, u8_t seqno)
{
struct tree_conn *tc = (struct tree_conn *)
((char *)c - offsetof(struct tree_conn, ruc_conn));
struct collect_conn *tc = (struct collect_conn *)
((char *)c - offsetof(struct collect_conn, ruc_conn));
struct hdr *hdr = rimebuf_dataptr();
struct neighbor *n;
int i;
@ -220,8 +220,8 @@ node_packet_received(struct ruc_conn *c, rimeaddr_t *from, u8_t seqno)
static void
node_packet_sent(struct ruc_conn *c, rimeaddr_t *to, u8_t retransmissions)
{
struct tree_conn *tc = (struct tree_conn *)
((char *)c - offsetof(struct tree_conn, ruc_conn));
struct collect_conn *tc = (struct collect_conn *)
((char *)c - offsetof(struct collect_conn, ruc_conn));
tc->forwarding = 0;
neighbor_update_etx(neighbor_find(to), retransmissions);
@ -231,8 +231,8 @@ node_packet_sent(struct ruc_conn *c, rimeaddr_t *to, u8_t retransmissions)
static void
node_packet_timedout(struct ruc_conn *c, rimeaddr_t *to, u8_t retransmissions)
{
struct tree_conn *tc = (struct tree_conn *)
((char *)c - offsetof(struct tree_conn, ruc_conn));
struct collect_conn *tc = (struct collect_conn *)
((char *)c - offsetof(struct collect_conn, ruc_conn));
tc->forwarding = 0;
neighbor_timedout_etx(neighbor_find(to), retransmissions);
@ -242,8 +242,8 @@ node_packet_timedout(struct ruc_conn *c, rimeaddr_t *to, u8_t retransmissions)
static void
adv_received(struct nbh_conn *c, rimeaddr_t *from, uint16_t rtmetric)
{
struct tree_conn *tc = (struct tree_conn *)
((char *)c - offsetof(struct tree_conn, nbh_conn));
struct collect_conn *tc = (struct collect_conn *)
((char *)c - offsetof(struct collect_conn, nbh_conn));
struct neighbor *n;
n = neighbor_find(from);
@ -268,8 +268,8 @@ static const struct nbh_callbacks nbh_callbacks = { adv_received,
NULL};
/*---------------------------------------------------------------------------*/
void
tree_open(struct tree_conn *tc, u16_t channels,
const struct tree_callbacks *cb)
collect_open(struct collect_conn *tc, u16_t channels,
const struct collect_callbacks *cb)
{
nbh_open(&tc->nbh_conn, channels, &nbh_callbacks);
ruc_open(&tc->ruc_conn, channels + 1, &ruc_callbacks);
@ -278,14 +278,14 @@ tree_open(struct tree_conn *tc, u16_t channels,
}
/*---------------------------------------------------------------------------*/
void
tree_close(struct tree_conn *tc)
collect_close(struct collect_conn *tc)
{
nbh_close(&tc->nbh_conn);
ruc_close(&tc->ruc_conn);
}
/*---------------------------------------------------------------------------*/
void
tree_set_sink(struct tree_conn *tc, int should_be_sink)
collect_set_sink(struct collect_conn *tc, int should_be_sink)
{
if(should_be_sink) {
tc->local_rtmetric = SINK;
@ -297,7 +297,7 @@ tree_set_sink(struct tree_conn *tc, int should_be_sink)
}
/*---------------------------------------------------------------------------*/
void
tree_send(struct tree_conn *tc, int rexmits)
collect_send(struct collect_conn *tc, int rexmits)
{
struct neighbor *n;
struct hdr *hdr;
@ -330,7 +330,7 @@ tree_send(struct tree_conn *tc, int rexmits)
}
/*---------------------------------------------------------------------------*/
int
tree_depth(struct tree_conn *tc)
collect_depth(struct collect_conn *tc)
{
return tc->local_rtmetric;
}

View File

@ -4,15 +4,15 @@
*/
/**
* \defgroup rimetree Tree-based hop-by-hop reliable data collection
* \defgroup rimecollect Tree-based hop-by-hop reliable data collection
* @{
*
* The tree module implements a hop-by-hop reliable data collection
* The collect module implements a hop-by-hop reliable data collection
* mechanism.
*
* \section channels Channels
*
* The tree module uses 2 channels; one for neighbor discovery and one
* The collect module uses 2 channels; one for neighbor discovery and one
* for data packets.
*
*/
@ -47,7 +47,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: tree.h,v 1.9 2007/11/13 20:39:29 adamdunkels Exp $
* $Id: collect.h,v 1.1 2007/11/28 16:04:41 adamdunkels Exp $
*/
/**
@ -57,40 +57,40 @@
* Adam Dunkels <adam@sics.se>
*/
#ifndef __TREE_H__
#define __TREE_H__
#ifndef __COLLECT_H__
#define __COLLECT_H__
#include "net/rime/ipolite.h"
#include "net/rime/ruc.h"
#include "net/rime/nbh.h"
struct tree_callbacks {
struct collect_callbacks {
void (* recv)(rimeaddr_t *originator, u8_t seqno,
u8_t hops);
};
struct tree_conn {
struct collect_conn {
struct nbh_conn nbh_conn;
struct ruc_conn ruc_conn;
const struct tree_callbacks *cb;
const struct collect_callbacks *cb;
struct ctimer t;
u8_t forwarding;
u8_t local_rtmetric;
u8_t seqno;
};
void tree_open(struct tree_conn *c, u16_t channels,
const struct tree_callbacks *callbacks);
void tree_close(struct tree_conn *c);
void collect_open(struct collect_conn *c, u16_t channels,
const struct collect_callbacks *callbacks);
void collect_close(struct collect_conn *c);
void tree_send(struct tree_conn *c, int rexmits);
void collect_send(struct collect_conn *c, int rexmits);
void tree_set_sink(struct tree_conn *c, int should_be_sink);
void collect_set_sink(struct collect_conn *c, int should_be_sink);
int tree_depth(struct tree_conn *c);
int collect_depth(struct collect_conn *c);
#define TREE_MAX_DEPTH 255
#define COLLECT_MAX_DEPTH 255
#endif /* __TREE_H__ */
#endif /* __COLLECT_H__ */
/** @} */
/** @} */