csma_sender.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 INRIA
3  * Copyright (C) 2016 Freie Universit├Ąt Berlin
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
25 #ifndef CSMA_SENDER_H
26 #define CSMA_SENDER_H
27 
28 #include <stdint.h>
29 
30 #include "net/netdev.h"
31 
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
40 #ifndef CSMA_SENDER_MIN_BE_DEFAULT
41 #define CSMA_SENDER_MIN_BE_DEFAULT (3U)
42 #endif
43 
47 #ifndef CSMA_SENDER_MAX_BE_DEFAULT
48 #define CSMA_SENDER_MAX_BE_DEFAULT (5U)
49 #endif
50 
55 #ifndef CSMA_SENDER_MAX_BACKOFFS_DEFAULT
56 #define CSMA_SENDER_MAX_BACKOFFS_DEFAULT (4U)
57 #endif
58 
62 #ifndef CSMA_SENDER_BACKOFF_PERIOD_UNIT
63 #define CSMA_SENDER_BACKOFF_PERIOD_UNIT (320U)
64 #endif
65 
69 typedef struct {
70  uint8_t min_be;
71  uint8_t max_be;
72  uint16_t max_backoffs;
73  uint32_t backoff_period;
75 
80 
104 int csma_sender_csma_ca_send(netdev_t *dev, struct iovec *vector,
105  unsigned count, const csma_sender_conf_t *conf);
106 
136 int csma_sender_cca_send(netdev_t *dev, struct iovec *vector, unsigned count);
137 
138 
139 #ifdef __cplusplus
140 }
141 #endif
142 
143 #endif /* CSMA_SENDER_H */
144 
int csma_sender_cca_send(netdev_t *dev, struct iovec *vector, unsigned count)
Sends a 802.15.4 frame when medium is avaiable.
uint8_t max_be
maximum backoff exponent
Definition: csma_sender.h:71
uint32_t backoff_period
backoff period in microseconds
Definition: csma_sender.h:73
Definitions low-level network driver interface.
uint16_t max_backoffs
maximum number of retries
Definition: csma_sender.h:72
uint8_t min_be
minimum backoff exponent
Definition: csma_sender.h:70
Configuration type for backoff.
Definition: csma_sender.h:69
const csma_sender_conf_t CSMA_SENDER_CONF_DEFAULT
Default configuration.
Structure to hold driver state.
int csma_sender_csma_ca_send(netdev_t *dev, struct iovec *vector, unsigned count, const csma_sender_conf_t *conf)
Sends a 802.15.4 frame using the CSMA/CA method.
Structure for scatter/gather I/O.
Definition: uio.h:33