44 #define MAX_TRANSMISSIONS 8
49 #define PRINTF(...) printf(__VA_ARGS__)
55 read_data(
struct rucb_conn *c)
59 if(c->u->read_chunk) {
60 len = c->u->read_chunk(c, c->chunk * RUCB_DATASIZE,
68 acked(
struct runicast_conn *ruc,
const linkaddr_t *to, uint8_t retransmissions)
70 struct rucb_conn *c = (
struct rucb_conn *)ruc;
72 PRINTF(
"%d.%d: rucb acked\n",
76 if(len == 0 && c->last_size == 0) {
82 runicast_send(&c->c, &c->receiver, MAX_TRANSMISSIONS);
89 timedout(
struct runicast_conn *ruc,
const linkaddr_t *to, uint8_t retransmissions)
91 struct rucb_conn *c = (
struct rucb_conn *)ruc;
92 PRINTF(
"%d.%d: rucb timedout\n",
100 recv(
struct runicast_conn *ruc,
const linkaddr_t *from, uint8_t seqno)
102 struct rucb_conn *c = (
struct rucb_conn *)ruc;
104 PRINTF(
"%d.%d: rucb: recv from %d.%d len %d\n",
108 if(seqno == c->last_seqno) {
111 c->last_seqno = seqno;
123 if(datalen < RUCB_DATASIZE) {
124 PRINTF(
"%d.%d: get %d bytes, file complete\n",
127 c->u->write_chunk(c, c->chunk * RUCB_DATASIZE,
130 c->u->write_chunk(c, c->chunk * RUCB_DATASIZE,
141 static const struct runicast_callbacks ruc = {recv, acked, timedout};
144 rucb_open(
struct rucb_conn *c, uint16_t channel,
145 const struct rucb_callbacks *u)
148 runicast_open(&c->c, channel, &ruc);
155 rucb_close(
struct rucb_conn *c)
157 runicast_close(&c->c);
161 rucb_send(
struct rucb_conn *c,
const linkaddr_t *receiver)
167 runicast_send(&c->c, receiver, MAX_TRANSMISSIONS);
linkaddr_t linkaddr_node_addr
The Rime address of the node.
const linkaddr_t linkaddr_null
The null Rime address.
void packetbuf_set_datalen(uint16_t len)
Set the length of the data in the packetbuf.
uint16_t packetbuf_totlen(void)
Get the total length of the header and data in the packetbuf.
Header file for the Rime stack
uint16_t packetbuf_datalen(void)
Get the length of the data in the packetbuf.
void linkaddr_copy(linkaddr_t *dest, const linkaddr_t *src)
Copy a Rime address.
void packetbuf_clear(void)
Clear and reset the packetbuf.
int linkaddr_cmp(const linkaddr_t *addr1, const linkaddr_t *addr2)
Compare two Rime addresses.
void * packetbuf_dataptr(void)
Get a pointer to the data in the packetbuf.
Header file for the reliable unicast bulk transfer module