Contiki 2.6

rimeaddr.h

Go to the documentation of this file.
00001 /**
00002  * \addtogroup rime
00003  * @{
00004  */
00005 
00006 /**
00007  * \defgroup rimeaddr Rime addresses
00008  * @{
00009  *
00010  * The rimeaddr module is an abstract representation of addresses in
00011  * Rime.
00012  *
00013  */
00014 
00015 /*
00016  * Copyright (c) 2007, Swedish Institute of Computer Science.
00017  * All rights reserved.
00018  *
00019  * Redistribution and use in source and binary forms, with or without
00020  * modification, are permitted provided that the following conditions
00021  * are met:
00022  * 1. Redistributions of source code must retain the above copyright
00023  *    notice, this list of conditions and the following disclaimer.
00024  * 2. Redistributions in binary form must reproduce the above copyright
00025  *    notice, this list of conditions and the following disclaimer in the
00026  *    documentation and/or other materials provided with the distribution.
00027  * 3. Neither the name of the Institute nor the names of its contributors
00028  *    may be used to endorse or promote products derived from this software
00029  *    without specific prior written permission.
00030  *
00031  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
00032  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00033  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00034  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
00035  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00036  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00037  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00038  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00039  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00040  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00041  * SUCH DAMAGE.
00042  *
00043  * This file is part of the Contiki operating system.
00044  *
00045  * $Id: rimeaddr.h,v 1.6 2009/05/26 13:58:53 nvt-se Exp $
00046  */
00047 
00048 /**
00049  * \file
00050  *         Header file for the Rime address representation
00051  * \author
00052  *         Adam Dunkels <adam@sics.se>
00053  */
00054 
00055 #ifndef __RIMEADDR_H__
00056 #define __RIMEADDR_H__
00057 
00058 #include "contiki-conf.h"
00059 
00060 #ifdef RIMEADDR_CONF_SIZE
00061 #define RIMEADDR_SIZE RIMEADDR_CONF_SIZE
00062 #else /* RIMEADDR_SIZE */
00063 #define RIMEADDR_SIZE 2
00064 #endif /* RIMEADDR_SIZE */
00065 
00066 typedef union {
00067   unsigned char u8[RIMEADDR_SIZE];
00068 } rimeaddr_t;
00069 
00070 
00071 /**
00072  * \brief      Copy a Rime address
00073  * \param dest The destination
00074  * \param from The source
00075  *
00076  *             This function copies a Rime address from one location
00077  *             to another.
00078  *
00079  */
00080 void rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *from);
00081 
00082 /**
00083  * \brief      Compare two Rime addresses
00084  * \param addr1 The first address
00085  * \param addr2 The second address
00086  * \return     Non-zero if the addresses are the same, zero if they are different
00087  *
00088  *             This function compares two Rime addresses and returns
00089  *             the result of the comparison. The function acts like
00090  *             the '==' operator and returns non-zero if the addresses
00091  *             are the same, and zero if the addresses are different.
00092  *
00093  */
00094 int rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2);
00095 
00096 
00097 /**
00098  * \brief      Set the address of the current node
00099  * \param addr The address
00100  *
00101  *             This function sets the Rime address of the node.
00102  *
00103  */
00104 void rimeaddr_set_node_addr(rimeaddr_t *addr);
00105 
00106 /**
00107  * \brief      The Rime address of the node
00108  *
00109  *             This variable contains the Rime address of the
00110  *             node. This variable should not be changed directly;
00111  *             rather, the rimeaddr_set_node_addr() function should be
00112  *             used.
00113  *
00114  */
00115 extern rimeaddr_t rimeaddr_node_addr;
00116 
00117 /**
00118  * \brief      The null Rime address
00119  *
00120  *             This variable contains the null Rime address. The null
00121  *             address is used in route tables to indicate that the
00122  *             table entry is unused. Nodes with no configured address
00123  *             has the null address. Nodes with their node address set
00124  *             to the null address will have problems communicating
00125  *             with other nodes.
00126  *
00127  */
00128 extern const rimeaddr_t rimeaddr_null;
00129 
00130 #endif /* __RIMEADDR_H__ */
00131 /** @} */
00132 /** @} */