Skip to content

Commit

Permalink
added possibility to set next sequence number on PBBR. (ARMmbed#1867)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakvenugopal authored Oct 22, 2018
1 parent 1cc4aff commit ab1260a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
14 changes: 14 additions & 0 deletions nanostack/thread_bbr_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ int thread_bbr_timeout_set(int8_t interface_id, uint32_t timeout_a, uint32_t tim
*/
int thread_bbr_prefix_set(int8_t interface_id, uint8_t *prefix);

/**
* Set sequence number to be used by bbr
*
* update sequence number value
*
* \param interface_id interface ID of the Thread network.
* \param sequence_number value that needs to be set on bbr
*
* \return 0 on success
* \return <0 in case of errors
*
*/
int thread_bbr_sequence_number_set(int8_t interface_id, uint8_t sequence_number);

/**
* Set the Thread validation interface destination address.
*
Expand Down
11 changes: 11 additions & 0 deletions source/6LoWPAN/Thread/thread_bbr_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,17 @@ int thread_bbr_prefix_set(int8_t interface_id, uint8_t *prefix)
#endif // HAVE_THREAD_BORDER_ROUTER
}

int thread_bbr_sequence_number_set(int8_t interface_id, uint8_t sequence_number)
{
(void) interface_id;
(void) sequence_number;
#ifdef HAVE_THREAD_BORDER_ROUTER
return thread_extension_bbr_sequence_number_set(interface_id, sequence_number);
#else
return -1;
#endif // HAVE_THREAD_BORDER_ROUTER
}

int thread_bbr_validation_interface_address_set(int8_t interface_id, const uint8_t *addr_ptr, uint16_t port)
{
(void) interface_id;
Expand Down
14 changes: 14 additions & 0 deletions source/6LoWPAN/Thread/thread_extension_bbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1438,5 +1438,19 @@ int thread_extension_bbr_address_set(int8_t interface_id, const uint8_t *addr_pt
return 0;
}

int thread_extension_bbr_sequence_number_set(int8_t interface_id, uint8_t seq_number)
{
thread_pbbr_t *this = thread_bbr_find_by_interface(interface_id);

if (!this) {
return -1;
}
if (seq_number) {
this->sequence_number = --seq_number;
}

return 0;
}


#endif //HAVE_THREAD_BORDER_ROUTER && HAVE_THREAD_V2
2 changes: 2 additions & 0 deletions source/6LoWPAN/Thread/thread_extension_bbr.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ int8_t thread_extension_bbr_init(int8_t interface_id, int8_t backbone_interface_
void thread_extension_bbr_delete(int8_t interface_id);
bool thread_extension_bbr_nd_query_process(protocol_interface_info_entry_t *cur, const uint8_t *target_addr, uint16_t rloc);
void thread_extension_bbr_seconds_timer(int8_t interface_id, uint32_t seconds);
int thread_extension_bbr_sequence_number_set(int8_t interface_id, uint8_t seq_number);
int thread_extension_bbr_timeout_set(int8_t interface_id, uint32_t timeout_a, uint32_t timeout_b, uint32_t delay);
int thread_extension_bbr_address_set(int8_t interface_id, const uint8_t *addr_ptr, uint16_t port);
void thread_extension_bbr_route_update(protocol_interface_info_entry_t *cur);
Expand All @@ -67,6 +68,7 @@ int thread_extension_bbr_prefix_set(int8_t interface_id, uint8_t *prefix);
#define thread_extension_bbr_timeout_set(interface_id, timeout_a, timeout_b, delay)
#define thread_extension_bbr_address_set(interface_id, addr_ptr, port) (-1)
#define thread_extension_bbr_route_update(cur)
#define thread_extension_bbr_sequence_number_set(interface_id, seq_number) (-1)
#define thread_extension_bbr_prefix_set(interface_id, prefix) 0
#endif

Expand Down

0 comments on commit ab1260a

Please sign in to comment.