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" 48 #include "net/routing/rpl-classic/rpl-private.h" 51 #define DEBUG DEBUG_PRINT 55 static void orchestra_packet_received(
void);
56 static void orchestra_packet_sent(
int mac_status);
57 NETSTACK_SNIFFER(orchestra_sniffer, orchestra_packet_received, orchestra_packet_sent);
60 linkaddr_t orchestra_parent_linkaddr;
62 int orchestra_parent_knows_us = 0;
65 const struct orchestra_rule *all_rules[] = ORCHESTRA_RULES;
66 #define NUM_RULES (sizeof(all_rules) / sizeof(struct orchestra_rule *)) 70 orchestra_packet_received(
void)
75 orchestra_packet_sent(
int mac_status)
78 if(orchestra_parent_knows_us == 0
80 && packetbuf_attr(PACKETBUF_ATTR_NETWORK_ID) == UIP_PROTO_ICMP6
81 && packetbuf_attr(PACKETBUF_ATTR_CHANNEL) == (
ICMP6_RPL << 8 | RPL_CODE_DAO)) {
83 &&
linkaddr_cmp(&orchestra_parent_linkaddr, packetbuf_addr(PACKETBUF_ADDR_RECEIVER))) {
84 orchestra_parent_knows_us = 1;
90 orchestra_callback_child_added(
const linkaddr_t *
addr)
94 for(i = 0; i < NUM_RULES; i++) {
95 if(all_rules[i]->child_added != NULL) {
96 all_rules[i]->child_added(addr);
102 orchestra_callback_child_removed(
const linkaddr_t *addr)
106 for(i = 0; i < NUM_RULES; i++) {
107 if(all_rules[i]->child_removed != NULL) {
108 all_rules[i]->child_removed(addr);
114 orchestra_callback_packet_ready(
void)
118 uint16_t slotframe = 0xffff;
119 uint16_t timeslot = 0xffff;
123 uint16_t channel_offset = 0xffff;
124 int matched_rule = -1;
127 for(i = 0; i < NUM_RULES; i++) {
128 if(all_rules[i]->select_packet != NULL) {
129 if(all_rules[i]->select_packet(&slotframe, ×lot, &channel_offset)) {
136 #if TSCH_WITH_LINK_SELECTOR 137 packetbuf_set_attr(PACKETBUF_ATTR_TSCH_SLOTFRAME, slotframe);
138 packetbuf_set_attr(PACKETBUF_ATTR_TSCH_TIMESLOT, timeslot);
139 packetbuf_set_attr(PACKETBUF_ATTR_TSCH_CHANNEL_OFFSET, channel_offset);
155 orchestra_parent_knows_us = 0;
157 for(i = 0; i < NUM_RULES; i++) {
158 if(all_rules[i]->new_time_source != NULL) {
159 all_rules[i]->new_time_source(old,
new);
170 netstack_sniffer_add(&orchestra_sniffer);
173 for(i = 0; i < NUM_RULES; i++) {
174 PRINTF(
"Orchestra: initializing rule %s (%u)\n", all_rules[i]->name, i);
175 if(all_rules[i]->init != NULL) {
176 all_rules[i]->init(i);
179 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