unicast.h

Go to the documentation of this file.
00001 /**
00002  * \addtogroup rime
00003  * @{
00004  */
00005 
00006 /**
00007  * \defgroup rimeuc Single-hop unicast
00008  * @{
00009  *
00010  * The unicast module sends a packet to an identified single-hop
00011  * neighbor.  The unicast primitive uses the broadcast primitive and
00012  * adds the single-hop receiver address attribute to the outgoing
00013  * packets. For incoming packets, the unicast module inspects the
00014  * single-hop receiver address attribute and discards the packet if
00015  * the address does not match the address of the node.
00016  *
00017  * \section channels Channels
00018  *
00019  * The unicast module uses 1 channel.
00020  *
00021  */
00022 
00023 /*
00024  * Copyright (c) 2006, Swedish Institute of Computer Science.
00025  * All rights reserved.
00026  *
00027  * Redistribution and use in source and binary forms, with or without
00028  * modification, are permitted provided that the following conditions
00029  * are met:
00030  * 1. Redistributions of source code must retain the above copyright
00031  *    notice, this list of conditions and the following disclaimer.
00032  * 2. Redistributions in binary form must reproduce the above copyright
00033  *    notice, this list of conditions and the following disclaimer in the
00034  *    documentation and/or other materials provided with the distribution.
00035  * 3. Neither the name of the Institute nor the names of its contributors
00036  *    may be used to endorse or promote products derived from this software
00037  *    without specific prior written permission.
00038  *
00039  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
00040  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00041  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00042  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
00043  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00044  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00045  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00046  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00047  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00048  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00049  * SUCH DAMAGE.
00050  *
00051  * This file is part of the Contiki operating system.
00052  *
00053  * $Id: unicast.h,v 1.6 2010/02/23 18:38:05 adamdunkels Exp $
00054  */
00055 
00056 /**
00057  * \file
00058  *         Header file for Rime's single-hop unicast
00059  * \author
00060  *         Adam Dunkels <adam@sics.se>
00061  */
00062 
00063 #ifndef __UNICAST_H__
00064 #define __UNICAST_H__
00065 
00066 #include "net/rime/broadcast.h"
00067 
00068 struct unicast_conn;
00069 
00070 #define UNICAST_ATTRIBUTES   { PACKETBUF_ADDR_RECEIVER, PACKETBUF_ADDRSIZE }, \
00071                         BROADCAST_ATTRIBUTES
00072 
00073 struct unicast_callbacks {
00074   void (* recv)(struct unicast_conn *c, const rimeaddr_t *from);
00075   void (* sent)(struct unicast_conn *ptr, int status, int num_tx);
00076 };
00077 
00078 struct unicast_conn {
00079   struct broadcast_conn c;
00080   const struct unicast_callbacks *u;
00081 };
00082 
00083 void unicast_open(struct unicast_conn *c, uint16_t channel,
00084               const struct unicast_callbacks *u);
00085 void unicast_close(struct unicast_conn *c);
00086 
00087 int unicast_send(struct unicast_conn *c, const rimeaddr_t *receiver);
00088 
00089 #endif /* __UNICAST_H__ */
00090 /** @} */
00091 /** @} */

Generated on Mon Apr 11 14:23:31 2011 for Contiki 2.5 by  doxygen 1.6.1