Contiki-NG
sixp-nbr.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  * Neighbor Management APIs for 6top Protocol (6P)
37  * \author
38  * Yasuyuki Tanaka <yasuyuki.tanaka@inf.ethz.ch>
39  */
40 
41 #include "sixp-pkt.h"
42 
43 typedef struct sixp_nbr sixp_nbr_t;
44 
45 /**
46  * \brief Find a neighbor
47  * \param addr The MAC address of a neighbor
48  * \return The pointer to a neighbor, NULL on failure
49  */
50 sixp_nbr_t *sixp_nbr_find(const linkaddr_t *addr);
51 
52 /**
53  * \brief Allocate a neighbor
54  * \param addr The MAC address of a neighbor
55  * \return The pointer to a allocated neighbor, NULL on failure
56  */
57 sixp_nbr_t *sixp_nbr_alloc(const linkaddr_t *addr);
58 
59 /**
60  * \brief Free a neighbor
61  * \param nbr The pointer to a neighbor to free
62  */
64 
65 /**
66  * \brief Get the next sequence number of a neighbor
67  * \param nbr The pointer to a neighbor
68  * \return A sequence number to use for a next request, -1 on failure
69  */
71 
72 /**
73  * \brief Set the specified value to the next sequence number of a neighbor
74  * \param nbr The pointer to a neighbor
75  * \param seqno Value to be set
76  * \return 0 on success, -1 on failure
77  */
78 int sixp_nbr_set_next_seqno(sixp_nbr_t *nbr, uint16_t seqno);
79 
80 /**
81  * \brief Reset the next sequence number of a neighbor to zero
82  * \param nbr The pointer to a neighbor
83  * \return 0 on success, -1 on failure
84  */
86 
87 /**
88  * \brief Increment the next sequence number of a neighbor
89  * \param nbr The pointer to a neighbor
90  * \return 0 on success, -1 on failure
91  */
93 
94 /**
95  * \brief Initialize 6p Neighbor Table
96  */
97 int sixp_nbr_init(void);
98 
99 /*---------------------------------------------------------------------------*/
100 /** @} */
struct sixp_nbr sixp_nbr_t
6P Neighbor Data Structure (for internal use)
static uip_ds6_nbr_t * nbr
Pointer to llao option in uip_buf.
Definition: uip-nd6.c:115
static uip_ds6_addr_t * addr
Pointer to a nbr cache entry.
Definition: uip-nd6.c:116
int sixp_nbr_reset_next_seqno(sixp_nbr_t *nbr)
Reset the next sequence number of a neighbor to zero.
Definition: sixp-nbr.c:144
int sixp_nbr_increment_next_seqno(sixp_nbr_t *nbr)
Increment the next sequence number of a neighbor.
Definition: sixp-nbr.c:156
void sixp_nbr_free(sixp_nbr_t *nbr)
Free a neighbor.
Definition: sixp-nbr.c:112
sixp_nbr_t * sixp_nbr_alloc(const linkaddr_t *addr)
Allocate a neighbor.
Definition: sixp-nbr.c:80
6top Protocol (6P) Packet Manipulation APIs
int sixp_nbr_init(void)
Initialize 6p Neighbor Table.
Definition: sixp-nbr.c:175
int sixp_nbr_get_next_seqno(sixp_nbr_t *nbr)
Get the next sequence number of a neighbor.
Definition: sixp-nbr.c:121
sixp_nbr_t * sixp_nbr_find(const linkaddr_t *addr)
Find a neighbor.
Definition: sixp-nbr.c:70
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.
Definition: sixp-nbr.c:132