nf is now based on uibc

This commit is contained in:
adamdunkels 2007-03-21 23:21:54 +00:00
parent 9951aba084
commit 70f2be4652
2 changed files with 12 additions and 11 deletions

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.6 2007/03/19 22:10:17 adamdunkels Exp $ * $Id: nf.c,v 1.7 2007/03/21 23:21:54 adamdunkels Exp $
*/ */
/** /**
@ -43,7 +43,7 @@
#include "lib/rand.h" #include "lib/rand.h"
#include <string.h> #include <string.h>
#define QUEUE_TIME ((CLOCK_SECOND / 16) * (rand() % 16)) #define QUEUE_TIME CLOCK_SECOND / 2
#define HOPS_MAX 16 #define HOPS_MAX 16
@ -77,7 +77,7 @@ send(void *ptr)
queuebuf_to_rimebuf(c->buf); queuebuf_to_rimebuf(c->buf);
queuebuf_free(c->buf); queuebuf_free(c->buf);
c->buf = NULL; c->buf = NULL;
ibc_send(&c->c); uibc_send(&c->c, QUEUE_TIME);
if(c->u->sent != NULL) { if(c->u->sent != NULL) {
c->u->sent(c); c->u->sent(c);
} }
@ -99,9 +99,9 @@ queue_for_send(struct nf_conn *c)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
recv_from_ibc(struct ibc_conn *ibc, rimeaddr_t *from) recv_from_uibc(struct uibc_conn *uibc, rimeaddr_t *from)
{ {
register struct nf_conn *c = (struct nf_conn *)ibc; register struct nf_conn *c = (struct nf_conn *)uibc;
struct nf_hdr *hdr = rimebuf_dataptr(); struct nf_hdr *hdr = rimebuf_dataptr();
u8_t hops; u8_t hops;
struct queuebuf *queuebuf; struct queuebuf *queuebuf;
@ -147,20 +147,20 @@ recv_from_ibc(struct ibc_conn *ibc, rimeaddr_t *from)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static const struct ibc_callbacks nf = {recv_from_ibc}; static const struct uibc_callbacks nf = {recv_from_uibc, NULL, NULL};
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
nf_open(struct nf_conn *c, u16_t channel, nf_open(struct nf_conn *c, u16_t channel,
const struct nf_callbacks *u) const struct nf_callbacks *u)
{ {
ibc_open(&c->c, channel, &nf); uibc_open(&c->c, channel, &nf);
c->u = u; c->u = u;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
nf_close(struct nf_conn *c) nf_close(struct nf_conn *c)
{ {
ibc_close(&c->c); uibc_close(&c->c);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int

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.6 2007/03/19 22:10:17 adamdunkels Exp $ * $Id: nf.h,v 1.7 2007/03/21 23:21:54 adamdunkels Exp $
*/ */
/** /**
@ -41,9 +41,10 @@
#ifndef __NF_H__ #ifndef __NF_H__
#define __NF_H__ #define __NF_H__
#include "net/rime/uc.h"
#include "net/rime/ctimer.h" #include "net/rime/ctimer.h"
#include "net/rime/queuebuf.h" #include "net/rime/queuebuf.h"
#include "net/rime/uibc.h"
struct nf_conn; struct nf_conn;
@ -54,7 +55,7 @@ struct nf_callbacks {
}; };
struct nf_conn { struct nf_conn {
struct ibc_conn c; struct uibc_conn c;
struct ctimer t; struct ctimer t;
struct queuebuf *buf; struct queuebuf *buf;
u8_t packets_received; u8_t packets_received;