44 #if ROUTING_CONF_RPL_LITE 45 #include "net/routing/rpl-lite/rpl.h" 46 #elif ROUTING_CONF_RPL_CLASSIC 47 #include "net/routing/rpl-classic/rpl.h" 50 #define DEBUG DEBUG_PRINT 54 static void orchestra_packet_received(
void);
55 static void orchestra_packet_sent(
int mac_status);
56 NETSTACK_SNIFFER(orchestra_sniffer, orchestra_packet_received, orchestra_packet_sent);
59 linkaddr_t orchestra_parent_linkaddr;
61 int orchestra_parent_knows_us = 0;
64 const struct orchestra_rule *all_rules[] = ORCHESTRA_RULES;
65 #define NUM_RULES (sizeof(all_rules) / sizeof(struct orchestra_rule *)) 69 orchestra_packet_received(
void)
74 orchestra_packet_sent(
int mac_status)
77 if(orchestra_parent_knows_us == 0
79 && packetbuf_attr(PACKETBUF_ATTR_NETWORK_ID) == UIP_PROTO_ICMP6
80 && packetbuf_attr(PACKETBUF_ATTR_CHANNEL) == (
ICMP6_RPL << 8 | RPL_CODE_DAO)) {
82 &&
linkaddr_cmp(&orchestra_parent_linkaddr, packetbuf_addr(PACKETBUF_ADDR_RECEIVER))) {
83 orchestra_parent_knows_us = 1;
89 orchestra_callback_child_added(
const linkaddr_t *
addr)
93 for(i = 0; i < NUM_RULES; i++) {
94 if(all_rules[i]->child_added != NULL) {
95 all_rules[i]->child_added(addr);
101 orchestra_callback_child_removed(
const linkaddr_t *addr)
105 for(i = 0; i < NUM_RULES; i++) {
106 if(all_rules[i]->child_removed != NULL) {
107 all_rules[i]->child_removed(addr);
113 orchestra_callback_packet_ready(
void)
117 uint16_t slotframe = 9;
118 uint16_t timeslot = 0xffff;
121 for(i = 0; i < NUM_RULES; i++) {
122 if(all_rules[i]->select_packet != NULL) {
123 if(all_rules[i]->select_packet(&slotframe, ×lot)) {
129 #if TSCH_WITH_LINK_SELECTOR 130 packetbuf_set_attr(PACKETBUF_ATTR_TSCH_SLOTFRAME, slotframe);
131 packetbuf_set_attr(PACKETBUF_ATTR_TSCH_TIMESLOT, timeslot);
145 orchestra_parent_knows_us = 0;
147 for(i = 0; i < NUM_RULES; i++) {
148 if(all_rules[i]->new_time_source != NULL) {
149 all_rules[i]->new_time_source(old,
new);
160 netstack_sniffer_add(&orchestra_sniffer);
163 for(i = 0; i < NUM_RULES; i++) {
164 if(all_rules[i]->init != NULL) {
165 PRINTF(
"Orchestra: initializing rule %u\n", i);
166 all_rules[i]->init(i);
169 PRINTF(
"Orchestra: initialization done\n");
Header file for ICMPv6 message and error handing (RFC 4443)
static uip_ds6_addr_t * addr
Pointer to a nbr cache entry.
TSCH neighbor information.
A set of debugging macros for the IP stack
const linkaddr_t linkaddr_null
The null link-layer address.
The MAC layer transmission was OK.
Routing driver header file
void linkaddr_copy(linkaddr_t *dest, const linkaddr_t *src)
Copy a link-layer address.
int linkaddr_cmp(const linkaddr_t *addr1, const linkaddr_t *addr2)
Compare two link-layer addresses.
Header file for the Packet buffer (packetbuf) management