56 #if UIP_MAX_ROUTES != 0 58 static uint16_t slotframe_handle = 0;
59 static uint16_t local_channel_offset;
64 get_node_pair_timeslot(
const linkaddr_t *from,
const linkaddr_t *to)
66 if(from != NULL && to != NULL && ORCHESTRA_UNICAST_PERIOD > 0) {
67 return ORCHESTRA_LINKADDR_HASH2(from, to) % ORCHESTRA_UNICAST_PERIOD;
74 get_node_channel_offset(
const linkaddr_t *
addr)
76 if(addr != NULL && ORCHESTRA_UNICAST_MAX_CHANNEL_OFFSET >= ORCHESTRA_UNICAST_MIN_CHANNEL_OFFSET) {
77 return ORCHESTRA_LINKADDR_HASH(addr) % (ORCHESTRA_UNICAST_MAX_CHANNEL_OFFSET - ORCHESTRA_UNICAST_MIN_CHANNEL_OFFSET + 1)
78 + ORCHESTRA_UNICAST_MIN_CHANNEL_OFFSET;
85 neighbor_has_uc_link(
const linkaddr_t *linkaddr)
88 if(orchestra_parent_knows_us &&
linkaddr_cmp(&orchestra_parent_linkaddr, linkaddr)) {
91 if(nbr_table_get_from_lladdr(nbr_routes, (linkaddr_t *)linkaddr) != NULL) {
99 add_uc_links(
const linkaddr_t *linkaddr)
101 if(linkaddr != NULL) {
106 tsch_schedule_add_link(sf_unicast, LINK_OPTION_TX | LINK_OPTION_SHARED, LINK_TYPE_NORMAL, &tsch_broadcast_address,
107 timeslot_tx, local_channel_offset, 0);
110 timeslot_rx, local_channel_offset, 0);
116 remove_unicast_link(uint16_t timeslot, uint16_t options)
120 if(l->timeslot == timeslot
121 && l->channel_offset == local_channel_offset
122 && l->link_options == options) {
131 remove_uc_links(
const linkaddr_t *linkaddr)
133 if(linkaddr != NULL) {
137 remove_unicast_link(timeslot_rx, LINK_OPTION_RX);
138 remove_unicast_link(timeslot_tx, LINK_OPTION_TX | LINK_OPTION_SHARED);
147 child_added(
const linkaddr_t *linkaddr)
149 add_uc_links(linkaddr);
153 child_removed(
const linkaddr_t *linkaddr)
155 remove_uc_links(linkaddr);
159 select_packet(uint16_t *slotframe, uint16_t *timeslot, uint16_t *channel_offset)
162 const linkaddr_t *dest = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
163 if(packetbuf_attr(PACKETBUF_ATTR_FRAME_TYPE) == FRAME802154_DATAFRAME
164 && !orchestra_is_root_schedule_active(dest)
165 && neighbor_has_uc_link(dest)) {
166 if(slotframe != NULL) {
167 *slotframe = slotframe_handle;
169 if(timeslot != NULL) {
173 if(channel_offset != NULL) {
174 *channel_offset = get_node_channel_offset(dest);
187 if(new_addr != NULL) {
192 remove_uc_links(old_addr);
193 add_uc_links(new_addr);
198 init(uint16_t sf_handle)
200 slotframe_handle = sf_handle;
206 struct orchestra_rule unicast_per_neighbor_link_based = {
213 "unicast per neighbor link based",
214 ORCHESTRA_UNICAST_PERIOD,
static uip_ds6_addr_t * addr
Pointer to a nbr cache entry.
TSCH neighbor information.
802.15.4e slotframe (contains links)
struct tsch_slotframe * tsch_schedule_add_slotframe(uint16_t handle, uint16_t size)
Creates and adds a new slotframe.
const linkaddr_t linkaddr_null
The null link-layer address.
linkaddr_t linkaddr_node_addr
The link-layer address of the node.
struct tsch_link * tsch_schedule_add_link(struct tsch_slotframe *slotframe, uint8_t link_options, enum link_type link_type, const linkaddr_t *address, uint16_t timeslot, uint16_t channel_offset, uint8_t do_remove)
Adds a link to a slotframe.
linkaddr_t * tsch_queue_get_nbr_address(const struct tsch_neighbor *n)
Get the address of a neighbor.
void * list_head(list_t list)
Get a pointer to the first element of a list.
int tsch_schedule_remove_link(struct tsch_slotframe *slotframe, struct tsch_link *l)
Removes a link.
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.
An IEEE 802.15.4-2015 TSCH link (also called cell or slot)
Header file for the Packet buffer (packetbuf) management
void * list_item_next(void *item)
Get the next item following this item.
void tsch_queue_free_packets_to(const linkaddr_t *addr)
Flush packets to a specific address.