Contiki 2.6

rime.h

Go to the documentation of this file.
00001 /**
00002  * \addtogroup rime
00003  * @{
00004  */
00005 
00006 /*
00007  * Copyright (c) 2006, Swedish Institute of Computer Science.
00008  * All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without
00011  * modification, are permitted provided that the following conditions
00012  * are met:
00013  * 1. Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  * 3. Neither the name of the Institute nor the names of its contributors
00019  *    may be used to endorse or promote products derived from this software
00020  *    without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
00023  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00025  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
00026  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00027  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00028  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00029  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00031  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00032  * SUCH DAMAGE.
00033  *
00034  * This file is part of the Contiki operating system.
00035  *
00036  * $Id: rime.h,v 1.30 2010/06/14 19:19:16 adamdunkels Exp $
00037  */
00038 
00039 /**
00040  * \file
00041  *         Header file for the Rime stack
00042  * \author
00043  *         Adam Dunkels <adam@sics.se>
00044  */
00045 
00046 #ifndef __RIME_H__
00047 #define __RIME_H__
00048 
00049 #include "net/rime/announcement.h"
00050 #include "net/rime/collect.h"
00051 #include "net/rime/ipolite.h"
00052 #include "net/rime/mesh.h"
00053 #include "net/rime/multihop.h"
00054 #include "net/rime/neighbor-discovery.h"
00055 #include "net/rime/netflood.h"
00056 #include "net/rime/polite-announcement.h"
00057 #include "net/rime/polite.h"
00058 #include "net/queuebuf.h"
00059 #include "net/rime/rimeaddr.h"
00060 #include "net/packetbuf.h"
00061 #include "net/rime/rimestats.h"
00062 #include "net/rime/rmh.h"
00063 #include "net/rime/route-discovery.h"
00064 #include "net/rime/route.h"
00065 #include "net/rime/rucb.h"
00066 #include "net/rime/runicast.h"
00067 #include "net/rime/timesynch.h"
00068 #include "net/rime/trickle.h"
00069 
00070 #include "net/mac/mac.h"
00071 /**
00072  * \brief      Initialize Rime
00073  *
00074  *             This function should be called from the system boot up
00075  *             code to initialize Rime.
00076  */
00077 int rime_init(void);
00078 
00079 /**
00080  * \brief      Send an incoming packet to Rime
00081  *
00082  *             This function should be called by the network driver to
00083  *             hand over a packet to Rime for further processing. The
00084  *             packet should be placed in the packetbuf (with
00085  *             packetbuf_copyfrom()) before calling this function.
00086  *
00087  */
00088 void rime_input(void);
00089 
00090 int rime_output(struct channel *c);
00091 
00092 struct rime_sniffer {
00093   struct rime_sniffer *next;
00094   void (* input_callback)(void);
00095   void (* output_callback)(int mac_status);
00096 };
00097 
00098 #define RIME_SNIFFER(name, input_callback, output_callback) \
00099 static struct rime_sniffer name = { NULL, input_callback, output_callback }
00100 
00101 void rime_sniffer_add(struct rime_sniffer *s);
00102 void rime_sniffer_remove(struct rime_sniffer *s);
00103 
00104 extern const struct network_driver rime_driver;
00105 
00106 /* Generic Rime return values. */
00107 enum {
00108   RIME_OK,
00109   RIME_ERR,
00110   RIME_ERR_CONTENTION,
00111   RIME_ERR_NOACK,
00112 };
00113 #endif /* __RIME_H__ */
00114 
00115 /** @} */
00116 /** @} */