Contiki 2.5
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
core
net
rime
abc.h
Go to the documentation of this file.
1
/**
2
* \addtogroup rime
3
* @{
4
*/
5
6
/**
7
* \defgroup rimeabc Anonymous best-effort local area broadcast
8
* @{
9
*
10
* The abc module sends packets to all local area neighbors. The abc
11
* module adds no headers to outgoing packets.
12
*
13
* \section channels Channels
14
*
15
* The abc module uses 1 channel.
16
*
17
*/
18
19
/*
20
* Copyright (c) 2006, Swedish Institute of Computer Science.
21
* All rights reserved.
22
*
23
* Redistribution and use in source and binary forms, with or without
24
* modification, are permitted provided that the following conditions
25
* are met:
26
* 1. Redistributions of source code must retain the above copyright
27
* notice, this list of conditions and the following disclaimer.
28
* 2. Redistributions in binary form must reproduce the above copyright
29
* notice, this list of conditions and the following disclaimer in the
30
* documentation and/or other materials provided with the distribution.
31
* 3. Neither the name of the Institute nor the names of its contributors
32
* may be used to endorse or promote products derived from this software
33
* without specific prior written permission.
34
*
35
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
36
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
39
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
40
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
41
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
43
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
44
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45
* SUCH DAMAGE.
46
*
47
* This file is part of the Contiki operating system.
48
*
49
* $Id: abc.h,v 1.17 2010/06/14 19:19:17 adamdunkels Exp $
50
*/
51
/**
52
* \file
53
* Header file for the Rime module Anonymous BroadCast (abc)
54
* \author
55
* Adam Dunkels <adam@sics.se>
56
*/
57
58
#ifndef __ABC_H__
59
#define __ABC_H__
60
61
#include "
net/packetbuf.h
"
62
#include "
net/rime/channel.h
"
63
64
struct
abc_conn;
65
66
#define ABC_ATTRIBUTES
67
68
/**
69
* \brief Callback structure for abc
70
*
71
*/
72
struct
abc_callbacks
{
73
/** Called when a packet has been received by the abc module. */
74
void (*
recv
)(
struct
abc_conn *ptr);
75
void (* sent)(
struct
abc_conn *ptr,
int
status,
int
num_tx);
76
};
77
78
struct
abc_conn {
79
struct
channel channel;
80
const
struct
abc_callbacks
*u;
81
};
82
83
/**
84
* \brief Set up an anonymous best-effort broadcast connection
85
* \param c A pointer to a struct abc_conn
86
* \param channel The channel on which the connection will operate
87
* \param u A struct abc_callbacks with function pointers to functions that will be called when a packet has been received
88
*
89
* This function sets up an abc connection on the
90
* specified channel. The caller must have allocated the
91
* memory for the struct abc_conn, usually by declaring it
92
* as a static variable.
93
*
94
* The struct abc_callbacks pointer must point to a structure
95
* containing a pointer to a function that will be called
96
* when a packet arrives on the channel.
97
*
98
*/
99
void
abc_open
(
struct
abc_conn *c, uint16_t channel,
100
const
struct
abc_callbacks
*u);
101
102
/**
103
* \brief Close an abc connection
104
* \param c A pointer to a struct abc_conn
105
*
106
* This function closes an abc connection that has
107
* previously been opened with abc_open().
108
*
109
* This function typically is called as an exit handler.
110
*
111
*/
112
void
abc_close
(
struct
abc_conn *c);
113
114
/**
115
* \brief Send an anonymous best-effort broadcast packet
116
* \param c The abc connection on which the packet should be sent
117
* \retval Non-zero if the packet could be sent, zero otherwise
118
*
119
* This function sends an anonymous best-effort broadcast
120
* packet. The packet must be present in the packetbuf
121
* before this function is called.
122
*
123
* The parameter c must point to an abc connection that
124
* must have previously been set up with abc_open().
125
*
126
*/
127
int
abc_send
(
struct
abc_conn *c);
128
129
/**
130
* \brief Internal Rime function: Pass a packet to the abc layer
131
*
132
* This function is used internally by Rime to pass
133
* packets to the abc layer. Should never be called
134
* directly.
135
*
136
*/
137
138
void
abc_input
(
struct
channel *channel);
139
140
void
abc_sent(
struct
channel *channel,
int
status,
int
num_tx);
141
142
#endif
/* __ABC_H__ */
143
/** @} */
144
/** @} */
Generated on Fri Aug 30 2013 12:34:05 for Contiki 2.5 by
1.8.3.1