Contiki-NG
Files | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
6TiSCH Operation Sublayer (6top)

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...
 

Macros

#define SIXP_INITIAL_SEQUENCE_NUMBER   0
 The initial sequence number used for 6P request.
 
#define SIXTOP_MAX_SCHEDULING_FUNCTIONS   1
 The maximum number of Scheduling Functions in the system.
 
#define SIXTOP_MAX_TRANSACTIONS   1
 The maximum number of transactions which the sixtop module can handle at the same time.
 

Typedefs

typedef struct sixp_nbr sixp_nbr_t
 6P Neighbor Data Structure (for internal use) More...
 
typedef struct sixp_trans sixp_trans_t
 6P Transaction 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. More...
 
typedef void(* sixtop_sf_timeout) (sixp_pkt_cmd_t cmd, const linkaddr_t *peer_addr)
 Timeout Handler of Scheduling Function. More...
 

Enumerations

enum  sixp_pkt_type_t { SIXP_PKT_TYPE_REQUEST = 0x00, SIXP_PKT_TYPE_RESPONSE = 0x01, SIXP_PKT_TYPE_CONFIRMATION = 0x02, SIXP_PKT_TYPE_RESERVED = 0x03 }
 6P Message Types More...
 
enum  sixp_pkt_cmd_t {
  SIXP_PKT_CMD_ADD = 0x01, SIXP_PKT_CMD_DELETE = 0x02, SIXP_PKT_CMD_RELOCATE = 0x03, SIXP_PKT_CMD_COUNT = 0x04,
  SIXP_PKT_CMD_LIST = 0x05, SIXP_PKT_CMD_SIGNAL = 0x06, SIXP_PKT_CMD_CLEAR = 0x07, SIXP_PKT_CMD_UNAVAILABLE = 0xff
}
 6P Command Identifiers More...
 
enum  sixp_pkt_rc_t {
  SIXP_PKT_RC_SUCCESS = 0x00, SIXP_PKT_RC_EOL = 0x01, SIXP_PKT_RC_ERR = 0x02, SIXP_PKT_RC_RESET = 0x03,
  SIXP_PKT_RC_ERR_VERSION = 0x04, SIXP_PKT_RC_ERR_SFID = 0x05, SIXP_PKT_RC_ERR_SEQNUM = 0x06, SIXP_PKT_RC_ERR_CELLLIST = 0x07,
  SIXP_PKT_RC_ERR_BUSY = 0x08, SIXP_PKT_RC_ERR_LOCKED = 0x09
}
 6P Return Codes More...
 
enum  sixp_pkt_cell_option_t { SIXP_PKT_CELL_OPTION_TX = 0x01, SIXP_PKT_CELL_OPTION_RX = 0x02, SIXP_PKT_CELL_OPTION_SHARED = 0x04 }
 6P Cell Options More...
 
enum  sixp_trans_state_t
 6P Transaction States (for internal use)
 
enum  sixp_trans_mode_t
 6P Transaction Modes (for internal use)
 
enum  sixp_output_status_t { SIXP_OUTPUT_STATUS_SUCCESS, SIXP_OUTPUT_STATUS_FAILURE }
 6P Send Status, which represents sixp_output() result. More...
 

Functions

sixp_nbr_tsixp_nbr_find (const linkaddr_t *addr)
 Find a neighbor. More...
 
sixp_nbr_tsixp_nbr_alloc (const linkaddr_t *addr)
 Allocate a neighbor. More...
 
void sixp_nbr_free (sixp_nbr_t *nbr)
 Free a neighbor. More...
 
int sixp_nbr_get_next_seqno (sixp_nbr_t *nbr)
 Get the next sequence number of a neighbor. More...
 
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. More...
 
int sixp_nbr_reset_next_seqno (sixp_nbr_t *nbr)
 Reset the next sequence number of a neighbor to zero. More...
 
int sixp_nbr_increment_next_seqno (sixp_nbr_t *nbr)
 Increment the next sequence number of a neighbor. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int sixp_pkt_parse (const uint8_t *buf, uint16_t len, sixp_pkt_t *pkt)
 Parse a 6P packet. More...
 
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. More...
 
int sixp_trans_transit_state (sixp_trans_t *trans, sixp_trans_state_t new_state)
 Change the state of a specified transaction. More...
 
sixp_pkt_cmd_t sixp_trans_get_cmd (sixp_trans_t *trans)
 Return the command associated with a specified transaction. More...
 
sixp_trans_state_t sixp_trans_get_state (sixp_trans_t *trans)
 Return the state of a specified transaction. More...
 
int16_t sixp_trans_get_seqno (sixp_trans_t *trans)
 Return the sequence number associated with a specified transaction. More...
 
sixp_trans_mode_t sixp_trans_get_mode (sixp_trans_t *trans)
 Return the mode, 2-step or 3-step, of a specified transaction. More...
 
void sixp_trans_invoke_callback (sixp_trans_t *trans, sixp_output_status_t status)
 Invoke the output callback of a specified transaction. More...
 
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. More...
 
sixp_trans_tsixp_trans_alloc (const sixp_pkt_t *pkt, const linkaddr_t *peer_addr)
 Allocate a transaction. More...
 
sixp_trans_tsixp_trans_find (const linkaddr_t *peer_addr)
 Find a transaction. More...
 
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. More...
 
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. More...
 
void sixp_init (void)
 Initialize 6P Module It invokes sixp_nbr_init() and sixp_trans_init().
 
const sixtop_sf_tsixtop_find_sf (uint8_t sfid)
 Find a SF which has been added by SFID. More...
 
int sixtop_add_sf (const sixtop_sf_t *sf)
 Add a Scheduling Function (SF) to 6top Sublayer. More...
 
void sixtop_output (const linkaddr_t *dest_addr, mac_callback_t callback, void *arg)
 Output a 6P packet which is supposestored in packetbuf. More...
 
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. More...
 
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. More...
 

Detailed Description

Typedef Documentation

◆ sixp_nbr_t

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.

◆ sixtop_sf_input

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.

Parameters
type6P Message Type of an input packet
codeCode, 6P Command Identifier or Return Code, of an input packet
bodyBody, "Other Fields", of an input packet
body_lenThe length of body
bodysrc_addr Source address of an input packet

Definition at line 63 of file sixtop.h.

◆ sixtop_sf_timeout

typedef void(* sixtop_sf_timeout) (sixp_pkt_cmd_t cmd, const linkaddr_t *peer_addr)

Timeout Handler of Scheduling Function.

Parameters
cmd6P Command (Identifier) in process under the transaction
peer_addrThe peer address of the transaction

Definition at line 74 of file sixtop.h.

Enumeration Type Documentation

◆ sixp_output_status_t

6P Send Status, which represents sixp_output() result.

Enumerator
SIXP_OUTPUT_STATUS_SUCCESS 

SUCCESS.

SIXP_OUTPUT_STATUS_FAILURE 

FAILURE.

Definition at line 65 of file sixp.h.

◆ sixp_pkt_cell_option_t

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.

◆ sixp_pkt_cmd_t

6P Command Identifiers

Enumerator
SIXP_PKT_CMD_ADD 

CMD_ADD.

SIXP_PKT_CMD_DELETE 

CMD_DELETE.

SIXP_PKT_CMD_RELOCATE 

CMD_STATUS.

SIXP_PKT_CMD_COUNT 

CMD_STATUS.

SIXP_PKT_CMD_LIST 

CMD_LIST.

SIXP_PKT_CMD_SIGNAL 

CMD_SIGNAL.

SIXP_PKT_CMD_CLEAR 

CMD_CLEAR.

SIXP_PKT_CMD_UNAVAILABLE 

for internal use

Definition at line 72 of file sixp-pkt.h.

◆ sixp_pkt_rc_t

6P Return Codes

Enumerator
SIXP_PKT_RC_SUCCESS 

RC_SUCCESS.

SIXP_PKT_RC_EOL 

RC_EOL.

SIXP_PKT_RC_ERR 

RC_ERR.

SIXP_PKT_RC_RESET 

RC_RESET.

SIXP_PKT_RC_ERR_VERSION 

RC_ERR_VERSION.

SIXP_PKT_RC_ERR_SFID 

RC_ERR_SFID.

SIXP_PKT_RC_ERR_SEQNUM 

RC_ERR_SEQNUM.

SIXP_PKT_RC_ERR_CELLLIST 

RC_ERR_CELLLIST.

SIXP_PKT_RC_ERR_BUSY 

RC_ERR_BUSY.

SIXP_PKT_RC_ERR_LOCKED 

RC_ERR_LOCKED.

Definition at line 86 of file sixp-pkt.h.

◆ 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.

Function Documentation

◆ sixp_input()

void sixp_input ( const uint8_t *  buf,
uint16_t  len,
const linkaddr_t *  src_addr 
)

Input a 6P packet.

Parameters
bufThe pointer to a buffer pointing the head of 6top IE Content
lenThe lengh of 6top IE Content
src_addrThe Source address of an incoming packet
Returns
0 if , -1 on failure

Definition at line 136 of file sixp.c.

◆ sixp_nbr_alloc()

sixp_nbr_t * sixp_nbr_alloc ( const linkaddr_t *  addr)

Allocate a neighbor.

Parameters
addrThe MAC address of a neighbor
Returns
The pointer to a allocated neighbor, NULL on failure

Definition at line 80 of file sixp-nbr.c.

References nbr.

◆ sixp_nbr_find()

sixp_nbr_t * sixp_nbr_find ( const linkaddr_t *  addr)

Find a neighbor.

Parameters
addrThe MAC address of a neighbor
Returns
The pointer to a neighbor, NULL on failure

Definition at line 70 of file sixp-nbr.c.

◆ sixp_nbr_free()

void sixp_nbr_free ( sixp_nbr_t nbr)

Free a neighbor.

Parameters
nbrThe pointer to a neighbor to free

Definition at line 112 of file sixp-nbr.c.

◆ sixp_nbr_get_next_seqno()

int16_t sixp_nbr_get_next_seqno ( sixp_nbr_t nbr)

Get the next sequence number of a neighbor.

Parameters
nbrThe pointer to a neighbor
Returns
A sequence number to use for a next request, -1 on failure

Definition at line 121 of file sixp-nbr.c.

◆ sixp_nbr_increment_next_seqno()

int sixp_nbr_increment_next_seqno ( sixp_nbr_t nbr)

Increment the next sequence number of a neighbor.

Parameters
nbrThe pointer to a neighbor
Returns
0 on success, -1 on failure

Definition at line 156 of file sixp-nbr.c.

◆ sixp_nbr_reset_next_seqno()

int sixp_nbr_reset_next_seqno ( sixp_nbr_t nbr)

Reset the next sequence number of a neighbor to zero.

Parameters
nbrThe pointer to a neighbor
Returns
0 on success, -1 on failure

Definition at line 144 of file sixp-nbr.c.

◆ sixp_nbr_set_next_seqno()

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.

Parameters
nbrThe pointer to a neighbor
seqnoValue to be set
Returns
0 on success, -1 on failure

Definition at line 132 of file sixp-nbr.c.

◆ sixp_output()

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.

Parameters
typeMessage Type
codeMessage Code; Command ID or Return Code
sfidScheduling Function Identifier
body6top IE Content
body_lenThe length of 6top IE Content
dest_addrThe destination Address
funccallback function invoked after the transmission process
argThe pointer to an argument to be passed with the callback
arg_lenThe length of the argument
Returns
0 on success, -1 on failure

Definition at line 294 of file sixp.c.

References nbr.

◆ sixp_pkt_create()

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.

Parameters
type6P Message Type
code6P Message Code, Command Identifier or Return Code
sfidScheduling Function Identifier
seqnoSequence Number
bodyThe pointer to "Other Fields" in a buffer
body_lenThe length of body, typically "Other Fields" length
pktThe pointer to a sixp_pkt_t structure to store packet info (option)
Returns
0 on success, -1 on failure

Definition at line 1081 of file sixp-pkt.c.

◆ sixp_pkt_get_cand_cell_list()

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.

Note
If you want only the length of CandCellList, you can set null to cell_list.
Parameters
type6P Message Type
code6P Command Identifier or Return Code
cand_cell_listThe double pointer to store the starting address of CandCellList
cand_cell_list_lenPointer to store the length of CandCellList
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 776 of file sixp-pkt.c.

◆ sixp_pkt_get_cell_list()

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.

Note
If you want only the length of CellList, you can set null to cell_list.
Parameters
type6P Message Type
code6P Command Identifier or Return Code
cell_listThe double pointer to store the starting address of CellList
cell_list_lenPointer to store the length of CellList
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 608 of file sixp-pkt.c.

◆ sixp_pkt_get_cell_options()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
cell_optionsThe pointer to buffer to store CellOptions in
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 294 of file sixp-pkt.c.

◆ sixp_pkt_get_max_num_cells()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
max_num_cellsThe pointer to buffer to store MaxNumCells in
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 537 of file sixp-pkt.c.

◆ sixp_pkt_get_metadata()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
metadataThe pointer to a buffer to store Metadata in
bodyThe pointer to the buffer having "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 229 of file sixp-pkt.c.

◆ sixp_pkt_get_num_cells()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
num_cellsThe pointer to buffer to store NumCells in
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 349 of file sixp-pkt.c.

◆ sixp_pkt_get_offset()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
offsetThe pointer to buffer to store Offset in
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 468 of file sixp-pkt.c.

◆ sixp_pkt_get_payload()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
bufThe pointer to buffer to store "Payload" in
buf_lenThe length of buf
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 913 of file sixp-pkt.c.

◆ sixp_pkt_get_rel_cell_list()

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.

Note
If you want only the length of RelCellList, you can set null to rel_cell_list.
Parameters
type6P Message Type
code6P Command Identifier or Return Code
rel_cell_listThe double pointer to store the starting address of RelCellList
rel_cell_list_lenPointer to store the length of a returned RelCellList
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 691 of file sixp-pkt.c.

◆ sixp_pkt_get_reserved()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
reservedThe pointer to buffer to store Reserved in
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 409 of file sixp-pkt.c.

◆ sixp_pkt_get_total_num_cells()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
total_num_cellsThe pointer to buffer to store TotalNumCells in
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 849 of file sixp-pkt.c.

◆ sixp_pkt_parse()

int sixp_pkt_parse ( const uint8_t *  buf,
uint16_t  len,
sixp_pkt_t pkt 
)

Parse a 6P packet.

Parameters
bufThe pointer to a buffer pointing 6top IE Content
lenThe length of the buffer
pktThe pointer to a sixp_pkt_t structure to store packet info
Returns
0 on success, -1 on failure

Definition at line 947 of file sixp-pkt.c.

◆ sixp_pkt_set_cand_cell_list()

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.

Note
"offset" is specified by index in CandCellList
Parameters
type6P Message Type
code6P Command Identifier or Return Code
cand_cell_listThe pointer to "CandCellList" to write
cand_cell_list_lenLength to write
offsetOffset in the "CandCellList" field to start writing
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 734 of file sixp-pkt.c.

◆ sixp_pkt_set_cell_list()

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.

Note
"offset" is specified by index in CellList
Parameters
type6P Message Type
code6P Command Identifier or Return Code
cell_listThe pointer to "CellList" to write
cell_list_lenLength to write
offsetOffset in the "CellList" field to start writing
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 572 of file sixp-pkt.c.

◆ sixp_pkt_set_cell_options()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
cell_options"CellOptions" to write
bodyThe pointer to buffer having "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 263 of file sixp-pkt.c.

◆ sixp_pkt_set_max_num_cells()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
max_num_cells"MaxNumCells" to write
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 503 of file sixp-pkt.c.

◆ sixp_pkt_set_metadata()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
metadataMetadata to write
bodyThe pointer to "Other Fields" in a buffer
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 196 of file sixp-pkt.c.

◆ sixp_pkt_set_num_cells()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
num_cells"NumCells" to write
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 325 of file sixp-pkt.c.

◆ sixp_pkt_set_offset()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
offset"Offset" to write
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 434 of file sixp-pkt.c.

◆ sixp_pkt_set_payload()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
payload"Payload" to write
payload_lenThe length of "Payload" to write
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 880 of file sixp-pkt.c.

◆ sixp_pkt_set_rel_cell_list()

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.

Note
"offset" is specified by index in RelCellList
Parameters
type6P Message Type
code6P Command Identifier or Return Code
rel_cell_listThe pointer to "RelCellList" to write
rel_cell_list_lenLength to write
offsetOffset in the "RelCellList" field to start writing
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 645 of file sixp-pkt.c.

◆ sixp_pkt_set_reserved()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
reserved"Reserved" to write
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 379 of file sixp-pkt.c.

◆ sixp_pkt_set_total_num_cells()

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.

Parameters
type6P Message Type
code6P Command Identifier or Return Code
total_num_cells"TotalNumCells" to write
bodyThe pointer to buffer pointing to "Other Fields"
body_lenThe length of body, typically "Other Fields" length
Returns
0 on success, -1 on failure

Definition at line 821 of file sixp-pkt.c.

◆ sixp_trans_alloc()

sixp_trans_t * sixp_trans_alloc ( const sixp_pkt_t pkt,
const linkaddr_t *  peer_addr 
)

Allocate a transaction.

Parameters
pktThe pointer to a packet which triggers the allocation
peer_addrThe peer address which will be associated
Returns
A pointer to an newly allocated transaction, NULL on failure

Definition at line 341 of file sixp-trans.c.

◆ sixp_trans_find()

sixp_trans_t * sixp_trans_find ( const linkaddr_t *  peer_addr)

Find a transaction.

Parameters
peer_addrThe peer address
Returns
The pointer to a transaction; NULL on failure

Definition at line 384 of file sixp-trans.c.

◆ sixp_trans_get_cmd()

sixp_pkt_cmd_t sixp_trans_get_cmd ( sixp_trans_t trans)

Return the command associated with a specified transaction.

Parameters
transThe pointer to a transaction
Returns
Command identifier; SIXP_PKT_CMD_UNAVAILABLE on failure

Definition at line 274 of file sixp-trans.c.

◆ sixp_trans_get_mode()

sixp_trans_mode_t sixp_trans_get_mode ( sixp_trans_t trans)

Return the mode, 2-step or 3-step, of a specified transaction.

Parameters
transThe pointer to a transaction
Returns
The mode of the transaction, SIXP_TRANS_MODE_UNAVAILABLE on failure

Definition at line 305 of file sixp-trans.c.

◆ sixp_trans_get_seqno()

int16_t sixp_trans_get_seqno ( sixp_trans_t trans)

Return the sequence number associated with a specified transaction.

Parameters
transThe pointer of a transaction
Returns
0 or larger than 0 on success, -1 on failure

Definition at line 294 of file sixp-trans.c.

◆ sixp_trans_get_state()

sixp_trans_state_t sixp_trans_get_state ( sixp_trans_t trans)

Return the state of a specified transaction.

Parameters
transThe pointer to a transaction
Returns
a state of the transaction; SIXP_TRANS_STATE_UNAVAILABLE if the transaction is not found in the system.

Definition at line 284 of file sixp-trans.c.

◆ sixp_trans_invoke_callback()

void sixp_trans_invoke_callback ( sixp_trans_t trans,
sixp_output_status_t  status 
)

Invoke the output callback of a specified transaction.

Parameters
transThe pointer to a transaction
statusAn output result value

Definition at line 316 of file sixp-trans.c.

◆ sixp_trans_set_callback()

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.

Parameters
transThe pointer to a transaction
funcThe pointer to a callback function
argThe pointer to an argument which will be passed to func
arg_lenThe length of the argument

Definition at line 328 of file sixp-trans.c.

◆ sixp_trans_transit_state()

int sixp_trans_transit_state ( sixp_trans_t trans,
sixp_trans_state_t  new_state 
)

Change the state of a specified transaction.

Parameters
transThe pointer to a transaction
new_stateNew state to move the transaction to
Returns
0 on success, -1 on failure

Definition at line 206 of file sixp-trans.c.

References nbr.

◆ sixtop_add_sf()

int sixtop_add_sf ( const sixtop_sf_t sf)

Add a Scheduling Function (SF) to 6top Sublayer.

Parameters
sfThe pointer to a Scheduling Function Driver
Returns
0 on success, -1 on failure

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.

◆ sixtop_find_sf()

const sixtop_sf_t * sixtop_find_sf ( uint8_t  sfid)

Find a SF which has been added by SFID.

Parameters
sfidScheduling Function Identifier of a SF
Returns
The pointer to a SF driver having the specified SFID on success, NULL on failure (not found)

Definition at line 110 of file sixtop.c.

◆ sixtop_init()

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 260 of file sixtop.c.

◆ sixtop_output()

void sixtop_output ( const linkaddr_t *  dest_addr,
mac_callback_t  callback,
void *  arg 
)

Output a 6P packet which is supposestored in packetbuf.

Parameters
dest_addrDestination address of the outgoing packet
callbackMAC callback function to get a TX result
argThe pointer to an argument which is returned with the MAC callback

Definition at line 125 of file sixtop.c.

Variable Documentation

◆ sfid

sixtop_sf_t::sfid

SFID.

managed: 0x00-0xfe unmanaged: 0xf0-0xfe reserved: 0xff

Definition at line 80 of file sixtop.h.