Contiki 2.5
rimeaddr.h
Go to the documentation of this file.
1 /**
2  * \addtogroup rime
3  * @{
4  */
5 
6 /**
7  * \defgroup rimeaddr Rime addresses
8  * @{
9  *
10  * The rimeaddr module is an abstract representation of addresses in
11  * Rime.
12  *
13  */
14 
15 /*
16  * Copyright (c) 2007, Swedish Institute of Computer Science.
17  * All rights reserved.
18  *
19  * Redistribution and use in source and binary forms, with or without
20  * modification, are permitted provided that the following conditions
21  * are met:
22  * 1. Redistributions of source code must retain the above copyright
23  * notice, this list of conditions and the following disclaimer.
24  * 2. Redistributions in binary form must reproduce the above copyright
25  * notice, this list of conditions and the following disclaimer in the
26  * documentation and/or other materials provided with the distribution.
27  * 3. Neither the name of the Institute nor the names of its contributors
28  * may be used to endorse or promote products derived from this software
29  * without specific prior written permission.
30  *
31  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
32  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
35  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
40  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41  * SUCH DAMAGE.
42  *
43  * This file is part of the Contiki operating system.
44  *
45  * $Id: rimeaddr.h,v 1.6 2009/05/26 13:58:53 nvt-se Exp $
46  */
47 
48 /**
49  * \file
50  * Header file for the Rime address representation
51  * \author
52  * Adam Dunkels <adam@sics.se>
53  */
54 
55 #ifndef __RIMEADDR_H__
56 #define __RIMEADDR_H__
57 
58 #include "contiki-conf.h"
59 
60 #ifdef RIMEADDR_CONF_SIZE
61 #define RIMEADDR_SIZE RIMEADDR_CONF_SIZE
62 #else /* RIMEADDR_SIZE */
63 #define RIMEADDR_SIZE 2
64 #endif /* RIMEADDR_SIZE */
65 
66 typedef union {
67  unsigned char u8[RIMEADDR_SIZE];
68 } rimeaddr_t;
69 
70 
71 /**
72  * \brief Copy a Rime address
73  * \param dest The destination
74  * \param from The source
75  *
76  * This function copies a Rime address from one location
77  * to another.
78  *
79  */
80 void rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *from);
81 
82 /**
83  * \brief Compare two Rime addresses
84  * \param addr1 The first address
85  * \param addr2 The second address
86  * \return Non-zero if the addresses are the same, zero if they are different
87  *
88  * This function compares two Rime addresses and returns
89  * the result of the comparison. The function acts like
90  * the '==' operator and returns non-zero if the addresses
91  * are the same, and zero if the addresses are different.
92  *
93  */
94 int rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2);
95 
96 
97 /**
98  * \brief Set the address of the current node
99  * \param addr The address
100  *
101  * This function sets the Rime address of the node.
102  *
103  */
104 void rimeaddr_set_node_addr(rimeaddr_t *addr);
105 
106 /**
107  * \brief The Rime address of the node
108  *
109  * This variable contains the Rime address of the
110  * node. This variable should not be changed directly;
111  * rather, the rimeaddr_set_node_addr() function should be
112  * used.
113  *
114  */
115 extern rimeaddr_t rimeaddr_node_addr;
116 
117 /**
118  * \brief The null Rime address
119  *
120  * This variable contains the null Rime address. The null
121  * address is used in route tables to indicate that the
122  * table entry is unused. Nodes with no configured address
123  * has the null address. Nodes with their node address set
124  * to the null address will have problems communicating
125  * with other nodes.
126  *
127  */
128 extern const rimeaddr_t rimeaddr_null;
129 
130 #endif /* __RIMEADDR_H__ */
131 /** @} */
132 /** @} */