From 65eb5fd4e8ff93e9f4da928b621de8ca3b2f14f7 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Thu, 12 Mar 2009 21:58:20 +0000 Subject: [PATCH] Renamed the rimebuf module to packetbuf to signal that the module is used outside of a pure Rime context (e.g., the sicslowpan code uses it). --- apps/deluge/deluge.c | 18 +++--- apps/shell/shell-rime-debug.c | 26 ++++----- apps/shell/shell-rime-netcmd.c | 16 ++--- apps/shell/shell-rime-ping.c | 10 ++-- apps/shell/shell-rime-sniff.c | 24 ++++---- apps/shell/shell-rime.c | 38 ++++++------ apps/shell/shell-rsh.c | 34 +++++------ core/dev/cc2420.c | 14 ++--- core/net/mac/ctdma_mac.c | 12 ++-- core/net/mac/cxmac.c | 32 +++++----- core/net/mac/lpp.c | 48 +++++++-------- core/net/mac/nullmac.c | 12 ++-- core/net/mac/tdma_mac.c | 12 ++-- core/net/mac/xmac.c | 48 +++++++-------- core/net/rime.h | 14 ++--- core/net/rime/Makefile.rime | 2 +- core/net/rime/abc.c | 6 +- core/net/rime/abc.h | 6 +- core/net/rime/broadcast.c | 10 ++-- core/net/rime/broadcast.h | 6 +- core/net/rime/chameleon-bitopt.c | 72 +++++++++++------------ core/net/rime/chameleon-raw.c | 74 ++++++++++++------------ core/net/rime/chameleon.c | 12 ++-- core/net/rime/chameleon.h | 6 +- core/net/rime/channel.c | 4 +- core/net/rime/channel.h | 8 +-- core/net/rime/collect.c | 56 +++++++++--------- core/net/rime/collect.h | 12 ++-- core/net/rime/ipolite.c | 12 ++-- core/net/rime/ipolite.h | 4 +- core/net/rime/mesh.c | 6 +- core/net/rime/mesh.h | 4 +- core/net/rime/multihop.c | 20 +++---- core/net/rime/multihop.h | 8 +-- core/net/rime/neighbor-discovery.c | 10 ++-- core/net/rime/netflood.c | 18 +++--- core/net/rime/netflood.h | 8 +-- core/net/rime/polite-announcement.c | 12 ++-- core/net/rime/polite.c | 12 ++-- core/net/rime/polite.h | 4 +- core/net/rime/queuebuf.c | 42 +++++++------- core/net/rime/queuebuf.h | 8 +-- core/net/rime/rime.c | 6 +- core/net/rime/rmh.c | 12 ++-- core/net/rime/route-discovery.c | 20 +++---- core/net/rime/rucb.c | 20 +++---- core/net/rime/rudolph0.c | 14 ++--- core/net/rime/rudolph1.c | 18 +++--- core/net/rime/rudolph2.c | 32 +++++----- core/net/rime/runicast.c | 54 ++++++++--------- core/net/rime/runicast.h | 6 +- core/net/rime/stbroadcast.c | 6 +- core/net/rime/stunicast.c | 6 +- core/net/rime/timesynch.c | 6 +- core/net/rime/trickle.c | 20 +++---- core/net/rime/trickle.h | 4 +- core/net/rime/unicast.c | 14 ++--- core/net/rime/unicast.h | 4 +- core/net/sicslowpan.c | 50 ++++++++-------- core/net/uip-over-mesh.c | 16 ++--- core/sys/compower.c | 12 ++-- core/sys/compower.h | 6 +- cpu/avr/radio/mac/sicslowmac.c | 52 ++++++++--------- doc/sicslowpan-doc.txt | 8 +-- examples/compile-platforms/Makefile | 3 + examples/energest-demo/energest-demo.c | 8 +-- examples/esb/radio-test.c | 18 +++--- examples/rime/example-abc.c | 6 +- examples/rime/example-collect.c | 10 ++-- examples/rime/example-mesh.c | 8 +-- examples/rime/example-meshconn.c | 6 +- examples/rime/example-multihop.c | 8 +-- examples/rime/example-polite.c | 4 +- examples/rime/example-runicast.c | 4 +- examples/rime/example-trickle.c | 6 +- examples/rime/example-unicast.c | 4 +- examples/sky-shell/sky-checkpoint.c | 12 ++-- examples/sky-shell/sky-shell.c | 12 ++-- examples/sky/radio-test.c | 18 +++--- examples/sky/sky-collect.c | 10 ++-- platform/avr-raven/contiki-conf.h | 2 +- platform/avr-ravenusb/sicslow_ethernet.c | 12 ++-- platform/avr-rcb/contiki-conf.h | 2 +- platform/avr-zigbit/contiki-conf.h | 2 +- platform/esb/contiki-conf.h | 2 +- platform/msb430/apps/test-abc.c | 12 ++-- platform/netsim/contiki-conf.h | 6 +- platform/netsim/net/ethernode-rime.c | 10 ++-- platform/sky/contiki-conf.h | 4 +- tools/sky/check-size | 2 +- 90 files changed, 690 insertions(+), 687 deletions(-) diff --git a/apps/deluge/deluge.c b/apps/deluge/deluge.c index 0fe67f4de..0df3951b7 100644 --- a/apps/deluge/deluge.c +++ b/apps/deluge/deluge.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: deluge.c,v 1.4 2009/03/01 12:49:43 nvt-se Exp $ + * $Id: deluge.c,v 1.5 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -269,7 +269,7 @@ send_request(void *arg) PRINTF("Sending request for page %d, version %u, request_set %u\n", request.pagenum, request.version, request.request_set); - rimebuf_copyfrom((uint8_t *)&request, sizeof (request)); + packetbuf_copyfrom((uint8_t *)&request, sizeof (request)); unicast_send(&deluge_uc, &obj->summary_from); /* Deluge R.2 */ @@ -300,7 +300,7 @@ advertise_summary(struct deluge_object *obj) PRINTF("Advertising summary for object id %u: version=%u, available=%u\n", (unsigned) obj->object_id, summary.version, summary.highest_available); - rimebuf_copyfrom((uint8_t *)&summary, sizeof (summary)); + packetbuf_copyfrom((uint8_t *)&summary, sizeof (summary)); broadcast_send(&deluge_broadcast); } @@ -375,7 +375,7 @@ send_page(struct deluge_object *obj, unsigned pagenum) for(cp = buf; cp + S_PKT <= (unsigned char *)&buf[S_PAGE]; cp += S_PKT) { pkt.crc = checksum(cp, S_PKT); memcpy(pkt.payload, cp, S_PKT); - rimebuf_copyfrom((uint8_t *)&pkt, sizeof (pkt)); + packetbuf_copyfrom((uint8_t *)&pkt, sizeof (pkt)); broadcast_send(&deluge_broadcast); obj->tx_set &= ~(1 << pkt.packetnum++); @@ -517,8 +517,8 @@ unicast_recv(struct unicast_conn *c, rimeaddr_t *sender) char *msg; int len; - msg = rimebuf_dataptr(); - len = rimebuf_datalen(); + msg = packetbuf_dataptr(); + len = packetbuf_datalen(); if(len < 5) return; @@ -551,7 +551,7 @@ send_profile(struct deluge_object *obj) msg->version_vector[i] = obj->pages[i].version; } - rimebuf_copyfrom(buf, sizeof (buf)); + packetbuf_copyfrom(buf, sizeof (buf)); broadcast_send(&deluge_broadcast); } } @@ -627,8 +627,8 @@ broadcast_recv(struct broadcast_conn *c, rimeaddr_t *sender) int len; struct deluge_msg_profile *profile; - msg = rimebuf_dataptr(); - len = rimebuf_datalen(); + msg = packetbuf_dataptr(); + len = packetbuf_datalen(); if(len < 5) return; diff --git a/apps/shell/shell-rime-debug.c b/apps/shell/shell-rime-debug.c index f89f33d54..6466cd9c9 100644 --- a/apps/shell/shell-rime-debug.c +++ b/apps/shell/shell-rime-debug.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-rime-debug.c,v 1.2 2008/08/15 18:58:42 adamdunkels Exp $ + * $Id: shell-rime-debug.c,v 1.3 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -98,10 +98,10 @@ PROCESS_THREAD(shell_broadcast_process, ev, data) PROCESS_EXIT(); } - if(len < RIMEBUF_SIZE) { - rimebuf_clear(); - rimebuf_set_datalen(len + COLLECT_MSG_HDRSIZE); - msg = rimebuf_dataptr(); + if(len < PACKETBUF_SIZE) { + packetbuf_clear(); + packetbuf_set_datalen(len + COLLECT_MSG_HDRSIZE); + msg = packetbuf_dataptr(); memcpy(msg->data, input->data1, input->len1); memcpy(msg->data + input->len1, input->data2, input->len2); #if TIMESYNCH_CONF_ENABLED @@ -121,7 +121,7 @@ recv_broadcast(struct broadcast_conn *c, rimeaddr_t *from) struct collect_msg *msg; rtimer_clock_t latency; - msg = rimebuf_dataptr(); + msg = packetbuf_dataptr(); #if TIMESYNCH_CONF_ENABLED latency = timesynch_time() - msg->timestamp; @@ -132,7 +132,7 @@ recv_broadcast(struct broadcast_conn *c, rimeaddr_t *from) printf("broadcast message received from %d.%d, latency %lu ms, data '%.*s'\n", from->u8[0], from->u8[1], (1000L * latency) / RTIMER_ARCH_SECOND, - rimebuf_datalen() - COLLECT_MSG_HDRSIZE, + packetbuf_datalen() - COLLECT_MSG_HDRSIZE, msg->data); } static const struct broadcast_callbacks broadcast_callbacks = {recv_broadcast}; @@ -170,10 +170,10 @@ PROCESS_THREAD(shell_unicast_process, ev, data) PROCESS_EXIT(); } - if(len < RIMEBUF_SIZE) { - rimebuf_clear(); - rimebuf_set_datalen(len + COLLECT_MSG_HDRSIZE); - msg = rimebuf_dataptr(); + if(len < PACKETBUF_SIZE) { + packetbuf_clear(); + packetbuf_set_datalen(len + COLLECT_MSG_HDRSIZE); + msg = packetbuf_dataptr(); memcpy(msg->data, input->data1, input->len1); memcpy(msg->data + input->len1, input->data2, input->len2); #if TIMESYNCH_CONF_ENABLED @@ -193,7 +193,7 @@ recv_uc(struct unicast_conn *c, rimeaddr_t *from) struct collect_msg *msg; rtimer_clock_t latency; - msg = rimebuf_dataptr(); + msg = packetbuf_dataptr(); #if TIMESYNCH_CONF_ENABLED latency = timesynch_time() - msg->timestamp; @@ -204,7 +204,7 @@ recv_uc(struct unicast_conn *c, rimeaddr_t *from) printf("unicast message received from %d.%d, latency %lu ms, data '%.*s'\n", from->u8[0], from->u8[1], (1000L * latency) / RTIMER_ARCH_SECOND, - rimebuf_datalen() - COLLECT_MSG_HDRSIZE, + packetbuf_datalen() - COLLECT_MSG_HDRSIZE, msg->data); } static const struct unicast_callbacks unicast_callbacks = {recv_uc}; diff --git a/apps/shell/shell-rime-netcmd.c b/apps/shell/shell-rime-netcmd.c index 82594d7a8..e1f331fa4 100644 --- a/apps/shell/shell-rime-netcmd.c +++ b/apps/shell/shell-rime-netcmd.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-rime-netcmd.c,v 1.5 2008/11/17 22:52:10 oliverschmidt Exp $ + * $Id: shell-rime-netcmd.c,v 1.6 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -112,15 +112,15 @@ PROCESS_THREAD(shell_netcmd_process, ev, data) PROCESS_BEGIN(); len = strlen((char *)data); - if(len > RIMEBUF_SIZE) { + if(len > PACKETBUF_SIZE) { char buf[32]; snprintf(buf, sizeof(buf), "%d", len); shell_output_str(&netcmd_command, "command line too large: ", buf); } else { - rimebuf_clear(); - msg = rimebuf_dataptr(); - rimebuf_set_datalen(len + 2 + TRICKLEMSG_HDR_SIZE); + packetbuf_clear(); + msg = packetbuf_dataptr(); + packetbuf_set_datalen(len + 2 + TRICKLEMSG_HDR_SIZE); strcpy(msg->netcmd, data); msg->crc = crc16_data(msg->netcmd, len, 0); /* printf("netcmd sending '%s'\n", msg->netcmd);*/ @@ -136,14 +136,14 @@ recv_trickle(struct trickle_conn *c) struct trickle_msg *msg; int len; - msg = rimebuf_dataptr(); + msg = packetbuf_dataptr(); - if(rimebuf_datalen() > 2 + TRICKLEMSG_HDR_SIZE) { + if(packetbuf_datalen() > 2 + TRICKLEMSG_HDR_SIZE) { /* First ensure that the old process is killed. */ process_exit(&shell_netcmd_server_process); - len = rimebuf_datalen() - 2 - TRICKLEMSG_HDR_SIZE; + len = packetbuf_datalen() - 2 - TRICKLEMSG_HDR_SIZE; /* Make sure that the incoming command is null-terminated (which is should be already). */ diff --git a/apps/shell/shell-rime-ping.c b/apps/shell/shell-rime-ping.c index 46f029fd9..d291bf83f 100644 --- a/apps/shell/shell-rime-ping.c +++ b/apps/shell/shell-rime-ping.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-rime-ping.c,v 1.6 2009/03/05 23:54:14 adamdunkels Exp $ + * $Id: shell-rime-ping.c,v 1.7 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -86,9 +86,9 @@ PROCESS_THREAD(shell_rime_ping_process, ev, data) shell_output_str(&rime_ping_command, "Sending 4 pings to ", buf); for(i = 0; i < 4; ++i) { - rimebuf_clear(); - ping = rimebuf_dataptr(); - rimebuf_set_datalen(sizeof(struct rime_ping_msg)); + packetbuf_clear(); + ping = packetbuf_dataptr(); + packetbuf_set_datalen(sizeof(struct rime_ping_msg)); #if TIMESYNCH_CONF_ENABLED ping->pingtime = timesynch_time(); #else @@ -128,7 +128,7 @@ recv_mesh(struct mesh_conn *c, rimeaddr_t *from, u8_t hops) char buf[64]; rtimer_clock_t pingrecvtime; - ping = rimebuf_dataptr(); + ping = packetbuf_dataptr(); if(waiting_for_pong == 0) { #if TIMESYNCH_CONF_ENABLED diff --git a/apps/shell/shell-rime-sniff.c b/apps/shell/shell-rime-sniff.c index 80e2f1f22..277ce26da 100644 --- a/apps/shell/shell-rime-sniff.c +++ b/apps/shell/shell-rime-sniff.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-rime-sniff.c,v 1.2 2009/03/02 21:58:16 adamdunkels Exp $ + * $Id: shell-rime-sniff.c,v 1.3 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -79,14 +79,14 @@ sniff_attributes_output(int type) struct sniff_attributes_blob msg; msg.len = 10; msg.type = type; - msg.rssi = rimebuf_attr(RIMEBUF_ATTR_RSSI); - msg.lqi = rimebuf_attr(RIMEBUF_ATTR_LINK_QUALITY); - msg.timestamp = rimebuf_attr(RIMEBUF_ATTR_TIMESTAMP); - msg.listen_time = rimebuf_attr(RIMEBUF_ATTR_LISTEN_TIME); - msg.transmit_time = rimebuf_attr(RIMEBUF_ATTR_TRANSMIT_TIME); - msg.channel = rimebuf_attr(RIMEBUF_ATTR_CHANNEL); - rimeaddr_copy(&msg.src, rimebuf_addr(RIMEBUF_ADDR_SENDER)); - rimeaddr_copy(&msg.dest, rimebuf_addr(RIMEBUF_ADDR_RECEIVER)); + msg.rssi = packetbuf_attr(PACKETBUF_ATTR_RSSI); + msg.lqi = packetbuf_attr(PACKETBUF_ATTR_LINK_QUALITY); + msg.timestamp = packetbuf_attr(PACKETBUF_ATTR_TIMESTAMP); + msg.listen_time = packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME); + msg.transmit_time = packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME); + msg.channel = packetbuf_attr(PACKETBUF_ATTR_CHANNEL); + rimeaddr_copy(&msg.src, packetbuf_addr(PACKETBUF_ADDR_SENDER)); + rimeaddr_copy(&msg.dest, packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); shell_output(&sniff_command, &msg, sizeof(msg), NULL, 0); } @@ -96,11 +96,11 @@ sniff_packet_output(int type) { struct sniff_packet_blob msg; - msg.len = rimebuf_totlen() / 2 + 1; + msg.len = packetbuf_totlen() / 2 + 1; msg.type = type; shell_output(&sniff_command, &msg, sizeof(msg), - rimebuf_dataptr(), (rimebuf_datalen() & 0xfffe) + - 2 * (rimebuf_totlen() & 1)); + packetbuf_dataptr(), (packetbuf_datalen() & 0xfffe) + + 2 * (packetbuf_totlen() & 1)); } /*---------------------------------------------------------------------------*/ static void diff --git a/apps/shell/shell-rime.c b/apps/shell/shell-rime.c index a599363cd..ef6d5255b 100644 --- a/apps/shell/shell-rime.c +++ b/apps/shell/shell-rime.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-rime.c,v 1.12 2009/02/11 11:08:53 adamdunkels Exp $ + * $Id: shell-rime.c,v 1.13 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -183,8 +183,8 @@ PROCESS_THREAD(shell_packetize_process, ev, data) PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input); if(q == NULL) { - rimebuf_clear(); - q = queuebuf_new_from_rimebuf(); + packetbuf_clear(); + q = queuebuf_new_from_packetbuf(); if(q == NULL) { shell_output_str(&packetize_command, "packetize: could not allocate packet buffer", ""); PROCESS_EXIT(); @@ -197,7 +197,7 @@ PROCESS_THREAD(shell_packetize_process, ev, data) len = input->len1 + input->len2; - if(len + size >= RIMEBUF_SIZE || + if(len + size >= PACKETBUF_SIZE || len == 0) { shell_output(&packetize_command, ptr, size, @@ -296,9 +296,9 @@ PROCESS_THREAD(shell_nodes_process, ev, data) is_sink = 1; } - rimebuf_clear(); - msg = rimebuf_dataptr(); - rimebuf_set_datalen(sizeof(struct netflood_msg)); + packetbuf_clear(); + msg = packetbuf_dataptr(); + packetbuf_set_datalen(sizeof(struct netflood_msg)); msg->type = NETFLOOD_TYPE_NODES; netflood_send(&netflood, nodes_seqno++); @@ -369,10 +369,10 @@ PROCESS_THREAD(shell_send_process, ev, data) PROCESS_EXIT(); } - if(len < RIMEBUF_SIZE) { - rimebuf_clear(); - rimebuf_set_datalen(len + COLLECT_MSG_HDRSIZE); - msg = rimebuf_dataptr(); + if(len < PACKETBUF_SIZE) { + packetbuf_clear(); + packetbuf_set_datalen(len + COLLECT_MSG_HDRSIZE); + msg = packetbuf_dataptr(); memcpy(msg->data, input->data1, input->len1); memcpy(msg->data + input->len1, input->data2, input->len2); #if TIMESYNCH_CONF_ENABLED @@ -395,7 +395,7 @@ recv_collect(const rimeaddr_t *originator, u8_t seqno, u8_t hops) rtimer_clock_t latency; int len; - collect_msg = rimebuf_dataptr(); + collect_msg = packetbuf_dataptr(); #if TIMESYNCH_CONF_ENABLED latency = timesynch_time() - collect_msg->timestamp; @@ -412,20 +412,20 @@ recv_collect(const rimeaddr_t *originator, u8_t seqno, u8_t hops) uint16_t latency; } msg; - if(rimebuf_datalen() >= COLLECT_MSG_HDRSIZE) { - len = rimebuf_datalen() - COLLECT_MSG_HDRSIZE; + if(packetbuf_datalen() >= COLLECT_MSG_HDRSIZE) { + len = packetbuf_datalen() - COLLECT_MSG_HDRSIZE; if(collect_msg->crc == crc16_data(collect_msg->data, len, 0)) { - msg.len = 5 + (rimebuf_datalen() - COLLECT_MSG_HDRSIZE) / 2; + msg.len = 5 + (packetbuf_datalen() - COLLECT_MSG_HDRSIZE) / 2; rimeaddr_copy((rimeaddr_t *)&msg.originator, originator); msg.seqno = seqno; msg.hops = hops; msg.latency = latency; - /* printf("recv_collect datalen %d\n", rimebuf_datalen());*/ + /* printf("recv_collect datalen %d\n", packetbuf_datalen());*/ shell_output(&collect_command, &msg, sizeof(msg), - collect_msg->data, rimebuf_datalen() - COLLECT_MSG_HDRSIZE); + collect_msg->data, packetbuf_datalen() - COLLECT_MSG_HDRSIZE); } } } else if(waiting_for_nodes) { @@ -449,7 +449,7 @@ send_collect(void *dummy) #else msg.timestamp = 0; #endif - rimebuf_copyfrom(&msg, COLLECT_MSG_HDRSIZE); + packetbuf_copyfrom(&msg, COLLECT_MSG_HDRSIZE); collect_send(&collect, COLLECT_REXMITS); } /*---------------------------------------------------------------------------*/ @@ -459,7 +459,7 @@ recv_netflood(struct netflood_conn *c, rimeaddr_t *from, { struct netflood_msg *msg; - msg = rimebuf_dataptr(); + msg = packetbuf_dataptr(); if(msg->type == NETFLOOD_TYPE_NODES) { ctimer_set(&ctimer, random_rand() % (CLOCK_SECOND * 8), send_collect, NULL); diff --git a/apps/shell/shell-rsh.c b/apps/shell/shell-rsh.c index 837c76184..946ec4145 100644 --- a/apps/shell/shell-rsh.c +++ b/apps/shell/shell-rsh.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-rsh.c,v 1.2 2008/11/09 10:53:25 adamdunkels Exp $ + * $Id: shell-rsh.c,v 1.3 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -96,14 +96,14 @@ PROCESS_THREAD(shell_rsh_process, ev, data) meshconn_close_connection(&meshconn); PROCESS_EXIT(); } - if(input->len1 + input->len2 >= RIMEBUF_SIZE) { + if(input->len1 + input->len2 >= PACKETBUF_SIZE) { shell_output_str(&rsh_command, "rsh: input too long", ""); } else { - rimebuf_clear(); - memcpy(rimebuf_dataptr(), input->data1, input->len1); - memcpy((char *)rimebuf_dataptr() + input->len1, + packetbuf_clear(); + memcpy(packetbuf_dataptr(), input->data1, input->len1); + memcpy((char *)packetbuf_dataptr() + input->len1, input->data2, input->len2); - rimebuf_set_datalen(input->len1 + input->len2); + packetbuf_set_datalen(input->len1 + input->len2); meshconn_send(&meshconn); } } @@ -125,11 +125,11 @@ PROCESS_THREAD(shell_rsh_server_process, ev, data) } else if(ev == shell_event_input) { struct shell_input *input; input = data; - rimebuf_clear(); - memcpy(rimebuf_dataptr(), input->data1, input->len1); - memcpy((char *)rimebuf_dataptr() + input->len1, + packetbuf_clear(); + memcpy(packetbuf_dataptr(), input->data1, input->len1); + memcpy((char *)packetbuf_dataptr() + input->len1, input->data2, input->len2); - rimebuf_set_datalen(input->len1 + input->len2); + packetbuf_set_datalen(input->len1 + input->len2); /* printf("Sending meshconn with %d + %d bytes\n", input->len1, input->len2);*/ meshconn_send(&meshconn); @@ -150,10 +150,10 @@ recv_meshconn(struct meshconn_conn *c) /* int ret; struct process *started_process;*/ - /* printf("got '%.*s'\n", rimebuf_datalen(), (char *)rimebuf_dataptr());*/ + /* printf("got '%.*s'\n", packetbuf_datalen(), (char *)packetbuf_dataptr());*/ /* Echo reply */ if(!initiator) { - rimebuf_copyfrom("abcdefghijklmnopq", 18); + packetbuf_copyfrom("abcdefghijklmnopq", 18); meshconn_send(c); } @@ -162,14 +162,14 @@ recv_meshconn(struct meshconn_conn *c) if(front_process != NULL && process_is_running(front_process)) { struct shell_input input; - input.data1 = rimebuf_dataptr(); - input.len1 = rimebuf_datalen(); + input.data1 = packetbuf_dataptr(); + input.len1 = packetbuf_datalen(); input.data2 = ""; input.len2 = 0; process_post_synch(front_process, shell_event_input, &input); } else { - ret = shell_start_command(rimebuf_dataptr(), rimebuf_datalen(), + ret = shell_start_command(packetbuf_dataptr(), packetbuf_datalen(), &rsh_server_command, &started_process); if(started_process != NULL && @@ -178,8 +178,8 @@ recv_meshconn(struct meshconn_conn *c) front_process = started_process; } } - /* shell_input(rimebuf_dataptr(), rimebuf_datalen());*/ - /* shell_output(&rsh_command, rimebuf_dataptr(), rimebuf_datalen(), "", 0);*/ + /* shell_input(packetbuf_dataptr(), packetbuf_datalen());*/ + /* shell_output(&rsh_command, packetbuf_dataptr(), packetbuf_datalen(), "", 0);*/ #endif } static void diff --git a/core/dev/cc2420.c b/core/dev/cc2420.c index 9a0f0ed29..2b16213ed 100644 --- a/core/dev/cc2420.c +++ b/core/dev/cc2420.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: cc2420.c,v 1.28 2009/03/11 20:38:53 adamdunkels Exp $ + * @(#)$Id: cc2420.c,v 1.29 2009/03/12 21:58:20 adamdunkels Exp $ */ /* * This code is almost device independent and should be easy to port. @@ -50,7 +50,7 @@ #include "dev/cc2420.h" #include "dev/cc2420_const.h" -#include "net/rime/rimebuf.h" +#include "net/rime/packetbuf.h" #include "net/rime/rimestats.h" #include "sys/timetable.h" @@ -318,8 +318,8 @@ cc2420_send(const void *payload, unsigned short payload_len) GET_LOCK(); - if(rimebuf_attr(RIMEBUF_ATTR_RADIO_TXPOWER) > 0) { - cc2420_set_txpower(rimebuf_attr(RIMEBUF_ATTR_RADIO_TXPOWER) - 1); + if(packetbuf_attr(PACKETBUF_ATTR_RADIO_TXPOWER) > 0) { + cc2420_set_txpower(packetbuf_attr(PACKETBUF_ATTR_RADIO_TXPOWER) - 1); } else { cc2420_set_txpower(CC2420_TXPOWER_MAX); } @@ -646,8 +646,8 @@ cc2420_read(void *buf, unsigned short bufsize) cc2420_last_correlation = footer[1] & FOOTER1_CORRELATION; - rimebuf_set_attr(RIMEBUF_ATTR_RSSI, cc2420_last_rssi); - rimebuf_set_attr(RIMEBUF_ATTR_LINK_QUALITY, cc2420_last_correlation); + packetbuf_set_attr(PACKETBUF_ATTR_RSSI, cc2420_last_rssi); + packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, cc2420_last_correlation); RIMESTATS_ADD(llrx); @@ -659,7 +659,7 @@ cc2420_read(void *buf, unsigned short bufsize) cc2420_authority_level_of_sender = t.authority_level; - rimebuf_set_attr(RIMEBUF_ATTR_TIMESTAMP, t.time); + packetbuf_set_attr(PACKETBUF_ATTR_TIMESTAMP, t.time); #endif /* CC2420_CONF_TIMESTAMPS */ } else { diff --git a/core/net/mac/ctdma_mac.c b/core/net/mac/ctdma_mac.c index c5283f58c..5d0446707 100644 --- a/core/net/mac/ctdma_mac.c +++ b/core/net/mac/ctdma_mac.c @@ -28,12 +28,12 @@ * * This file is part of the Contiki operating system. * - * $Id: ctdma_mac.c,v 1.2 2008/02/24 22:10:30 adamdunkels Exp $ + * $Id: ctdma_mac.c,v 1.3 2009/03/12 21:58:20 adamdunkels Exp $ */ #include "contiki.h" #include "net/mac/ctdma_mac.h" -#include "net/rime/rimebuf.h" +#include "net/rime/packetbuf.h" #include "net/uip-fw.h" #include "net/rime/ctimer.h" #include "net/rime.h" @@ -165,7 +165,7 @@ send(void) } /* Allocate queue buf for packet */ - data[freeslot] = queuebuf_new_from_rimebuf(); + data[freeslot] = queuebuf_new_from_packetbuf(); id[freeslot] = id_counter; if (data[freeslot] == NULL) { @@ -196,9 +196,9 @@ static int read(void) { int len; - rimebuf_clear(); - len = radio->read(rimebuf_dataptr(), RIMEBUF_SIZE); - rimebuf_set_datalen(len); + packetbuf_clear(); + len = radio->read(packetbuf_dataptr(), PACKETBUF_SIZE); + packetbuf_set_datalen(len); return len; } /*---------------------------------------------------------------------------*/ diff --git a/core/net/mac/cxmac.c b/core/net/mac/cxmac.c index 401916df9..66458b02a 100644 --- a/core/net/mac/cxmac.c +++ b/core/net/mac/cxmac.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: cxmac.c,v 1.2 2008/02/24 22:10:30 adamdunkels Exp $ + * $Id: cxmac.c,v 1.3 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -251,19 +251,19 @@ send(void) /* printf("xmac_send\n");*/ #if !CHAMELEON - PRINTF("xmac: send() len %d to %d.%d\n", rimebuf_totlen(), + PRINTF("xmac: send() len %d to %d.%d\n", packetbuf_totlen(), uc_receiver.u8[0], uc_receiver.u8[1]); #endif - rimebuf_hdralloc(sizeof(struct xmac_hdr)); - hdr = rimebuf_hdrptr(); + packetbuf_hdralloc(sizeof(struct xmac_hdr)); + hdr = packetbuf_hdrptr(); rimeaddr_copy(&hdr->sender, &rimeaddr_node_addr); #if CHAMELEON rimeaddr_copy(&hdr->receiver, packattr_aget(PACKATTR_RECEIVER)); #else rimeaddr_copy(&hdr->receiver, &uc_receiver); #endif - rimebuf_compact(); + packetbuf_compact(); /* should_be_awake = 1; while(!radio_is_on) {}*/ @@ -325,7 +325,7 @@ send(void) } while(clock_time() < t0 + OFF_TIME + ON_TIME); /* } while(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + OFF_TIME + ON_TIME * 2));*/ - radio->send(rimebuf_hdrptr(), rimebuf_totlen()); + radio->send(packetbuf_hdrptr(), packetbuf_totlen()); /* printf("xmac send time %d\n", (rtimer_clock_t)(RTIMER_NOW() - t0)); if((rtimer_clock_t)(RTIMER_NOW() - t0) > 10000) { @@ -360,7 +360,7 @@ qsend(void) return 0; } else { #if WITH_QUEUE - queued_packet = queuebuf_new_from_rimebuf(); + queued_packet = queuebuf_new_from_packetbuf(); return 1; #else RIMESTATS_ADD(contentiondrop); @@ -377,7 +377,7 @@ qsend(void) static void send_queued(void *ptr) { - queuebuf_to_rimebuf(queued_packet); + queuebuf_to_packetbuf(queued_packet); queuebuf_free(queued_packet); queued_packet = NULL; qsend(); @@ -405,10 +405,10 @@ read(void) struct xmac_hdr *hdr; uint8_t len; - rimebuf_clear(); + packetbuf_clear(); PRINTF("xmac: input "); - len = radio->read(rimebuf_dataptr(), RIMEBUF_SIZE); + len = radio->read(packetbuf_dataptr(), PACKETBUF_SIZE); PRINTF("%d bytes at %d.%d\n", len, rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]); @@ -417,16 +417,16 @@ read(void) ctimer_set(&ctimer, (OFF_TIME * 2), reset_state, NULL); - rimebuf_set_datalen(len); - hdr = rimebuf_dataptr(); + packetbuf_set_datalen(len); + hdr = packetbuf_dataptr(); - rimebuf_hdrreduce(sizeof(struct xmac_hdr)); + packetbuf_hdrreduce(sizeof(struct xmac_hdr)); if(rimeaddr_cmp(&hdr->receiver, &rimeaddr_node_addr)) { should_be_awake = 1; PRINTF("xmac: for us\n"); if(!rimeaddr_cmp(&hdr->sender, &rimeaddr_node_addr) && - rimebuf_totlen() == 0) { + packetbuf_totlen() == 0) { /* XXX Send an ACK and wait for packet . */ PRINTF("xmac: got sender %d.%d receiver %d.%d\n", hdr->sender.u8[0],hdr->sender.u8[1], @@ -460,7 +460,7 @@ read(void) /* PRINTF("xmac: not for us\n");*/ } - if(rimebuf_totlen() > 0) { + if(packetbuf_totlen() > 0) { /* We have received the final packet, so we can go back to being asleep. */ @@ -475,7 +475,7 @@ read(void) } #endif - return rimebuf_totlen(); + return packetbuf_totlen(); } } return 0; diff --git a/core/net/mac/lpp.c b/core/net/mac/lpp.c index c4c4bd758..9373ce766 100644 --- a/core/net/mac/lpp.c +++ b/core/net/mac/lpp.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: lpp.c,v 1.9 2009/02/20 21:22:39 adamdunkels Exp $ + * $Id: lpp.c,v 1.10 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -55,7 +55,7 @@ #include "net/rime.h" #include "net/mac/mac.h" #include "net/mac/lpp.h" -#include "net/rime/rimebuf.h" +#include "net/rime/packetbuf.h" #include "net/rime/announcement.h" #include @@ -147,12 +147,12 @@ send_probe(void) struct announcement *a; /* Set up the probe header. */ - rimebuf_clear(); - rimebuf_set_datalen(sizeof(struct lpp_hdr)); - hdr = rimebuf_dataptr(); + packetbuf_clear(); + packetbuf_set_datalen(sizeof(struct lpp_hdr)); + hdr = packetbuf_dataptr(); hdr->type = TYPE_PROBE; rimeaddr_copy(&hdr->sender, &rimeaddr_node_addr); - rimeaddr_copy(&hdr->receiver, rimebuf_addr(RIMEBUF_ADDR_RECEIVER)); + rimeaddr_copy(&hdr->receiver, packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); /* Construct the announcements */ @@ -165,12 +165,12 @@ send_probe(void) adata->num++; } - rimebuf_set_datalen(sizeof(struct lpp_hdr) + + packetbuf_set_datalen(sizeof(struct lpp_hdr) + ANNOUNCEMENT_MSG_HEADERLEN + sizeof(struct announcement_data) * adata->num); /* PRINTF("Sending probe\n");*/ - radio->send(rimebuf_hdrptr(), rimebuf_totlen()); + radio->send(packetbuf_hdrptr(), packetbuf_totlen()); } /*---------------------------------------------------------------------------*/ /** @@ -237,24 +237,24 @@ send_packet(void) { struct lpp_hdr *hdr; - rimebuf_hdralloc(sizeof(struct lpp_hdr)); - hdr = rimebuf_hdrptr(); + packetbuf_hdralloc(sizeof(struct lpp_hdr)); + hdr = packetbuf_hdrptr(); rimeaddr_copy(&hdr->sender, &rimeaddr_node_addr); - rimeaddr_copy(&hdr->receiver, rimebuf_addr(RIMEBUF_ADDR_RECEIVER)); + rimeaddr_copy(&hdr->receiver, packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); hdr->type = TYPE_DATA; - rimebuf_compact(); + packetbuf_compact(); PRINTF("%d.%d: queueing packet to %d.%d, channel %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], hdr->receiver.u8[0], hdr->receiver.u8[1], - rimebuf_attr(RIMEBUF_ATTR_CHANNEL)); + packetbuf_attr(PACKETBUF_ATTR_CHANNEL)); - if(rimebuf_attr(RIMEBUF_ATTR_PACKET_TYPE) == RIMEBUF_ATTR_PACKET_TYPE_ACK) { + if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == PACKETBUF_ATTR_PACKET_TYPE_ACK) { /* Immediately send ACKs - we're assuming that the other node is listening. */ /* printf("Immediately sending ACK\n");*/ - return radio->send(rimebuf_hdrptr(), rimebuf_totlen()); + return radio->send(packetbuf_hdrptr(), packetbuf_totlen()); } else { /* If a packet is already queued, the DUMP_QUEUED_PACKET option @@ -265,10 +265,10 @@ send_packet(void) if(queued_packet != NULL) { remove_queued_packet(); } - queued_packet = queuebuf_new_from_rimebuf(); + queued_packet = queuebuf_new_from_packetbuf(); #else /* DUMP_QUEUED_PACKET */ if(queued_packet == NULL) { - queued_packet = queuebuf_new_from_rimebuf(); + queued_packet = queuebuf_new_from_packetbuf(); } #endif /* DUMP_QUEUED_PACKET */ @@ -291,16 +291,16 @@ read_packet(void) int len; struct lpp_hdr *hdr, *qhdr; - rimebuf_clear(); - len = radio->read(rimebuf_dataptr(), RIMEBUF_SIZE); + packetbuf_clear(); + len = radio->read(packetbuf_dataptr(), PACKETBUF_SIZE); if(len > 0) { - rimebuf_set_datalen(len); - hdr = rimebuf_dataptr(); - rimebuf_hdrreduce(sizeof(struct lpp_hdr)); + packetbuf_set_datalen(len); + hdr = packetbuf_dataptr(); + packetbuf_hdrreduce(sizeof(struct lpp_hdr)); /* PRINTF("got packet type %d\n", hdr->type);*/ if(hdr->type == TYPE_PROBE) { /* Parse incoming announcements */ - struct announcement_msg *adata = rimebuf_dataptr(); + struct announcement_msg *adata = packetbuf_dataptr(); int i; /* PRINTF("%d.%d: probe from %d.%d with %d announcements\n", @@ -355,7 +355,7 @@ read_packet(void) rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], hdr->sender.u8[0], hdr->sender.u8[1]); } - len = rimebuf_datalen(); + len = packetbuf_datalen(); } return len; } diff --git a/core/net/mac/nullmac.c b/core/net/mac/nullmac.c index 0554c1e26..95a8cbe88 100644 --- a/core/net/mac/nullmac.c +++ b/core/net/mac/nullmac.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: nullmac.c,v 1.8 2008/06/30 08:09:17 adamdunkels Exp $ + * $Id: nullmac.c,v 1.9 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -39,7 +39,7 @@ */ #include "net/mac/nullmac.h" -#include "net/rime/rimebuf.h" +#include "net/rime/packetbuf.h" static const struct radio_driver *radio; static void (* receiver_callback)(const struct mac_driver *); @@ -47,7 +47,7 @@ static void (* receiver_callback)(const struct mac_driver *); static int send_packet(void) { - return radio->send(rimebuf_hdrptr(), rimebuf_totlen()); + return radio->send(packetbuf_hdrptr(), packetbuf_totlen()); } /*---------------------------------------------------------------------------*/ static void @@ -62,9 +62,9 @@ static int read_packet(void) { int len; - rimebuf_clear(); - len = radio->read(rimebuf_dataptr(), RIMEBUF_SIZE); - rimebuf_set_datalen(len); + packetbuf_clear(); + len = radio->read(packetbuf_dataptr(), PACKETBUF_SIZE); + packetbuf_set_datalen(len); return len; } /*---------------------------------------------------------------------------*/ diff --git a/core/net/mac/tdma_mac.c b/core/net/mac/tdma_mac.c index 307afe40c..71e648c79 100644 --- a/core/net/mac/tdma_mac.c +++ b/core/net/mac/tdma_mac.c @@ -28,12 +28,12 @@ * * This file is part of the Contiki operating system. * - * $Id: tdma_mac.c,v 1.5 2008/11/12 12:42:41 fros4943 Exp $ + * $Id: tdma_mac.c,v 1.6 2009/03/12 21:58:20 adamdunkels Exp $ */ #include "contiki.h" #include "net/mac/tdma_mac.h" -#include "net/rime/rimebuf.h" +#include "net/rime/packetbuf.h" #include "net/uip-fw.h" #include "sys/rtimer.h" #include "net/rime.h" @@ -168,7 +168,7 @@ send(void) } /* Allocate queue buf for packet */ - data[freeslot] = queuebuf_new_from_rimebuf(); + data[freeslot] = queuebuf_new_from_packetbuf(); id[freeslot] = id_counter; if(data[freeslot] == NULL) { PRINTF("BUFFER Queuebuffer full, dropping packet #%i\n", id[freeslot]); @@ -202,9 +202,9 @@ static int read(void) { int len; - rimebuf_clear(); - len = radio->read(rimebuf_dataptr(), RIMEBUF_SIZE); - rimebuf_set_datalen(len); + packetbuf_clear(); + len = radio->read(packetbuf_dataptr(), PACKETBUF_SIZE); + packetbuf_set_datalen(len); return len; } /*---------------------------------------------------------------------------*/ diff --git a/core/net/mac/xmac.c b/core/net/mac/xmac.c index 5cb3f90b1..c704607c3 100644 --- a/core/net/mac/xmac.c +++ b/core/net/mac/xmac.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: xmac.c,v 1.27 2009/03/05 19:37:52 adamdunkels Exp $ + * $Id: xmac.c,v 1.28 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -304,7 +304,7 @@ static int parse_announcements(rimeaddr_t *from) { /* Parse incoming announcements */ - struct announcement_msg *adata = rimebuf_dataptr(); + struct announcement_msg *adata = packetbuf_dataptr(); int i; PRINTF("%d.%d: probe from %d.%d with %d announcements\n", @@ -398,16 +398,16 @@ send_packet(void) alignment of the header in the packet buffer. */ hdr.type = TYPE_DATA; rimeaddr_copy(&hdr.sender, &rimeaddr_node_addr); - rimeaddr_copy(&hdr.receiver, rimebuf_addr(RIMEBUF_ADDR_RECEIVER)); + rimeaddr_copy(&hdr.receiver, packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); if(rimeaddr_cmp(&hdr.receiver, &rimeaddr_null)) { is_broadcast = 1; } /* Copy the X-MAC header to the header portion of the packet buffer. */ - rimebuf_hdralloc(sizeof(struct xmac_hdr)); - memcpy(rimebuf_hdrptr(), &hdr, sizeof(struct xmac_hdr)); - rimebuf_compact(); + packetbuf_hdralloc(sizeof(struct xmac_hdr)); + memcpy(packetbuf_hdrptr(), &hdr, sizeof(struct xmac_hdr)); + packetbuf_compact(); t0 = RTIMER_NOW(); strobes = 0; @@ -431,7 +431,7 @@ send_packet(void) t = RTIMER_NOW(); strobe.hdr.type = TYPE_STROBE; rimeaddr_copy(&strobe.hdr.sender, &rimeaddr_node_addr); - rimeaddr_copy(&strobe.hdr.receiver, rimebuf_addr(RIMEBUF_ADDR_RECEIVER)); + rimeaddr_copy(&strobe.hdr.receiver, packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); #if WITH_TIMETABLE if(rimeaddr_cmp(&strobe.hdr.receiver, &rimeaddr_null)) { @@ -476,8 +476,8 @@ send_packet(void) /* If we have received the strobe ACK, and we are sending a packet that will need an upper layer ACK (as signified by the - RIMEBUF_ATTR_RELIABLE packet attribute), we keep the radio on. */ - if(got_strobe_ack && rimebuf_attr(RIMEBUF_ATTR_RELIABLE)) { + PACKETBUF_ATTR_RELIABLE packet attribute), we keep the radio on. */ + if(got_strobe_ack && packetbuf_attr(PACKETBUF_ATTR_RELIABLE)) { #if WITH_TIMETABLE TIMETABLE_TIMESTAMP(xmac_timetable, "send got ack"); #endif @@ -501,13 +501,13 @@ send_packet(void) #if WITH_TIMETABLE TIMETABLE_TIMESTAMP(xmac_timetable, "send packet"); #endif - radio->send(rimebuf_hdrptr(), rimebuf_totlen()); + radio->send(packetbuf_hdrptr(), packetbuf_totlen()); CPRINTF("#"); } watchdog_start(); PRINTF("xmac: send (strobes=%u,len=%u,%s), done\n", strobes, - rimebuf_totlen(), got_strobe_ack ? "ack" : "no ack"); + packetbuf_totlen(), got_strobe_ack ? "ack" : "no ack"); #if XMAC_CONF_COMPOWER /* Accumulate the power consumption for the packet transmission. */ @@ -545,7 +545,7 @@ qsend_packet(void) return 0; } else { #if WITH_QUEUE - queued_packet = queuebuf_new_from_rimebuf(); + queued_packet = queuebuf_new_from_packetbuf(); return 1; #else RIMESTATS_ADD(sendingdrop); @@ -573,15 +573,15 @@ read_packet(void) struct xmac_hdr *hdr; uint8_t len; - rimebuf_clear(); + packetbuf_clear(); - len = radio->read(rimebuf_dataptr(), RIMEBUF_SIZE); + len = radio->read(packetbuf_dataptr(), PACKETBUF_SIZE); if(len > 0) { - rimebuf_set_datalen(len); - hdr = rimebuf_dataptr(); + packetbuf_set_datalen(len); + hdr = packetbuf_dataptr(); - rimebuf_hdrreduce(sizeof(struct xmac_hdr)); + packetbuf_hdrreduce(sizeof(struct xmac_hdr)); if(hdr->type == TYPE_STROBE) { CPRINTF("."); @@ -626,7 +626,7 @@ read_packet(void) } /* Check for annoucements in the strobe */ - /* if(rimebuf_datalen() > 0) { + /* if(packetbuf_datalen() > 0) { parse_announcements(&hdr->sender); }*/ /* We are done processing the strobe and we therefore return @@ -669,7 +669,7 @@ read_packet(void) queued_packet = NULL; } - return rimebuf_totlen(); + return packetbuf_totlen(); } #if XMAC_CONF_ANNOUNCEMENTS } else if(hdr->type == TYPE_ANNOUNCEMENT) { @@ -688,9 +688,9 @@ send_announcement(void *ptr) int announcement_len; /* Set up the probe header. */ - rimebuf_clear(); - rimebuf_set_datalen(sizeof(struct xmac_hdr)); - hdr = rimebuf_dataptr(); + packetbuf_clear(); + packetbuf_set_datalen(sizeof(struct xmac_hdr)); + hdr = packetbuf_dataptr(); hdr->type = TYPE_ANNOUNCEMENT; rimeaddr_copy(&hdr->sender, &rimeaddr_node_addr); rimeaddr_copy(&hdr->receiver, &rimeaddr_null); @@ -698,10 +698,10 @@ send_announcement(void *ptr) announcement_len = format_announcement((char *)hdr + sizeof(struct xmac_hdr)); - rimebuf_set_datalen(sizeof(struct xmac_hdr) + announcement_len); + packetbuf_set_datalen(sizeof(struct xmac_hdr) + announcement_len); /* PRINTF("Sending probe\n");*/ - radio->send(rimebuf_hdrptr(), rimebuf_totlen()); + radio->send(packetbuf_hdrptr(), packetbuf_totlen()); } /*---------------------------------------------------------------------------*/ static void diff --git a/core/net/rime.h b/core/net/rime.h index 76e323088..d91b4e0be 100644 --- a/core/net/rime.h +++ b/core/net/rime.h @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rime.h,v 1.21 2009/02/09 21:09:42 adamdunkels Exp $ + * $Id: rime.h,v 1.22 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -59,7 +59,7 @@ #include "net/rime/polite.h" #include "net/rime/queuebuf.h" #include "net/rime/rimeaddr.h" -#include "net/rime/rimebuf.h" +#include "net/rime/packetbuf.h" #include "net/rime/rimestats.h" #include "net/rime/rmh.h" #include "net/rime/route-discovery.h" @@ -83,8 +83,8 @@ void rime_init(const struct mac_driver *); * * This function should be called by the network driver to * hand over a packet to Rime for furhter processing. The - * packet should be placed in the rimebuf (with - * rimebuf_copyfrom()) before calling this function. + * packet should be placed in the packetbuf (with + * packetbuf_copyfrom()) before calling this function. * */ void rime_input(void); @@ -94,10 +94,10 @@ void rime_input(void); * * This function must be implemented by the driver running * below Rime. It is called by abRime to send out a - * packet. The packet is consecutive in the rimebuf. A + * packet. The packet is consecutive in the packetbuf. A * pointer to the first byte of the packet is obtained - * with the rimebuf_hdrptr() function. The length of the - * packet to send is obtained with the rimebuf_totlen() + * with the packetbuf_hdrptr() function. The length of the + * packet to send is obtained with the packetbuf_totlen() * function. * * The driver, which typically is a MAC protocol, may diff --git a/core/net/rime/Makefile.rime b/core/net/rime/Makefile.rime index 1ca784600..0102b03e5 100644 --- a/core/net/rime/Makefile.rime +++ b/core/net/rime/Makefile.rime @@ -1,5 +1,5 @@ RIME_CHAMELEON = chameleon.c channel.c chameleon-raw.c chameleon-bitopt.c -RIME_BASE = rimebuf.c queuebuf.c rimeaddr.c ctimer.c rime.c timesynch.c \ +RIME_BASE = packetbuf.c queuebuf.c rimeaddr.c ctimer.c rime.c timesynch.c \ rimestats.c announcement.c polite-announcement.c RIME_SINGLEHOP = broadcast.c stbroadcast.c unicast.c stunicast.c \ runicast.c abc.c \ diff --git a/core/net/rime/abc.c b/core/net/rime/abc.c index 6ccd22988..6ff8df2b2 100644 --- a/core/net/rime/abc.c +++ b/core/net/rime/abc.c @@ -36,7 +36,7 @@ * * Author: Adam Dunkels * - * $Id: abc.c,v 1.18 2008/02/25 02:14:34 adamdunkels Exp $ + * $Id: abc.c,v 1.19 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -58,8 +58,8 @@ #define PRINTF(...) #endif -static const struct rimebuf_attrlist attributes[] = - { ABC_ATTRIBUTES RIMEBUF_ATTR_LAST }; +static const struct packetbuf_attrlist attributes[] = + { ABC_ATTRIBUTES PACKETBUF_ATTR_LAST }; /*---------------------------------------------------------------------------*/ void diff --git a/core/net/rime/abc.h b/core/net/rime/abc.h index 8c9d35592..63294e3a7 100644 --- a/core/net/rime/abc.h +++ b/core/net/rime/abc.h @@ -46,7 +46,7 @@ * * This file is part of the Contiki operating system. * - * $Id: abc.h,v 1.14 2008/02/25 02:14:34 adamdunkels Exp $ + * $Id: abc.h,v 1.15 2009/03/12 21:58:20 adamdunkels Exp $ */ /** * \file @@ -58,7 +58,7 @@ #ifndef __ABC_H__ #define __ABC_H__ -#include "net/rime/rimebuf.h" +#include "net/rime/packetbuf.h" #include "net/rime/channel.h" struct abc_conn; @@ -116,7 +116,7 @@ void abc_close(struct abc_conn *c); * \retval Non-zero if the packet could be sent, zero otherwise * * This function sends an anonymous best-effort broadcast - * packet. The packet must be present in the rimebuf + * packet. The packet must be present in the packetbuf * before this function is called. * * The parameter c must point to an abc connection that diff --git a/core/net/rime/broadcast.c b/core/net/rime/broadcast.c index 4bd0c055d..0cf00def1 100644 --- a/core/net/rime/broadcast.c +++ b/core/net/rime/broadcast.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: broadcast.c,v 1.1 2008/06/26 11:19:22 adamdunkels Exp $ + * $Id: broadcast.c,v 1.2 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -46,9 +46,9 @@ #include "contiki-net.h" #include -static const struct rimebuf_attrlist attributes[] = +static const struct packetbuf_attrlist attributes[] = { - BROADCAST_ATTRIBUTES RIMEBUF_ATTR_LAST + BROADCAST_ATTRIBUTES PACKETBUF_ATTR_LAST }; #define DEBUG 0 @@ -66,7 +66,7 @@ recv_from_abc(struct abc_conn *bc) rimeaddr_t sender; struct broadcast_conn *c = (struct broadcast_conn *)bc; - rimeaddr_copy(&sender, rimebuf_addr(RIMEBUF_ADDR_SENDER)); + rimeaddr_copy(&sender, packetbuf_addr(PACKETBUF_ADDR_SENDER)); PRINTF("%d.%d: broadcast: from %d.%d\n", rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1], @@ -96,7 +96,7 @@ broadcast_send(struct broadcast_conn *c) { PRINTF("%d.%d: broadcast_send\n", rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]); - rimebuf_set_addr(RIMEBUF_ADDR_SENDER, &rimeaddr_node_addr); + packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr); return abc_send(&c->c); } /*---------------------------------------------------------------------------*/ diff --git a/core/net/rime/broadcast.h b/core/net/rime/broadcast.h index 1d01191f2..9b99392dc 100644 --- a/core/net/rime/broadcast.h +++ b/core/net/rime/broadcast.h @@ -53,7 +53,7 @@ * * This file is part of the Contiki operating system. * - * $Id: broadcast.h,v 1.2 2009/03/07 11:15:46 adamdunkels Exp $ + * $Id: broadcast.h,v 1.3 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -71,7 +71,7 @@ struct broadcast_conn; -#define BROADCAST_ATTRIBUTES { RIMEBUF_ADDR_SENDER, RIMEBUF_ADDRSIZE }, \ +#define BROADCAST_ATTRIBUTES { PACKETBUF_ADDR_SENDER, PACKETBUF_ADDRSIZE }, \ ABC_ATTRIBUTES /** @@ -125,7 +125,7 @@ void broadcast_close(struct broadcast_conn *c); * \retval Non-zero if the packet could be sent, zero otherwise * * This function sends an identified best-effort broadcast - * packet. The packet must be present in the rimebuf + * packet. The packet must be present in the packetbuf * before this function is called. * * The parameter c must point to a broadcast connection that diff --git a/core/net/rime/chameleon-bitopt.c b/core/net/rime/chameleon-bitopt.c index 486b01212..9a17fa19d 100644 --- a/core/net/rime/chameleon-bitopt.c +++ b/core/net/rime/chameleon-bitopt.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: chameleon-bitopt.c,v 1.6 2009/02/10 23:49:58 adamdunkels Exp $ + * $Id: chameleon-bitopt.c,v 1.7 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -110,7 +110,7 @@ get_bits(uint8_t *to, uint8_t *from, int bitpos, int vallen) } /*---------------------------------------------------------------------------*/ static int -header_size(const struct rimebuf_attrlist *a) +header_size(const struct packetbuf_attrlist *a) { int size, len; @@ -118,9 +118,9 @@ header_size(const struct rimebuf_attrlist *a) all attributes that are used on this channel. */ size = 0; - for(; a->type != RIMEBUF_ATTR_NONE; ++a) { + for(; a->type != PACKETBUF_ATTR_NONE; ++a) { /* PRINTF("chameleon header_size: header type %s (%d) len %d\n", - rimebuf_attr_strings[a->type], + packetbuf_attr_strings[a->type], a->type, a->len);*/ len = a->len; @@ -219,7 +219,7 @@ printhdr(uint8_t *hdr, int len) static int pack_header(struct channel *c) { - const struct rimebuf_attrlist *a; + const struct packetbuf_attrlist *a; int hdrbytesize; int byteptr, bitptr, len; uint8_t *hdrptr; @@ -229,32 +229,32 @@ pack_header(struct channel *c) all attributes that are used on this channel. */ hdrbytesize = c->hdrsize / 8 + ((c->hdrsize & 7) == 0? 0: 1); - rimebuf_hdralloc(hdrbytesize); - hdrptr = rimebuf_hdrptr(); + packetbuf_hdralloc(hdrbytesize); + hdrptr = packetbuf_hdrptr(); memset(hdrptr, 0, hdrbytesize); byteptr = bitptr = 0; - for(a = c->attrlist; a->type != RIMEBUF_ATTR_NONE; ++a) { + for(a = c->attrlist; a->type != PACKETBUF_ATTR_NONE; ++a) { PRINTF("%d.%d: pack_header type %s, len %d, bitptr %d, ", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_attr_strings[a->type], a->len, bitptr); + packetbuf_attr_strings[a->type], a->len, bitptr); /* len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0);*/ len = a->len; byteptr = bitptr / 8; - if(a->type == RIMEBUF_ADDR_SENDER || - a->type == RIMEBUF_ADDR_RECEIVER || - a->type == RIMEBUF_ADDR_ESENDER || - a->type == RIMEBUF_ADDR_ERECEIVER) { + if(a->type == PACKETBUF_ADDR_SENDER || + a->type == PACKETBUF_ADDR_RECEIVER || + a->type == PACKETBUF_ADDR_ESENDER || + a->type == PACKETBUF_ADDR_ERECEIVER) { set_bits(&hdrptr[byteptr], bitptr & 7, - (uint8_t *)rimebuf_addr(a->type), len); + (uint8_t *)packetbuf_addr(a->type), len); PRINTF("address %d.%d\n", /* rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],*/ - ((uint8_t *)rimebuf_addr(a->type))[0], - ((uint8_t *)rimebuf_addr(a->type))[1]); + ((uint8_t *)packetbuf_addr(a->type))[0], + ((uint8_t *)packetbuf_addr(a->type))[1]); } else { - rimebuf_attr_t val; - val = rimebuf_attr(a->type); + packetbuf_attr_t val; + val = packetbuf_attr(a->type); set_bits(&hdrptr[byteptr], bitptr & 7, (uint8_t *)&val, len); PRINTF("value %d\n", @@ -266,8 +266,8 @@ pack_header(struct channel *c) } /* printhdr(hdrptr, hdrbytesize);*/ - rimebuf_hdralloc(sizeof(struct bitopt_hdr)); - hdr = (struct bitopt_hdr *)rimebuf_hdrptr(); + packetbuf_hdralloc(sizeof(struct bitopt_hdr)); + hdr = (struct bitopt_hdr *)packetbuf_hdrptr(); hdr->channel[0] = c->channelno & 0xff; hdr->channel[1] = (c->channelno >> 8) & 0xff; @@ -277,7 +277,7 @@ pack_header(struct channel *c) static struct channel * unpack_header(void) { - const struct rimebuf_attrlist *a; + const struct packetbuf_attrlist *a; int byteptr, bitptr, len; int hdrbytesize; uint8_t *hdrptr; @@ -287,44 +287,44 @@ unpack_header(void) /* The packet has a header that tells us what channel the packet is for. */ - hdr = (struct bitopt_hdr *)rimebuf_dataptr(); - rimebuf_hdrreduce(sizeof(struct bitopt_hdr)); + hdr = (struct bitopt_hdr *)packetbuf_dataptr(); + packetbuf_hdrreduce(sizeof(struct bitopt_hdr)); c = channel_lookup((hdr->channel[1] << 8) + hdr->channel[0]); if(c == NULL) { PRINTF("chameleon-bitopt: input: channel %d not found\n", hdr->channel); return NULL; } - hdrptr = rimebuf_dataptr(); + hdrptr = packetbuf_dataptr(); hdrbytesize = c->hdrsize / 8 + ((c->hdrsize & 7) == 0? 0: 1); - rimebuf_hdrreduce(hdrbytesize); + packetbuf_hdrreduce(hdrbytesize); byteptr = bitptr = 0; - for(a = c->attrlist; a->type != RIMEBUF_ATTR_NONE; ++a) { + for(a = c->attrlist; a->type != PACKETBUF_ATTR_NONE; ++a) { PRINTF("%d.%d: unpack_header type %s, len %d, bitptr %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_attr_strings[a->type], a->len, bitptr); + packetbuf_attr_strings[a->type], a->len, bitptr); /* len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0);*/ len = a->len; byteptr = bitptr / 8; - if(a->type == RIMEBUF_ADDR_SENDER || - a->type == RIMEBUF_ADDR_RECEIVER || - a->type == RIMEBUF_ADDR_ESENDER || - a->type == RIMEBUF_ADDR_ERECEIVER) { + if(a->type == PACKETBUF_ADDR_SENDER || + a->type == PACKETBUF_ADDR_RECEIVER || + a->type == PACKETBUF_ADDR_ESENDER || + a->type == PACKETBUF_ADDR_ERECEIVER) { rimeaddr_t addr; get_bits((uint8_t *)&addr, &hdrptr[byteptr], bitptr & 7, len); PRINTF("%d.%d: unpack_header type %s, addr %d.%d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_attr_strings[a->type], + packetbuf_attr_strings[a->type], addr.u8[0], addr.u8[1]); - rimebuf_set_addr(a->type, &addr); + packetbuf_set_addr(a->type, &addr); } else { - rimebuf_attr_t val = 0; + packetbuf_attr_t val = 0; get_bits((uint8_t *)&val, &hdrptr[byteptr], bitptr & 7, len); - rimebuf_set_attr(a->type, val); + packetbuf_set_attr(a->type, val); PRINTF("%d.%d: unpack_header type %s, val %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_attr_strings[a->type], + packetbuf_attr_strings[a->type], val); } /* byteptr += len / 8;*/ diff --git a/core/net/rime/chameleon-raw.c b/core/net/rime/chameleon-raw.c index f260f5f91..4e9404eb4 100644 --- a/core/net/rime/chameleon-raw.c +++ b/core/net/rime/chameleon-raw.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: chameleon-raw.c,v 1.5 2009/03/05 13:51:28 zhitao Exp $ + * $Id: chameleon-raw.c,v 1.6 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -59,7 +59,7 @@ struct raw_hdr { static struct channel * input(void) { - const struct rimebuf_attrlist *a; + const struct packetbuf_attrlist *a; int byteptr, bitptr, len; uint8_t *hdrptr; struct raw_hdr *hdr; @@ -67,41 +67,41 @@ input(void) /* The packet has a header that tells us what channel the packet is for. */ - hdr = (struct raw_hdr *)rimebuf_dataptr(); - rimebuf_hdrreduce(sizeof(struct raw_hdr)); + hdr = (struct raw_hdr *)packetbuf_dataptr(); + packetbuf_hdrreduce(sizeof(struct raw_hdr)); c = channel_lookup(hdr->channel); if(c == NULL) { PRINTF("chameleon-raw: input: channel %d not found\n", hdr->channel); return NULL; } - hdrptr = rimebuf_dataptr(); - rimebuf_hdrreduce(c->hdrsize); + hdrptr = packetbuf_dataptr(); + packetbuf_hdrreduce(c->hdrsize); byteptr = bitptr = 0; - for(a = c->attrlist; a->type != RIMEBUF_ATTR_NONE; ++a) { + for(a = c->attrlist; a->type != PACKETBUF_ATTR_NONE; ++a) { PRINTF("%d.%d: unpack_header type %s, len %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_attr_strings[a->type], a->len); + packetbuf_attr_strings[a->type], a->len); len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0); - if(a->type == RIMEBUF_ADDR_SENDER || - a->type == RIMEBUF_ADDR_RECEIVER || - a->type == RIMEBUF_ADDR_ESENDER || - a->type == RIMEBUF_ADDR_ERECEIVER) { + if(a->type == PACKETBUF_ADDR_SENDER || + a->type == PACKETBUF_ADDR_RECEIVER || + a->type == PACKETBUF_ADDR_ESENDER || + a->type == PACKETBUF_ADDR_ERECEIVER) { const rimeaddr_t addr; memcpy((uint8_t *)&addr, &hdrptr[byteptr], len / 8); PRINTF("%d.%d: unpack_header type %s, addr %d.%d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_attr_strings[a->type], + packetbuf_attr_strings[a->type], addr.u8[0], addr.u8[1]); - rimebuf_set_addr(a->type, &addr); + packetbuf_set_addr(a->type, &addr); } else { - rimebuf_attr_t val = 0; + packetbuf_attr_t val = 0; memcpy((uint8_t *)&val, &hdrptr[byteptr], len / 8); - rimebuf_set_attr(a->type, val); + packetbuf_set_attr(a->type, val); PRINTF("%d.%d: unpack_header type %s, val %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_attr_strings[a->type], + packetbuf_attr_strings[a->type], val); } byteptr += len / 8; @@ -112,38 +112,38 @@ input(void) static int output(struct channel *c) { - const struct rimebuf_attrlist *a; + const struct packetbuf_attrlist *a; int byteptr, len; uint8_t *hdrptr; struct raw_hdr *hdr; /* Compute the total size of the final header by summing the size of all attributes that are used on this channel. */ - rimebuf_hdralloc(c->hdrsize); - hdrptr = rimebuf_hdrptr(); + packetbuf_hdralloc(c->hdrsize); + hdrptr = packetbuf_hdrptr(); byteptr = 0; - for(a = c->attrlist; a->type != RIMEBUF_ATTR_NONE; ++a) { + for(a = c->attrlist; a->type != PACKETBUF_ATTR_NONE; ++a) { PRINTF("%d.%d: pack_header type %s, len %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_attr_strings[a->type], a->len); + packetbuf_attr_strings[a->type], a->len); len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0); - if(a->type == RIMEBUF_ADDR_SENDER || - a->type == RIMEBUF_ADDR_RECEIVER || - a->type == RIMEBUF_ADDR_ESENDER || - a->type == RIMEBUF_ADDR_ERECEIVER) { + if(a->type == PACKETBUF_ADDR_SENDER || + a->type == PACKETBUF_ADDR_RECEIVER || + a->type == PACKETBUF_ADDR_ESENDER || + a->type == PACKETBUF_ADDR_ERECEIVER) { const rimeaddr_t *rimeaddr; - /* memcpy(&hdrptr[byteptr], (uint8_t *)rimebuf_attr_aget(a->type), len / 8);*/ - rimeaddr = rimebuf_addr(a->type); + /* memcpy(&hdrptr[byteptr], (uint8_t *)packetbuf_attr_aget(a->type), len / 8);*/ + rimeaddr = packetbuf_addr(a->type); hdrptr[byteptr] = rimeaddr->u8[0]; hdrptr[byteptr + 1] = rimeaddr->u8[1]; PRINTF("%d.%d: address %d.%d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - ((uint8_t *)rimebuf_addr(a->type))[0], - ((uint8_t *)rimebuf_addr(a->type))[1]); + ((uint8_t *)packetbuf_addr(a->type))[0], + ((uint8_t *)packetbuf_addr(a->type))[1]); } else { - rimebuf_attr_t val; - val = rimebuf_attr(a->type); + packetbuf_attr_t val; + val = packetbuf_attr(a->type); memcpy(&hdrptr[byteptr], &val, len / 8); PRINTF("%d.%d: value %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], @@ -152,15 +152,15 @@ output(struct channel *c) byteptr += len / 8; } - rimebuf_hdralloc(sizeof(struct raw_hdr)); - hdr = (struct raw_hdr *)rimebuf_hdrptr(); + packetbuf_hdralloc(sizeof(struct raw_hdr)); + hdr = (struct raw_hdr *)packetbuf_hdrptr(); hdr->channel = c->channelno; return 1; /* Send out packet */ } /*---------------------------------------------------------------------------*/ static int -hdrsize(const struct rimebuf_attrlist *a) +hdrsize(const struct packetbuf_attrlist *a) { int size, len; @@ -168,9 +168,9 @@ hdrsize(const struct rimebuf_attrlist *a) all attributes that are used on this channel. */ size = 0; - for(; a->type != RIMEBUF_ATTR_NONE; ++a) { + for(; a->type != PACKETBUF_ATTR_NONE; ++a) { /* PRINTF("chameleon header_size: header type %s (%d) len %d\n", - rimebuf_attr_strings[a->type], + packetbuf_attr_strings[a->type], a->type, a->len);*/ len = a->len; diff --git a/core/net/rime/chameleon.c b/core/net/rime/chameleon.c index dfcbe2caa..cc7100750 100644 --- a/core/net/rime/chameleon.c +++ b/core/net/rime/chameleon.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: chameleon.c,v 1.5 2008/08/15 18:59:22 adamdunkels Exp $ + * $Id: chameleon.c,v 1.6 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -108,7 +108,7 @@ chameleon_input(void) PRINTF("%d.%d: chameleon_input\n", rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]); #if DEBUG - printhdr(rimebuf_dataptr(), rimebuf_datalen()); + printhdr(packetbuf_dataptr(), packetbuf_datalen()); #endif /* DEBUG */ if(header_module) { c = header_module->input(); @@ -116,7 +116,7 @@ chameleon_input(void) PRINTF("%d.%d: chameleon_input channel %d\n", rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1], c->channelno); - rimebuf_set_attr(RIMEBUF_ATTR_CHANNEL, c->channelno); + packetbuf_set_attr(PACKETBUF_ATTR_CHANNEL, c->channelno); abc_input(c); } else { PRINTF("%d.%d: chameleon_input channel not found for incoming packet\n", @@ -136,9 +136,9 @@ chameleon_output(struct channel *c) if(header_module) { ret = header_module->output(c); - rimebuf_set_attr(RIMEBUF_ATTR_CHANNEL, c->channelno); + packetbuf_set_attr(PACKETBUF_ATTR_CHANNEL, c->channelno); #if DEBUG - printhdr(rimebuf_hdrptr(), rimebuf_hdrlen()); + printhdr(packetbuf_hdrptr(), packetbuf_hdrlen()); #endif /* DEBUG */ if(ret) { rime_output(); @@ -149,7 +149,7 @@ chameleon_output(struct channel *c) } /*---------------------------------------------------------------------------*/ int -chameleon_hdrsize(const struct rimebuf_attrlist attrlist[]) +chameleon_hdrsize(const struct packetbuf_attrlist attrlist[]) { if(header_module != NULL && header_module->hdrsize != NULL) { diff --git a/core/net/rime/chameleon.h b/core/net/rime/chameleon.h index a9ea8bbc1..04a52776a 100644 --- a/core/net/rime/chameleon.h +++ b/core/net/rime/chameleon.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: chameleon.h,v 1.1 2008/02/25 02:14:34 adamdunkels Exp $ + * $Id: chameleon.h,v 1.2 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -49,13 +49,13 @@ struct chameleon_module { struct channel *(* input)(void); int (* output)(struct channel *); - int (* hdrsize)(const struct rimebuf_attrlist *); + int (* hdrsize)(const struct packetbuf_attrlist *); void (* init)(void); }; void chameleon_init(const struct chameleon_module *header_processing_module); -int chameleon_hdrsize(const struct rimebuf_attrlist attrlist[]); +int chameleon_hdrsize(const struct packetbuf_attrlist attrlist[]); void chameleon_input(void); int chameleon_output(struct channel *c); diff --git a/core/net/rime/channel.c b/core/net/rime/channel.c index 27f7fc620..ada1e5788 100644 --- a/core/net/rime/channel.c +++ b/core/net/rime/channel.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: channel.c,v 1.1 2008/02/25 02:14:34 adamdunkels Exp $ + * $Id: channel.c,v 1.2 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -53,7 +53,7 @@ channel_init(void) /*---------------------------------------------------------------------------*/ void channel_set_attributes(uint16_t channelno, - const struct rimebuf_attrlist attrlist[]) + const struct packetbuf_attrlist attrlist[]) { struct channel *c; c = channel_lookup(channelno); diff --git a/core/net/rime/channel.h b/core/net/rime/channel.h index 8d8193dcd..bf7427b87 100644 --- a/core/net/rime/channel.h +++ b/core/net/rime/channel.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: channel.h,v 1.1 2008/02/25 02:14:34 adamdunkels Exp $ + * $Id: channel.h,v 1.2 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -44,20 +44,20 @@ struct channel; #include "contiki-conf.h" -#include "net/rime/rimebuf.h" +#include "net/rime/packetbuf.h" #include "net/rime/chameleon.h" struct channel { struct channel *next; uint16_t channelno; - const struct rimebuf_attrlist *attrlist; + const struct packetbuf_attrlist *attrlist; uint8_t hdrsize; }; struct channel *channel_lookup(uint16_t channelno); void channel_set_attributes(uint16_t channelno, - const struct rimebuf_attrlist attrlist[]); + const struct packetbuf_attrlist attrlist[]); void channel_open(struct channel *c, uint16_t channelno); void channel_close(struct channel *c); void channel_init(void); diff --git a/core/net/rime/collect.c b/core/net/rime/collect.c index d40d1169d..3188be872 100644 --- a/core/net/rime/collect.c +++ b/core/net/rime/collect.c @@ -36,7 +36,7 @@ * * This file is part of the Contiki operating system. * - * $Id: collect.c,v 1.22 2009/03/10 14:07:41 zhitao Exp $ + * $Id: collect.c,v 1.23 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -62,10 +62,10 @@ #include #include -static const struct rimebuf_attrlist attributes[] = +static const struct packetbuf_attrlist attributes[] = { COLLECT_ATTRIBUTES - RIMEBUF_ATTR_LAST + PACKETBUF_ATTR_LAST }; #define NUM_RECENT_PACKETS 2 @@ -157,18 +157,18 @@ node_packet_received(struct runicast_conn *c, rimeaddr_t *from, uint8_t seqno) packet exists in the list, we drop the packet. */ for(i = 0; i < NUM_RECENT_PACKETS; i++) { - if(recent_packets[i].seqno == rimebuf_attr(RIMEBUF_ATTR_EPACKET_ID) && + if(recent_packets[i].seqno == packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID) && rimeaddr_cmp(&recent_packets[i].originator, - rimebuf_addr(RIMEBUF_ADDR_ESENDER))) { + packetbuf_addr(PACKETBUF_ADDR_ESENDER))) { PRINTF("%d.%d: dropping duplicate packet with seqno %d\n", - rimebuf_attr(RIMEBUF_ATTR_EPACKET_ID)); + packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID)); /* Drop the packet. */ return; } } - recent_packets[recent_packet_ptr].seqno = rimebuf_attr(RIMEBUF_ATTR_EPACKET_ID); + recent_packets[recent_packet_ptr].seqno = packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID); rimeaddr_copy(&recent_packets[recent_packet_ptr].originator, - rimebuf_addr(RIMEBUF_ADDR_ESENDER)); + packetbuf_addr(PACKETBUF_ADDR_ESENDER)); recent_packet_ptr = (recent_packet_ptr + 1) % NUM_RECENT_PACKETS; if(tc->rtmetric == SINK) { @@ -177,29 +177,29 @@ node_packet_received(struct runicast_conn *c, rimeaddr_t *from, uint8_t seqno) PRINTF("%d.%d: sink received packet from %d.%d via %d.%d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_addr(RIMEBUF_ADDR_ESENDER)->u8[0], - rimebuf_addr(RIMEBUF_ADDR_ESENDER)->u8[1], + packetbuf_addr(PACKETBUF_ADDR_ESENDER)->u8[0], + packetbuf_addr(PACKETBUF_ADDR_ESENDER)->u8[1], from->u8[0], from->u8[1]); if(tc->cb->recv != NULL) { - tc->cb->recv(rimebuf_addr(RIMEBUF_ADDR_ESENDER), - rimebuf_attr(RIMEBUF_ATTR_EPACKET_ID), - rimebuf_attr(RIMEBUF_ATTR_HOPS)); + tc->cb->recv(packetbuf_addr(PACKETBUF_ADDR_ESENDER), + packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID), + packetbuf_attr(PACKETBUF_ATTR_HOPS)); } return; - } else if(rimebuf_attr(RIMEBUF_ATTR_TTL) > 1 && + } else if(packetbuf_attr(PACKETBUF_ATTR_TTL) > 1 && tc->rtmetric != RTMETRIC_MAX) { /* If we are not the sink, we forward the packet to the best neighbor. */ - rimebuf_set_attr(RIMEBUF_ATTR_HOPS, rimebuf_attr(RIMEBUF_ATTR_HOPS) + 1); - rimebuf_set_attr(RIMEBUF_ATTR_TTL, rimebuf_attr(RIMEBUF_ATTR_TTL) - 1); + packetbuf_set_attr(PACKETBUF_ATTR_HOPS, packetbuf_attr(PACKETBUF_ATTR_HOPS) + 1); + packetbuf_set_attr(PACKETBUF_ATTR_TTL, packetbuf_attr(PACKETBUF_ATTR_TTL) - 1); PRINTF("%d.%d: packet received from %d.%d via %d.%d, forwarding %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_addr(RIMEBUF_ADDR_ESENDER)->u8[0], - rimebuf_addr(RIMEBUF_ADDR_ESENDER)->u8[1], + packetbuf_addr(PACKETBUF_ADDR_ESENDER)->u8[0], + packetbuf_addr(PACKETBUF_ADDR_ESENDER)->u8[1], from->u8[0], from->u8[1], tc->forwarding); if(!tc->forwarding) { @@ -209,7 +209,7 @@ node_packet_received(struct runicast_conn *c, rimeaddr_t *from, uint8_t seqno) ether_set_line(n->addr.u8[0], n->addr.u8[1]); #endif /* CONTIKI_TARGET_NETSIM */ tc->forwarding = 1; - runicast_send(c, &n->addr, rimebuf_attr(RIMEBUF_ATTR_MAX_REXMIT)); + runicast_send(c, &n->addr, packetbuf_attr(PACKETBUF_ATTR_MAX_REXMIT)); } else { PRINTF("%d.%d: did not find any neighbor to forward to\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]); @@ -341,18 +341,18 @@ collect_send(struct collect_conn *tc, int rexmits) { struct neighbor *n; - rimebuf_set_attr(RIMEBUF_ATTR_EPACKET_ID, tc->seqno++); - rimebuf_set_addr(RIMEBUF_ADDR_ESENDER, &rimeaddr_node_addr); - rimebuf_set_attr(RIMEBUF_ATTR_HOPS, 1); - rimebuf_set_attr(RIMEBUF_ATTR_TTL, MAX_HOPLIM); - rimebuf_set_attr(RIMEBUF_ATTR_MAX_REXMIT, rexmits); + packetbuf_set_attr(PACKETBUF_ATTR_EPACKET_ID, tc->seqno++); + packetbuf_set_addr(PACKETBUF_ADDR_ESENDER, &rimeaddr_node_addr); + packetbuf_set_attr(PACKETBUF_ATTR_HOPS, 1); + packetbuf_set_attr(PACKETBUF_ATTR_TTL, MAX_HOPLIM); + packetbuf_set_attr(PACKETBUF_ATTR_MAX_REXMIT, rexmits); if(tc->rtmetric == 0) { - rimebuf_set_attr(RIMEBUF_ATTR_HOPS, 0); + packetbuf_set_attr(PACKETBUF_ATTR_HOPS, 0); if(tc->cb->recv != NULL) { - tc->cb->recv(rimebuf_addr(RIMEBUF_ADDR_ESENDER), - rimebuf_attr(RIMEBUF_ATTR_EPACKET_ID), - rimebuf_attr(RIMEBUF_ATTR_HOPS)); + tc->cb->recv(packetbuf_addr(PACKETBUF_ADDR_ESENDER), + packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID), + packetbuf_attr(PACKETBUF_ATTR_HOPS)); } return 1; } else { diff --git a/core/net/rime/collect.h b/core/net/rime/collect.h index 98553e29b..e6db7f42a 100644 --- a/core/net/rime/collect.h +++ b/core/net/rime/collect.h @@ -47,7 +47,7 @@ * * This file is part of the Contiki operating system. * - * $Id: collect.h,v 1.9 2009/02/09 20:58:25 adamdunkels Exp $ + * $Id: collect.h,v 1.10 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -63,11 +63,11 @@ #include "net/rime/announcement.h" #include "net/rime/runicast.h" -#define COLLECT_ATTRIBUTES { RIMEBUF_ADDR_ESENDER, RIMEBUF_ADDRSIZE }, \ - { RIMEBUF_ATTR_EPACKET_ID, RIMEBUF_ATTR_BIT * 2 }, \ - { RIMEBUF_ATTR_TTL, RIMEBUF_ATTR_BIT * 4 }, \ - { RIMEBUF_ATTR_HOPS, RIMEBUF_ATTR_BIT * 4 }, \ - { RIMEBUF_ATTR_MAX_REXMIT, RIMEBUF_ATTR_BIT * 3 }, \ +#define COLLECT_ATTRIBUTES { PACKETBUF_ADDR_ESENDER, PACKETBUF_ADDRSIZE }, \ + { PACKETBUF_ATTR_EPACKET_ID, PACKETBUF_ATTR_BIT * 2 }, \ + { PACKETBUF_ATTR_TTL, PACKETBUF_ATTR_BIT * 4 }, \ + { PACKETBUF_ATTR_HOPS, PACKETBUF_ATTR_BIT * 4 }, \ + { PACKETBUF_ATTR_MAX_REXMIT, PACKETBUF_ATTR_BIT * 3 }, \ RUNICAST_ATTRIBUTES struct collect_callbacks { diff --git a/core/net/rime/ipolite.c b/core/net/rime/ipolite.c index e49b19c8a..78b9420a1 100644 --- a/core/net/rime/ipolite.c +++ b/core/net/rime/ipolite.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: ipolite.c,v 1.13 2009/03/02 11:22:09 adamdunkels Exp $ + * $Id: ipolite.c,v 1.14 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -71,9 +71,9 @@ recv(struct broadcast_conn *broadcast, rimeaddr_t *from) { struct ipolite_conn *c = (struct ipolite_conn *)broadcast; if(c->q != NULL && - rimebuf_datalen() == queuebuf_datalen(c->q) && - memcmp(rimebuf_dataptr(), queuebuf_dataptr(c->q), - MIN(c->hdrsize, rimebuf_datalen())) == 0) { + packetbuf_datalen() == queuebuf_datalen(c->q) && + memcmp(packetbuf_dataptr(), queuebuf_dataptr(c->q), + MIN(c->hdrsize, packetbuf_datalen())) == 0) { /* We received a copy of our own packet, so we do not send out packet. */ queuebuf_free(c->q); @@ -98,7 +98,7 @@ send(void *ptr) c->q); if(c->q != NULL) { - queuebuf_to_rimebuf(c->q); + queuebuf_to_packetbuf(c->q); queuebuf_free(c->q); c->q = NULL; broadcast_send(&c->c); @@ -150,7 +150,7 @@ ipolite_send(struct ipolite_conn *c, clock_time_t interval, uint8_t hdrsize) } } else { - c->q = queuebuf_new_from_rimebuf(); + c->q = queuebuf_new_from_packetbuf(); if(c->q != NULL) { ctimer_set(&c->t, interval / 2 + (random_rand() % (interval / 2)), diff --git a/core/net/rime/ipolite.h b/core/net/rime/ipolite.h index 57da1386d..fe3d092bd 100644 --- a/core/net/rime/ipolite.h +++ b/core/net/rime/ipolite.h @@ -81,7 +81,7 @@ * * This file is part of the Contiki operating system. * - * $Id: ipolite.h,v 1.7 2009/03/07 11:15:46 adamdunkels Exp $ + * $Id: ipolite.h,v 1.8 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -170,7 +170,7 @@ void ipolite_close(struct ipolite_conn *c); * \param interval The timer interval in which the packet should be sent. * \param hdrsize The size of the header that should be unique within the time interval. * - * This function sends a packet from the rimebuf on the + * This function sends a packet from the packetbuf on the * ipolite connection. The packet is sent some time during * the time interval, but only if no other packet is * received with the same header. diff --git a/core/net/rime/mesh.c b/core/net/rime/mesh.c index 4baa976db..28086a121 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.14 2008/07/03 22:36:02 adamdunkels Exp $ + * $Id: mesh.c,v 1.15 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -96,7 +96,7 @@ found_route(struct route_discovery_conn *rdc, rimeaddr_t *dest) if(c->queued_data != NULL && rimeaddr_cmp(dest, &c->queued_data_dest)) { - queuebuf_to_rimebuf(c->queued_data); + queuebuf_to_packetbuf(c->queued_data); queuebuf_free(c->queued_data); c->queued_data = NULL; multihop_send(&c->multihop, dest); @@ -156,7 +156,7 @@ mesh_send(struct mesh_conn *c, rimeaddr_t *to) } PRINTF("mesh_send: queueing data, sending rreq\n"); - c->queued_data = queuebuf_new_from_rimebuf(); + c->queued_data = queuebuf_new_from_packetbuf(); rimeaddr_copy(&c->queued_data_dest, to); route_discovery_discover(&c->route_discovery_conn, to, PACKET_TIMEOUT); diff --git a/core/net/rime/mesh.h b/core/net/rime/mesh.h index f6dee09ae..e9a3ee47e 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.12 2008/07/03 22:36:02 adamdunkels Exp $ + * $Id: mesh.h,v 1.13 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -126,7 +126,7 @@ void mesh_close(struct mesh_conn *c); * \retval Non-zero if the packet could be queued for sending, zero otherwise * * This function sends a mesh packet. The packet must be - * present in the rimebuf before this function is called. + * present in the packetbuf before this function is called. * * The parameter c must point to an abc connection that * must have previously been set up with mesh_open(). diff --git a/core/net/rime/multihop.c b/core/net/rime/multihop.c index 23e1a086a..c2881839c 100644 --- a/core/net/rime/multihop.c +++ b/core/net/rime/multihop.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: multihop.c,v 1.1 2008/07/03 22:36:03 adamdunkels Exp $ + * $Id: multihop.c,v 1.2 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -73,28 +73,28 @@ data_packet_received(struct unicast_conn *uc, rimeaddr_t *from) struct data_hdr msg; rimeaddr_t *nexthop; - memcpy(&msg, rimebuf_dataptr(), sizeof(struct data_hdr)); + memcpy(&msg, packetbuf_dataptr(), sizeof(struct data_hdr)); PRINTF("data_packet_received from %d.%d towards %d.%d len %d\n", from->u8[0], from->u8[1], msg.dest.u8[0], msg.dest.u8[1], - rimebuf_datalen()); + packetbuf_datalen()); if(rimeaddr_cmp(&msg.dest, &rimeaddr_node_addr)) { PRINTF("for us!\n"); - rimebuf_hdrreduce(sizeof(struct data_hdr)); + packetbuf_hdrreduce(sizeof(struct data_hdr)); if(c->cb->recv) { c->cb->recv(c, &msg.originator, from, msg.hops); } } else { nexthop = NULL; if(c->cb->forward) { - rimebuf_hdrreduce(sizeof(struct data_hdr)); + packetbuf_hdrreduce(sizeof(struct data_hdr)); nexthop = c->cb->forward(c, &msg.originator, &msg.dest, from, msg.hops); - rimebuf_hdralloc(sizeof(struct data_hdr)); + packetbuf_hdralloc(sizeof(struct data_hdr)); msg.hops++; - memcpy(rimebuf_hdrptr(), &msg, sizeof(struct data_hdr)); + memcpy(packetbuf_hdrptr(), &msg, sizeof(struct data_hdr)); } if(nexthop) { PRINTF("forwarding to %d.%d\n", nexthop->u8[0], nexthop->u8[1]); @@ -128,7 +128,7 @@ multihop_send(struct multihop_conn *c, rimeaddr_t *to) if(c->cb->forward == NULL) { return 0; } - rimebuf_compact(); + packetbuf_compact(); nexthop = c->cb->forward(c, &rimeaddr_node_addr, to, NULL, 0); if(nexthop == NULL) { @@ -137,8 +137,8 @@ multihop_send(struct multihop_conn *c, rimeaddr_t *to) } else { PRINTF("multihop_send: sending data towards %d.%d\n", nexthop->u8[0], nexthop->u8[1]); - if(rimebuf_hdralloc(sizeof(struct data_hdr))) { - hdr = rimebuf_hdrptr(); + if(packetbuf_hdralloc(sizeof(struct data_hdr))) { + hdr = packetbuf_hdrptr(); rimeaddr_copy(&hdr->dest, to); rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr); hdr->hops = 1; diff --git a/core/net/rime/multihop.h b/core/net/rime/multihop.h index fe4b64eb0..d12e45fec 100644 --- a/core/net/rime/multihop.h +++ b/core/net/rime/multihop.h @@ -58,7 +58,7 @@ * * This file is part of the Contiki operating system. * - * $Id: multihop.h,v 1.3 2009/03/07 11:15:46 adamdunkels Exp $ + * $Id: multihop.h,v 1.4 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -76,9 +76,9 @@ struct multihop_conn; -#define MULTIHOP_ATTRIBUTES { RIMEBUF_ADDR_ESENDER, RIMEBUF_ADDRSIZE }, \ - { RIMEBUF_ADDR_ERECEIVER, RIMEBUF_ADDRSIZE }, \ - { RIMEBUF_ATTR_TTL, RIMEBUF_ATTR_BIT * 5 }, \ +#define MULTIHOP_ATTRIBUTES { PACKETBUF_ADDR_ESENDER, PACKETBUF_ADDRSIZE }, \ + { PACKETBUF_ADDR_ERECEIVER, PACKETBUF_ADDRSIZE }, \ + { PACKETBUF_ATTR_TTL, PACKETBUF_ATTR_BIT * 5 }, \ UNICAST_ATTRIBUTES diff --git a/core/net/rime/neighbor-discovery.c b/core/net/rime/neighbor-discovery.c index 7d856e83e..7b5cd24bd 100644 --- a/core/net/rime/neighbor-discovery.c +++ b/core/net/rime/neighbor-discovery.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: neighbor-discovery.c,v 1.13 2009/02/11 11:08:56 adamdunkels Exp $ + * $Id: neighbor-discovery.c,v 1.14 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -89,9 +89,9 @@ send_adv(void *ptr) struct neighbor_discovery_conn *c = ptr; struct adv_msg *hdr; - rimebuf_clear(); - rimebuf_set_datalen(sizeof(struct adv_msg)); - hdr = rimebuf_dataptr(); + packetbuf_clear(); + packetbuf_set_datalen(sizeof(struct adv_msg)); + hdr = packetbuf_dataptr(); hdr->val = c->val; broadcast_send(&c->c); if(c->u->sent) { @@ -106,7 +106,7 @@ static void adv_packet_received(struct broadcast_conn *ibc, rimeaddr_t *from) { struct neighbor_discovery_conn *c = (struct neighbor_discovery_conn *)ibc; - struct adv_msg *msg = rimebuf_dataptr(); + struct adv_msg *msg = packetbuf_dataptr(); PRINTF("%d.%d: adv_packet_received from %d.%d with val %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], diff --git a/core/net/rime/netflood.c b/core/net/rime/netflood.c index 80d6b632e..97cc50dff 100644 --- a/core/net/rime/netflood.c +++ b/core/net/rime/netflood.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: netflood.c,v 1.2 2009/02/11 11:08:56 adamdunkels Exp $ + * $Id: netflood.c,v 1.3 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -76,16 +76,16 @@ static void recv_from_ipolite(struct ipolite_conn *ipolite, rimeaddr_t *from) { struct netflood_conn *c = (struct netflood_conn *)ipolite; - struct netflood_hdr *hdr = rimebuf_dataptr(); + struct netflood_hdr *hdr = packetbuf_dataptr(); uint8_t hops; struct queuebuf *queuebuf; hops = hdr->hops; /* Remember packet if we need to forward it. */ - queuebuf = queuebuf_new_from_rimebuf(); + queuebuf = queuebuf_new_from_packetbuf(); - rimebuf_hdrreduce(sizeof(struct netflood_hdr)); + packetbuf_hdrreduce(sizeof(struct netflood_hdr)); if(c->u->recv != NULL) { if(!(rimeaddr_cmp(&hdr->originator, &c->last_originator) && hdr->originator_seqno <= c->last_originator_seqno)) { @@ -94,10 +94,10 @@ recv_from_ipolite(struct ipolite_conn *ipolite, rimeaddr_t *from) hops)) { if(queuebuf != NULL) { - queuebuf_to_rimebuf(queuebuf); + queuebuf_to_packetbuf(queuebuf); queuebuf_free(queuebuf); queuebuf = NULL; - hdr = rimebuf_dataptr(); + hdr = packetbuf_dataptr(); /* Rebroadcast received packet. */ if(hops < HOPS_MAX) { @@ -160,15 +160,15 @@ netflood_close(struct netflood_conn *c) int netflood_send(struct netflood_conn *c, uint8_t seqno) { - if(rimebuf_hdralloc(sizeof(struct netflood_hdr))) { - struct netflood_hdr *hdr = rimebuf_hdrptr(); + if(packetbuf_hdralloc(sizeof(struct netflood_hdr))) { + struct netflood_hdr *hdr = packetbuf_hdrptr(); rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr); rimeaddr_copy(&c->last_originator, &hdr->originator); c->last_originator_seqno = hdr->originator_seqno = seqno; hdr->hops = 0; PRINTF("%d.%d: netflood sending '%s'\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - (char *)rimebuf_dataptr()); + (char *)packetbuf_dataptr()); return ipolite_send(&c->c, 0, 4); } return 0; diff --git a/core/net/rime/netflood.h b/core/net/rime/netflood.h index eaf14e8c8..2164eb3de 100644 --- a/core/net/rime/netflood.h +++ b/core/net/rime/netflood.h @@ -62,7 +62,7 @@ * * This file is part of the Contiki operating system. * - * $Id: netflood.h,v 1.3 2009/03/07 11:15:46 adamdunkels Exp $ + * $Id: netflood.h,v 1.4 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -82,9 +82,9 @@ struct netflood_conn; -#define NETFLOOD_ATTRIBUTES { RIMEBUF_ADDR_ESENDER, RIMEBUF_ADDRSIZE }, \ - { RIMEBUF_ATTR_HOPS, RIMEBUF_ATTR_BIT * 5 }, \ - { RIMEBUF_ATTR_EPACKET_ID, RIMEBUF_ATTR_BIT * 4 }, \ +#define NETFLOOD_ATTRIBUTES { PACKETBUF_ADDR_ESENDER, PACKETBUF_ADDRSIZE }, \ + { PACKETBUF_ATTR_HOPS, PACKETBUF_ATTR_BIT * 5 }, \ + { PACKETBUF_ATTR_EPACKET_ID, PACKETBUF_ATTR_BIT * 4 }, \ IPOLITE_ATTRIBUTES struct netflood_callbacks { diff --git a/core/net/rime/polite-announcement.c b/core/net/rime/polite-announcement.c index aeb652024..0f6dce424 100644 --- a/core/net/rime/polite-announcement.c +++ b/core/net/rime/polite-announcement.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: polite-announcement.c,v 1.1 2009/02/05 19:32:01 adamdunkels Exp $ + * $Id: polite-announcement.c,v 1.2 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -93,8 +93,8 @@ send_adv(clock_time_t interval) struct announcement_msg *adata; struct announcement *a; - rimebuf_clear(); - adata = rimebuf_dataptr(); + packetbuf_clear(); + adata = packetbuf_dataptr(); adata->num = 0; for(a = announcement_list(); a != NULL; a = a->next) { adata->data[adata->num].id = a->id; @@ -102,19 +102,19 @@ send_adv(clock_time_t interval) adata->num++; } - rimebuf_set_datalen(ANNOUNCEMENT_MSG_HEADERLEN + + packetbuf_set_datalen(ANNOUNCEMENT_MSG_HEADERLEN + sizeof(struct announcement_data) * adata->num); PRINTF("%d.%d: sending neighbor advertisement with %d announcements\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], adata->num); - ipolite_send(&c.c, interval, rimebuf_datalen()); + ipolite_send(&c.c, interval, packetbuf_datalen()); } /*---------------------------------------------------------------------------*/ static void adv_packet_received(struct ipolite_conn *ipolite, rimeaddr_t *from) { - struct announcement_msg *adata = rimebuf_dataptr(); + struct announcement_msg *adata = packetbuf_dataptr(); int i; PRINTF("%d.%d: adv_packet_received from %d.%d with %d announcements\n", diff --git a/core/net/rime/polite.c b/core/net/rime/polite.c index e30e54b61..74774f4d1 100644 --- a/core/net/rime/polite.c +++ b/core/net/rime/polite.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: polite.c,v 1.8 2009/03/02 11:22:09 adamdunkels Exp $ + * $Id: polite.c,v 1.9 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -64,9 +64,9 @@ recv(struct abc_conn *abc) { struct polite_conn *c = (struct polite_conn *)abc; if(c->q != NULL && - rimebuf_datalen() == queuebuf_datalen(c->q) && - memcmp(rimebuf_dataptr(), queuebuf_dataptr(c->q), - MIN(c->hdrsize, rimebuf_datalen())) == 0) { + packetbuf_datalen() == queuebuf_datalen(c->q) && + memcmp(packetbuf_dataptr(), queuebuf_dataptr(c->q), + MIN(c->hdrsize, packetbuf_datalen())) == 0) { /* We received a copy of our own packet, so we do not send out packet. */ queuebuf_free(c->q); @@ -87,7 +87,7 @@ send(void *ptr) struct polite_conn *c = ptr; if(c->q != NULL) { - queuebuf_to_rimebuf(c->q); + queuebuf_to_packetbuf(c->q); queuebuf_free(c->q); c->q = NULL; abc_send(&c->c); @@ -126,7 +126,7 @@ polite_send(struct polite_conn *c, clock_time_t interval, uint8_t hdrsize) queuebuf_free(c->q); } c->hdrsize = hdrsize; - c->q = queuebuf_new_from_rimebuf(); + c->q = queuebuf_new_from_packetbuf(); if(c->q != NULL) { ctimer_set(&c->t, interval / 2 + (random_rand() % (interval / 2)), send, c); return 1; diff --git a/core/net/rime/polite.h b/core/net/rime/polite.h index f9ba9733f..c3bc3f988 100644 --- a/core/net/rime/polite.h +++ b/core/net/rime/polite.h @@ -81,7 +81,7 @@ * * This file is part of the Contiki operating system. * - * $Id: polite.h,v 1.6 2009/03/07 11:15:46 adamdunkels Exp $ + * $Id: polite.h,v 1.7 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -170,7 +170,7 @@ void polite_close(struct polite_conn *c); * \param interval The timer interval in which the packet should be sent. * \param hdrsize The size of the header that should be unique within the time interval. * - * This function sends a packet from the rimebuf on the + * This function sends a packet from the packetbuf on the * polite connection. The packet is sent some time during * the time interval, but only if no other packet is * received with the same header. diff --git a/core/net/rime/queuebuf.c b/core/net/rime/queuebuf.c index 1f46c497a..ad3ab2c4a 100644 --- a/core/net/rime/queuebuf.c +++ b/core/net/rime/queuebuf.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: queuebuf.c,v 1.13 2008/11/17 22:52:10 oliverschmidt Exp $ + * $Id: queuebuf.c,v 1.14 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -61,15 +61,15 @@ struct queuebuf { uint16_t len; - uint8_t data[RIMEBUF_SIZE + RIMEBUF_HDR_SIZE]; - struct rimebuf_attr attrs[RIMEBUF_NUM_ATTRS]; - struct rimebuf_addr addrs[RIMEBUF_NUM_ADDRS]; + uint8_t data[PACKETBUF_SIZE + PACKETBUF_HDR_SIZE]; + struct packetbuf_attr attrs[PACKETBUF_NUM_ATTRS]; + struct packetbuf_addr addrs[PACKETBUF_NUM_ADDRS]; }; struct queuebuf_ref { uint16_t len; uint8_t *ref; - uint8_t hdr[RIMEBUF_HDR_SIZE]; + uint8_t hdr[PACKETBUF_HDR_SIZE]; uint8_t hdrlen; }; @@ -101,12 +101,12 @@ queuebuf_init(void) } /*---------------------------------------------------------------------------*/ struct queuebuf * -queuebuf_new_from_rimebuf(void) +queuebuf_new_from_packetbuf(void) { struct queuebuf *buf; struct queuebuf_ref *rbuf; - if(rimebuf_is_reference()) { + if(packetbuf_is_reference()) { rbuf = memb_alloc(&refbufmem); if(rbuf != NULL) { #if QUEUEBUF_STATS @@ -117,11 +117,11 @@ queuebuf_new_from_rimebuf(void) queuebuf_ref_len);*/ #endif /* CONTIKI_TARGET_NETSIM */ #endif /* QUEUEBUF_STATS */ - rbuf->len = rimebuf_datalen(); - rbuf->ref = rimebuf_reference_ptr(); - rbuf->hdrlen = rimebuf_copyto_hdr(rbuf->hdr); + rbuf->len = packetbuf_datalen(); + rbuf->ref = packetbuf_reference_ptr(); + rbuf->hdrlen = packetbuf_copyto_hdr(rbuf->hdr); } else { - PRINTF("queuebuf_new_from_rimebuf: could not allocate a reference queuebuf\n"); + PRINTF("queuebuf_new_from_packetbuf: could not allocate a reference queuebuf\n"); } return (struct queuebuf *)rbuf; } else { @@ -140,10 +140,10 @@ queuebuf_new_from_rimebuf(void) queuebuf_ref_len);*/ #endif /* CONTIKI_TARGET_NETSIM */ #endif /* QUEUEBUF_STATS */ - buf->len = rimebuf_copyto(buf->data); - rimebuf_attr_copyto(buf->attrs, buf->addrs); + buf->len = packetbuf_copyto(buf->data); + packetbuf_attr_copyto(buf->attrs, buf->addrs); } else { - PRINTF("queuebuf_new_from_rimebuf: could not allocate a queuebuf\n"); + PRINTF("queuebuf_new_from_packetbuf: could not allocate a queuebuf\n"); } return buf; } @@ -176,19 +176,19 @@ queuebuf_free(struct queuebuf *buf) } /*---------------------------------------------------------------------------*/ void -queuebuf_to_rimebuf(struct queuebuf *b) +queuebuf_to_packetbuf(struct queuebuf *b) { struct queuebuf_ref *r; if(memb_inmemb(&bufmem, b)) { - rimebuf_copyfrom(b->data, b->len); - rimebuf_attr_copyfrom(b->attrs, b->addrs); + packetbuf_copyfrom(b->data, b->len); + packetbuf_attr_copyfrom(b->attrs, b->addrs); } else if(memb_inmemb(&refbufmem, b)) { r = (struct queuebuf_ref *)b; - rimebuf_clear(); - rimebuf_copyfrom(r->ref, r->len); - rimebuf_hdralloc(r->hdrlen); - memcpy(rimebuf_hdrptr(), r->hdr, r->hdrlen); + packetbuf_clear(); + packetbuf_copyfrom(r->ref, r->len); + packetbuf_hdralloc(r->hdrlen); + memcpy(packetbuf_hdrptr(), r->hdr, r->hdrlen); } } /*---------------------------------------------------------------------------*/ diff --git a/core/net/rime/queuebuf.h b/core/net/rime/queuebuf.h index 69b512fe5..de29daa71 100644 --- a/core/net/rime/queuebuf.h +++ b/core/net/rime/queuebuf.h @@ -41,7 +41,7 @@ * * This file is part of the Contiki operating system. * - * $Id: queuebuf.h,v 1.5 2007/03/31 18:31:28 adamdunkels Exp $ + * $Id: queuebuf.h,v 1.6 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -54,15 +54,15 @@ #ifndef __QUEUEBUF_H__ #define __QUEUEBUF_H__ -#include "net/rime/rimebuf.h" +#include "net/rime/packetbuf.h" struct queuebuf; void queuebuf_init(void); -struct queuebuf *queuebuf_new_from_rimebuf(void); +struct queuebuf *queuebuf_new_from_packetbuf(void); void queuebuf_free(struct queuebuf *b); -void queuebuf_to_rimebuf(struct queuebuf *b); +void queuebuf_to_packetbuf(struct queuebuf *b); void *queuebuf_dataptr(struct queuebuf *b); int queuebuf_datalen(struct queuebuf *b); diff --git a/core/net/rime/rime.c b/core/net/rime/rime.c index 6cb451d0d..08968e4bb 100644 --- a/core/net/rime/rime.c +++ b/core/net/rime/rime.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rime.c,v 1.20 2009/03/01 10:43:57 adamdunkels Exp $ + * $Id: rime.c,v 1.21 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -111,7 +111,7 @@ rime_init(const struct mac_driver *m) { queuebuf_init(); route_init(); - rimebuf_clear(); + packetbuf_clear(); neighbor_init(); announcement_init(); rime_mac = m; @@ -139,7 +139,7 @@ rime_output(void) struct rime_sniffer *s; RIMESTATS_ADD(tx); - rimebuf_compact(); + packetbuf_compact(); if(rime_mac) { if(rime_mac->send()) { diff --git a/core/net/rime/rmh.c b/core/net/rime/rmh.c index fa0010734..b4406a563 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.7 2008/07/03 21:52:25 adamdunkels Exp $ + * $Id: rmh.c,v 1.8 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -67,16 +67,16 @@ static void received(struct runicast_conn *uc, rimeaddr_t *from, uint8_t seqno) { struct rmh_conn *c = (struct rmh_conn *)uc; - struct data_hdr *msg = rimebuf_dataptr(); + struct data_hdr *msg = packetbuf_dataptr(); rimeaddr_t *nexthop; PRINTF("data_packet_received from %d towards %d len %d\n", from->u16[0], msg->dest.u16[0], - rimebuf_datalen()); + packetbuf_datalen()); if(rimeaddr_cmp(&msg->dest, &rimeaddr_node_addr)) { PRINTF("for us!\n"); - rimebuf_hdrreduce(sizeof(struct data_hdr)); + packetbuf_hdrreduce(sizeof(struct data_hdr)); if(c->cb->recv) { c->cb->recv(c, &msg->originator, msg->hops); } @@ -144,8 +144,8 @@ rmh_send(struct rmh_conn *c, rimeaddr_t *to, uint8_t num_rexmit, uint8_t max_hop PRINTF("rmh_send: sending data\n"); - if(rimebuf_hdralloc(sizeof(struct data_hdr))) { - hdr = rimebuf_hdrptr(); + if(packetbuf_hdralloc(sizeof(struct data_hdr))) { + hdr = packetbuf_hdrptr(); rimeaddr_copy(&hdr->dest, to); rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr); hdr->hops = 1; diff --git a/core/net/rime/route-discovery.c b/core/net/rime/route-discovery.c index fe562421d..f81885652 100644 --- a/core/net/rime/route-discovery.c +++ b/core/net/rime/route-discovery.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: route-discovery.c,v 1.13 2009/01/21 14:29:24 fros4943 Exp $ + * $Id: route-discovery.c,v 1.14 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -82,9 +82,9 @@ send_rreq(struct route_discovery_conn *c, rimeaddr_t *dest) { struct route_msg *msg; - rimebuf_clear(); - msg = rimebuf_dataptr(); - rimebuf_set_datalen(sizeof(struct route_msg)); + packetbuf_clear(); + msg = packetbuf_dataptr(); + packetbuf_set_datalen(sizeof(struct route_msg)); msg->pad = 0; msg->rreq_id = c->rreq_id; @@ -100,9 +100,9 @@ send_rrep(struct route_discovery_conn *c, rimeaddr_t *dest) struct rrep_hdr *rrepmsg; struct route_entry *rt; - rimebuf_clear(); - rrepmsg = rimebuf_dataptr(); - rimebuf_set_datalen(sizeof(struct rrep_hdr)); + packetbuf_clear(); + rrepmsg = packetbuf_dataptr(); + packetbuf_set_datalen(sizeof(struct rrep_hdr)); rrepmsg->hops = 0; rimeaddr_copy(&rrepmsg->dest, dest); rimeaddr_copy(&rrepmsg->originator, &rimeaddr_node_addr); @@ -139,7 +139,7 @@ insert_route(rimeaddr_t *originator, rimeaddr_t *last_hop, uint8_t hops) static void rrep_packet_received(struct unicast_conn *uc, rimeaddr_t *from) { - struct rrep_hdr *msg = rimebuf_dataptr(); + struct rrep_hdr *msg = packetbuf_dataptr(); struct route_entry *rt; rimeaddr_t dest; struct route_discovery_conn *c = (struct route_discovery_conn *) @@ -149,7 +149,7 @@ rrep_packet_received(struct unicast_conn *uc, rimeaddr_t *from) rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], from->u8[0],from->u8[1], msg->dest.u8[0],msg->dest.u8[1], - rimebuf_datalen()); + packetbuf_datalen()); insert_route(&msg->originator, from, msg->hops); @@ -178,7 +178,7 @@ static int rreq_packet_received(struct netflood_conn *nf, rimeaddr_t *from, rimeaddr_t *originator, uint8_t seqno, uint8_t hops) { - struct route_msg *msg = rimebuf_dataptr(); + struct route_msg *msg = packetbuf_dataptr(); struct route_discovery_conn *c = (struct route_discovery_conn *) ((char *)nf - offsetof(struct route_discovery_conn, rreqconn)); diff --git a/core/net/rime/rucb.c b/core/net/rime/rucb.c index dc948ab56..4f20a2b7a 100644 --- a/core/net/rime/rucb.c +++ b/core/net/rime/rucb.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rucb.c,v 1.8 2008/07/03 21:52:25 adamdunkels Exp $ + * $Id: rucb.c,v 1.9 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -59,12 +59,12 @@ read_data(struct rucb_conn *c) { int len = 0; - rimebuf_clear(); + packetbuf_clear(); if(c->u->read_chunk) { len = c->u->read_chunk(c, c->chunk * RUCB_DATASIZE, - rimebuf_dataptr(), RUCB_DATASIZE); + packetbuf_dataptr(), RUCB_DATASIZE); } - rimebuf_set_datalen(len); + packetbuf_set_datalen(len); return len; } /*---------------------------------------------------------------------------*/ @@ -102,7 +102,7 @@ recv(struct runicast_conn *ruc, rimeaddr_t *from, uint8_t seqno) PRINTF("%d.%d: rucb: recv from %d.%d len %d\n", rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1], - from->u8[0], from->u8[1], rimebuf_totlen()); + from->u8[0], from->u8[1], packetbuf_totlen()); if(seqno == c->last_seqno) { return; @@ -111,28 +111,28 @@ recv(struct runicast_conn *ruc, rimeaddr_t *from, uint8_t seqno) if(rimeaddr_cmp(&c->sender, &rimeaddr_null)) { rimeaddr_copy(&c->sender, from); - c->u->write_chunk(c, 0, RUCB_FLAG_NEWFILE, rimebuf_dataptr(), 0); + c->u->write_chunk(c, 0, RUCB_FLAG_NEWFILE, packetbuf_dataptr(), 0); c->chunk = 0; } if(rimeaddr_cmp(&c->sender, from)) { - int datalen = rimebuf_datalen(); + int datalen = packetbuf_datalen(); if(datalen < RUCB_DATASIZE) { PRINTF("%d.%d: get %d bytes, file complete\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], datalen); c->u->write_chunk(c, c->chunk * RUCB_DATASIZE, - RUCB_FLAG_LASTCHUNK, rimebuf_dataptr(), datalen); + RUCB_FLAG_LASTCHUNK, packetbuf_dataptr(), datalen); } else { c->u->write_chunk(c, c->chunk * RUCB_DATASIZE, - RUCB_FLAG_NONE, rimebuf_dataptr(), datalen); + RUCB_FLAG_NONE, packetbuf_dataptr(), datalen); } c->chunk++; } - if(rimebuf_datalen() < RUCB_DATASIZE) { + if(packetbuf_datalen() < RUCB_DATASIZE) { rimeaddr_copy(&c->sender, &rimeaddr_null); } } diff --git a/core/net/rime/rudolph0.c b/core/net/rime/rudolph0.c index a0db8321a..6766bc560 100644 --- a/core/net/rime/rudolph0.c +++ b/core/net/rime/rudolph0.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rudolph0.c,v 1.10 2008/06/30 08:28:53 adamdunkels Exp $ + * $Id: rudolph0.c,v 1.11 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -90,9 +90,9 @@ static void send_nack(struct rudolph0_conn *c) { struct rudolph0_hdr *hdr; - rimebuf_clear(); - rimebuf_hdralloc(sizeof(struct rudolph0_hdr)); - hdr = rimebuf_hdrptr(); + packetbuf_clear(); + packetbuf_hdralloc(sizeof(struct rudolph0_hdr)); + hdr = packetbuf_hdrptr(); hdr->type = TYPE_NACK; hdr->version = c->current.h.version; @@ -122,7 +122,7 @@ static void recv(struct stbroadcast_conn *stbroadcast) { struct rudolph0_conn *c = (struct rudolph0_conn *)stbroadcast; - struct rudolph0_datapacket *p = rimebuf_dataptr(); + struct rudolph0_datapacket *p = packetbuf_dataptr(); if(p->h.type == TYPE_DATA) { if(c->current.h.version != p->h.version) { @@ -164,7 +164,7 @@ recv_nack(struct polite_conn *polite) struct rudolph0_conn *c = (struct rudolph0_conn *) ((char *)polite - offsetof(struct rudolph0_conn, nackc)); - struct rudolph0_datapacket *p = rimebuf_dataptr(); + struct rudolph0_datapacket *p = packetbuf_dataptr(); if(p->h.type == TYPE_NACK && c->state == STATE_SENDER) { if(p->h.version == c->current.h.version) { @@ -210,7 +210,7 @@ rudolph0_send(struct rudolph0_conn *c, clock_time_t send_interval) c->current.h.chunk = 0; c->current.h.type = TYPE_DATA; read_new_datapacket(c); - rimebuf_reference(&c->current, sizeof(struct rudolph0_datapacket)); + packetbuf_reference(&c->current, sizeof(struct rudolph0_datapacket)); c->send_interval = send_interval; stbroadcast_send_stubborn(&c->c, c->send_interval); } diff --git a/core/net/rime/rudolph1.c b/core/net/rime/rudolph1.c index d04895fe2..743d4e850 100644 --- a/core/net/rime/rudolph1.c +++ b/core/net/rime/rudolph1.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rudolph1.c,v 1.11 2008/02/24 22:05:27 adamdunkels Exp $ + * $Id: rudolph1.c,v 1.12 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -102,13 +102,13 @@ format_data(struct rudolph1_conn *c, int chunk) { struct rudolph1_datapacket *p; - rimebuf_clear(); - p = rimebuf_dataptr(); + packetbuf_clear(); + p = packetbuf_dataptr(); p->h.type = TYPE_DATA; p->h.version = c->version; p->h.chunk = chunk; p->datalen = read_data(c, p->data, chunk); - rimebuf_set_datalen(sizeof(struct rudolph1_datapacket) - + packetbuf_set_datalen(sizeof(struct rudolph1_datapacket) - (RUDOLPH1_DATASIZE - p->datalen)); return p->datalen; @@ -137,9 +137,9 @@ static void send_nack(struct rudolph1_conn *c) { struct rudolph1_hdr *hdr; - rimebuf_clear(); - rimebuf_hdralloc(sizeof(struct rudolph1_hdr)); - hdr = rimebuf_hdrptr(); + packetbuf_clear(); + packetbuf_hdralloc(sizeof(struct rudolph1_hdr)); + hdr = packetbuf_hdrptr(); hdr->type = TYPE_NACK; hdr->version = c->version; @@ -207,7 +207,7 @@ static void recv_trickle(struct trickle_conn *trickle) { struct rudolph1_conn *c = (struct rudolph1_conn *)trickle; - struct rudolph1_datapacket *p = rimebuf_dataptr(); + struct rudolph1_datapacket *p = packetbuf_dataptr(); if(p->h.type == TYPE_DATA) { PRINTF("%d.%d: received trickle with chunk %d\n", @@ -236,7 +236,7 @@ recv_ipolite(struct ipolite_conn *ipolite, rimeaddr_t *from) { struct rudolph1_conn *c = (struct rudolph1_conn *) ((char *)ipolite - offsetof(struct rudolph1_conn, ipolite)); - struct rudolph1_datapacket *p = rimebuf_dataptr(); + struct rudolph1_datapacket *p = packetbuf_dataptr(); PRINTF("%d.%d: Got ipolite type %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], diff --git a/core/net/rime/rudolph2.c b/core/net/rime/rudolph2.c index 10374fb9a..d049db783 100644 --- a/core/net/rime/rudolph2.c +++ b/core/net/rime/rudolph2.c @@ -39,7 +39,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rudolph2.c,v 1.6 2008/11/09 12:16:33 adamdunkels Exp $ + * $Id: rudolph2.c,v 1.7 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -111,14 +111,14 @@ format_data(struct rudolph2_conn *c, int chunk) struct rudolph2_hdr *hdr; int len; - rimebuf_clear(); - hdr = rimebuf_dataptr(); + packetbuf_clear(); + hdr = packetbuf_dataptr(); hdr->type = TYPE_DATA; hdr->hops_from_base = c->hops_from_base; hdr->version = c->version; hdr->chunk = chunk; len = read_data(c, (uint8_t *)hdr + sizeof(struct rudolph2_hdr), chunk); - rimebuf_set_datalen(sizeof(struct rudolph2_hdr) + len); + packetbuf_set_datalen(sizeof(struct rudolph2_hdr) + len); return len; } @@ -170,9 +170,9 @@ static void send_nack(struct rudolph2_conn *c) { struct rudolph2_hdr *hdr; - rimebuf_clear(); - rimebuf_hdralloc(sizeof(struct rudolph2_hdr)); - hdr = rimebuf_hdrptr(); + packetbuf_clear(); + packetbuf_hdralloc(sizeof(struct rudolph2_hdr)); + hdr = packetbuf_hdrptr(); hdr->hops_from_base = c->hops_from_base; hdr->type = TYPE_NACK; @@ -290,7 +290,7 @@ static void recv(struct polite_conn *polite) { struct rudolph2_conn *c = (struct rudolph2_conn *)polite; - struct rudolph2_hdr *hdr = rimebuf_dataptr(); + struct rudolph2_hdr *hdr = packetbuf_dataptr(); /* Only accept NACKs from nodes that are farther away from the base than us. */ @@ -326,8 +326,8 @@ recv(struct polite_conn *polite) if(hdr->chunk != 0) { send_nack(c); } else { - rimebuf_hdrreduce(sizeof(struct rudolph2_hdr)); - write_data(c, 0, rimebuf_dataptr(), rimebuf_totlen()); + packetbuf_hdrreduce(sizeof(struct rudolph2_hdr)); + write_data(c, 0, packetbuf_dataptr(), packetbuf_totlen()); } } else if(hdr->version == c->version) { PRINTF("%d.%d: got chunk %d snd_nxt %d rcv_nxt %d\n", @@ -336,12 +336,12 @@ recv(struct polite_conn *polite) if(hdr->chunk == c->rcv_nxt) { int len; - rimebuf_hdrreduce(sizeof(struct rudolph2_hdr)); + packetbuf_hdrreduce(sizeof(struct rudolph2_hdr)); PRINTF("%d.%d: received chunk %d len %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - hdr->chunk, rimebuf_totlen()); - len = rimebuf_totlen(); - write_data(c, hdr->chunk, rimebuf_dataptr(), rimebuf_totlen()); + hdr->chunk, packetbuf_totlen()); + len = packetbuf_totlen(); + write_data(c, hdr->chunk, packetbuf_dataptr(), packetbuf_totlen()); c->rcv_nxt++; if(len < RUDOLPH2_DATASIZE) { c->flags |= FLAG_LAST_RECEIVED; @@ -388,9 +388,9 @@ rudolph2_send(struct rudolph2_conn *c, clock_time_t send_interval) c->version++; c->snd_nxt = 0; len = RUDOLPH2_DATASIZE; - rimebuf_clear(); + packetbuf_clear(); for(c->rcv_nxt = 0; len == RUDOLPH2_DATASIZE; c->rcv_nxt++) { - len = read_data(c, rimebuf_dataptr(), c->rcv_nxt); + len = read_data(c, packetbuf_dataptr(), c->rcv_nxt); } c->flags = FLAG_LAST_RECEIVED; /* printf("Highest chunk %d\n", c->rcv_nxt);*/ diff --git a/core/net/rime/runicast.c b/core/net/rime/runicast.c index 904e6dd43..24104e0e3 100644 --- a/core/net/rime/runicast.c +++ b/core/net/rime/runicast.c @@ -34,7 +34,7 @@ * * This file is part of the Contiki operating system. * - * $Id: runicast.c,v 1.4 2009/03/03 12:19:46 fros4943 Exp $ + * $Id: runicast.c,v 1.5 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -53,10 +53,10 @@ #define REXMIT_TIME CLOCK_SECOND -static const struct rimebuf_attrlist attributes[] = +static const struct packetbuf_attrlist attributes[] = { RUNICAST_ATTRIBUTES - RIMEBUF_ATTR_LAST + PACKETBUF_ATTR_LAST }; #define DEBUG 0 @@ -77,7 +77,7 @@ sent_by_stunicast(struct stunicast_conn *stunicast) RIMESTATS_ADD(rexmit); PRINTF("%d.%d: runicast: packet %u resent %u\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_attr(RIMEBUF_ATTR_PACKET_ID), c->rxmit); + packetbuf_attr(PACKETBUF_ATTR_PACKET_ID), c->rxmit); } c->rxmit++; @@ -103,21 +103,21 @@ static void recv_from_stunicast(struct stunicast_conn *stunicast, rimeaddr_t *from) { struct runicast_conn *c = (struct runicast_conn *)stunicast; - /* struct runicast_hdr *hdr = rimebuf_dataptr();*/ + /* struct runicast_hdr *hdr = packetbuf_dataptr();*/ PRINTF("%d.%d: runicast: recv_from_stunicast from %d.%d type %d seqno %d\n", rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1], from->u8[0], from->u8[1], - rimebuf_attr(RIMEBUF_ATTR_PACKET_TYPE), - rimebuf_attr(RIMEBUF_ATTR_PACKET_ID)); + packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE), + packetbuf_attr(PACKETBUF_ATTR_PACKET_ID)); - if(rimebuf_attr(RIMEBUF_ATTR_PACKET_TYPE) == - RIMEBUF_ATTR_PACKET_TYPE_ACK) { - if(rimebuf_attr(RIMEBUF_ATTR_PACKET_ID) == c->sndnxt) { + if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == + PACKETBUF_ATTR_PACKET_TYPE_ACK) { + if(packetbuf_attr(PACKETBUF_ATTR_PACKET_ID) == c->sndnxt) { RIMESTATS_ADD(ackrx); PRINTF("%d.%d: runicast: ACKed %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_attr(RIMEBUF_ATTR_PACKET_ID)); + packetbuf_attr(PACKETBUF_ATTR_PACKET_ID)); c->sndnxt = (c->sndnxt + 1) % (1 << RUNICAST_PACKET_ID_BITS); c->is_tx = 0; stunicast_cancel(&c->c); @@ -127,12 +127,12 @@ recv_from_stunicast(struct stunicast_conn *stunicast, rimeaddr_t *from) } else { PRINTF("%d.%d: runicast: received bad ACK %d for %d\n", rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1], - rimebuf_attr(RIMEBUF_ATTR_PACKET_ID), + packetbuf_attr(PACKETBUF_ATTR_PACKET_ID), c->sndnxt); RIMESTATS_ADD(badackrx); } - } else if(rimebuf_attr(RIMEBUF_ATTR_PACKET_TYPE) == - RIMEBUF_ATTR_PACKET_TYPE_DATA) { + } else if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == + PACKETBUF_ATTR_PACKET_TYPE_DATA) { /* int send_ack = 1;*/ uint16_t packet_seqno; struct queuebuf *q; @@ -141,29 +141,29 @@ recv_from_stunicast(struct stunicast_conn *stunicast, rimeaddr_t *from) PRINTF("%d.%d: runicast: got packet %d\n", rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1], - rimebuf_attr(RIMEBUF_ATTR_PACKET_ID)); + packetbuf_attr(PACKETBUF_ATTR_PACKET_ID)); - packet_seqno = rimebuf_attr(RIMEBUF_ATTR_PACKET_ID); + packet_seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID); - /* rimebuf_hdrreduce(sizeof(struct runicast_hdr));*/ + /* packetbuf_hdrreduce(sizeof(struct runicast_hdr));*/ - q = queuebuf_new_from_rimebuf(); + q = queuebuf_new_from_packetbuf(); if(q != NULL) { PRINTF("%d.%d: runicast: Sending ACK to %d.%d for %d\n", rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1], from->u8[0], from->u8[1], packet_seqno); - rimebuf_clear(); - /* rimebuf_hdralloc(sizeof(struct runicast_hdr)); - hdr = rimebuf_hdrptr(); + packetbuf_clear(); + /* packetbuf_hdralloc(sizeof(struct runicast_hdr)); + hdr = packetbuf_hdrptr(); hdr->type = TYPE_ACK; hdr->seqno = packet_seqno;*/ - rimebuf_set_attr(RIMEBUF_ATTR_PACKET_TYPE, RIMEBUF_ATTR_PACKET_TYPE_ACK); - rimebuf_set_attr(RIMEBUF_ATTR_PACKET_ID, packet_seqno); + packetbuf_set_attr(PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_PACKET_TYPE_ACK); + packetbuf_set_attr(PACKETBUF_ATTR_PACKET_ID, packet_seqno); stunicast_send(&c->c, from); RIMESTATS_ADD(acktx); - queuebuf_to_rimebuf(q); + queuebuf_to_packetbuf(q); queuebuf_free(q); } if(c->u->recv != NULL) { @@ -206,9 +206,9 @@ runicast_send(struct runicast_conn *c, rimeaddr_t *receiver, uint8_t max_retrans rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]); return 0; } - rimebuf_set_attr(RIMEBUF_ATTR_RELIABLE, 1); - rimebuf_set_attr(RIMEBUF_ATTR_PACKET_TYPE, RIMEBUF_ATTR_PACKET_TYPE_DATA); - rimebuf_set_attr(RIMEBUF_ATTR_PACKET_ID, c->sndnxt); + packetbuf_set_attr(PACKETBUF_ATTR_RELIABLE, 1); + packetbuf_set_attr(PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_PACKET_TYPE_DATA); + packetbuf_set_attr(PACKETBUF_ATTR_PACKET_ID, c->sndnxt); c->max_rxmit = max_retransmissions; c->rxmit = 0; c->is_tx = 1; diff --git a/core/net/rime/runicast.h b/core/net/rime/runicast.h index ab8c4bf17..b09b68063 100644 --- a/core/net/rime/runicast.h +++ b/core/net/rime/runicast.h @@ -66,7 +66,7 @@ * * This file is part of the Contiki operating system. * - * $Id: runicast.h,v 1.4 2009/03/07 11:15:46 adamdunkels Exp $ + * $Id: runicast.h,v 1.5 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -83,8 +83,8 @@ struct runicast_conn; -#define RUNICAST_ATTRIBUTES { RIMEBUF_ATTR_PACKET_TYPE, RIMEBUF_ATTR_BIT }, \ - { RIMEBUF_ATTR_PACKET_ID, RIMEBUF_ATTR_BIT * 2 }, \ +#define RUNICAST_ATTRIBUTES { PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_BIT }, \ + { PACKETBUF_ATTR_PACKET_ID, PACKETBUF_ATTR_BIT * 2 }, \ STUNICAST_ATTRIBUTES struct runicast_callbacks { void (* recv)(struct runicast_conn *c, rimeaddr_t *from, uint8_t seqno); diff --git a/core/net/rime/stbroadcast.c b/core/net/rime/stbroadcast.c index 865eea929..61b3cf026 100644 --- a/core/net/rime/stbroadcast.c +++ b/core/net/rime/stbroadcast.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: stbroadcast.c,v 1.1 2008/06/30 08:28:53 adamdunkels Exp $ + * $Id: stbroadcast.c,v 1.2 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -82,7 +82,7 @@ send(void *ptr) struct stbroadcast_conn *c = ptr; /* DEBUGF(3, "stbroadcast: send()\n");*/ - queuebuf_to_rimebuf(c->buf); + queuebuf_to_packetbuf(c->buf); broadcast_send(&c->c); ctimer_reset(&c->t); if(c->u->sent != NULL) { @@ -102,7 +102,7 @@ stbroadcast_send_stubborn(struct stbroadcast_conn *c, clock_time_t t) if(c->buf != NULL) { queuebuf_free(c->buf); } - c->buf = queuebuf_new_from_rimebuf(); + c->buf = queuebuf_new_from_packetbuf(); if(c->buf == NULL) { return 0; } diff --git a/core/net/rime/stunicast.c b/core/net/rime/stunicast.c index ea85b4c88..b27da3659 100644 --- a/core/net/rime/stunicast.c +++ b/core/net/rime/stunicast.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: stunicast.c,v 1.1 2008/07/03 21:35:46 adamdunkels Exp $ + * $Id: stunicast.c,v 1.2 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -102,7 +102,7 @@ send(void *ptr) PRINTF("%d.%d: stunicast: resend to %d.%d\n", rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1], c->receiver.u8[0], c->receiver.u8[1]); - queuebuf_to_rimebuf(c->buf); + queuebuf_to_packetbuf(c->buf); unicast_send(&c->c, &c->receiver); stunicast_set_timer(c, CLOCK_SECOND); if(c->u->sent != NULL) { @@ -123,7 +123,7 @@ stunicast_send_stubborn(struct stunicast_conn *c, rimeaddr_t *receiver, if(c->buf != NULL) { queuebuf_free(c->buf); } - c->buf = queuebuf_new_from_rimebuf(); + c->buf = queuebuf_new_from_packetbuf(); if(c->buf == NULL) { return 0; } diff --git a/core/net/rime/timesynch.c b/core/net/rime/timesynch.c index 77591064c..4ebeebcd7 100644 --- a/core/net/rime/timesynch.c +++ b/core/net/rime/timesynch.c @@ -34,7 +34,7 @@ * * This file is part of the Contiki operating system. * - * $Id: timesynch.c,v 1.6 2009/02/20 21:23:22 adamdunkels Exp $ + * $Id: timesynch.c,v 1.7 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -45,7 +45,7 @@ */ #include "net/rime/timesynch.h" -#include "net/rime/rimebuf.h" +#include "net/rime/packetbuf.h" #include "net/rime.h" #include "dev/cc2420.h" @@ -102,7 +102,7 @@ adjust_offset(rtimer_clock_t authoritative_time, rtimer_clock_t local_time) static void incoming_packet(void) { - if(rimebuf_totlen() != 0) { + if(packetbuf_totlen() != 0) { /* We check the authority level of the sender of the incoming packet. If the sending node has a lower authority level than we have, we synchronize to the time of the sending node and set our diff --git a/core/net/rime/trickle.c b/core/net/rime/trickle.c index 55b858c08..7c58a9072 100644 --- a/core/net/rime/trickle.c +++ b/core/net/rime/trickle.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: trickle.c,v 1.15 2009/02/11 11:08:56 adamdunkels Exp $ + * $Id: trickle.c,v 1.16 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -57,9 +57,9 @@ #define SEQNO_LT(a, b) ((signed char)((a) - (b)) < 0) -static const struct rimebuf_attrlist attributes[] = +static const struct packetbuf_attrlist attributes[] = { - TRICKLE_ATTRIBUTES RIMEBUF_ATTR_LAST + TRICKLE_ATTRIBUTES PACKETBUF_ATTR_LAST }; @@ -79,7 +79,7 @@ send(void *ptr) struct trickle_conn *c = ptr; if(c->q != NULL) { - queuebuf_to_rimebuf(c->q); + queuebuf_to_packetbuf(c->q); broadcast_send(&c->c); } else { PRINTF("%d.%d: trickle send but c->q == NULL\n", @@ -136,15 +136,15 @@ static void recv(struct broadcast_conn *bc, rimeaddr_t *from) { struct trickle_conn *c = (struct trickle_conn *)bc; - uint16_t seqno = rimebuf_attr(RIMEBUF_ATTR_EPACKET_ID); + uint16_t seqno = packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID); PRINTF("%d.%d: trickle recv seqno %d from %d.%d our %d data len %d channel %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], seqno, from->u8[0], from->u8[1], c->seqno, - rimebuf_datalen(), - rimebuf_attr(RIMEBUF_ATTR_CHANNEL)); + packetbuf_datalen(), + packetbuf_attr(PACKETBUF_ATTR_CHANNEL)); if(seqno == c->seqno) { /* c->cb->recv(c);*/ @@ -161,7 +161,7 @@ recv(struct broadcast_conn *bc, rimeaddr_t *from) if(c->q != NULL) { queuebuf_free(c->q); } - c->q = queuebuf_new_from_rimebuf(); + c->q = queuebuf_new_from_packetbuf(); c->interval_scaling = 0; reset_interval(c); send(c); @@ -198,8 +198,8 @@ trickle_send(struct trickle_conn *c) queuebuf_free(c->q); } c->seqno++; - rimebuf_set_attr(RIMEBUF_ATTR_EPACKET_ID, c->seqno); - c->q = queuebuf_new_from_rimebuf(); + packetbuf_set_attr(PACKETBUF_ATTR_EPACKET_ID, c->seqno); + c->q = queuebuf_new_from_packetbuf(); PRINTF("%d.%d: trickle send seqno %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], c->seqno); diff --git a/core/net/rime/trickle.h b/core/net/rime/trickle.h index 41e752a38..4f66be537 100644 --- a/core/net/rime/trickle.h +++ b/core/net/rime/trickle.h @@ -45,7 +45,7 @@ * * This file is part of the Contiki operating system. * - * $Id: trickle.h,v 1.9 2008/07/07 23:29:30 adamdunkels Exp $ + * $Id: trickle.h,v 1.10 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -62,7 +62,7 @@ #include "net/rime/ctimer.h" #include "net/rime/queuebuf.h" -#define TRICKLE_ATTRIBUTES { RIMEBUF_ATTR_EPACKET_ID, RIMEBUF_ATTR_BIT * 8 },\ +#define TRICKLE_ATTRIBUTES { PACKETBUF_ATTR_EPACKET_ID, PACKETBUF_ATTR_BIT * 8 },\ BROADCAST_ATTRIBUTES struct trickle_conn; diff --git a/core/net/rime/unicast.c b/core/net/rime/unicast.c index c6b5e4e3b..14705d1be 100644 --- a/core/net/rime/unicast.c +++ b/core/net/rime/unicast.c @@ -34,7 +34,7 @@ * * This file is part of the Contiki operating system. * - * $Id: unicast.c,v 1.1 2008/06/26 11:19:22 adamdunkels Exp $ + * $Id: unicast.c,v 1.2 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -48,10 +48,10 @@ #include "net/rime/unicast.h" #include -static const struct rimebuf_attrlist attributes[] = +static const struct packetbuf_attrlist attributes[] = { UNICAST_ATTRIBUTES - RIMEBUF_ATTR_LAST + PACKETBUF_ATTR_LAST }; #define DEBUG 0 @@ -70,9 +70,9 @@ recv_from_broadcast(struct broadcast_conn *broadcast, rimeaddr_t *from) PRINTF("%d.%d: uc: recv_from_broadcast, receiver %d.%d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_addr(RIMEBUF_ADDR_RECEIVER)->u8[0], - rimebuf_addr(RIMEBUF_ADDR_RECEIVER)->u8[1]); - if(rimeaddr_cmp(rimebuf_addr(RIMEBUF_ADDR_RECEIVER), &rimeaddr_node_addr)) { + packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0], + packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]); + if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_node_addr)) { c->u->recv(c, from); } } @@ -100,7 +100,7 @@ unicast_send(struct unicast_conn *c, const rimeaddr_t *receiver) PRINTF("%d.%d: unicast_send to %d.%d\n", rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1], receiver->u8[0], receiver->u8[1]); - rimebuf_set_addr(RIMEBUF_ADDR_RECEIVER, receiver); + packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, receiver); return broadcast_send(&c->c); } /*---------------------------------------------------------------------------*/ diff --git a/core/net/rime/unicast.h b/core/net/rime/unicast.h index cfed80cb4..4333103e4 100644 --- a/core/net/rime/unicast.h +++ b/core/net/rime/unicast.h @@ -50,7 +50,7 @@ * * This file is part of the Contiki operating system. * - * $Id: unicast.h,v 1.3 2009/03/08 21:43:24 adamdunkels Exp $ + * $Id: unicast.h,v 1.4 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -67,7 +67,7 @@ struct unicast_conn; -#define UNICAST_ATTRIBUTES { RIMEBUF_ADDR_RECEIVER, RIMEBUF_ADDRSIZE }, \ +#define UNICAST_ATTRIBUTES { PACKETBUF_ADDR_RECEIVER, PACKETBUF_ADDRSIZE }, \ BROADCAST_ATTRIBUTES struct unicast_callbacks { diff --git a/core/net/sicslowpan.c b/core/net/sicslowpan.c index 12aff099e..c8d97c666 100644 --- a/core/net/sicslowpan.c +++ b/core/net/sicslowpan.c @@ -32,7 +32,7 @@ * * This file is part of the Contiki operating system. * - * $Id: sicslowpan.c,v 1.4 2008/11/06 20:45:06 nvt-se Exp $ + * $Id: sicslowpan.c,v 1.5 2009/03/12 21:58:20 adamdunkels Exp $ */ /** * \file @@ -60,14 +60,14 @@ u8_t p; #define PRINTF(...) printf(__VA_ARGS__) #define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",lladdr->addr[0], lladdr->addr[1], lladdr->addr[2], lladdr->addr[3],lladdr->addr[4], lladdr->addr[5],lladdr->addr[6], lladdr->addr[7]) -#define PRINTRIMEBUF() PRINTF("RIME buffer: "); for(p = 0; p < rimebuf_datalen(); p++){PRINTF("%.2X", *(rime_ptr + p));} PRINTF("\n") +#define PRINTPACKETBUF() PRINTF("RIME buffer: "); for(p = 0; p < packetbuf_datalen(); p++){PRINTF("%.2X", *(rime_ptr + p));} PRINTF("\n") #define PRINTUIPBUF() PRINTF("UIP buffer: "); for(p = 0; p < uip_len; p++){PRINTF("%.2X", uip_buf[p]);}PRINTF("\n") #define PRINTSICSLOWPANBUF() PRINTF("SICSLOWPAN buffer: "); for(p = 0; p < sicslowpan_len; p++){PRINTF("%.2X", sicslowpan_buf[p]);}PRINTF("\n") #else #define PRINTF(...) #define PRINT6ADDR(addr) #define PRINTLLADDR(lladdr) -#define PRINTRIMEBUF() +#define PRINTPACKETBUF() #define PRINTUIPBUF() #define PRINTSICSLOWPANBUF() #endif /* DEBUG == 1*/ @@ -232,7 +232,7 @@ addr_context_lookup_by_number(u8_t number) { * \brief Compress IP/UDP header * * This function is called by the 6lowpan code to create a compressed - * 6lowpan packet in the rimebuf buffer from a full IPv6 packet in the + * 6lowpan packet in the packetbuf buffer from a full IPv6 packet in the * uip_buf buffer. * * @@ -598,7 +598,7 @@ uncompress_hdr_hc01(u16_t ip_len) { memcpy(&SICSLOWPAN_IP_BUF->srcipaddr, context->prefix, 8); /* infer IID from L2 address */ uip_netif_addr_autoconf_set(&SICSLOWPAN_IP_BUF->srcipaddr, - (uip_lladdr_t *)rimebuf_addr(RIMEBUF_ADDR_SENDER)); + (uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER)); break; case SICSLOWPAN_IPHC_SAM_16: if((*hc01_ptr & 0x80) == 0) { @@ -657,7 +657,7 @@ uncompress_hdr_hc01(u16_t ip_len) { memcpy(&SICSLOWPAN_IP_BUF->destipaddr, context->prefix, 8); /* infer IID from L2 address */ uip_netif_addr_autoconf_set(&SICSLOWPAN_IP_BUF->destipaddr, - (uip_lladdr_t *)rimebuf_addr(RIMEBUF_ADDR_RECEIVER)); + (uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); break; case SICSLOWPAN_IPHC_DAM_16: if((*hc01_ptr & 0x80) == 0) { @@ -738,7 +738,7 @@ uncompress_hdr_hc01(u16_t ip_len) { if(ip_len == 0) { /* This is not a fragmented packet */ SICSLOWPAN_IP_BUF->len[0] = 0; - SICSLOWPAN_IP_BUF->len[1] = rimebuf_datalen() - rime_hdr_len + uncomp_hdr_len - UIP_IPH_LEN; + SICSLOWPAN_IP_BUF->len[1] = packetbuf_datalen() - rime_hdr_len + uncomp_hdr_len - UIP_IPH_LEN; } else { /* This is a 1st fragment */ SICSLOWPAN_IP_BUF->len[0] = (ip_len - UIP_IPH_LEN) >> 8; @@ -764,7 +764,7 @@ uncompress_hdr_hc01(u16_t ip_len) { * \brief Compress IP/UDP header using HC1 and HC_UDP * * This function is called by the 6lowpan code to create a compressed - * 6lowpan packet in the rimebuf buffer from a full IPv6 packet in the + * 6lowpan packet in the packetbuf buffer from a full IPv6 packet in the * uip_buf buffer. * * @@ -924,10 +924,10 @@ uncompress_hdr_hc1(u16_t ip_len) { /* src and dest ip addresses */ uip_ip6addr(&SICSLOWPAN_IP_BUF->srcipaddr, 0xfe80, 0, 0, 0, 0, 0, 0, 0); uip_netif_addr_autoconf_set(&SICSLOWPAN_IP_BUF->srcipaddr, - (uip_lladdr_t *)rimebuf_addr(RIMEBUF_ADDR_SENDER)); + (uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER)); uip_ip6addr(&SICSLOWPAN_IP_BUF->destipaddr, 0xfe80, 0, 0, 0, 0, 0, 0, 0); uip_netif_addr_autoconf_set(&SICSLOWPAN_IP_BUF->destipaddr, - (uip_lladdr_t *)rimebuf_addr(RIMEBUF_ADDR_RECEIVER)); + (uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); uncomp_hdr_len += UIP_IPH_LEN; @@ -979,7 +979,7 @@ uncompress_hdr_hc1(u16_t ip_len) { if(ip_len == 0) { /* This is not a fragmented packet */ SICSLOWPAN_IP_BUF->len[0] = 0; - SICSLOWPAN_IP_BUF->len[1] = rimebuf_datalen() - rime_hdr_len + uncomp_hdr_len - UIP_IPH_LEN; + SICSLOWPAN_IP_BUF->len[1] = packetbuf_datalen() - rime_hdr_len + uncomp_hdr_len - UIP_IPH_LEN; } else { /* This is a 1st fragment */ SICSLOWPAN_IP_BUF->len[0] = (ip_len - UIP_IPH_LEN) >> 8; @@ -1040,10 +1040,10 @@ send_packet(rimeaddr_t *dest) { /* Set the link layer destination address for the packet as a - * rimebuf attribute. The MAC layer can access the destination - * address with the function "rimebuf_addr(RIMEBUF_ADDR_RECEIVER); + * packetbuf attribute. The MAC layer can access the destination + * address with the function "packetbuf_addr(PACKETBUF_ADDR_RECEIVER); */ - rimebuf_set_addr(RIMEBUF_ADDR_RECEIVER, dest); + packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, dest); if(mac != NULL) { /** \todo: Fix sending delays so they aren't blocking, or even better would @@ -1058,7 +1058,7 @@ send_packet(rimeaddr_t *dest) * * The IP packet is initially in uip_buf. Its header is compressed * and if necessary it is fragmented. The resulting - * packet/fragments are put in rimebuf and delivered to the 802.15.4 + * packet/fragments are put in packetbuf and delivered to the 802.15.4 * MAC. */ static u8_t @@ -1073,8 +1073,8 @@ output(uip_lladdr_t *localdest) rime_hdr_len = 0; /* reset rime buffer */ - rimebuf_clear(); - rime_ptr = rimebuf_dataptr(); + packetbuf_clear(); + rime_ptr = packetbuf_dataptr(); /* * The destination address will be tagged to each outbound @@ -1131,7 +1131,7 @@ output(uip_lladdr_t *localdest) PRINTF("(len %d, tag %d)\n", rime_payload_len, my_tag); memcpy(rime_ptr + rime_hdr_len, (void *)UIP_IP_BUF + uncomp_hdr_len, rime_payload_len); - rimebuf_set_datalen(rime_payload_len + rime_hdr_len); + packetbuf_set_datalen(rime_payload_len + rime_hdr_len); send_packet(&dest); /* set processed_ip_len to what we already sent from the IP payload*/ @@ -1159,7 +1159,7 @@ output(uip_lladdr_t *localdest) processed_ip_len >> 3, rime_payload_len, my_tag); memcpy(rime_ptr + rime_hdr_len, (void *)UIP_IP_BUF + processed_ip_len, rime_payload_len); - rimebuf_set_datalen(rime_payload_len + rime_hdr_len); + packetbuf_set_datalen(rime_payload_len + rime_hdr_len); send_packet(&dest); processed_ip_len += rime_payload_len; } @@ -1178,7 +1178,7 @@ output(uip_lladdr_t *localdest) */ memcpy(rime_ptr + rime_hdr_len, (void *)UIP_IP_BUF + uncomp_hdr_len, uip_len - uncomp_hdr_len); - rimebuf_set_datalen(uip_len - uncomp_hdr_len + rime_hdr_len); + packetbuf_set_datalen(uip_len - uncomp_hdr_len + rime_hdr_len); send_packet(&dest); } return 1; @@ -1188,7 +1188,7 @@ output(uip_lladdr_t *localdest) /** \brief Process a received 6lowpan packet. * \param r The MAC layer * - * The 6lowpan packet is put in rimebuf by the MAC. If its a frag1 or + * The 6lowpan packet is put in packetbuf by the MAC. If its a frag1 or * a non-fragmented packet we first uncompress the IP header. The * 6lowpan payload and possibly the uncompressed IP header are then * copied in siclowpan_buf. If the IP packet is complete it is copied @@ -1220,7 +1220,7 @@ input(const struct mac_driver *r) rime_hdr_len = 0; /* The MAC puts the 15.4 payload inside the RIME data buffer */ - rime_ptr = rimebuf_dataptr(); + rime_ptr = packetbuf_dataptr(); #if SICSLOWPAN_CONF_FRAG /* if reassembly timed out, cancel it */ @@ -1265,7 +1265,7 @@ input(const struct mac_driver *r) if((frag_size > 0 && (frag_size != sicslowpan_len || reass_tag != frag_tag || - !rimeaddr_cmp(&frag_sender, rimebuf_addr(RIMEBUF_ADDR_SENDER)))) || + !rimeaddr_cmp(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER)))) || frag_size == 0) { /* * the packet is a fragment that does not belong to the packet @@ -1285,7 +1285,7 @@ input(const struct mac_driver *r) timer_set(&reass_timer, SICSLOWPAN_REASS_MAXAGE*CLOCK_SECOND); PRINTF("sicslowpan input: INIT FRAGMENTATION (len %d, tag %d)\n", sicslowpan_len, reass_tag); - rimeaddr_copy(&frag_sender, rimebuf_addr(RIMEBUF_ADDR_SENDER)); + rimeaddr_copy(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER)); } } @@ -1337,7 +1337,7 @@ input(const struct mac_driver *r) * and rime_hdr_len are non 0, frag_offset is. * If this is a subsequent fragment, this is the contrary. */ - rime_payload_len = rimebuf_datalen() - rime_hdr_len; + rime_payload_len = packetbuf_datalen() - rime_hdr_len; memcpy((void *)SICSLOWPAN_IP_BUF + uncomp_hdr_len + (u16_t)(frag_offset << 3), rime_ptr + rime_hdr_len, rime_payload_len); /* update processed_ip_len if fragment, sicslowpan_len otherwise */ diff --git a/core/net/uip-over-mesh.c b/core/net/uip-over-mesh.c index bc8bb64bc..646b77cda 100644 --- a/core/net/uip-over-mesh.c +++ b/core/net/uip-over-mesh.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: uip-over-mesh.c,v 1.10 2008/11/09 12:20:56 adamdunkels Exp $ + * $Id: uip-over-mesh.c,v 1.11 2009/03/12 21:58:20 adamdunkels Exp $ */ /** @@ -80,7 +80,7 @@ static uip_ipaddr_t netaddr, netmask; static void recv_data(struct unicast_conn *c, rimeaddr_t *from) { - uip_len = rimebuf_copyto(&uip_buf[UIP_LLH_LEN]); + uip_len = packetbuf_copyto(&uip_buf[UIP_LLH_LEN]); /* uip_len = hc_inflate(&uip_buf[UIP_LLH_LEN], uip_len);*/ @@ -94,7 +94,7 @@ send_data(rimeaddr_t *next) { PRINTF("uip-over-mesh: %d.%d: send_data with len %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - rimebuf_totlen()); + packetbuf_totlen()); unicast_send(&dataconn, next); } /*---------------------------------------------------------------------------*/ @@ -106,7 +106,7 @@ new_route(struct route_discovery_conn *c, rimeaddr_t *to) if(queued_packet) { PRINTF("uip-over-mesh: new route, sending queued packet\n"); - queuebuf_to_rimebuf(queued_packet); + queuebuf_to_packetbuf(queued_packet); queuebuf_free(queued_packet); queued_packet = NULL; @@ -141,7 +141,7 @@ static void gateway_announce_recv(struct trickle_conn *c) { struct gateway_msg *msg; - msg = rimebuf_dataptr(); + msg = packetbuf_dataptr(); PRINTF("%d.%d: gateway message: %d.%d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], msg->gateway.u8[0], msg->gateway.u8[1]); @@ -163,7 +163,7 @@ uip_over_mesh_make_announced_gateway(void) rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]); uip_over_mesh_set_gateway(&rimeaddr_node_addr); rimeaddr_copy(&(msg.gateway), &rimeaddr_node_addr); - rimebuf_copyfrom(&msg, sizeof(struct gateway_msg)); + packetbuf_copyfrom(&msg, sizeof(struct gateway_msg)); trickle_send(&gateway_announce_conn); is_gateway = 1; } @@ -232,13 +232,13 @@ uip_over_mesh_send(void) /* uip_len = hc_compress(&uip_buf[UIP_LLH_LEN], uip_len);*/ - rimebuf_copyfrom(&uip_buf[UIP_LLH_LEN], uip_len); + packetbuf_copyfrom(&uip_buf[UIP_LLH_LEN], uip_len); rt = route_lookup(&receiver); if(rt == NULL) { PRINTF("uIP over mesh no route to %d.%d\n", receiver.u8[0], receiver.u8[1]); if(queued_packet == NULL) { - queued_packet = queuebuf_new_from_rimebuf(); + queued_packet = queuebuf_new_from_packetbuf(); rimeaddr_copy(&queued_receiver, &receiver); route_discovery_discover(&route_discovery, &receiver, ROUTE_TIMEOUT); } else if(!rimeaddr_cmp(&queued_receiver, &receiver)) { diff --git a/core/sys/compower.c b/core/sys/compower.c index 0d203a46f..e0e4a8f65 100644 --- a/core/sys/compower.c +++ b/core/sys/compower.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: compower.c,v 1.2 2009/03/02 22:00:41 adamdunkels Exp $ + * $Id: compower.c,v 1.3 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -46,7 +46,7 @@ #include "contiki-conf.h" #include "sys/energest.h" #include "sys/compower.h" -#include "net/rime/rimebuf.h" +#include "net/rime/packetbuf.h" struct compower_activity compower_idle_activity; @@ -81,15 +81,15 @@ compower_clear(struct compower_activity *e) void compower_attrconv(struct compower_activity *e) { - rimebuf_set_attr(RIMEBUF_ATTR_LISTEN_TIME, e->listen); - rimebuf_set_attr(RIMEBUF_ATTR_TRANSMIT_TIME, e->transmit); + packetbuf_set_attr(PACKETBUF_ATTR_LISTEN_TIME, e->listen); + packetbuf_set_attr(PACKETBUF_ATTR_TRANSMIT_TIME, e->transmit); } /*---------------------------------------------------------------------------*/ void compower_accumulate_attrs(struct compower_activity *e) { - e->listen += rimebuf_attr(RIMEBUF_ATTR_LISTEN_TIME); - e->transmit += rimebuf_attr(RIMEBUF_ATTR_TRANSMIT_TIME); + e->listen += packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME); + e->transmit += packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME); } /*---------------------------------------------------------------------------*/ /** @} */ diff --git a/core/sys/compower.h b/core/sys/compower.h index 007e0dbba..b5797a055 100644 --- a/core/sys/compower.h +++ b/core/sys/compower.h @@ -42,7 +42,7 @@ * * This file is part of the Contiki operating system. * - * $Id: compower.h,v 1.1 2009/03/01 20:32:03 adamdunkels Exp $ + * $Id: compower.h,v 1.2 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -116,7 +116,7 @@ void compower_clear(struct compower_activity *a); * * This function converts accumulated power consumption * information for a communication activity to packet - * attributes (see \ref rimebufattr "packet attributes"). + * attributes (see \ref packetbufattr "packet attributes"). */ void compower_attrconv(struct compower_activity *a); @@ -126,7 +126,7 @@ void compower_attrconv(struct compower_activity *a); * * This function accumulates power consumption information * for a communication activity from packet attributes - * (see \ref rimebufattr "packet attributes"). + * (see \ref packetbufattr "packet attributes"). */ void compower_accumulate_attrs(struct compower_activity *a); diff --git a/cpu/avr/radio/mac/sicslowmac.c b/cpu/avr/radio/mac/sicslowmac.c index f25026985..3065b8ccb 100644 --- a/cpu/avr/radio/mac/sicslowmac.c +++ b/cpu/avr/radio/mac/sicslowmac.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: sicslowmac.c,v 1.6 2008/12/10 21:26:05 c_oflynn Exp $ + * $Id: sicslowmac.c,v 1.7 2009/03/12 21:58:21 adamdunkels Exp $ */ @@ -51,7 +51,7 @@ #include #include #include -#include "net/rime/rimebuf.h" +#include "net/rime/packetbuf.h" #include "zmac.h" #include "mac.h" #include "frame.h" @@ -239,13 +239,13 @@ static uint8_t src_reversed[UIP_LLADDR_LEN]; void sicslowmac_dataIndication(void) { - rimebuf_clear(); + packetbuf_clear(); #if UIP_LLADDR_LEN == 8 /* Finally, get the stuff into the rime buffer.... */ - rimebuf_copyfrom(parsed_frame->payload, parsed_frame->payload_length); - rimebuf_set_datalen(parsed_frame->payload_length); + packetbuf_copyfrom(parsed_frame->payload, parsed_frame->payload_length); + packetbuf_set_datalen(parsed_frame->payload_length); memcpy(dest_reversed, (uint8_t *)parsed_frame->dest_addr, UIP_LLADDR_LEN); memcpy(src_reversed, (uint8_t *)parsed_frame->src_addr, UIP_LLADDR_LEN); @@ -254,13 +254,13 @@ sicslowmac_dataIndication(void) byte_reverse((uint8_t *)dest_reversed, UIP_LLADDR_LEN); byte_reverse((uint8_t *)src_reversed, UIP_LLADDR_LEN); - rimebuf_set_addr(RIMEBUF_ADDR_RECEIVER, (const rimeaddr_t *)dest_reversed); - rimebuf_set_addr(RIMEBUF_ADDR_SENDER, (const rimeaddr_t *)src_reversed); + packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (const rimeaddr_t *)dest_reversed); + packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const rimeaddr_t *)src_reversed); #elif UIP_CONF_USE_RUM /* Finally, get the stuff into the rime buffer.... */ - rimebuf_copyfrom(parsed_frame->payload + UIP_DATA_RUM_OFFSET, parsed_frame->payload_length - UIP_DATA_RUM_OFFSET); - rimebuf_set_datalen(parsed_frame->payload_length + UIP_DATA_RUM_OFFSET); + packetbuf_copyfrom(parsed_frame->payload + UIP_DATA_RUM_OFFSET, parsed_frame->payload_length - UIP_DATA_RUM_OFFSET); + packetbuf_set_datalen(parsed_frame->payload_length + UIP_DATA_RUM_OFFSET); dest_reversed[0] = MSB(parsed_frame->dest_pid); dest_reversed[1] = LSB(parsed_frame->dest_pid); @@ -278,8 +278,8 @@ sicslowmac_dataIndication(void) #else /* Finally, get the stuff into the rime buffer.... */ - rimebuf_copyfrom(parsed_frame->payload, parsed_frame->payload_length); - rimebuf_set_datalen(parsed_frame->payload_length); + packetbuf_copyfrom(parsed_frame->payload, parsed_frame->payload_length); + packetbuf_set_datalen(parsed_frame->payload_length); dest_reversed[0] = MSB(parsed_frame->dest_pid); dest_reversed[1] = LSB(parsed_frame->dest_pid); @@ -295,8 +295,8 @@ sicslowmac_dataIndication(void) src_reversed[4] = MSB(parsed_frame->src_addr->addr16); src_reversed[5] = LSB(parsed_frame->src_addr->addr16); - rimebuf_set_addr(RIMEBUF_ADDR_RECEIVER, (const rimeaddr_t *)dest_reversed); - rimebuf_set_addr(RIMEBUF_ADDR_SENDER, (const rimeaddr_t *)src_reversed); + packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (const rimeaddr_t *)dest_reversed); + packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const rimeaddr_t *)src_reversed); #endif @@ -309,11 +309,11 @@ sicslowmac_unknownIndication(void) { if (sicslowmac_snifferhook) { - rimebuf_clear(); + packetbuf_clear(); /* Finally, get the stuff into the rime buffer.... */ - rimebuf_copyfrom(parsed_frame->payload, parsed_frame->payload_length); - rimebuf_set_datalen(parsed_frame->payload_length); + packetbuf_copyfrom(parsed_frame->payload, parsed_frame->payload_length); + packetbuf_set_datalen(parsed_frame->payload_length); #if UIP_LLADDR_LEN == 8 memcpy(dest_reversed, (uint8_t *)parsed_frame->dest_addr, UIP_LLADDR_LEN); @@ -323,8 +323,8 @@ sicslowmac_unknownIndication(void) byte_reverse((uint8_t *)dest_reversed, UIP_LLADDR_LEN); byte_reverse((uint8_t *)src_reversed, UIP_LLADDR_LEN); - rimebuf_set_addr(RIMEBUF_ADDR_RECEIVER, (const rimeaddr_t *)dest_reversed); - rimebuf_set_addr(RIMEBUF_ADDR_SENDER, (const rimeaddr_t *)src_reversed); + packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (const rimeaddr_t *)dest_reversed); + packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const rimeaddr_t *)src_reversed); #elif UIP_CONF_USE_RUM @@ -358,8 +358,8 @@ sicslowmac_unknownIndication(void) src_reversed[4] = MSB(parsed_frame->src_addr->addr16); src_reversed[5] = LSB(parsed_frame->src_addr->addr16); - rimebuf_set_addr(RIMEBUF_ADDR_RECEIVER, (const rimeaddr_t *)dest_reversed); - rimebuf_set_addr(RIMEBUF_ADDR_SENDER, (const rimeaddr_t *)src_reversed); + packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (const rimeaddr_t *)dest_reversed); + packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const rimeaddr_t *)src_reversed); #endif @@ -401,13 +401,13 @@ sicslowmac_dataRequest(void) frame_result_t result; /* Save the msduHandle in a global variable. */ - msduHandle = rimebuf_attr(RIMEBUF_ATTR_PACKET_ID); + msduHandle = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID); /* Build the FCF. */ params.fcf.frameType = DATAFRAME; params.fcf.securityEnabled = false; params.fcf.framePending = false; - params.fcf.ackRequired = rimebuf_attr(RIMEBUF_ATTR_RELIABLE); + params.fcf.ackRequired = packetbuf_attr(PACKETBUF_ATTR_RELIABLE); params.fcf.panIdCompression = false; /* Insert IEEE 802.15.4 (2003) version bit. */ @@ -428,7 +428,7 @@ sicslowmac_dataRequest(void) * If the output address is NULL in the Rime buf, then it is broadcast * on the 802.15.4 network. */ - if(rimeaddr_cmp(rimebuf_addr(RIMEBUF_ADDR_RECEIVER), &rimeaddr_null) ) { + if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null) ) { /* Broadcast requires short address mode. */ params.fcf.destAddrMode = SHORTADDRMODE; params.dest_pid = BROADCASTPANDID; @@ -437,7 +437,7 @@ sicslowmac_dataRequest(void) } else { /* Phase 1.5 - end nodes send to anyone? */ - memcpy(¶ms.dest_addr, (uint8_t *)rimebuf_addr(RIMEBUF_ADDR_RECEIVER), LONG_ADDR_LEN); + memcpy(¶ms.dest_addr, (uint8_t *)packetbuf_addr(PACKETBUF_ADDR_RECEIVER), LONG_ADDR_LEN); /* Change from sicslowpan byte arrangement to sicslowmac */ byte_reverse((uint8_t*)¶ms.dest_addr.addr64, LONG_ADDR_LEN); @@ -457,8 +457,8 @@ sicslowmac_dataRequest(void) params.src_addr.addr64 = ieee15_4ManagerAddress.get_long_addr(); /* Copy the payload data. */ - params.payload_len = rimebuf_datalen(); - params.payload = rimebuf_dataptr(); + params.payload_len = packetbuf_datalen(); + params.payload = packetbuf_dataptr(); /* Create transmission frame. */ frame_tx_create(¶ms, &result); diff --git a/doc/sicslowpan-doc.txt b/doc/sicslowpan-doc.txt index b15a704e3..9e3c64f85 100644 --- a/doc/sicslowpan-doc.txt +++ b/doc/sicslowpan-doc.txt @@ -117,10 +117,10 @@ At packet reception, the link-layer copies the 802.15.4 payload in the rime buffer, and sets its length. It also stores the source and destination link-layer addresses as two rime addresses. \code -rimebuf_copyfrom(&rx_frame.payload, rx_frame.payload_length); -rimebuf_set_datalen(rx_frame.payload_length); -rimebuf_set_addr(RIMEBUF_ADDR_RECEIVER, (const rimeaddr_t *)&rx_frame.dest_addr); -rimebuf_set_addr(RIMEBUF_ADDR_SENDER, (const rimeaddr_t *)&rx_frame.src_addr); +packetbuf_copyfrom(&rx_frame.payload, rx_frame.payload_length); +packetbuf_set_datalen(rx_frame.payload_length); +packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (const rimeaddr_t *)&rx_frame.dest_addr); +packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const rimeaddr_t *)&rx_frame.src_addr); \endcode It then calls the sicslowpan #input function. Similarly, when the IPv6 layer has a packet to send over the radio, it puts the packet in uip_buf, diff --git a/examples/compile-platforms/Makefile b/examples/compile-platforms/Makefile index 3e3191a6d..efb3de150 100644 --- a/examples/compile-platforms/Makefile +++ b/examples/compile-platforms/Makefile @@ -11,6 +11,9 @@ msp430: sky.platform esb.platform # msb430.platform native: native.platform netsim.platform minimal-net.platform avr: avr-raven.platform +clean: + @rm -rf [a-z]* + %.platform: @mkdir -p $* @cp *.c $* diff --git a/examples/energest-demo/energest-demo.c b/examples/energest-demo/energest-demo.c index d5a394d5a..8a6ce7de2 100644 --- a/examples/energest-demo/energest-demo.c +++ b/examples/energest-demo/energest-demo.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: energest-demo.c,v 1.7 2008/07/02 09:05:41 adamdunkels Exp $ + * $Id: energest-demo.c,v 1.8 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -100,7 +100,7 @@ static int send_amount = 10; static void abc_recv(struct abc_conn *c) { - struct energy_time *incoming= (struct energy_time *)rimebuf_dataptr(); + struct energy_time *incoming= (struct energy_time *)packetbuf_dataptr(); read++; if(node_id == SINK_ID) { printf("%i SICS %i %u %li %li %li %li\n", node_id, read, @@ -129,7 +129,7 @@ do_sending(void) cc2420_set_txpower(1); for(i = 0;i < send_amount; i++) { - rimebuf_copyfrom(send_string, send_length); + packetbuf_copyfrom(send_string, send_length); mac->on(); abc_send(&abc); @@ -196,7 +196,7 @@ PROCESS_THREAD(output_process, ev, data) /* printf("%i SICS %i %i %li %li %li %li\n", node_id, send, */ /* diff.source, diff.cpu, diff.lpm, diff.transmit, diff.listen); */ - rimebuf_copyfrom((char*)&diff, sizeof(diff)); + packetbuf_copyfrom((char*)&diff, sizeof(diff)); mac->on(); abc_send(&abc); diff --git a/examples/esb/radio-test.c b/examples/esb/radio-test.c index edbc304ec..93100ab84 100644 --- a/examples/esb/radio-test.c +++ b/examples/esb/radio-test.c @@ -26,14 +26,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: radio-test.c,v 1.1 2007/11/28 23:10:38 nifi Exp $ + * $Id: radio-test.c,v 1.2 2009/03/12 21:58:21 adamdunkels Exp $ * * ----------------------------------------------------------------- * * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne * Created : 2006-03-07 - * Updated : $Date: 2007/11/28 23:10:38 $ - * $Revision: 1.1 $ + * Updated : $Date: 2009/03/12 21:58:21 $ + * $Revision: 1.2 $ * * Simple application to indicate connectivity between two nodes: * @@ -88,15 +88,15 @@ static void abc_recv(struct abc_conn *c) { /* packet received */ - if(rimebuf_datalen() < PACKET_SIZE - || strncmp((char *)rimebuf_dataptr(), HEADER, sizeof(HEADER))) { + if(packetbuf_datalen() < PACKET_SIZE + || strncmp((char *)packetbuf_dataptr(), HEADER, sizeof(HEADER))) { /* invalid message */ leds_blink(); } else { PROCESS_CONTEXT_BEGIN(&radio_test_process); set(&recv, ON); - set(&other, ((char *)rimebuf_dataptr())[sizeof(HEADER)] ? ON : OFF); + set(&other, ((char *)packetbuf_dataptr())[sizeof(HEADER)] ? ON : OFF); /* synchronize the sending to keep the nodes from sending simultaneously */ @@ -131,10 +131,10 @@ PROCESS_THREAD(radio_test_process, ev, data) etimer_reset(&send_timer); /* send packet */ - rimebuf_copyfrom(HEADER, sizeof(HEADER)); - ((char *)rimebuf_dataptr())[sizeof(HEADER)] = recv.onoff; + packetbuf_copyfrom(HEADER, sizeof(HEADER)); + ((char *)packetbuf_dataptr())[sizeof(HEADER)] = recv.onoff; /* send arbitrary data to fill the packet size */ - rimebuf_set_datalen(PACKET_SIZE); + packetbuf_set_datalen(PACKET_SIZE); set(&flash, ON); abc_send(&abc); diff --git a/examples/rime/example-abc.c b/examples/rime/example-abc.c index 844a61d7f..19da07006 100644 --- a/examples/rime/example-abc.c +++ b/examples/rime/example-abc.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: example-abc.c,v 1.4 2009/02/07 22:38:01 adamdunkels Exp $ + * $Id: example-abc.c,v 1.5 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -53,7 +53,7 @@ AUTOSTART_PROCESSES(&example_abc_process); static void abc_recv(struct abc_conn *c) { - printf("abc message received '%s'\n", (char *)rimebuf_dataptr()); + printf("abc message received '%s'\n", (char *)packetbuf_dataptr()); } static const struct abc_callbacks abc_call = {abc_recv}; static struct abc_conn abc; @@ -74,7 +74,7 @@ PROCESS_THREAD(example_abc_process, ev, data) PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - rimebuf_copyfrom("Hello", 6); + packetbuf_copyfrom("Hello", 6); abc_send(&abc); printf("abc message sent\n"); diff --git a/examples/rime/example-collect.c b/examples/rime/example-collect.c index f15e58ace..2e9e61540 100644 --- a/examples/rime/example-collect.c +++ b/examples/rime/example-collect.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: example-collect.c,v 1.7 2009/03/10 14:36:48 zhitao Exp $ + * $Id: example-collect.c,v 1.8 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -60,8 +60,8 @@ recv(const rimeaddr_t *originator, uint8_t seqno, uint8_t hops) printf("Sink got message from %d.%d, seqno %d, hops %d: len %d '%s'\n", originator->u8[0], originator->u8[1], seqno, hops, - rimebuf_datalen(), - (char *)rimebuf_dataptr()); + packetbuf_datalen(), + (char *)packetbuf_dataptr()); } /*---------------------------------------------------------------------------*/ @@ -88,8 +88,8 @@ PROCESS_THREAD(example_collect_process, ev, data) PROCESS_PAUSE(); } printf("Sending\n"); - rimebuf_clear(); - rimebuf_set_datalen(sprintf(rimebuf_dataptr(), + packetbuf_clear(); + packetbuf_set_datalen(sprintf(packetbuf_dataptr(), "%s", "Hello") + 1); collect_send(&tc, 4); } diff --git a/examples/rime/example-mesh.c b/examples/rime/example-mesh.c index 5fdf0cb81..7a4765f89 100644 --- a/examples/rime/example-mesh.c +++ b/examples/rime/example-mesh.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: example-mesh.c,v 1.3 2009/01/19 13:24:42 nifi Exp $ + * $Id: example-mesh.c,v 1.4 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -68,9 +68,9 @@ recv(struct mesh_conn *c, rimeaddr_t *from, uint8_t hops) { printf("Data received from %d.%d: %.*s (%d)\n", from->u8[0], from->u8[1], - rimebuf_datalen(), (char *)rimebuf_dataptr(), rimebuf_datalen()); + packetbuf_datalen(), (char *)packetbuf_dataptr(), packetbuf_datalen()); - rimebuf_copyfrom("Hopp", 4); + packetbuf_copyfrom("Hopp", 4); mesh_send(&mesh, from); } @@ -100,7 +100,7 @@ PROCESS_THREAD(example_mesh_process, ev, data) * 6. */ - rimebuf_copyfrom("Hej", 3); + packetbuf_copyfrom("Hej", 3); addr.u8[0] = 161; addr.u8[1] = 161; mesh_send(&mesh, &addr); diff --git a/examples/rime/example-meshconn.c b/examples/rime/example-meshconn.c index 748095adf..2ee7ecfa6 100644 --- a/examples/rime/example-meshconn.c +++ b/examples/rime/example-meshconn.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: example-meshconn.c,v 1.1 2008/01/25 18:00:50 adamdunkels Exp $ + * $Id: example-meshconn.c,v 1.2 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -77,7 +77,7 @@ static void recv(struct meshconn_conn *c) { printf("Data received from %.*s (%d)\n", - rimebuf_datalen(), (char *)rimebuf_dataptr(), rimebuf_datalen()); + packetbuf_datalen(), (char *)packetbuf_dataptr(), packetbuf_datalen()); /* meshconn_send(&meshconn, from);*/ } @@ -116,7 +116,7 @@ PROCESS_THREAD(test_meshconn_process, ev, data) addr.u8[1] = 0; meshconn_connect(&meshconn, addr); - rimebuf_copyfrom("Hej", 3); + packetbuf_copyfrom("Hej", 3); meshconn_send(&meshconn, &addr); } PROCESS_END(); diff --git a/examples/rime/example-multihop.c b/examples/rime/example-multihop.c index a082a9767..f925f2831 100644 --- a/examples/rime/example-multihop.c +++ b/examples/rime/example-multihop.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: example-multihop.c,v 1.2 2009/01/16 17:40:16 nifi Exp $ + * $Id: example-multihop.c,v 1.3 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -54,13 +54,13 @@ static void recv(struct multihop_conn *c, rimeaddr_t *sender, rimeaddr_t *prevhop, uint8_t hops) { - printf("multihop message received '%s'\n", (char *)rimebuf_dataptr()); + printf("multihop message received '%s'\n", (char *)packetbuf_dataptr()); } static rimeaddr_t * forward(struct multihop_conn *c, rimeaddr_t *originator, rimeaddr_t *dest, rimeaddr_t *prevhop, uint8_t hops) { - printf("Forwarding message '%s'\n", (char *)rimebuf_dataptr()); + printf("Forwarding message '%s'\n", (char *)packetbuf_dataptr()); return NULL; } static const struct multihop_callbacks multihop_call = {recv, forward}; @@ -82,7 +82,7 @@ PROCESS_THREAD(example_multihop_process, ev, data) PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - rimebuf_copyfrom("Hej", 4); + packetbuf_copyfrom("Hej", 4); to.u8[0] = 161; to.u8[1] = 161; multihop_send(&multihop, &to); diff --git a/examples/rime/example-polite.c b/examples/rime/example-polite.c index ee1b02cbd..054e49a1e 100644 --- a/examples/rime/example-polite.c +++ b/examples/rime/example-polite.c @@ -11,7 +11,7 @@ AUTOSTART_PROCESSES(&example_polite_process); static void recv(struct polite_conn *c) { - printf("recv '%s'\n", (char *)rimebuf_dataptr()); + printf("recv '%s'\n", (char *)packetbuf_dataptr()); } static void sent(struct polite_conn *c) @@ -39,7 +39,7 @@ PROCESS_THREAD(example_polite_process, ev, data) static struct etimer et; etimer_set(&et, CLOCK_SECOND * 4); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - rimebuf_copyfrom("Hej", 4); + packetbuf_copyfrom("Hej", 4); polite_send(&c, CLOCK_SECOND * 4, 4); diff --git a/examples/rime/example-runicast.c b/examples/rime/example-runicast.c index 82f237a01..fa3603746 100644 --- a/examples/rime/example-runicast.c +++ b/examples/rime/example-runicast.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: example-runicast.c,v 1.3 2009/03/03 12:28:39 fros4943 Exp $ + * $Id: example-runicast.c,v 1.4 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -144,7 +144,7 @@ PROCESS_THREAD(test_runicast_process, ev, data) if(!runicast_is_transmitting(&runicast)) { rimeaddr_t recv; - rimebuf_copyfrom("Hello", 5); + packetbuf_copyfrom("Hello", 5); recv.u8[0] = 1; recv.u8[1] = 0; diff --git a/examples/rime/example-trickle.c b/examples/rime/example-trickle.c index b0a821e9a..036c74009 100644 --- a/examples/rime/example-trickle.c +++ b/examples/rime/example-trickle.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: example-trickle.c,v 1.1 2008/01/25 18:00:51 adamdunkels Exp $ + * $Id: example-trickle.c,v 1.2 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -55,7 +55,7 @@ trickle_recv(struct trickle_conn *c) { printf("%d.%d: trickle message received '%s'\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - (char *)rimebuf_dataptr()); + (char *)packetbuf_dataptr()); } const static struct trickle_callbacks trickle_call = {trickle_recv}; static struct trickle_conn trickle; @@ -72,7 +72,7 @@ PROCESS_THREAD(example_trickle_process, ev, data) PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event && data == &button_sensor); - rimebuf_copyfrom("Hello, world", 13); + packetbuf_copyfrom("Hello, world", 13); trickle_send(&trickle); } diff --git a/examples/rime/example-unicast.c b/examples/rime/example-unicast.c index b7c094377..dfefa43ff 100644 --- a/examples/rime/example-unicast.c +++ b/examples/rime/example-unicast.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: example-unicast.c,v 1.1 2008/06/26 11:20:22 adamdunkels Exp $ + * $Id: example-unicast.c,v 1.2 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -76,7 +76,7 @@ PROCESS_THREAD(example_unicast_process, ev, data) PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - rimebuf_copyfrom("Hello", 5); + packetbuf_copyfrom("Hello", 5); addr.u8[0] = 41; addr.u8[1] = 41; unicast_send(&uc, &addr); diff --git a/examples/sky-shell/sky-checkpoint.c b/examples/sky-shell/sky-checkpoint.c index bb166395e..69e6cff58 100644 --- a/examples/sky-shell/sky-checkpoint.c +++ b/examples/sky-shell/sky-checkpoint.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: sky-checkpoint.c,v 1.1 2009/02/14 22:53:00 adamdunkels Exp $ + * $Id: sky-checkpoint.c,v 1.2 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -75,11 +75,11 @@ input_sniffer(void) int i; uint8_t *dataptr; - printf("x %d ", rimebuf_totlen()); - dataptr = rimebuf_dataptr(); + printf("x %d ", packetbuf_totlen()); + dataptr = packetbuf_dataptr(); printf("%02x ", dataptr[0]); /* if(dataptr[0] == 18) {*/ - for(i = 1; i < rimebuf_totlen(); ++i) { + for(i = 1; i < packetbuf_totlen(); ++i) { printf("%02x ", dataptr[i]); } /* }*/ @@ -90,8 +90,8 @@ static void output_sniffer(void) { uint8_t *dataptr; - printf("- %d ", rimebuf_totlen()); - dataptr = rimebuf_dataptr(); + printf("- %d ", packetbuf_totlen()); + dataptr = packetbuf_dataptr(); printf("%02x\n", dataptr[0]); } /*---------------------------------------------------------------------------*/ diff --git a/examples/sky-shell/sky-shell.c b/examples/sky-shell/sky-shell.c index aa642e64b..98ff16181 100644 --- a/examples/sky-shell/sky-shell.c +++ b/examples/sky-shell/sky-shell.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: sky-shell.c,v 1.9 2009/02/14 22:53:00 adamdunkels Exp $ + * $Id: sky-shell.c,v 1.10 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -75,11 +75,11 @@ input_sniffer(void) int i; uint8_t *dataptr; - printf("x %d ", rimebuf_totlen()); - dataptr = rimebuf_dataptr(); + printf("x %d ", packetbuf_totlen()); + dataptr = packetbuf_dataptr(); printf("%02x ", dataptr[0]); /* if(dataptr[0] == 18) {*/ - for(i = 1; i < rimebuf_totlen(); ++i) { + for(i = 1; i < packetbuf_totlen(); ++i) { printf("%02x ", dataptr[i]); } /* }*/ @@ -90,8 +90,8 @@ static void output_sniffer(void) { uint8_t *dataptr; - printf("- %d ", rimebuf_totlen()); - dataptr = rimebuf_dataptr(); + printf("- %d ", packetbuf_totlen()); + dataptr = packetbuf_dataptr(); printf("%02x\n", dataptr[0]); } /*---------------------------------------------------------------------------*/ diff --git a/examples/sky/radio-test.c b/examples/sky/radio-test.c index 7eb81f750..46c1ad34e 100644 --- a/examples/sky/radio-test.c +++ b/examples/sky/radio-test.c @@ -26,14 +26,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: radio-test.c,v 1.4 2008/07/09 21:49:20 nifi Exp $ + * $Id: radio-test.c,v 1.5 2009/03/12 21:58:21 adamdunkels Exp $ * * ----------------------------------------------------------------- * * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne * Created : 2006-03-07 - * Updated : $Date: 2008/07/09 21:49:20 $ - * $Revision: 1.4 $ + * Updated : $Date: 2009/03/12 21:58:21 $ + * $Revision: 1.5 $ * * Simple application to indicate connectivity between two nodes: * @@ -91,14 +91,14 @@ static void abc_recv(struct abc_conn *c) { /* packet received */ - if(rimebuf_datalen() < PACKET_SIZE - || strncmp((char *)rimebuf_dataptr(), HEADER, sizeof(HEADER))) { + if(packetbuf_datalen() < PACKET_SIZE + || strncmp((char *)packetbuf_dataptr(), HEADER, sizeof(HEADER))) { /* invalid message */ } else { PROCESS_CONTEXT_BEGIN(&radio_test_process); set(&recv, ON); - set(&other, ((char *)rimebuf_dataptr())[sizeof(HEADER)] ? ON : OFF); + set(&other, ((char *)packetbuf_dataptr())[sizeof(HEADER)] ? ON : OFF); /* synchronize the sending to keep the nodes from sending simultaneously */ @@ -137,10 +137,10 @@ PROCESS_THREAD(radio_test_process, ev, data) etimer_reset(&send_timer); /* send packet */ - rimebuf_copyfrom(HEADER, sizeof(HEADER)); - ((char *)rimebuf_dataptr())[sizeof(HEADER)] = recv.onoff; + packetbuf_copyfrom(HEADER, sizeof(HEADER)); + ((char *)packetbuf_dataptr())[sizeof(HEADER)] = recv.onoff; /* send arbitrary data to fill the packet size */ - rimebuf_set_datalen(PACKET_SIZE); + packetbuf_set_datalen(PACKET_SIZE); set(&flash, ON); abc_send(&abc); diff --git a/examples/sky/sky-collect.c b/examples/sky/sky-collect.c index f58c22bbd..42f155b98 100644 --- a/examples/sky/sky-collect.c +++ b/examples/sky/sky-collect.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: sky-collect.c,v 1.8 2008/12/02 08:09:46 adamdunkels Exp $ + * $Id: sky-collect.c,v 1.9 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -164,7 +164,7 @@ recv(const rimeaddr_t *originator, uint8_t seqno, uint8_t hops) { struct sky_collect_msg *msg; - msg = rimebuf_dataptr(); + msg = packetbuf_dataptr(); printf("%u %u %u %u %u %u %u %u %u %u %u %lu %lu %lu %lu %lu ", (originator->u8[1] << 8) + originator->u8[0], seqno, hops, @@ -213,9 +213,9 @@ PROCESS_THREAD(test_collect_process, ev, data) struct sky_collect_msg *msg; struct neighbor *n; /* leds_toggle(LEDS_BLUE);*/ - rimebuf_clear(); - msg = (struct sky_collect_msg *)rimebuf_dataptr(); - rimebuf_set_datalen(sizeof(struct sky_collect_msg)); + packetbuf_clear(); + msg = (struct sky_collect_msg *)packetbuf_dataptr(); + packetbuf_set_datalen(sizeof(struct sky_collect_msg)); msg->light1 = sensors_light1(); msg->light2 = sensors_light2(); msg->temperature = sht11_temp(); diff --git a/platform/avr-raven/contiki-conf.h b/platform/avr-raven/contiki-conf.h index 3bf57879b..51daaaa3f 100644 --- a/platform/avr-raven/contiki-conf.h +++ b/platform/avr-raven/contiki-conf.h @@ -70,7 +70,7 @@ typedef int32_t s32_t; #define CLIF #define RIMEADDR_CONF_SIZE 8 -#define RIMEBUF_CONF_HDR_SIZE 0 +#define PACKETBUF_CONF_HDR_SIZE 0 /* 0 for IPv6, or 1 for HC1, 2 for HC01 */ #define SICSLOWPAN_CONF_COMPRESSION_IPV6 0 diff --git a/platform/avr-ravenusb/sicslow_ethernet.c b/platform/avr-ravenusb/sicslow_ethernet.c index b8d5b86a4..b3b14458a 100644 --- a/platform/avr-ravenusb/sicslow_ethernet.c +++ b/platform/avr-ravenusb/sicslow_ethernet.c @@ -330,12 +330,12 @@ void mac_LowpanToEthernet(void) } else { //Otherwise we have a real address mac_createEthernetAddr((uint8_t *) &(ETHBUF(uip_buf)->dest.addr[0]), - (uip_lladdr_t *)rimebuf_addr(RIMEBUF_ADDR_RECEIVER)); + (uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); } mac_createEthernetAddr((uint8_t *) &(ETHBUF(uip_buf)->src.addr[0]), - (uip_lladdr_t *)rimebuf_addr(RIMEBUF_ADDR_SENDER)); + (uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER)); //We only do address translation in network mode! if (usbstick_mode.translate) { @@ -731,7 +731,7 @@ void slide(uint8_t * data, uint8_t length, int16_t slide) /** \brief Process a received 6lowpan packet. Hijack function. * \param r The MAC layer * - * The 6lowpan packet is put in rimebuf by the MAC. This routine calls + * The 6lowpan packet is put in packetbuf by the MAC. This routine calls * any other needed layers (either 6lowpan, or just raw ethernet dump) */ void mac_ethhijack(const struct mac_driver *r) @@ -830,7 +830,7 @@ void mac_logTXtoEthernet(frame_create_params_t *p,frame_result_t *frame_result) /** \brief Process a received 6lowpan packet. * \param r The MAC layer * - * The 6lowpan packet is put in rimebuf by the MAC. This routine passes + * The 6lowpan packet is put in packetbuf by the MAC. This routine passes * it directly to the ethernet layer without decompressing. */ void mac_802154raw(const struct mac_driver *r) @@ -861,12 +861,12 @@ void mac_802154raw(const struct mac_driver *r) //Otherwise we have a real address mac_createEthernetAddr((uint8_t *) &(ETHBUF(raw_buf)->dest.addr[0]), - (uip_lladdr_t *)rimebuf_addr(RIMEBUF_ADDR_RECEIVER)); + (uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); } mac_createEthernetAddr((uint8_t *) &(ETHBUF(raw_buf)->src.addr[0]), - (uip_lladdr_t *)rimebuf_addr(RIMEBUF_ADDR_SENDER)); + (uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER)); PRINTF("Low2Eth: Sending 802.15.4 packet to ethernet\n"); diff --git a/platform/avr-rcb/contiki-conf.h b/platform/avr-rcb/contiki-conf.h index 0447d6c4b..313f11fb8 100644 --- a/platform/avr-rcb/contiki-conf.h +++ b/platform/avr-rcb/contiki-conf.h @@ -71,7 +71,7 @@ typedef int32_t s32_t; #define CLIF #define RIMEADDR_CONF_SIZE 8 -#define RIMEBUF_CONF_HDR_SIZE 0 +#define PACKETBUF_CONF_HDR_SIZE 0 /* 0 for IPv6, or 1 for HC1, 2 for HC01 */ #define SICSLOWPAN_CONF_COMPRESSION_IPV6 0 diff --git a/platform/avr-zigbit/contiki-conf.h b/platform/avr-zigbit/contiki-conf.h index c1ef019ca..005d37429 100644 --- a/platform/avr-zigbit/contiki-conf.h +++ b/platform/avr-zigbit/contiki-conf.h @@ -74,7 +74,7 @@ typedef int32_t s32_t; #define CLIF #define RIMEADDR_CONF_SIZE 8 -#define RIMEBUF_CONF_HDR_SIZE 0 +#define PACKETBUF_CONF_HDR_SIZE 0 /* 0 for IPv6, or 1 for HC1, 2 for HC01 */ #define SICSLOWPAN_CONF_COMPRESSION_IPV6 0 diff --git a/platform/esb/contiki-conf.h b/platform/esb/contiki-conf.h index 9c0860008..99ab57de5 100644 --- a/platform/esb/contiki-conf.h +++ b/platform/esb/contiki-conf.h @@ -1,7 +1,7 @@ #ifndef __CONTIKI_CONF_H__ #define __CONTIKI_CONF_H__ -#define RIMEBUF_CONF_ATTRS_INLINE 1 +#define PACKETBUF_CONF_ATTRS_INLINE 1 #define QUEUEBUF_CONF_NUM 1 #define QUEUEBUF_CONF_REF_NUM 1 #define ROUTE_CONF_ENTRIES 4 diff --git a/platform/msb430/apps/test-abc.c b/platform/msb430/apps/test-abc.c index 52c3908af..bc03108ef 100644 --- a/platform/msb430/apps/test-abc.c +++ b/platform/msb430/apps/test-abc.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: test-abc.c,v 1.3 2007/11/06 14:48:18 nvt-se Exp $ + * $Id: test-abc.c,v 1.4 2009/03/12 21:58:21 adamdunkels Exp $ */ /** @@ -53,11 +53,11 @@ abc_recv(struct abc_conn *c) char *s; int i; - s = rimebuf_dataptr(); + s = packetbuf_dataptr(); - printf("abc message received '%s'\n", (char *)rimebuf_dataptr()); - printf("message length: %u\n", rimebuf_datalen()); - for (i = 0; i < rimebuf_datalen(); i++) { + printf("abc message received '%s'\n", (char *)packetbuf_dataptr()); + printf("message length: %u\n", packetbuf_datalen()); + for (i = 0; i < packetbuf_datalen(); i++) { printf("0x%x ", s[i]); } printf("\n"); @@ -83,7 +83,7 @@ PROCESS_THREAD(test_abc_process, ev, data) PROCESS_WAIT_EVENT(); if (etimer_expired(&et)) { len = snprintf(buf, sizeof (buf), "%u", ++i); - rimebuf_copyfrom(buf, len + 1); + packetbuf_copyfrom(buf, len + 1); abc_send(&abc); } } diff --git a/platform/netsim/contiki-conf.h b/platform/netsim/contiki-conf.h index b175c8ecb..cf0040855 100644 --- a/platform/netsim/contiki-conf.h +++ b/platform/netsim/contiki-conf.h @@ -35,7 +35,7 @@ * * This file is part of the Contiki desktop OS * - * $Id: contiki-conf.h,v 1.10 2008/05/14 19:19:29 adamdunkels Exp $ + * $Id: contiki-conf.h,v 1.11 2009/03/12 21:58:21 adamdunkels Exp $ * */ @@ -107,8 +107,8 @@ typedef unsigned long clock_time_t; /*------------------------------------------------------------------------------*/ -#define RIMEBUF_CONF_SIZE 128 -#define RIMEBUF_CONF_HDR_SIZE 32 +#define PACKETBUF_CONF_SIZE 128 +#define PACKETBUF_CONF_HDR_SIZE 32 #define UIP_CONF_UIP_IP4ADDR_T_WITH_U32 1 diff --git a/platform/netsim/net/ethernode-rime.c b/platform/netsim/net/ethernode-rime.c index 7addba817..d6088aaa3 100644 --- a/platform/netsim/net/ethernode-rime.c +++ b/platform/netsim/net/ethernode-rime.c @@ -30,7 +30,7 @@ * * Author: Adam Dunkels * - * $Id: ethernode-rime.c,v 1.6 2007/05/22 21:09:19 adamdunkels Exp $ + * $Id: ethernode-rime.c,v 1.7 2009/03/12 21:58:21 adamdunkels Exp $ */ #include "contiki.h" @@ -53,12 +53,12 @@ receiver(void) { u8_t len; - rimebuf_clear(); + packetbuf_clear(); - len = ethernode_read(rimebuf_dataptr(), RIMEBUF_SIZE); + len = ethernode_read(packetbuf_dataptr(), PACKETBUF_SIZE); if(len > 0) { - rimebuf_set_datalen(len); + packetbuf_set_datalen(len); rime_input(); } } @@ -66,7 +66,7 @@ receiver(void) void ethernode_rime_send(void) { - ethernode_send_buf(rimebuf_hdrptr(), rimebuf_totlen()); + ethernode_send_buf(packetbuf_hdrptr(), packetbuf_totlen()); } /*---------------------------------------------------------------------------*/ void diff --git a/platform/sky/contiki-conf.h b/platform/sky/contiki-conf.h index aa8998f36..61215ad2e 100644 --- a/platform/sky/contiki-conf.h +++ b/platform/sky/contiki-conf.h @@ -1,5 +1,5 @@ /* -*- C -*- */ -/* @(#)$Id: contiki-conf.h,v 1.40 2009/03/09 08:19:07 julienabeille Exp $ */ +/* @(#)$Id: contiki-conf.h,v 1.41 2009/03/12 21:58:21 adamdunkels Exp $ */ #ifndef CONTIKI_CONF_H #define CONTIKI_CONF_H @@ -8,7 +8,7 @@ #define XMAC_CONF_ANNOUNCEMENTS 1 #define RIME_CONF_NO_POLITE_ANNOUCEMENTS 1 -#define RIMEBUF_CONF_ATTRS_INLINE 1 +#define PACKETBUF_CONF_ATTRS_INLINE 1 #define SHELL_VARS_CONF_RAM_BEGIN 0x1100 #define SHELL_VARS_CONF_RAM_END 0x2000 diff --git a/tools/sky/check-size b/tools/sky/check-size index aca64c8e5..fc0bb9429 100755 --- a/tools/sky/check-size +++ b/tools/sky/check-size @@ -1,7 +1,7 @@ #!/usr/bin/perl @rime = ( "abc", "collect", "ctimer", "ibc", "ipolite", "mesh", "meshconn", "mh", "neighbor-discovery", "neighbor", "nf", "polite", "queuebuf", - "rime", "rimeaddr", "rimebuf", "rimestats", "rmesh", "rmh", + "rime", "rimeaddr", "packetbuf", "rimestats", "rmesh", "rmh", "route-discovery", "route", "ruc", "rucb", "rudolph0", "rudolph1", "rudolph2", "sabc", "sibc", "suc", "trickle", "uc", "timesynch", "nullmac", "xmac" );