Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
sixp.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2016, Yasuyuki Tanaka
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* 3. Neither the name of the copyright holder nor the names of its
14
* contributors may be used to endorse or promote products derived
15
* from this software without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
* OF THE POSSIBILITY OF SUCH DAMAGE.
29
*/
30
/**
31
* \addtogroup sixtop
32
* @{
33
*/
34
/**
35
* \file
36
* 6top Protocol (6P) APIs
37
* \author
38
* Yasuyuki Tanaka <yasuyuki.tanaka@inf.ethz.ch>
39
*/
40
41
#ifndef _SIXP_H_
42
#define _SIXP_H_
43
44
#include "
net/linkaddr.h
"
45
#include "sys/clock.h"
46
47
#include "
sixp-pkt.h
"
48
49
#define SIXP_SUBIE_ID 0x00
50
51
#ifdef SIXP_CONF_WITH_PAYLOAD_TERMINATION_IE
52
#define SIXP_WITH_PAYLOAD_TERMINATION_IE SIXP_CONF_WITH_PAYLOAD_TERMINATION_IE
53
#else
54
#define SIXP_WITH_PAYLOAD_TERMINATION_IE 0
55
#endif
/* SIXP_CONF_WITH_PAYLOAD_TERMINATION_IE */
56
57
/**
58
* \brief The initial sequence number used for 6P request
59
*/
60
#define SIXP_INITIAL_SEQUENCE_NUMBER 0
61
62
/**
63
* \brief 6P Send Status, which represents sixp_output() result.
64
*/
65
typedef
enum
{
66
SIXP_OUTPUT_STATUS_SUCCESS
,
/**< SUCCESS */
67
SIXP_OUTPUT_STATUS_FAILURE
,
/**< FAILURE */
68
SIXP_OUTPUT_STATUS_ABORTED
/**< ABORTED */
69
}
sixp_output_status_t
;
70
71
/**
72
* \brief 6P Packet Sent Handler
73
*/
74
typedef
void (*
sixp_sent_callback_t
)(
void
*arg, uint16_t arg_len,
75
const
linkaddr_t *dest_addr,
76
sixp_output_status_t
status);
77
78
/**
79
* \brief Input a 6P packet
80
* \param buf The pointer to a buffer pointing the head of 6top IE Content
81
* \param len The lengh of 6top IE Content
82
* \param src_addr The Source address of an incoming packet
83
*/
84
void
sixp_input
(
const
uint8_t *buf, uint16_t len,
85
const
linkaddr_t *src_addr);
86
87
/**
88
* \brief Output a 6P packet
89
* \param type Message Type
90
* \param code Message Code; Command ID or Return Code
91
* \param sfid Scheduling Function Identifier
92
* \param body 6top IE Content
93
* \param body_len The length of 6top IE Content
94
* \param dest_addr The destination Address
95
* \param func callback function invoked after the transmission process
96
* \param arg The pointer to an argument to be passed with the callback
97
* \param arg_len The length of the argument
98
* \return 0 on success, -1 on failure
99
*/
100
int
sixp_output
(
sixp_pkt_type_t
type,
sixp_pkt_code_t
code, uint8_t sfid,
101
const
uint8_t *body, uint16_t body_len,
102
const
linkaddr_t *dest_addr,
103
sixp_sent_callback_t
func,
void
*arg, uint16_t arg_len);
104
105
/**
106
* \brief Initialize 6P Module
107
* It invokes sixp_nbr_init() and sixp_trans_init().
108
*/
109
void
sixp_init
(
void
);
110
#endif
/* ! _SIXP_H_ */
111
/** @} */
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.
Definition
sixp.c:376
sixp_init
void sixp_init(void)
Initialize 6P Module It invokes sixp_nbr_init() and sixp_trans_init().
Definition
sixp.c:532
sixp_input
void sixp_input(const uint8_t *buf, uint16_t len, const linkaddr_t *src_addr)
Input a 6P packet.
Definition
sixp.c:205
sixp_sent_callback_t
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
Definition
sixp.h:74
sixp_output_status_t
sixp_output_status_t
6P Send Status, which represents sixp_output() result.
Definition
sixp.h:65
sixp_pkt_type_t
sixp_pkt_type_t
6P Message Types
Definition
sixp-pkt.h:62
SIXP_OUTPUT_STATUS_ABORTED
@ SIXP_OUTPUT_STATUS_ABORTED
ABORTED.
Definition
sixp.h:68
SIXP_OUTPUT_STATUS_FAILURE
@ SIXP_OUTPUT_STATUS_FAILURE
FAILURE.
Definition
sixp.h:67
SIXP_OUTPUT_STATUS_SUCCESS
@ SIXP_OUTPUT_STATUS_SUCCESS
SUCCESS.
Definition
sixp.h:66
linkaddr.h
Header file for the link-layer address representation.
sixp-pkt.h
6top Protocol (6P) Packet Manipulation APIs
sixp_pkt_code_t
6P Codes integrating Command IDs and Return Codes
Definition
sixp-pkt.h:103
os
net
mac
tsch
sixtop
sixp.h
Generated on
for Contiki-NG by
1.17.0