45 #include "net/uip-netif.h"
52 #define PRINTF(...) printf(__VA_ARGS__)
53 #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])
54 #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5])
57 #define PRINT6ADDR(addr)
58 #define PRINTLLADDR(addr)
61 #ifndef RIME_CONF_UDP_PORT
62 #define RIME_UDP_PORT 9508
64 #define RIME_UDP_PORT RIME_CONF_UDP_PORT
70 static void (* receiver_callback)(
const struct mac_driver *);
72 PROCESS(rime_udp_process,
"Rime over UDP process");
81 if(broadcast_conn ==
NULL) {
82 PRINTF(
"rime-udp: Failed to allocate a broadcast connection!\n");
85 uip_create_unspecified(&ipaddr);
87 if(unicast_conn ==
NULL) {
88 PRINTF(
"rime-udp: Failed to allocate a unicast connection!\n");
98 PRINTF(
"rime-udp: received %d bytes\n",
uip_datalen());
99 receiver_callback(&rime_udp_driver);
107 send_packet(mac_callback_t sent_callback,
void *ptr)
109 const rimeaddr_t *addr;
111 addr = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
113 addr->u8[0], addr->u8[1]);
116 uip_udp_packet_send(broadcast_conn,
118 mac_call_sent_callback(sent_callback, ptr,
MAC_TX_OK, 1);
122 uip_udp_packet_send(unicast_conn,
124 uip_create_unspecified(&unicast_conn->
ripaddr);
137 set_receive_function(
void (* recv)(
const struct mac_driver *))
139 receiver_callback = recv;
149 off(
int keep_radio_on)
154 static unsigned short