Renamed ulayer -> callbacks

This commit is contained in:
adamdunkels 2007-03-15 10:01:04 +00:00
parent 26a681cf37
commit fd33a89214
19 changed files with 67 additions and 67 deletions

View file

@ -30,7 +30,7 @@
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
* $Id: abc.c,v 1.2 2007/03/14 00:29:05 adamdunkels Exp $ * $Id: abc.c,v 1.3 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -57,10 +57,10 @@ LIST(channels);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
abc_setup(struct abc_conn *c, u16_t channel, abc_setup(struct abc_conn *c, u16_t channel,
const struct abc_ulayer *ulayer) const struct abc_callbacks *callbacks)
{ {
c->channel = channel; c->channel = channel;
c->u = ulayer; c->u = callbacks;
list_add(channels, c); list_add(channels, c);
} }

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: abc.h,v 1.3 2007/03/14 00:29:05 adamdunkels Exp $ * $Id: abc.h,v 1.4 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -51,34 +51,34 @@
struct abc_conn; struct abc_conn;
struct abc_ulayer { struct abc_callbacks {
void (* recv)(struct abc_conn *ptr); void (* recv)(struct abc_conn *ptr);
}; };
struct abc_conn { struct abc_conn {
struct abc_conn *next; struct abc_conn *next;
u16_t channel; u16_t channel;
const struct abc_ulayer *u; const struct abc_callbacks *u;
}; };
/** /**
* \brief Set up an anonymous best-effort broadcast connection * \brief Set up an anonymous best-effort broadcast connection
* \param c A pointer to a struct abc_conn * \param c A pointer to a struct abc_conn
* \param channel The channel on which the connection will operate * \param channel The channel on which the connection will operate
* \param u A struct abc_ulayer with function pointers to functions that will be called when a packet has been received * \param u A struct abc_callbacks with function pointers to functions that will be called when a packet has been received
* *
* This function sets up an abc connection on the * This function sets up an abc connection on the
* specified channel. The caller must have allocated the * specified channel. The caller must have allocated the
* memory for the struct abc_conn, usually by declaring it * memory for the struct abc_conn, usually by declaring it
* as a static variable. * as a static variable.
* *
* The struct abc_ulayer pointer must point to a structure * The struct abc_callbacks pointer must point to a structure
* containing a pointer to a function that will be called * containing a pointer to a function that will be called
* when a packet arrives on the channel. * when a packet arrives on the channel.
* *
*/ */
void abc_setup(struct abc_conn *c, u16_t channel, void abc_setup(struct abc_conn *c, u16_t channel,
const struct abc_ulayer *u); const struct abc_callbacks *u);
/** /**
* \brief Send an anonymous best-effort broadcast packet * \brief Send an anonymous best-effort broadcast packet

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: ccsabc.c,v 1.1 2007/02/28 16:38:51 adamdunkels Exp $ * $Id: ccsabc.c,v 1.2 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -62,11 +62,11 @@ sent_from_sabc(struct sabc_conn *sabc)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static const struct sabc_ulayer ccsabc = {recv_from_sabc, sent_from_sabc}; static const struct sabc_callbacks ccsabc = {recv_from_sabc, sent_from_sabc};
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
ccsabc_setup(struct ccsabc_conn *c, u16_t channel, ccsabc_setup(struct ccsabc_conn *c, u16_t channel,
const struct ccsabc_ulayer *u) const struct ccsabc_callbacks *u)
{ {
sabc_setup(&c->c, channel, &ccsabc); sabc_setup(&c->c, channel, &ccsabc);
} }

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: ccsabc.h,v 1.1 2007/02/28 16:38:51 adamdunkels Exp $ * $Id: ccsabc.h,v 1.2 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -46,20 +46,20 @@
struct ccsabc_conn; struct ccsabc_conn;
struct ccsabc_ulayer { struct ccsabc_callbacks {
void (* recv)(struct ccsabc_conn *c); void (* recv)(struct ccsabc_conn *c);
void (* sent)(struct ccsabc_conn *c); void (* sent)(struct ccsabc_conn *c);
}; };
struct ccsabc_conn { struct ccsabc_conn {
struct sabc_conn conn; struct sabc_conn conn;
const struct ccsabc_ulayer *u; const struct ccsabc_callbacks *u;
unsigned char state; unsigned char state;
unsigned char c; unsigned char c;
}; };
void ccsabc_setup(struct ccsabc_conn *c, u16_t channel, void ccsabc_setup(struct ccsabc_conn *c, u16_t channel,
const struct ccsabc_ulayer *u); const struct ccsabc_callbacks *u);
int ccsabc_send_stubborn(struct ccsabc_conn *c, clock_time_t t); int ccsabc_send_stubborn(struct ccsabc_conn *c, clock_time_t t);
void ccsabc_cancel(struct ccsabc_conn *c); void ccsabc_cancel(struct ccsabc_conn *c);

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: ibc.c,v 1.1 2007/02/28 16:38:51 adamdunkels Exp $ * $Id: ibc.c,v 1.2 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -57,11 +57,11 @@ recv_from_abc(struct abc_conn *bc)
c->u->recv(c, hdr->sender_id); c->u->recv(c, hdr->sender_id);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static const struct abc_ulayer ibc = {recv_from_abc}; static const struct abc_callbacks ibc = {recv_from_abc};
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
ibc_setup(struct ibc_conn *c, u16_t channel, ibc_setup(struct ibc_conn *c, u16_t channel,
const struct ibc_ulayer *u) const struct ibc_callbacks *u)
{ {
abc_setup(&c->c, channel, &ibc); abc_setup(&c->c, channel, &ibc);
c->u = u; c->u = u;

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: ibc.h,v 1.1 2007/02/28 16:38:51 adamdunkels Exp $ * $Id: ibc.h,v 1.2 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -46,17 +46,17 @@
struct ibc_conn; struct ibc_conn;
struct ibc_ulayer { struct ibc_callbacks {
void (* recv)(struct ibc_conn *ptr, node_id_t sender); void (* recv)(struct ibc_conn *ptr, node_id_t sender);
}; };
struct ibc_conn { struct ibc_conn {
struct abc_conn c; struct abc_conn c;
const struct ibc_ulayer *u; const struct ibc_callbacks *u;
}; };
void ibc_setup(struct ibc_conn *c, u16_t channel, void ibc_setup(struct ibc_conn *c, u16_t channel,
const struct ibc_ulayer *u); const struct ibc_callbacks *u);
int ibc_send(struct ibc_conn *c); int ibc_send(struct ibc_conn *c);
#endif /* __IBC_H__ */ #endif /* __IBC_H__ */

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: nf.c,v 1.2 2007/03/15 09:56:30 adamdunkels Exp $ * $Id: nf.c,v 1.3 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -147,11 +147,11 @@ recv_from_ibc(struct ibc_conn *ibc, node_id_t from_id)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static const struct ibc_ulayer nf = {recv_from_ibc}; static const struct ibc_callbacks nf = {recv_from_ibc};
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
nf_setup(struct nf_conn *c, u16_t channel, nf_setup(struct nf_conn *c, u16_t channel,
const struct nf_ulayer *u) const struct nf_callbacks *u)
{ {
ibc_setup(&c->c, channel, &nf); ibc_setup(&c->c, channel, &nf);
c->u = u; c->u = u;

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: nf.h,v 1.2 2007/03/15 09:56:30 adamdunkels Exp $ * $Id: nf.h,v 1.3 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -47,7 +47,7 @@
struct nf_conn; struct nf_conn;
struct nf_ulayer { struct nf_callbacks {
int (* recv)(struct nf_conn *c, node_id_t from, int (* recv)(struct nf_conn *c, node_id_t from,
node_id_t originator, u8_t seqno, u8_t hops); node_id_t originator, u8_t seqno, u8_t hops);
void (* sent)(struct nf_conn *c); void (* sent)(struct nf_conn *c);
@ -60,11 +60,11 @@ struct nf_conn {
u8_t packets_received; u8_t packets_received;
u8_t last_originator_seqno; u8_t last_originator_seqno;
node_id_t last_originator_id; node_id_t last_originator_id;
const struct nf_ulayer *u; const struct nf_callbacks *u;
}; };
void nf_setup(struct nf_conn *c, u16_t channel, void nf_setup(struct nf_conn *c, u16_t channel,
const struct nf_ulayer *u); const struct nf_callbacks *u);
int nf_send(struct nf_conn *c); int nf_send(struct nf_conn *c);

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: rime-debug.h,v 1.1 2007/02/28 16:38:52 adamdunkels Exp $ * $Id: rime-debug.h,v 1.2 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -41,7 +41,7 @@
#ifndef __RIME_DEBUG_H__ #ifndef __RIME_DEBUG_H__
#define __RIME_DEBUG_H__ #define __RIME_DEBUG_H__
#define DEBUG_LEVEL 0 #define DEBUG_LEVEL 1
#if DEBUG_LEVEL > 0 #if DEBUG_LEVEL > 0
#include <stdio.h> #include <stdio.h>

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: ruc.c,v 1.1 2007/02/28 16:38:52 adamdunkels Exp $ * $Id: ruc.c,v 1.2 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -110,11 +110,11 @@ recv_from_suc(struct suc_conn *suc, node_id_t from_id)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static const struct suc_ulayer ruc = {recv_from_suc, sent_by_suc}; static const struct suc_callbacks ruc = {recv_from_suc, sent_by_suc};
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
ruc_setup(struct ruc_conn *c, u16_t channel, ruc_setup(struct ruc_conn *c, u16_t channel,
const struct ruc_ulayer *u) const struct ruc_callbacks *u)
{ {
suc_setup(&c->c, channel, &ruc); suc_setup(&c->c, channel, &ruc);
c->u = u; c->u = u;

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: ruc.h,v 1.1 2007/02/28 16:38:52 adamdunkels Exp $ * $Id: ruc.h,v 1.2 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -45,19 +45,19 @@
struct ruc_conn; struct ruc_conn;
struct ruc_ulayer { struct ruc_callbacks {
int (* recv)(struct ruc_conn *c, node_id_t from, u8_t seqno); int (* recv)(struct ruc_conn *c, node_id_t from, u8_t seqno);
void (* sent)(struct ruc_conn *c); void (* sent)(struct ruc_conn *c);
}; };
struct ruc_conn { struct ruc_conn {
struct suc_conn c; struct suc_conn c;
const struct ruc_ulayer *u; const struct ruc_callbacks *u;
u8_t state; u8_t state;
}; };
void ruc_setup(struct ruc_conn *c, u16_t channel, void ruc_setup(struct ruc_conn *c, u16_t channel,
const struct ruc_ulayer *u); const struct ruc_callbacks *u);
int ruc_send(struct ruc_conn *c, node_id_t receiver_id); int ruc_send(struct ruc_conn *c, node_id_t receiver_id);

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: sabc.c,v 1.1 2007/02/28 16:38:52 adamdunkels Exp $ * $Id: sabc.c,v 1.2 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -54,11 +54,11 @@ recv_from_abc(struct abc_conn *abc)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static const struct abc_ulayer sabc = {recv_from_abc}; static const struct abc_callbacks sabc = {recv_from_abc};
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
sabc_setup(struct sabc_conn *c, u16_t channel, sabc_setup(struct sabc_conn *c, u16_t channel,
const struct sabc_ulayer *u) const struct sabc_callbacks *u)
{ {
abc_setup(&c->c, channel, &sabc); abc_setup(&c->c, channel, &sabc);
c->u = u; c->u = u;

View file

@ -44,7 +44,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: sabc.h,v 1.1 2007/02/28 16:38:52 adamdunkels Exp $ * $Id: sabc.h,v 1.2 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -63,7 +63,7 @@
struct sabc_conn; struct sabc_conn;
struct sabc_ulayer { struct sabc_callbacks {
void (* recv)(struct sabc_conn *c); void (* recv)(struct sabc_conn *c);
void (* sent)(struct sabc_conn *c); void (* sent)(struct sabc_conn *c);
}; };
@ -77,7 +77,7 @@ struct sabc_conn {
struct abc_conn c; struct abc_conn c;
struct ctimer t; struct ctimer t;
struct queuebuf *buf; struct queuebuf *buf;
const struct sabc_ulayer *u; const struct sabc_callbacks *u;
}; };
@ -97,7 +97,7 @@ struct sabc_conn {
* *
*/ */
void sabc_setup(struct sabc_conn *c, u16_t channel, void sabc_setup(struct sabc_conn *c, u16_t channel,
const struct sabc_ulayer *u); const struct sabc_callbacks *u);
/** /**

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: sibc.c,v 1.1 2007/02/28 16:38:52 adamdunkels Exp $ * $Id: sibc.c,v 1.2 2007/03/15 10:01:04 adamdunkels Exp $
*/ */
/** /**
@ -53,11 +53,11 @@ recv_from_ibc(struct ibc_conn *ibc, node_id_t from_id)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static const struct ibc_ulayer sibc = {recv_from_ibc}; static const struct ibc_callbacks sibc = {recv_from_ibc};
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
sibc_setup(struct sibc_conn *c, u16_t channel, sibc_setup(struct sibc_conn *c, u16_t channel,
const struct sibc_ulayer *u) const struct sibc_callbacks *u)
{ {
ibc_setup(&c->c, channel, &sibc); ibc_setup(&c->c, channel, &sibc);
c->u = u; c->u = u;

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: sibc.h,v 1.1 2007/02/28 16:38:52 adamdunkels Exp $ * $Id: sibc.h,v 1.2 2007/03/15 10:01:05 adamdunkels Exp $
*/ */
/** /**
@ -47,7 +47,7 @@
struct sibc_conn; struct sibc_conn;
struct sibc_ulayer { struct sibc_callbacks {
void (* recv)(struct sibc_conn *c, node_id_t from); void (* recv)(struct sibc_conn *c, node_id_t from);
void (* sent)(struct sibc_conn *c); void (* sent)(struct sibc_conn *c);
}; };
@ -56,11 +56,11 @@ struct sibc_conn {
struct ibc_conn c; struct ibc_conn c;
struct ctimer t; struct ctimer t;
struct queuebuf *buf; struct queuebuf *buf;
const struct sibc_ulayer *u; const struct sibc_callbacks *u;
}; };
void sibc_setup(struct sibc_conn *c, u16_t channel, void sibc_setup(struct sibc_conn *c, u16_t channel,
const struct sibc_ulayer *u); const struct sibc_callbacks *u);
int sibc_send_stubborn(struct sibc_conn *c, clock_time_t t); int sibc_send_stubborn(struct sibc_conn *c, clock_time_t t);
void sibc_cancel(struct sibc_conn *c); void sibc_cancel(struct sibc_conn *c);

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: suc.c,v 1.1 2007/02/28 16:38:52 adamdunkels Exp $ * $Id: suc.c,v 1.2 2007/03/15 10:01:05 adamdunkels Exp $
*/ */
/** /**
@ -53,11 +53,11 @@ recv_from_uc(struct uc_conn *uc, node_id_t from_id)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static const struct uc_ulayer suc = {recv_from_uc}; static const struct uc_callbacks suc = {recv_from_uc};
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
suc_setup(struct suc_conn *c, u16_t channel, suc_setup(struct suc_conn *c, u16_t channel,
const struct suc_ulayer *u) const struct suc_callbacks *u)
{ {
uc_setup(&c->c, channel, &suc); uc_setup(&c->c, channel, &suc);
c->u = u; c->u = u;

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: suc.h,v 1.1 2007/02/28 16:38:52 adamdunkels Exp $ * $Id: suc.h,v 1.2 2007/03/15 10:01:05 adamdunkels Exp $
*/ */
/** /**
@ -47,7 +47,7 @@
struct suc_conn; struct suc_conn;
struct suc_ulayer { struct suc_callbacks {
void (* recv)(struct suc_conn *c, node_id_t from); void (* recv)(struct suc_conn *c, node_id_t from);
void (* sent)(struct suc_conn *c); void (* sent)(struct suc_conn *c);
}; };
@ -56,12 +56,12 @@ struct suc_conn {
struct uc_conn c; struct uc_conn c;
struct ctimer t; struct ctimer t;
struct queuebuf *buf; struct queuebuf *buf;
const struct suc_ulayer *u; const struct suc_callbacks *u;
node_id_t receiver_id; node_id_t receiver_id;
}; };
void suc_setup(struct suc_conn *c, u16_t channel, void suc_setup(struct suc_conn *c, u16_t channel,
const struct suc_ulayer *u); const struct suc_callbacks *u);
int suc_send_stubborn(struct suc_conn *c, node_id_t receiver_id); int suc_send_stubborn(struct suc_conn *c, node_id_t receiver_id);
void suc_cancel(struct suc_conn *c); void suc_cancel(struct suc_conn *c);

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: uc.c,v 1.1 2007/02/28 16:38:52 adamdunkels Exp $ * $Id: uc.c,v 1.2 2007/03/15 10:01:05 adamdunkels Exp $
*/ */
/** /**
@ -60,11 +60,11 @@ recv_from_ibc(struct ibc_conn *ibc, node_id_t from_id)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static const struct ibc_ulayer uc = {recv_from_ibc}; static const struct ibc_callbacks uc = {recv_from_ibc};
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
uc_setup(struct uc_conn *c, u16_t channel, uc_setup(struct uc_conn *c, u16_t channel,
const struct uc_ulayer *u) const struct uc_callbacks *u)
{ {
ibc_setup(&c->c, channel, &uc); ibc_setup(&c->c, channel, &uc);
c->u = u; c->u = u;

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: uc.h,v 1.1 2007/02/28 16:38:52 adamdunkels Exp $ * $Id: uc.h,v 1.2 2007/03/15 10:01:05 adamdunkels Exp $
*/ */
/** /**
@ -45,17 +45,17 @@
struct uc_conn; struct uc_conn;
struct uc_ulayer { struct uc_callbacks {
void (* recv)(struct uc_conn *c, node_id_t from_id); void (* recv)(struct uc_conn *c, node_id_t from_id);
}; };
struct uc_conn { struct uc_conn {
struct ibc_conn c; struct ibc_conn c;
const struct uc_ulayer *u; const struct uc_callbacks *u;
}; };
void uc_setup(struct uc_conn *c, u16_t channel, void uc_setup(struct uc_conn *c, u16_t channel,
const struct uc_ulayer *u); const struct uc_callbacks *u);
int uc_send(struct uc_conn *c, node_id_t receiver_id); int uc_send(struct uc_conn *c, node_id_t receiver_id);
#endif /* __UC_H__ */ #endif /* __UC_H__ */