Contiki-NG
mac-sequence.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010, Swedish Institute of Computer Science.
3 * All rights reserved.
4 *
5 * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/
6 * Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * This file is part of the Contiki operating system.
34 *
35 */
36
37/**
38 * \file
39 * Header file for MAC sequence numbers management
40 * \author
41 * Adam Dunkels <adam@sics.se>
42 * Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
43 */
44
45#ifndef MAC_SEQUENCE_H
46#define MAC_SEQUENCE_H
47
48/**
49 * brief Initializes the destination sequence number to a random value.
50 */
51void mac_sequence_init(void);
52
53/**
54 * \brief Sets and increments the destination sequence number.
55 */
56void mac_sequence_set_dsn(void);
57
58/**
59 * \brief Tell whether the packetbuf is a duplicate packet
60 * \return Non-zero if the packetbuf is a duplicate packet, zero otherwise
61 *
62 * This function is used to check for duplicate packet by comparing
63 * the sequence number of the incoming packet with the last few ones
64 * we saw, filtering with the link-layer address.
65 */
67
68/**
69 * \brief Register the sequence number of the packetbuf
70 *
71 * This function is used to add the sequence number of the incoming
72 * packet to the history.
73 */
75
76#endif /* MAC_SEQUENCE_H */
void mac_sequence_set_dsn(void)
Sets and increments the destination sequence number.
Definition: mac-sequence.c:81
int mac_sequence_is_duplicate(void)
Tell whether the packetbuf is a duplicate packet.
Definition: mac-sequence.c:87
void mac_sequence_register_seqno(void)
Register the sequence number of the packetbuf.
Definition: mac-sequence.c:116
void mac_sequence_init(void)
brief Initializes the destination sequence number to a random value.
Definition: mac-sequence.c:75