Contiki-NG
sixp-pkt.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016, Yasuyuki Tanaka
3 * Copyright (c) 2016, Centre for Development of Advanced Computing (C-DAC).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of the copyright holder nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 * OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31/**
32 * \addtogroup sixtop
33 * @{
34 */
35/**
36 * \file
37 * 6top Protocol (6P) Packet Manipulation APIs
38 * \author
39 * Shalu R <shalur@cdac.in>
40 * Lijo Thomas <lijo@cdac.in>
41 * Yasuyuki Tanaka <yasuyuki.tanaka@inf.ethz.ch>
42 */
43#ifndef _SIXTOP_6P_PACKET_H_
44#define _SIXTOP_6P_PACKET_H_
45
46#define SIXP_PKT_VERSION 0x00
47
48/* typedefs for code readability */
49typedef uint8_t sixp_pkt_version_t;
50typedef uint8_t sixp_pkt_cell_options_t;
51typedef uint8_t sixp_pkt_num_cells_t;
52typedef uint8_t sixp_pkt_reserved_t;
53typedef uint16_t sixp_pkt_metadata_t;
54typedef uint16_t sixp_pkt_max_num_cells_t;
55typedef uint16_t sixp_pkt_offset_t;
56typedef uint32_t sixp_pkt_cell_t;
57typedef uint16_t sixp_pkt_total_num_cells_t;
58
59/**
60 * \brief 6P Message Types
61 */
62typedef enum {
63 SIXP_PKT_TYPE_REQUEST = 0x00, /**< 6P Request */
64 SIXP_PKT_TYPE_RESPONSE = 0x01, /**< 6P Response */
65 SIXP_PKT_TYPE_CONFIRMATION = 0x02, /**< 6P Confirmation */
66 SIXP_PKT_TYPE_RESERVED = 0x03, /**< Reserved */
68
69/**
70 * \brief 6P Command Identifiers
71 */
72typedef enum {
73 SIXP_PKT_CMD_ADD = 0x01, /**< CMD_ADD */
74 SIXP_PKT_CMD_DELETE = 0x02, /**< CMD_DELETE */
75 SIXP_PKT_CMD_RELOCATE = 0x03, /**< CMD_STATUS */
76 SIXP_PKT_CMD_COUNT = 0x04, /**< CMD_STATUS */
77 SIXP_PKT_CMD_LIST = 0x05, /**< CMD_LIST */
78 SIXP_PKT_CMD_SIGNAL = 0x06, /**< CMD_SIGNAL */
79 SIXP_PKT_CMD_CLEAR = 0x07, /**< CMD_CLEAR */
80 SIXP_PKT_CMD_UNAVAILABLE = 0xff, /**< for internal use */
82
83/**
84 * \brief 6P Return Codes
85 */
86typedef enum {
87 SIXP_PKT_RC_SUCCESS = 0x00, /**< RC_SUCCESS */
88 SIXP_PKT_RC_EOL = 0x01, /**< RC_EOL */
89 SIXP_PKT_RC_ERR = 0x02, /**< RC_ERR */
90 SIXP_PKT_RC_RESET = 0x03, /**< RC_RESET */
91 SIXP_PKT_RC_ERR_VERSION = 0x04, /**< RC_ERR_VERSION */
92 SIXP_PKT_RC_ERR_SFID = 0x05, /**< RC_ERR_SFID */
93 SIXP_PKT_RC_ERR_SEQNUM = 0x06, /**< RC_ERR_SEQNUM */
94 SIXP_PKT_RC_ERR_CELLLIST = 0x07, /**< RC_ERR_CELLLIST */
95 SIXP_PKT_RC_ERR_BUSY = 0x08, /**< RC_ERR_BUSY */
96 SIXP_PKT_RC_ERR_LOCKED = 0x09, /**< RC_ERR_LOCKED */
97 SIXP_PKT_RC_RESERVED = 0xff /**< RC_RESERVED */
99
100/**
101 * \brief 6P Codes integrating Command IDs and Return Codes
102 */
103typedef union {
104 sixp_pkt_cmd_t cmd; /**< 6P Command Identifier */
105 sixp_pkt_rc_t rc; /**< 6P Return Code */
106 uint8_t value; /**< 8-bit unsigned integer value */
108
109/**
110 * \brief 6P Cell Options
111 */
112typedef enum {
113 SIXP_PKT_CELL_OPTION_TX = 0x01, /**< TX Cell */
114 SIXP_PKT_CELL_OPTION_RX = 0x02, /**< RX Cell */
115 SIXP_PKT_CELL_OPTION_SHARED = 0x04 /**< SHARED Cell */
117
118/**
119 * \brief 6top IE Structure
120 */
121typedef struct {
122 sixp_pkt_version_t version; /**< Version */
123 sixp_pkt_type_t type; /**< Type */
124 sixp_pkt_code_t code; /**< Code */
125 uint8_t sfid; /**< SFID */
126 uint8_t seqno; /**< SeqNum */
127 const uint8_t *body; /**< Other Fields... */
128 uint16_t body_len; /**< The length of Other Fields */
129} sixp_pkt_t;
130
131/**
132 * \brief Write Metadata into "Other Fields" of 6P packet
133 * \param type 6P Message Type
134 * \param code 6P Command Identifier or Return Code
135 * \param metadata Metadata to write
136 * \param body The pointer to "Other Fields" in a buffer
137 * \param body_len The length of body, typically "Other Fields" length
138 * \return 0 on success, -1 on failure
139 */
141 sixp_pkt_metadata_t metadata,
142 uint8_t *body, uint16_t body_len);
143
144/**
145 * \brief Read Metadata stored in "Other Fields" of 6P packet
146 * \param type 6P Message Type
147 * \param code 6P Command Identifier or Return Code
148 * \param metadata The pointer to a buffer to store Metadata in
149 * \param body The pointer to the buffer having "Other Fields"
150 * \param body_len The length of body, typically "Other Fields" length
151 * \return 0 on success, -1 on failure
152 */
154 sixp_pkt_metadata_t *metadata,
155 const uint8_t *body, uint16_t body_len);
156
157/**
158 * \brief Write CellOptions in "Other Fields" of 6P packet
159 * \param type 6P Message Type
160 * \param code 6P Command Identifier or Return Code
161 * \param cell_options "CellOptions" to write
162 * \param body The pointer to buffer having "Other Fields"
163 * \param body_len The length of body, typically "Other Fields" length
164 * \return 0 on success, -1 on failure
165 */
167 sixp_pkt_cell_options_t cell_options,
168 uint8_t *body, uint16_t body_len);
169
170/**
171 * \brief Read CellOptions in "Other Fields" of 6P packet
172 * \param type 6P Message Type
173 * \param code 6P Command Identifier or Return Code
174 * \param cell_options The pointer to buffer to store CellOptions in
175 * \param body The pointer to buffer pointing to "Other Fields"
176 * \param body_len The length of body, typically "Other Fields" length
177 * \return 0 on success, -1 on failure
178 */
180 sixp_pkt_cell_options_t *cell_options,
181 const uint8_t *body, uint16_t body_len);
182
183/**
184 * \brief Write NumCells in "Other Fields" of 6P packet
185 * \param type 6P Message Type
186 * \param code 6P Command Identifier or Return Code
187 * \param num_cells "NumCells" to write
188 * \param body The pointer to buffer pointing to "Other Fields"
189 * \param body_len The length of body, typically "Other Fields" length
190 * \return 0 on success, -1 on failure
191 */
193 sixp_pkt_num_cells_t num_cells,
194 uint8_t *body, uint16_t body_len);
195
196/**
197 * \brief Read NumCells in "Other Fields" of 6P packet
198 * \param type 6P Message Type
199 * \param code 6P Command Identifier or Return Code
200 * \param num_cells The pointer to buffer to store NumCells in
201 * \param body The pointer to buffer pointing to "Other Fields"
202 * \param body_len The length of body, typically "Other Fields" length
203 * \return 0 on success, -1 on failure
204 */
206 sixp_pkt_num_cells_t *num_cells,
207 const uint8_t *body, uint16_t body_len);
208/**
209 * \brief Write Reserved in "Other Fields" of 6P packet
210 * \param type 6P Message Type
211 * \param code 6P Command Identifier or Return Code
212 * \param reserved "Reserved" to write
213 * \param body The pointer to buffer pointing to "Other Fields"
214 * \param body_len The length of body, typically "Other Fields" length
215 * \return 0 on success, -1 on failure
216 */
218 sixp_pkt_reserved_t reserved,
219 uint8_t *body, uint16_t body_len);
220
221/**
222 * \brief Read Reserved in "Other Fields" of 6P packet
223 * \param type 6P Message Type
224 * \param code 6P Command Identifier or Return Code
225 * \param reserved The pointer to buffer to store Reserved in
226 * \param body The pointer to buffer pointing to "Other Fields"
227 * \param body_len The length of body, typically "Other Fields" length
228 * \return 0 on success, -1 on failure
229 */
231 sixp_pkt_reserved_t *reserved,
232 const uint8_t *body, uint16_t body_len);
233
234/**
235 * \brief Write Offset in "Other Fields" of 6P packet
236 * \param type 6P Message Type
237 * \param code 6P Command Identifier or Return Code
238 * \param offset "Offset" to write
239 * \param body The pointer to buffer pointing to "Other Fields"
240 * \param body_len The length of body, typically "Other Fields" length
241 * \return 0 on success, -1 on failure
242 */
244 sixp_pkt_offset_t offset,
245 uint8_t *body, uint16_t body_len);
246/**
247 * \brief Read Offset in "Other Fields" of 6P packet
248 * \param type 6P Message Type
249 * \param code 6P Command Identifier or Return Code
250 * \param offset The pointer to buffer to store Offset in
251 * \param body The pointer to buffer pointing to "Other Fields"
252 * \param body_len The length of body, typically "Other Fields" length
253 * \return 0 on success, -1 on failure
254 */
256 sixp_pkt_offset_t *offset,
257 const uint8_t *body, uint16_t body_len);
258
259/**
260 * \brief Write MaxNumCells in "Other Fields" of 6P packet
261 * \param type 6P Message Type
262 * \param code 6P Command Identifier or Return Code
263 * \param max_num_cells "MaxNumCells" to write
264 * \param body The pointer to buffer pointing to "Other Fields"
265 * \param body_len The length of body, typically "Other Fields" length
266 * \return 0 on success, -1 on failure
267 */
269 sixp_pkt_code_t code,
270 sixp_pkt_max_num_cells_t max_num_cells,
271 uint8_t *body, uint16_t body_len);
272
273/**
274 * \brief Read MaxNumCells in "Other Fields" of 6P packet
275 * \param type 6P Message Type
276 * \param code 6P Command Identifier or Return Code
277 * \param max_num_cells The pointer to buffer to store MaxNumCells in
278 * \param body The pointer to buffer pointing to "Other Fields"
279 * \param body_len The length of body, typically "Other Fields" length
280 * \return 0 on success, -1 on failure
281 */
283 sixp_pkt_code_t code,
284 sixp_pkt_max_num_cells_t *max_num_cells,
285 const uint8_t *body, uint16_t body_len);
286
287/**
288 * \brief Write CellList in "Other Fields" of 6P packet
289 * \note "offset" is specified by index in CellList
290 * \param type 6P Message Type
291 * \param code 6P Command Identifier or Return Code
292 * \param cell_list The pointer to "CellList" to write
293 * \param cell_list_len Length to write
294 * \param offset Offset in the "CellList" field to start writing
295 * \param body The pointer to buffer pointing to "Other Fields"
296 * \param body_len The length of body, typically "Other Fields" length
297 * \return 0 on success, -1 on failure
298 */
300 const uint8_t *cell_list,
301 uint16_t cell_list_len,
302 uint16_t offset,
303 uint8_t *body, uint16_t body_len);
304/**
305 * \brief Read CellList in "Other Fields" of 6P packet
306 * \note If you want only the length of CellList, you can set null to cell_list.
307 * \param type 6P Message Type
308 * \param code 6P Command Identifier or Return Code
309 * \param cell_list The double pointer to store the starting address of CellList
310 * \param cell_list_len Pointer to store the length of CellList
311 * \param body The pointer to buffer pointing to "Other Fields"
312 * \param body_len The length of body, typically "Other Fields" length
313 * \return 0 on success, -1 on failure
314 */
316 const uint8_t **cell_list,
317 sixp_pkt_offset_t *cell_list_len,
318 const uint8_t *body, uint16_t body_len);
319
320/**
321 * \brief Write RelCellList in "Other Fields" of 6P packet
322 * \note "offset" is specified by index in RelCellList
323 * \param type 6P Message Type
324 * \param code 6P Command Identifier or Return Code
325 * \param rel_cell_list The pointer to "RelCellList" to write
326 * \param rel_cell_list_len Length to write
327 * \param offset Offset in the "RelCellList" field to start writing
328 * \param body The pointer to buffer pointing to "Other Fields"
329 * \param body_len The length of body, typically "Other Fields" length
330 * \return 0 on success, -1 on failure
331 */
333 const uint8_t *rel_cell_list,
334 uint16_t rel_cell_list_len,
335 uint16_t offset,
336 uint8_t *body, uint16_t body_len);
337
338/**
339 * \brief Read RelCellList in "Other Fields" of 6P packet
340 * \note If you want only the length of RelCellList, you can set null to
341 * rel_cell_list.
342 * \param type 6P Message Type
343 * \param code 6P Command Identifier or Return Code
344 * \param rel_cell_list The double pointer to store the starting address of
345 * RelCellList
346 * \param rel_cell_list_len Pointer to store the length of a returned
347 * RelCellList
348 * \param body The pointer to buffer pointing to "Other Fields"
349 * \param body_len The length of body, typically "Other Fields" length
350 * \return 0 on success, -1 on failure
351 */
353 const uint8_t **rel_cell_list,
354 sixp_pkt_offset_t *rel_cell_list_len,
355 const uint8_t *body, uint16_t body_len);
356
357/**
358 * \brief Write CandCellList in "Other Fields" of 6P packet
359 * \note "offset" is specified by index in CandCellList
360 * \param type 6P Message Type
361 * \param code 6P Command Identifier or Return Code
362 * \param cand_cell_list The pointer to "CandCellList" to write
363 * \param cand_cell_list_len Length to write
364 * \param offset Offset in the "CandCellList" field to start writing
365 * \param body The pointer to buffer pointing to "Other Fields"
366 * \param body_len The length of body, typically "Other Fields" length
367 * \return 0 on success, -1 on failure
368 */
370 const uint8_t *cand_cell_list,
371 uint16_t cand_cell_list_len,
372 uint16_t offset,
373 uint8_t *body, uint16_t body_len);
374
375/**
376 * \brief Read CandCellList in "Other Fields" of 6P packet
377 * \note If you want only the length of CandCellList, you can set null to
378 * cell_list.
379 * \param type 6P Message Type
380 * \param code 6P Command Identifier or Return Code
381 * \param cand_cell_list The double pointer to store the starting address of
382 * CandCellList
383 * \param cand_cell_list_len Pointer to store the length of CandCellList
384 * \param body The pointer to buffer pointing to "Other Fields"
385 * \param body_len The length of body, typically "Other Fields" length
386 * \return 0 on success, -1 on failure
387 */
389 const uint8_t **cand_cell_list,
390 sixp_pkt_offset_t *cand_cell_list_len,
391 const uint8_t *body, uint16_t body_len);
392
393/**
394 * \brief Write TotalNumCells in "Other Fields" of 6P packet
395 * \param type 6P Message Type
396 * \param code 6P Command Identifier or Return Code
397 * \param total_num_cells "TotalNumCells" to write
398 * \param body The pointer to buffer pointing to "Other Fields"
399 * \param body_len The length of body, typically "Other Fields" length
400 * \return 0 on success, -1 on failure
401 */
403 sixp_pkt_total_num_cells_t total_num_cells,
404 uint8_t *body, uint16_t body_len);
405
406/**
407 * \brief Read TotalNumCells in "Other Fields" of 6P packet
408 * \param type 6P Message Type
409 * \param code 6P Command Identifier or Return Code
410 * \param total_num_cells The pointer to buffer to store TotalNumCells in
411 * \param body The pointer to buffer pointing to "Other Fields"
412 * \param body_len The length of body, typically "Other Fields" length
413 * \return 0 on success, -1 on failure
414 */
416 sixp_pkt_total_num_cells_t *total_num_cells,
417 const uint8_t *body, uint16_t body_len);
418
419/**
420 * \brief Write Payload in "Other Fields" of 6P packet
421 * \param type 6P Message Type
422 * \param code 6P Command Identifier or Return Code
423 * \param payload "Payload" to write
424 * \param payload_len The length of "Payload" to write
425 * \param body The pointer to buffer pointing to "Other Fields"
426 * \param body_len The length of body, typically "Other Fields" length
427 * \return 0 on success, -1 on failure
428 */
430 const uint8_t *payload, uint16_t payload_len,
431 uint8_t *body, uint16_t body_len);
432
433/**
434 * \brief Read Payload in "Other Fields" of 6P packet
435 * \param type 6P Message Type
436 * \param code 6P Command Identifier or Return Code
437 * \param buf The pointer to buffer to store "Payload" in
438 * \param buf_len The length of buf
439 * \param body The pointer to buffer pointing to "Other Fields"
440 * \param body_len The length of body, typically "Other Fields" length
441 * \return 0 on success, -1 on failure
442 */
444 uint8_t *buf, uint16_t buf_len,
445 const uint8_t *body, uint16_t body_len);
446
447/**
448 * \brief Parse a 6P packet
449 * \param buf The pointer to a buffer pointing 6top IE Content
450 * \param len The length of the buffer
451 * \param pkt The pointer to a sixp_pkt_t structure to store packet info
452 * \return 0 on success, -1 on failure
453 */
454int sixp_pkt_parse(const uint8_t *buf, uint16_t len,
455 sixp_pkt_t *pkt);
456
457/**
458 * \brief Create a 6P packet
459 * \param type 6P Message Type
460 * \param code 6P Message Code, Command Identifier or Return Code
461 * \param sfid Scheduling Function Identifier
462 * \param seqno Sequence Number
463 * \param body The pointer to "Other Fields" in a buffer
464 * \param body_len The length of body, typically "Other Fields" length
465 * \param pkt The pointer to a sixp_pkt_t structure to store packet info
466 * (option)
467 * \return 0 on success, -1 on failure
468 */
470 uint8_t sfid, uint8_t seqno,
471 const uint8_t *body, uint16_t body_len,
472 sixp_pkt_t *pkt);
473
474#endif /* !_SIXP_PKT_H_ */
475/** @} */
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.
Definition: sixp-pkt.c:913
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.
Definition: sixp-pkt.c:691
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.
Definition: sixp-pkt.c:1086
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.
Definition: sixp-pkt.c:880
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.
Definition: sixp-pkt.c:196
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.
Definition: sixp-pkt.c:503
int sixp_pkt_parse(const uint8_t *buf, uint16_t len, sixp_pkt_t *pkt)
Parse a 6P packet.
Definition: sixp-pkt.c:947
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.
Definition: sixp-pkt.c:849
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.
Definition: sixp-pkt.c:325
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.
Definition: sixp-pkt.c:263
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.
Definition: sixp-pkt.c:349
sixp_pkt_cell_option_t
6P Cell Options
Definition: sixp-pkt.h:112
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.
Definition: sixp-pkt.c:821
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.
Definition: sixp-pkt.c:294
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.
Definition: sixp-pkt.c:608
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.
Definition: sixp-pkt.c:537
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 cell_offset, uint8_t *body, uint16_t body_len)
Write CellList in "Other Fields" of 6P packet.
Definition: sixp-pkt.c:572
int sixp_pkt_get_offset(sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_offset_t *cell_offset, const uint8_t *body, uint16_t body_len)
Read Offset in "Other Fields" of 6P packet.
Definition: sixp-pkt.c:468
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.
Definition: sixp-pkt.c:409
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.
Definition: sixp-pkt.c:229
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 cell_offset, uint8_t *body, uint16_t body_len)
Write CandCellList in "Other Fields" of 6P packet.
Definition: sixp-pkt.c:734
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.
Definition: sixp-pkt.c:379
int sixp_pkt_set_offset(sixp_pkt_type_t type, sixp_pkt_code_t code, sixp_pkt_offset_t cell_offset, uint8_t *body, uint16_t body_len)
Write Offset in "Other Fields" of 6P packet.
Definition: sixp-pkt.c:434
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.
Definition: sixp-pkt.c:776
sixp_pkt_rc_t
6P Return Codes
Definition: sixp-pkt.h:86
sixp_pkt_type_t
6P Message Types
Definition: sixp-pkt.h:62
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 cell_offset, uint8_t *body, uint16_t body_len)
Write RelCellList in "Other Fields" of 6P packet.
Definition: sixp-pkt.c:645
sixp_pkt_cmd_t
6P Command Identifiers
Definition: sixp-pkt.h:72
@ SIXP_PKT_CELL_OPTION_RX
RX Cell.
Definition: sixp-pkt.h:114
@ SIXP_PKT_CELL_OPTION_TX
TX Cell.
Definition: sixp-pkt.h:113
@ SIXP_PKT_CELL_OPTION_SHARED
SHARED Cell.
Definition: sixp-pkt.h:115
@ SIXP_PKT_RC_RESERVED
RC_RESERVED.
Definition: sixp-pkt.h:97
@ SIXP_PKT_RC_EOL
RC_EOL.
Definition: sixp-pkt.h:88
@ SIXP_PKT_RC_ERR
RC_ERR.
Definition: sixp-pkt.h:89
@ SIXP_PKT_RC_ERR_CELLLIST
RC_ERR_CELLLIST.
Definition: sixp-pkt.h:94
@ SIXP_PKT_RC_RESET
RC_RESET.
Definition: sixp-pkt.h:90
@ SIXP_PKT_RC_ERR_LOCKED
RC_ERR_LOCKED.
Definition: sixp-pkt.h:96
@ SIXP_PKT_RC_ERR_SFID
RC_ERR_SFID.
Definition: sixp-pkt.h:92
@ SIXP_PKT_RC_ERR_SEQNUM
RC_ERR_SEQNUM.
Definition: sixp-pkt.h:93
@ SIXP_PKT_RC_ERR_BUSY
RC_ERR_BUSY.
Definition: sixp-pkt.h:95
@ SIXP_PKT_RC_ERR_VERSION
RC_ERR_VERSION.
Definition: sixp-pkt.h:91
@ SIXP_PKT_RC_SUCCESS
RC_SUCCESS.
Definition: sixp-pkt.h:87
@ SIXP_PKT_TYPE_RESERVED
Reserved.
Definition: sixp-pkt.h:66
@ SIXP_PKT_TYPE_RESPONSE
6P Response
Definition: sixp-pkt.h:64
@ SIXP_PKT_TYPE_REQUEST
6P Request
Definition: sixp-pkt.h:63
@ SIXP_PKT_TYPE_CONFIRMATION
6P Confirmation
Definition: sixp-pkt.h:65
@ SIXP_PKT_CMD_UNAVAILABLE
for internal use
Definition: sixp-pkt.h:80
@ SIXP_PKT_CMD_CLEAR
CMD_CLEAR.
Definition: sixp-pkt.h:79
@ SIXP_PKT_CMD_RELOCATE
CMD_STATUS.
Definition: sixp-pkt.h:75
@ SIXP_PKT_CMD_LIST
CMD_LIST.
Definition: sixp-pkt.h:77
@ SIXP_PKT_CMD_ADD
CMD_ADD.
Definition: sixp-pkt.h:73
@ SIXP_PKT_CMD_DELETE
CMD_DELETE.
Definition: sixp-pkt.h:74
@ SIXP_PKT_CMD_COUNT
CMD_STATUS.
Definition: sixp-pkt.h:76
@ SIXP_PKT_CMD_SIGNAL
CMD_SIGNAL.
Definition: sixp-pkt.h:78
6top IE Structure
Definition: sixp-pkt.h:121
uint8_t sfid
SFID.
Definition: sixp-pkt.h:125
sixp_pkt_type_t type
Type.
Definition: sixp-pkt.h:123
sixp_pkt_code_t code
Code.
Definition: sixp-pkt.h:124
const uint8_t * body
Other Fields...
Definition: sixp-pkt.h:127
sixp_pkt_version_t version
Version.
Definition: sixp-pkt.h:122
uint8_t seqno
SeqNum.
Definition: sixp-pkt.h:126
uint16_t body_len
The length of Other Fields.
Definition: sixp-pkt.h:128
6P Codes integrating Command IDs and Return Codes
Definition: sixp-pkt.h:103
sixp_pkt_cmd_t cmd
6P Command Identifier
Definition: sixp-pkt.h:104
sixp_pkt_rc_t rc
6P Return Code
Definition: sixp-pkt.h:105
uint8_t value
8-bit unsigned integer value
Definition: sixp-pkt.h:106