Renamed rimebuf_hdrextend() to rimebuf_hdralloc()

This commit is contained in:
adamdunkels 2007-03-23 10:46:35 +00:00
parent 54228ae6e4
commit 013701f50c
13 changed files with 27 additions and 27 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: rudolph0.c,v 1.3 2007/03/22 23:54:40 adamdunkels Exp $ * $Id: rudolph0.c,v 1.4 2007/03/23 10:46:56 adamdunkels Exp $
*/ */
/** /**
@ -86,7 +86,7 @@ send_nack(struct rudolph0_conn *c)
{ {
struct rudolph0_hdr *hdr; struct rudolph0_hdr *hdr;
rimebuf_clear(); rimebuf_clear();
rimebuf_hdrextend(sizeof(struct rudolph0_hdr)); rimebuf_hdralloc(sizeof(struct rudolph0_hdr));
hdr = rimebuf_hdrptr(); hdr = rimebuf_hdrptr();
hdr->type = TYPE_NACK; hdr->type = TYPE_NACK;

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: rudolph1.c,v 1.2 2007/03/22 23:54:40 adamdunkels Exp $ * $Id: rudolph1.c,v 1.3 2007/03/23 10:46:56 adamdunkels Exp $
*/ */
/** /**
@ -137,7 +137,7 @@ send_nack(struct rudolph1_conn *c)
{ {
struct rudolph1_hdr *hdr; struct rudolph1_hdr *hdr;
rimebuf_clear(); rimebuf_clear();
rimebuf_hdrextend(sizeof(struct rudolph1_hdr)); rimebuf_hdralloc(sizeof(struct rudolph1_hdr));
hdr = rimebuf_hdrptr(); hdr = rimebuf_hdrptr();
hdr->type = TYPE_NACK; hdr->type = TYPE_NACK;

View file

@ -30,7 +30,7 @@
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
* $Id: abc.c,v 1.7 2007/03/20 12:28:13 adamdunkels Exp $ * $Id: abc.c,v 1.8 2007/03/23 10:46:35 adamdunkels Exp $
*/ */
/** /**
@ -74,7 +74,7 @@ abc_close(struct abc_conn *c)
int int
abc_send(struct abc_conn *c) abc_send(struct abc_conn *c)
{ {
if(rimebuf_hdrextend(sizeof(struct abc_hdr))) { if(rimebuf_hdralloc(sizeof(struct abc_hdr))) {
struct abc_hdr *hdr = rimebuf_hdrptr(); struct abc_hdr *hdr = rimebuf_hdrptr();
DEBUGF(1, "%d: abc: abc_send on channel %d\n", rimeaddr_node_addr.u16, c->channel); DEBUGF(1, "%d: abc: abc_send on channel %d\n", rimeaddr_node_addr.u16, c->channel);

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.6 2007/03/20 12:28:13 adamdunkels Exp $ * $Id: ibc.c,v 1.7 2007/03/23 10:46:35 adamdunkels Exp $
*/ */
/** /**
@ -81,7 +81,7 @@ int
ibc_send(struct ibc_conn *c) ibc_send(struct ibc_conn *c)
{ {
DEBUGF(1, "%d: ibc_send\n", rimeaddr_node_addr.u16); DEBUGF(1, "%d: ibc_send\n", rimeaddr_node_addr.u16);
if(rimebuf_hdrextend(sizeof(struct ibc_hdr))) { if(rimebuf_hdralloc(sizeof(struct ibc_hdr))) {
struct ibc_hdr *hdr = rimebuf_hdrptr(); struct ibc_hdr *hdr = rimebuf_hdrptr();
rimeaddr_copy(&hdr->sender, &rimeaddr_node_addr); rimeaddr_copy(&hdr->sender, &rimeaddr_node_addr);
return abc_send(&c->c); return abc_send(&c->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: mh.c,v 1.1 2007/03/22 17:33:15 adamdunkels Exp $ * $Id: mh.c,v 1.2 2007/03/23 10:46:35 adamdunkels Exp $
*/ */
/** /**
@ -64,7 +64,7 @@ send_data(struct mh_conn *c, rimeaddr_t *to, struct route_entry *next)
{ {
struct data_hdr *hdr; struct data_hdr *hdr;
if(rimebuf_hdrextend(sizeof(struct data_hdr))) { if(rimebuf_hdralloc(sizeof(struct data_hdr))) {
hdr = rimebuf_hdrptr(); hdr = rimebuf_hdrptr();
rimeaddr_copy(&hdr->dest, to); rimeaddr_copy(&hdr->dest, to);
rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr); rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr);

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.8 2007/03/22 18:53:38 adamdunkels Exp $ * $Id: nf.c,v 1.9 2007/03/23 10:46:35 adamdunkels Exp $
*/ */
/** /**
@ -185,7 +185,7 @@ nf_send(struct nf_conn *c)
c->buf = NULL; c->buf = NULL;
} }
if(rimebuf_hdrextend(sizeof(struct nf_hdr))) { if(rimebuf_hdralloc(sizeof(struct nf_hdr))) {
struct nf_hdr *hdr = rimebuf_hdrptr(); struct nf_hdr *hdr = rimebuf_hdrptr();
rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr); rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr);
rimeaddr_copy(&c->last_originator, &hdr->originator); rimeaddr_copy(&c->last_originator, &hdr->originator);

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: queuebuf.c,v 1.4 2007/03/20 12:26:23 adamdunkels Exp $ * $Id: queuebuf.c,v 1.5 2007/03/23 10:46:35 adamdunkels Exp $
*/ */
/** /**
@ -111,7 +111,7 @@ queuebuf_to_rimebuf(struct queuebuf *b)
r = (struct queuebuf_ref *)b; r = (struct queuebuf_ref *)b;
rimebuf_clear(); rimebuf_clear();
rimebuf_copyfrom(r->ref, r->len); rimebuf_copyfrom(r->ref, r->len);
rimebuf_hdrextend(r->hdrlen); rimebuf_hdralloc(r->hdrlen);
memcpy(rimebuf_hdrptr(), r->hdr, r->hdrlen); memcpy(rimebuf_hdrptr(), r->hdr, r->hdrlen);
} }
} }

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: rimebuf.c,v 1.3 2007/03/14 00:30:11 adamdunkels Exp $ * $Id: rimebuf.c,v 1.4 2007/03/23 10:46:35 adamdunkels Exp $
*/ */
/** /**
@ -130,7 +130,7 @@ rimebuf_copyto(u8_t *to)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int
rimebuf_hdrextend(int size) rimebuf_hdralloc(int size)
{ {
if(hdrptr > size) { if(hdrptr > size) {
hdrptr -= size; hdrptr -= size;

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: rimebuf.h,v 1.4 2007/03/15 09:57:00 adamdunkels Exp $ * $Id: rimebuf.h,v 1.5 2007/03/23 10:46:35 adamdunkels Exp $
*/ */
/** /**
@ -262,7 +262,7 @@ int rimebuf_copyto_hdr(u8_t *to);
* zero and does not allocate anything. * zero and does not allocate anything.
* *
*/ */
int rimebuf_hdrextend(int size); int rimebuf_hdralloc(int size);
/** /**
* \brief Reduce the header in the rimebuf, for incoming packets * \brief Reduce the header in the rimebuf, for incoming packets

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.6 2007/03/20 12:28:01 adamdunkels Exp $ * $Id: ruc.c,v 1.7 2007/03/23 10:46:35 adamdunkels Exp $
*/ */
/** /**
@ -100,7 +100,7 @@ recv_from_suc(struct suc_conn *suc, rimeaddr_t *from)
rimeaddr_node_addr.u16, from->u16, rimeaddr_node_addr.u16, from->u16,
packet_seqno); packet_seqno);
rimebuf_clear(); rimebuf_clear();
rimebuf_hdrextend(sizeof(struct ruc_hdr)); rimebuf_hdralloc(sizeof(struct ruc_hdr));
hdr = rimebuf_hdrptr(); hdr = rimebuf_hdrptr();
hdr->type = TYPE_ACK; hdr->type = TYPE_ACK;
hdr->seqno = packet_seqno; hdr->seqno = packet_seqno;
@ -130,7 +130,7 @@ ruc_close(struct ruc_conn *c)
int int
ruc_send(struct ruc_conn *c, rimeaddr_t *receiver) ruc_send(struct ruc_conn *c, rimeaddr_t *receiver)
{ {
if(rimebuf_hdrextend(sizeof(struct ruc_hdr))) { if(rimebuf_hdralloc(sizeof(struct ruc_hdr))) {
struct ruc_hdr *hdr = rimebuf_hdrptr(); struct ruc_hdr *hdr = rimebuf_hdrptr();
hdr->type = TYPE_DATA; hdr->type = TYPE_DATA;
hdr->seqno = seqno; hdr->seqno = seqno;

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: tree.c,v 1.6 2007/03/22 18:54:22 adamdunkels Exp $ * $Id: tree.c,v 1.7 2007/03/23 10:46:35 adamdunkels Exp $
*/ */
/** /**
@ -250,7 +250,7 @@ tree_send(struct tree_conn *tc)
struct neighbor *n; struct neighbor *n;
struct hdr *hdr; struct hdr *hdr;
if(rimebuf_hdrextend(sizeof(struct hdr))) { if(rimebuf_hdralloc(sizeof(struct hdr))) {
hdr = rimebuf_hdrptr(); hdr = rimebuf_hdrptr();
hdr->originator_seqno = tc->seqno++; hdr->originator_seqno = tc->seqno++;
rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr); rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr);

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: trickle.c,v 1.2 2007/03/21 23:23:02 adamdunkels Exp $ * $Id: trickle.c,v 1.3 2007/03/23 10:46:35 adamdunkels Exp $
*/ */
/** /**
@ -62,7 +62,7 @@ send(struct trickle_conn *c)
if(c->q != NULL) { if(c->q != NULL) {
queuebuf_to_rimebuf(c->q); queuebuf_to_rimebuf(c->q);
rimebuf_hdrextend(sizeof(struct trickle_hdr)); rimebuf_hdralloc(sizeof(struct trickle_hdr));
hdr = rimebuf_hdrptr(); hdr = rimebuf_hdrptr();
hdr->seqno = c->seqno; hdr->seqno = c->seqno;
hdr->interval = c->interval; hdr->interval = c->interval;

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.6 2007/03/20 12:28:13 adamdunkels Exp $ * $Id: uc.c,v 1.7 2007/03/23 10:46:35 adamdunkels Exp $
*/ */
/** /**
@ -80,7 +80,7 @@ int
uc_send(struct uc_conn *c, rimeaddr_t *receiver) uc_send(struct uc_conn *c, rimeaddr_t *receiver)
{ {
DEBUGF(2, "%d: uc_send to %d\n", rimeaddr_node_addr.u16, receiver->u16); DEBUGF(2, "%d: uc_send to %d\n", rimeaddr_node_addr.u16, receiver->u16);
if(rimebuf_hdrextend(sizeof(struct uc_hdr))) { if(rimebuf_hdralloc(sizeof(struct uc_hdr))) {
struct uc_hdr *hdr = rimebuf_hdrptr(); struct uc_hdr *hdr = rimebuf_hdrptr();
rimeaddr_copy(&hdr->receiver, receiver); rimeaddr_copy(&hdr->receiver, receiver);
return ibc_send(&c->c); return ibc_send(&c->c);