Contiki-NG
|
Files | |
file | sixp-nbr.c |
Neighbor Management for 6top Protocol (6P) | |
file | sixp-nbr.h |
Neighbor Management APIs for 6top Protocol (6P) | |
file | sixp-pkt.c |
6top Protocol (6P) Packet Manipulation | |
file | sixp-pkt.h |
6top Protocol (6P) Packet Manipulation APIs | |
file | sixp-trans.c |
Transaction Management for 6top Protocol (6P) | |
file | sixp-trans.h |
Transaction Management APIs for 6top Protocol (6P) | |
file | sixp.c |
6top Protocol (6P) | |
file | sixp.h |
6top Protocol (6P) APIs | |
file | sixtop-conf.h |
6top Configuration | |
file | sixtop.c |
6TiSCH Operation Sublayer (6top) | |
file | sixtop.h |
6TiSCH Operation Sublayer (6top) APIs | |
Data Structures | |
union | sixp_pkt_code_t |
6P Codes integrating Command IDs and Return Codes More... | |
struct | sixp_pkt_t |
6top IE Structure More... | |
struct | sixtop_sf_t |
/brief Scheduling Function Driver More... | |
Typedefs | |
typedef struct sixp_nbr | sixp_nbr_t |
6P Neighbor Data Structure (for internal use) | |
typedef void(* | sixp_sent_callback_t) (void *arg, uint16_t arg_len, const linkaddr_t *dest_addr, sixp_output_status_t status) |
6P Packet Sent Handler | |
typedef void(* | sixtop_sf_input) (sixp_pkt_type_t type, sixp_pkt_code_t code, const uint8_t *body, uint16_t body_len, const linkaddr_t *src_addr) |
Input Handler of Scheduling Function. | |
typedef void(* | sixtop_sf_timeout) (sixp_pkt_cmd_t cmd, const linkaddr_t *peer_addr) |
Timeout Handler of Scheduling Function. | |
typedef void(* | sixtop_sf_error) (sixp_error_t err, sixp_pkt_cmd_t cmd, uint8_t seqno, const linkaddr_t *peer_addr) |
Error Handler of Scheduling Function. | |
Functions | |
sixp_nbr_t * | sixp_nbr_find (const linkaddr_t *addr) |
Find a neighbor. | |
sixp_nbr_t * | sixp_nbr_alloc (const linkaddr_t *addr) |
Allocate a neighbor. | |
void | sixp_nbr_free (sixp_nbr_t *nbr) |
Free a neighbor. | |
int16_t | sixp_nbr_get_next_seqno (sixp_nbr_t *nbr) |
Get the next sequence number of a neighbor. | |
int | sixp_nbr_set_next_seqno (sixp_nbr_t *nbr, uint16_t seqno) |
Set the specified value to the next sequence number of a neighbor. | |
int | sixp_nbr_reset_next_seqno (sixp_nbr_t *nbr) |
Reset the next sequence number of a neighbor to zero. | |
int | sixp_nbr_increment_next_seqno (sixp_nbr_t *nbr) |
Increment the next sequence number of a neighbor. | |
int | sixp_nbr_init (void) |
Initialize 6p Neighbor Table. | |
int | sixp_pkt_set_metadata (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_metadata_t metadata, uint8_t *body, uint16_t body_len) |
Write Metadata into "Other Fields" of 6P packet. | |
int | sixp_pkt_get_metadata (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_metadata_t *metadata, const uint8_t *body, uint16_t body_len) |
Read Metadata stored in "Other Fields" of 6P packet. | |
int | sixp_pkt_set_cell_options (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_cell_options_t cell_options, uint8_t *body, uint16_t body_len) |
Write CellOptions in "Other Fields" of 6P packet. | |
int | sixp_pkt_get_cell_options (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_cell_options_t *cell_options, const uint8_t *body, uint16_t body_len) |
Read CellOptions in "Other Fields" of 6P packet. | |
int | sixp_pkt_set_num_cells (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_num_cells_t num_cells, uint8_t *body, uint16_t body_len) |
Write NumCells in "Other Fields" of 6P packet. | |
int | sixp_pkt_get_num_cells (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_num_cells_t *num_cells, const uint8_t *body, uint16_t body_len) |
Read NumCells in "Other Fields" of 6P packet. | |
int | sixp_pkt_set_reserved (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_reserved_t reserved, uint8_t *body, uint16_t body_len) |
Write Reserved in "Other Fields" of 6P packet. | |
int | sixp_pkt_get_reserved (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_reserved_t *reserved, const uint8_t *body, uint16_t body_len) |
Read Reserved in "Other Fields" of 6P packet. | |
int | sixp_pkt_set_offset (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_offset_t offset, uint8_t *body, uint16_t body_len) |
Write Offset in "Other Fields" of 6P packet. | |
int | sixp_pkt_get_offset (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_offset_t *offset, const uint8_t *body, uint16_t body_len) |
Read Offset in "Other Fields" of 6P packet. | |
int | sixp_pkt_set_max_num_cells (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_max_num_cells_t max_num_cells, uint8_t *body, uint16_t body_len) |
Write MaxNumCells in "Other Fields" of 6P packet. | |
int | sixp_pkt_get_max_num_cells (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_max_num_cells_t *max_num_cells, const uint8_t *body, uint16_t body_len) |
Read MaxNumCells in "Other Fields" of 6P packet. | |
int | sixp_pkt_set_cell_list (sixp_pkt_type_t type, sixp_pkt_code_t code, const uint8_t *cell_list, uint16_t cell_list_len, uint16_t offset, uint8_t *body, uint16_t body_len) |
Write CellList in "Other Fields" of 6P packet. | |
int | sixp_pkt_get_cell_list (sixp_pkt_type_t type, sixp_pkt_code_t code, const uint8_t **cell_list, sixp_pkt_offset_t *cell_list_len, const uint8_t *body, uint16_t body_len) |
Read CellList in "Other Fields" of 6P packet. | |
int | sixp_pkt_set_rel_cell_list (sixp_pkt_type_t type, sixp_pkt_code_t code, const uint8_t *rel_cell_list, uint16_t rel_cell_list_len, uint16_t offset, uint8_t *body, uint16_t body_len) |
Write RelCellList in "Other Fields" of 6P packet. | |
int | sixp_pkt_get_rel_cell_list (sixp_pkt_type_t type, sixp_pkt_code_t code, const uint8_t **rel_cell_list, sixp_pkt_offset_t *rel_cell_list_len, const uint8_t *body, uint16_t body_len) |
Read RelCellList in "Other Fields" of 6P packet. | |
int | sixp_pkt_set_cand_cell_list (sixp_pkt_type_t type, sixp_pkt_code_t code, const uint8_t *cand_cell_list, uint16_t cand_cell_list_len, uint16_t offset, uint8_t *body, uint16_t body_len) |
Write CandCellList in "Other Fields" of 6P packet. | |
int | sixp_pkt_get_cand_cell_list (sixp_pkt_type_t type, sixp_pkt_code_t code, const uint8_t **cand_cell_list, sixp_pkt_offset_t *cand_cell_list_len, const uint8_t *body, uint16_t body_len) |
Read CandCellList in "Other Fields" of 6P packet. | |
int | sixp_pkt_set_total_num_cells (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_total_num_cells_t total_num_cells, uint8_t *body, uint16_t body_len) |
Write TotalNumCells in "Other Fields" of 6P packet. | |
int | sixp_pkt_get_total_num_cells (sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_total_num_cells_t *total_num_cells, const uint8_t *body, uint16_t body_len) |
Read TotalNumCells in "Other Fields" of 6P packet. | |
int | sixp_pkt_set_payload (sixp_pkt_type_t type, sixp_pkt_code_t code, const uint8_t *payload, uint16_t payload_len, uint8_t *body, uint16_t body_len) |
Write Payload in "Other Fields" of 6P packet. | |
int | sixp_pkt_get_payload (sixp_pkt_type_t type, sixp_pkt_code_t code, uint8_t *buf, uint16_t buf_len, const uint8_t *body, uint16_t body_len) |
Read Payload in "Other Fields" of 6P packet. | |
int | sixp_pkt_parse (const uint8_t *buf, uint16_t len, sixp_pkt_t *pkt) |
Parse a 6P packet. | |
int | sixp_pkt_create (sixp_pkt_type_t type, sixp_pkt_code_t code, uint8_t sfid, uint8_t seqno, const uint8_t *body, uint16_t body_len, sixp_pkt_t *pkt) |
Create a 6P packet. | |
void | sixp_trans_free (sixp_trans_t *trans) |
Free a transaction. | |
int | sixp_trans_transit_state (sixp_trans_t *trans, sixp_trans_state_t new_state) |
Change the state of a specified transaction. | |
const sixtop_sf_t * | sixp_trans_get_sf (sixp_trans_t *trans) |
Return the scheduling function associated with a specified transaction. | |
sixp_pkt_cmd_t | sixp_trans_get_cmd (sixp_trans_t *trans) |
Return the command associated with a specified transaction. | |
sixp_trans_state_t | sixp_trans_get_state (sixp_trans_t *trans) |
Return the state of a specified transaction. | |
int16_t | sixp_trans_get_seqno (sixp_trans_t *trans) |
Return the sequence number associated with a specified transaction. | |
sixp_trans_mode_t | sixp_trans_get_mode (sixp_trans_t *trans) |
Return the mode, 2-step or 3-step, of a specified transaction. | |
const linkaddr_t * | sixp_trans_get_peer_addr (sixp_trans_t *trans) |
Return the peer addr of a specified transaction. | |
void | sixp_trans_invoke_callback (sixp_trans_t *trans, sixp_output_status_t status) |
Invoke the output callback of a specified transaction. | |
void | sixp_trans_set_callback (sixp_trans_t *trans, sixp_sent_callback_t func, void *arg, uint16_t arg_len) |
Set an output callback to a specified transaction. | |
sixp_trans_t * | sixp_trans_alloc (const sixp_pkt_t *pkt, const linkaddr_t *peer_addr) |
Allocate a transaction. | |
sixp_trans_t * | sixp_trans_find (const linkaddr_t *peer_addr) |
Find a transaction. | |
void | sixp_trans_terminate (sixp_trans_t *trans) |
Helper function to terminate a transaction. | |
void | sixp_trans_abort (sixp_trans_t *trans) |
Helper function to abort a transaction immediately. | |
int | sixp_trans_init (void) |
Initialize Memory and List for 6P transactions This function removes and frees existing transactions. | |
void | sixp_input (const uint8_t *buf, uint16_t len, const linkaddr_t *src_addr) |
Input a 6P packet. | |
int | sixp_output (sixp_pkt_type_t type, sixp_pkt_code_t code, uint8_t sfid, const uint8_t *body, uint16_t body_len, const linkaddr_t *dest_addr, sixp_sent_callback_t func, void *arg, uint16_t arg_len) |
Output a 6P packet. | |
void | sixp_init (void) |
Initialize 6P Module It invokes sixp_nbr_init() and sixp_trans_init(). | |
const sixtop_sf_t * | sixtop_find_sf (uint8_t sfid) |
Find a SF which has been added by SFID. | |
int | sixtop_add_sf (const sixtop_sf_t *sf) |
Add a Scheduling Function (SF) to 6top Sublayer. | |
int | sixtop_output (const linkaddr_t *dest_addr, mac_callback_t callback, void *arg) |
Output a 6P packet which is supposestored in packetbuf. | |
void | sixtop_input (void) |
Input a packet stored in packetbuf. | |
void | sixtop_init (void) |
Initialize 6top module This initialization function removes all the SFs which has been installed into the 6top sub-layer. | |
void | sixtop_init_sf (void) |
Initialize installed SFs which has been added in the system This function is supposed to be invoked every time the node gets associated. | |
Variables | |
uint8_t | sixtop_sf_t::sfid |
SFID. | |
typedef struct sixp_nbr sixp_nbr_t |
6P Neighbor Data Structure (for internal use)
XXX: for now, we have one nbr object per neighbor, which is shared with multiple SFs. It's unclear whether we should use a different generation counter for each SFs.
typedef void(* sixtop_sf_error) (sixp_error_t err, sixp_pkt_cmd_t cmd, uint8_t seqno, const linkaddr_t *peer_addr) |
typedef void(* sixtop_sf_input) (sixp_pkt_type_t type, sixp_pkt_code_t code, const uint8_t *body, uint16_t body_len, const linkaddr_t *src_addr) |
Input Handler of Scheduling Function.
type | 6P Message Type of an input packet |
code | Code, 6P Command Identifier or Return Code, of an input packet |
body | Body, "Other Fields", of an input packet |
body_len | The length of body |
src_addr | Source address of an input packet |
typedef void(* sixtop_sf_timeout) (sixp_pkt_cmd_t cmd, const linkaddr_t *peer_addr) |
enum sixp_output_status_t |
6P Send Status, which represents sixp_output() result.
Enumerator | |
---|---|
SIXP_OUTPUT_STATUS_SUCCESS | SUCCESS. |
SIXP_OUTPUT_STATUS_FAILURE | FAILURE. |
SIXP_OUTPUT_STATUS_ABORTED | ABORTED. |
6P Cell Options
Enumerator | |
---|---|
SIXP_PKT_CELL_OPTION_TX | TX Cell. |
SIXP_PKT_CELL_OPTION_RX | RX Cell. |
SIXP_PKT_CELL_OPTION_SHARED | SHARED Cell. |
Definition at line 112 of file sixp-pkt.h.
enum sixp_pkt_cmd_t |
6P Command Identifiers
Definition at line 72 of file sixp-pkt.h.
enum sixp_pkt_rc_t |
6P Return Codes
Definition at line 86 of file sixp-pkt.h.
enum sixp_pkt_type_t |
6P Message Types
Enumerator | |
---|---|
SIXP_PKT_TYPE_REQUEST | 6P Request |
SIXP_PKT_TYPE_RESPONSE | 6P Response |
SIXP_PKT_TYPE_CONFIRMATION | 6P Confirmation |
SIXP_PKT_TYPE_RESERVED | Reserved. |
Definition at line 62 of file sixp-pkt.h.
void sixp_input | ( | const uint8_t * | buf, |
uint16_t | len, | ||
const linkaddr_t * | src_addr ) |
Input a 6P packet.
buf | The pointer to a buffer pointing the head of 6top IE Content |
len | The lengh of 6top IE Content |
src_addr | The Source address of an incoming packet |
Definition at line 205 of file sixp.c.
References sixp_pkt_t::body, sixp_pkt_t::body_len, sixp_pkt_code_t::cmd, sixp_pkt_t::code, sixtop_sf_t::input, nbr, sixp_pkt_t::seqno, sixp_pkt_t::sfid, sixp_nbr_find(), sixp_nbr_get_next_seqno(), sixp_nbr_reset_next_seqno(), SIXP_PKT_CMD_CLEAR, sixp_pkt_parse(), SIXP_PKT_RC_ERR_BUSY, SIXP_PKT_RC_ERR_SFID, SIXP_PKT_RC_ERR_VERSION, SIXP_PKT_TYPE_CONFIRMATION, SIXP_PKT_TYPE_REQUEST, SIXP_PKT_TYPE_RESPONSE, sixp_trans_alloc(), sixp_trans_find(), sixp_trans_get_seqno(), sixp_trans_transit_state(), sixtop_find_sf(), sixp_pkt_t::type, and sixp_pkt_t::version.
Referenced by sixtop_input().
sixp_nbr_t * sixp_nbr_alloc | ( | const linkaddr_t * | addr | ) |
Allocate a neighbor.
addr | The MAC address of a neighbor |
Definition at line 80 of file sixp-nbr.c.
References addr, linkaddr_copy(), nbr, SIXP_INITIAL_SEQUENCE_NUMBER, and sixp_nbr_find().
Referenced by sixp_output().
sixp_nbr_t * sixp_nbr_find | ( | const linkaddr_t * | addr | ) |
Find a neighbor.
addr | The MAC address of a neighbor |
Definition at line 70 of file sixp-nbr.c.
References addr.
Referenced by sixp_input(), sixp_nbr_alloc(), sixp_output(), and sixp_trans_transit_state().
void sixp_nbr_free | ( | sixp_nbr_t * | nbr | ) |
Free a neighbor.
nbr | The pointer to a neighbor to free |
Definition at line 112 of file sixp-nbr.c.
References nbr.
Referenced by sixp_nbr_init().
int16_t sixp_nbr_get_next_seqno | ( | sixp_nbr_t * | nbr | ) |
Get the next sequence number of a neighbor.
nbr | The pointer to a neighbor |
Definition at line 121 of file sixp-nbr.c.
References nbr.
Referenced by sixp_input(), sixp_output(), and sixp_trans_transit_state().
int sixp_nbr_increment_next_seqno | ( | sixp_nbr_t * | nbr | ) |
Increment the next sequence number of a neighbor.
nbr | The pointer to a neighbor |
Definition at line 156 of file sixp-nbr.c.
References nbr.
Referenced by sixp_output(), and sixp_trans_transit_state().
int sixp_nbr_reset_next_seqno | ( | sixp_nbr_t * | nbr | ) |
Reset the next sequence number of a neighbor to zero.
nbr | The pointer to a neighbor |
Definition at line 144 of file sixp-nbr.c.
References nbr.
Referenced by sixp_input(), and sixp_output().
int sixp_nbr_set_next_seqno | ( | sixp_nbr_t * | nbr, |
uint16_t | seqno ) |
Set the specified value to the next sequence number of a neighbor.
nbr | The pointer to a neighbor |
seqno | Value to be set |
Definition at line 132 of file sixp-nbr.c.
References nbr.
Referenced by sixp_trans_transit_state().
int sixp_output | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
uint8_t | sfid, | ||
const uint8_t * | body, | ||
uint16_t | body_len, | ||
const linkaddr_t * | dest_addr, | ||
sixp_sent_callback_t | func, | ||
void * | arg, | ||
uint16_t | arg_len ) |
Output a 6P packet.
type | Message Type |
code | Message Code; Command ID or Return Code |
sfid | Scheduling Function Identifier |
body | 6top IE Content |
body_len | The length of 6top IE Content |
dest_addr | The destination Address |
func | callback function invoked after the transmission process |
arg | The pointer to an argument to be passed with the callback |
arg_len | The length of the argument |
Definition at line 376 of file sixp.c.
References sixp_pkt_code_t::cmd, nbr, sixp_nbr_alloc(), sixp_nbr_find(), sixp_nbr_get_next_seqno(), sixp_nbr_increment_next_seqno(), sixp_nbr_reset_next_seqno(), SIXP_PKT_CMD_CLEAR, sixp_pkt_create(), SIXP_PKT_RC_ERR_SFID, SIXP_PKT_RC_ERR_VERSION, SIXP_PKT_TYPE_CONFIRMATION, SIXP_PKT_TYPE_REQUEST, SIXP_PKT_TYPE_RESPONSE, sixp_trans_abort(), sixp_trans_alloc(), sixp_trans_find(), sixp_trans_get_cmd(), sixp_trans_get_seqno(), sixp_trans_get_state(), sixp_trans_set_callback(), sixp_trans_transit_state(), sixtop_output(), and sixp_pkt_code_t::value.
int sixp_pkt_create | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
uint8_t | sfid, | ||
uint8_t | seqno, | ||
const uint8_t * | body, | ||
uint16_t | body_len, | ||
sixp_pkt_t * | pkt ) |
Create a 6P packet.
type | 6P Message Type |
code | 6P Message Code, Command Identifier or Return Code |
sfid | Scheduling Function Identifier |
seqno | Sequence Number |
body | The pointer to "Other Fields" in a buffer |
body_len | The length of body, typically "Other Fields" length |
pkt | The pointer to a sixp_pkt_t structure to store packet info (option) |
Definition at line 1086 of file sixp-pkt.c.
References sixp_pkt_t::body, sixp_pkt_t::body_len, sixp_pkt_t::code, packetbuf_clear(), packetbuf_dataptr(), packetbuf_hdralloc(), packetbuf_hdrptr(), packetbuf_set_datalen(), PACKETBUF_SIZE, packetbuf_totlen(), sixp_pkt_t::seqno, sixp_pkt_t::sfid, sixp_pkt_t::type, and sixp_pkt_code_t::value.
Referenced by sixp_output().
int sixp_pkt_get_cand_cell_list | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
const uint8_t ** | cand_cell_list, | ||
sixp_pkt_offset_t * | cand_cell_list_len, | ||
const uint8_t * | body, | ||
uint16_t | body_len ) |
Read CandCellList in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
cand_cell_list | The double pointer to store the starting address of CandCellList |
cand_cell_list_len | Pointer to store the length of CandCellList |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 776 of file sixp-pkt.c.
References sixp_pkt_get_num_cells(), and sixp_pkt_code_t::value.
int sixp_pkt_get_cell_list | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
const uint8_t ** | cell_list, | ||
sixp_pkt_offset_t * | cell_list_len, | ||
const uint8_t * | body, | ||
uint16_t | body_len ) |
Read CellList in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
cell_list | The double pointer to store the starting address of CellList |
cell_list_len | Pointer to store the length of CellList |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 608 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_get_cell_options | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_cell_options_t * | cell_options, | ||
const uint8_t * | body, | ||
uint16_t | body_len ) |
Read CellOptions in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
cell_options | The pointer to buffer to store CellOptions in |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 294 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_get_max_num_cells | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_max_num_cells_t * | max_num_cells, | ||
const uint8_t * | body, | ||
uint16_t | body_len ) |
Read MaxNumCells in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
max_num_cells | The pointer to buffer to store MaxNumCells in |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 537 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_get_metadata | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_metadata_t * | metadata, | ||
const uint8_t * | body, | ||
uint16_t | body_len ) |
Read Metadata stored in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
metadata | The pointer to a buffer to store Metadata in |
body | The pointer to the buffer having "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 229 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_get_num_cells | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_num_cells_t * | num_cells, | ||
const uint8_t * | body, | ||
uint16_t | body_len ) |
Read NumCells in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
num_cells | The pointer to buffer to store NumCells in |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 349 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
Referenced by sixp_pkt_get_cand_cell_list(), sixp_pkt_get_rel_cell_list(), sixp_pkt_set_cand_cell_list(), and sixp_pkt_set_rel_cell_list().
int sixp_pkt_get_offset | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_offset_t * | offset, | ||
const uint8_t * | body, | ||
uint16_t | body_len ) |
Read Offset in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
offset | The pointer to buffer to store Offset in |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 468 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_get_payload | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
uint8_t * | buf, | ||
uint16_t | buf_len, | ||
const uint8_t * | body, | ||
uint16_t | body_len ) |
Read Payload in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
buf | The pointer to buffer to store "Payload" in |
buf_len | The length of buf |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 913 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_get_rel_cell_list | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
const uint8_t ** | rel_cell_list, | ||
sixp_pkt_offset_t * | rel_cell_list_len, | ||
const uint8_t * | body, | ||
uint16_t | body_len ) |
Read RelCellList in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
rel_cell_list | The double pointer to store the starting address of RelCellList |
rel_cell_list_len | Pointer to store the length of a returned RelCellList |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 691 of file sixp-pkt.c.
References sixp_pkt_get_num_cells(), and sixp_pkt_code_t::value.
int sixp_pkt_get_reserved | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_reserved_t * | reserved, | ||
const uint8_t * | body, | ||
uint16_t | body_len ) |
Read Reserved in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
reserved | The pointer to buffer to store Reserved in |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 409 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_get_total_num_cells | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_total_num_cells_t * | total_num_cells, | ||
const uint8_t * | body, | ||
uint16_t | body_len ) |
Read TotalNumCells in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
total_num_cells | The pointer to buffer to store TotalNumCells in |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 849 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_parse | ( | const uint8_t * | buf, |
uint16_t | len, | ||
sixp_pkt_t * | pkt ) |
Parse a 6P packet.
buf | The pointer to a buffer pointing 6top IE Content |
len | The length of the buffer |
pkt | The pointer to a sixp_pkt_t structure to store packet info |
Definition at line 947 of file sixp-pkt.c.
References sixp_pkt_t::body, sixp_pkt_t::body_len, sixp_pkt_code_t::cmd, sixp_pkt_t::code, sixp_pkt_code_t::rc, sixp_pkt_t::seqno, sixp_pkt_t::sfid, SIXP_PKT_CMD_ADD, SIXP_PKT_CMD_CLEAR, SIXP_PKT_CMD_COUNT, SIXP_PKT_CMD_DELETE, SIXP_PKT_CMD_LIST, SIXP_PKT_CMD_RELOCATE, SIXP_PKT_CMD_SIGNAL, SIXP_PKT_RC_EOL, SIXP_PKT_RC_ERR, SIXP_PKT_RC_ERR_BUSY, SIXP_PKT_RC_ERR_CELLLIST, SIXP_PKT_RC_ERR_LOCKED, SIXP_PKT_RC_ERR_SEQNUM, SIXP_PKT_RC_ERR_SFID, SIXP_PKT_RC_ERR_VERSION, SIXP_PKT_RC_RESET, SIXP_PKT_RC_SUCCESS, SIXP_PKT_TYPE_CONFIRMATION, SIXP_PKT_TYPE_REQUEST, SIXP_PKT_TYPE_RESPONSE, sixp_pkt_t::type, sixp_pkt_code_t::value, and sixp_pkt_t::version.
Referenced by sixp_input().
int sixp_pkt_set_cand_cell_list | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
const uint8_t * | cand_cell_list, | ||
uint16_t | cand_cell_list_len, | ||
uint16_t | offset, | ||
uint8_t * | body, | ||
uint16_t | body_len ) |
Write CandCellList in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
cand_cell_list | The pointer to "CandCellList" to write |
cand_cell_list_len | Length to write |
offset | Offset in the "CandCellList" field to start writing |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 734 of file sixp-pkt.c.
References sixp_pkt_get_num_cells(), and sixp_pkt_code_t::value.
int sixp_pkt_set_cell_list | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
const uint8_t * | cell_list, | ||
uint16_t | cell_list_len, | ||
uint16_t | offset, | ||
uint8_t * | body, | ||
uint16_t | body_len ) |
Write CellList in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
cell_list | The pointer to "CellList" to write |
cell_list_len | Length to write |
offset | Offset in the "CellList" field to start writing |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 572 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_set_cell_options | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_cell_options_t | cell_options, | ||
uint8_t * | body, | ||
uint16_t | body_len ) |
Write CellOptions in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
cell_options | "CellOptions" to write |
body | The pointer to buffer having "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 263 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_set_max_num_cells | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_max_num_cells_t | max_num_cells, | ||
uint8_t * | body, | ||
uint16_t | body_len ) |
Write MaxNumCells in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
max_num_cells | "MaxNumCells" to write |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 503 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_set_metadata | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_metadata_t | metadata, | ||
uint8_t * | body, | ||
uint16_t | body_len ) |
Write Metadata into "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
metadata | Metadata to write |
body | The pointer to "Other Fields" in a buffer |
body_len | The length of body, typically "Other Fields" length |
Definition at line 196 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_set_num_cells | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_num_cells_t | num_cells, | ||
uint8_t * | body, | ||
uint16_t | body_len ) |
Write NumCells in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
num_cells | "NumCells" to write |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 325 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_set_offset | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_offset_t | offset, | ||
uint8_t * | body, | ||
uint16_t | body_len ) |
Write Offset in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
offset | "Offset" to write |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 434 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_set_payload | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
const uint8_t * | payload, | ||
uint16_t | payload_len, | ||
uint8_t * | body, | ||
uint16_t | body_len ) |
Write Payload in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
payload | "Payload" to write |
payload_len | The length of "Payload" to write |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 880 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_set_rel_cell_list | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
const uint8_t * | rel_cell_list, | ||
uint16_t | rel_cell_list_len, | ||
uint16_t | offset, | ||
uint8_t * | body, | ||
uint16_t | body_len ) |
Write RelCellList in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
rel_cell_list | The pointer to "RelCellList" to write |
rel_cell_list_len | Length to write |
offset | Offset in the "RelCellList" field to start writing |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 645 of file sixp-pkt.c.
References sixp_pkt_get_num_cells(), and sixp_pkt_code_t::value.
int sixp_pkt_set_reserved | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_reserved_t | reserved, | ||
uint8_t * | body, | ||
uint16_t | body_len ) |
Write Reserved in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
reserved | "Reserved" to write |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 379 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
int sixp_pkt_set_total_num_cells | ( | sixp_pkt_type_t | type, |
sixp_pkt_code_t | code, | ||
sixp_pkt_total_num_cells_t | total_num_cells, | ||
uint8_t * | body, | ||
uint16_t | body_len ) |
Write TotalNumCells in "Other Fields" of 6P packet.
type | 6P Message Type |
code | 6P Command Identifier or Return Code |
total_num_cells | "TotalNumCells" to write |
body | The pointer to buffer pointing to "Other Fields" |
body_len | The length of body, typically "Other Fields" length |
Definition at line 821 of file sixp-pkt.c.
References sixp_pkt_code_t::value.
void sixp_trans_abort | ( | sixp_trans_t * | trans | ) |
Helper function to abort a transaction immediately.
trans | The pointer to a transaction to terminate |
Definition at line 469 of file sixp-trans.c.
References ctimer_expired(), ctimer_stop(), SIXP_OUTPUT_STATUS_ABORTED, sixp_trans_invoke_callback(), and sixp_trans_terminate().
Referenced by sixp_output().
sixp_trans_t * sixp_trans_alloc | ( | const sixp_pkt_t * | pkt, |
const linkaddr_t * | peer_addr ) |
Allocate a transaction.
pkt | The pointer to a packet which triggers the allocation |
peer_addr | The peer address which will be associated |
Definition at line 388 of file sixp-trans.c.
References sixp_pkt_t::code, list_add(), memb_alloc(), sixp_pkt_t::seqno, sixp_pkt_t::sfid, sixp_trans_find(), sixtop_find_sf(), and sixp_pkt_code_t::value.
Referenced by sixp_input(), and sixp_output().
sixp_trans_t * sixp_trans_find | ( | const linkaddr_t * | peer_addr | ) |
Find a transaction.
peer_addr | The peer address |
Definition at line 431 of file sixp-trans.c.
References list_head().
Referenced by sixp_input(), sixp_output(), and sixp_trans_alloc().
void sixp_trans_free | ( | sixp_trans_t * | trans | ) |
Free a transaction.
trans | The pointer to a transaction to be freed |
Definition at line 166 of file sixp-trans.c.
References ctimer_stop(), list_remove(), and memb_free().
Referenced by sixp_trans_init().
sixp_pkt_cmd_t sixp_trans_get_cmd | ( | sixp_trans_t * | trans | ) |
Return the command associated with a specified transaction.
trans | The pointer to a transaction |
Definition at line 310 of file sixp-trans.c.
References SIXP_PKT_CMD_UNAVAILABLE.
Referenced by sixp_output(), and sixp_trans_transit_state().
sixp_trans_mode_t sixp_trans_get_mode | ( | sixp_trans_t * | trans | ) |
Return the mode, 2-step or 3-step, of a specified transaction.
trans | The pointer to a transaction |
Definition at line 341 of file sixp-trans.c.
const linkaddr_t * sixp_trans_get_peer_addr | ( | sixp_trans_t * | trans | ) |
Return the peer addr of a specified transaction.
trans | The pointer to a transaction |
Definition at line 352 of file sixp-trans.c.
Referenced by sixp_trans_transit_state().
int16_t sixp_trans_get_seqno | ( | sixp_trans_t * | trans | ) |
Return the sequence number associated with a specified transaction.
trans | The pointer of a transaction |
Definition at line 330 of file sixp-trans.c.
Referenced by sixp_input(), sixp_output(), and sixp_trans_transit_state().
const sixtop_sf_t * sixp_trans_get_sf | ( | sixp_trans_t * | trans | ) |
Return the scheduling function associated with a specified transaction.
trans | The pointer to a transaction |
Definition at line 299 of file sixp-trans.c.
sixp_trans_state_t sixp_trans_get_state | ( | sixp_trans_t * | trans | ) |
Return the state of a specified transaction.
trans | The pointer to a transaction |
Definition at line 320 of file sixp-trans.c.
Referenced by sixp_output().
void sixp_trans_invoke_callback | ( | sixp_trans_t * | trans, |
sixp_output_status_t | status ) |
Invoke the output callback of a specified transaction.
trans | The pointer to a transaction |
status | An output result value |
Definition at line 363 of file sixp-trans.c.
Referenced by sixp_trans_abort().
void sixp_trans_set_callback | ( | sixp_trans_t * | trans, |
sixp_sent_callback_t | func, | ||
void * | arg, | ||
uint16_t | arg_len ) |
Set an output callback to a specified transaction.
trans | The pointer to a transaction |
func | The pointer to a callback function |
arg | The pointer to an argument which will be passed to func |
arg_len | The length of the argument |
Definition at line 375 of file sixp-trans.c.
Referenced by sixp_output().
void sixp_trans_terminate | ( | sixp_trans_t * | trans | ) |
Helper function to terminate a transaction.
trans | The pointer to a transaction to terminate |
Definition at line 458 of file sixp-trans.c.
References sixp_trans_transit_state().
Referenced by sixp_trans_abort().
int sixp_trans_transit_state | ( | sixp_trans_t * | trans, |
sixp_trans_state_t | new_state ) |
Change the state of a specified transaction.
trans | The pointer to a transaction |
new_state | New state to move the transaction to |
Definition at line 224 of file sixp-trans.c.
References sixtop_sf_t::error, nbr, sixp_nbr_find(), sixp_nbr_get_next_seqno(), sixp_nbr_increment_next_seqno(), sixp_nbr_set_next_seqno(), SIXP_PKT_CMD_CLEAR, sixp_trans_get_cmd(), sixp_trans_get_peer_addr(), and sixp_trans_get_seqno().
Referenced by sixp_input(), sixp_output(), and sixp_trans_terminate().
int sixtop_add_sf | ( | const sixtop_sf_t * | sf | ) |
Add a Scheduling Function (SF) to 6top Sublayer.
sf | The pointer to a Scheduling Function Driver |
If there is a SF whose SF is identical to one of a SF specified to this API, the addition will fail and -1 will be returned. If there is no room to another SF, -1 will be returned as well. You can specify how many SFs can be added with SIXTOP_CONF_MAX_SCHEDULING_FUNCTIONS.
Definition at line 74 of file sixtop.c.
References sixtop_sf_t::init, sixtop_sf_t::sfid, sixtop_find_sf(), and SIXTOP_MAX_SCHEDULING_FUNCTIONS.
const sixtop_sf_t * sixtop_find_sf | ( | uint8_t | sfid | ) |
Find a SF which has been added by SFID.
sfid | Scheduling Function Identifier of a SF |
Definition at line 110 of file sixtop.c.
References SIXTOP_MAX_SCHEDULING_FUNCTIONS.
Referenced by sixp_input(), sixp_trans_alloc(), and sixtop_add_sf().
void sixtop_init | ( | void | ) |
Initialize 6top module This initialization function removes all the SFs which has been installed into the 6top sub-layer.
In addition, it invokes sixp_init().
Definition at line 261 of file sixtop.c.
References sixp_init(), sixtop_init_sf(), and SIXTOP_MAX_SCHEDULING_FUNCTIONS.
int sixtop_output | ( | const linkaddr_t * | dest_addr, |
mac_callback_t | callback, | ||
void * | arg ) |
Output a 6P packet which is supposestored in packetbuf.
dest_addr | Destination address of the outgoing packet |
callback | MAC callback function to get a TX result |
arg | The pointer to an argument which is returned with the MAC callback |
Definition at line 125 of file sixtop.c.
References linkaddr_node_addr, MAC_TX_ERR_FATAL, packetbuf_datalen(), packetbuf_dataptr(), packetbuf_hdralloc(), packetbuf_hdrptr(), packetbuf_set_datalen(), PACKETBUF_SIZE, packetbuf_totlen(), and mac_driver::send.
Referenced by sixp_output().
sixtop_sf_t::sfid |
SFID.
managed: 0x00-0xfe unmanaged: 0xf0-0xfe reserved: 0xff
Definition at line 105 of file sixtop.h.
Referenced by sixtop_add_sf().