Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
zep.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2016 Freie Universität Berlin
3
*
4
* This file is subject to the terms and conditions of the GNU Lesser
5
* General Public License v2.1. See the file LICENSE in the top level
6
* directory for more details.
7
*/
8
21
#ifndef NET_ZEP_H
22
#define NET_ZEP_H
23
24
#include <stdint.h>
25
26
#include "
byteorder.h
"
27
#include "
net/ntp_packet.h
"
28
29
#ifdef __cplusplus
30
extern
"C"
{
31
#endif
32
33
#define ZEP_PORT_DEFAULT (17754)
38
#define ZEP_V2_TYPE_DATA (1)
39
43
#define ZEP_V2_TYPE_ACK (2)
44
48
#define ZEP_LENGTH_MASK (0x7f)
49
53
typedef
struct
__attribute__((packed)) {
54
char
preamble[2];
55
uint8_t
version
;
56
}
zep_hdr_t
;
57
62
typedef
struct
__attribute__((packed)) {
63
zep_hdr_t
hdr
;
64
uint8_t
chan
;
65
network_uint16_t
dev
;
66
uint8_t
lqi_mode
;
67
uint8_t
lqi_val
;
68
uint8_t resv[7];
69
uint8_t
length
;
70
}
zep_v1_hdr_t
;
71
76
typedef
struct
__attribute__((packed)) {
77
zep_hdr_t
hdr
;
78
uint8_t
type
;
79
uint8_t
chan
;
80
network_uint16_t
dev
;
81
uint8_t
lqi_mode
;
82
uint8_t
lqi_val
;
83
ntp_timestamp_t
time
;
84
network_uint32_t
seq
;
85
uint8_t resv[10];
86
uint8_t
length
;
87
}
zep_v2_data_hdr_t
;
88
93
typedef
struct
__attribute__((packed)) {
94
zep_hdr_t
hdr
;
95
uint8_t
type
;
96
network_uint32_t
seq
;
97
}
zep_v2_ack_hdr_t
;
98
99
#ifdef __cplusplus
100
}
101
#endif
102
103
#endif
/* NET_ZEP_H */
104
be_uint32_t
A 32 bit integer in big endian aka network byte order.
Definition:
byteorder.h:87
zep_hdr_t::version
uint8_t version
Protocol Version (must be 1 or 2)
Definition:
zep.h:55
byteorder.h
Functions to work with different byte orders.
be_uint16_t
A 16 bit integer in big endian aka network byte order.
Definition:
byteorder.h:77
zep_v2_data_hdr_t::seq
network_uint32_t seq
Sequence number.
Definition:
zep.h:84
zep_v1_hdr_t::lqi_val
uint8_t lqi_val
LQI value.
Definition:
zep.h:67
zep_v2_data_hdr_t::lqi_mode
uint8_t lqi_mode
CRC/LQI Mode.
Definition:
zep.h:81
zep_v1_hdr_t
ZEPv1 header definition.
Definition:
zep.h:62
zep_v2_data_hdr_t::lqi_val
uint8_t lqi_val
LQI value.
Definition:
zep.h:82
zep_hdr_t
ZEP header definition.
Definition:
zep.h:53
zep_v2_data_hdr_t::hdr
zep_hdr_t hdr
common header fields
Definition:
zep.h:77
ntp_timestamp_t
NTP timestamp.
Definition:
ntp_packet.h:73
zep_v2_ack_hdr_t::seq
network_uint32_t seq
Sequence number.
Definition:
zep.h:96
zep_v2_data_hdr_t
ZEPv2 header definition (type == Data)
Definition:
zep.h:76
zep_v2_data_hdr_t::chan
uint8_t chan
channel ID
Definition:
zep.h:79
zep_v1_hdr_t::lqi_mode
uint8_t lqi_mode
CRC/LQI Mode (0: append LQI to frame, 1: append FCS)
Definition:
zep.h:66
zep_v2_data_hdr_t::dev
network_uint16_t dev
device ID
Definition:
zep.h:80
zep_v1_hdr_t::chan
uint8_t chan
channel ID
Definition:
zep.h:64
zep_v2_data_hdr_t::time
ntp_timestamp_t time
NTP timestamp.
Definition:
zep.h:83
zep_v2_data_hdr_t::length
uint8_t length
length of the frame
Definition:
zep.h:86
zep_v1_hdr_t::hdr
zep_hdr_t hdr
common header fields
Definition:
zep.h:63
zep_v2_data_hdr_t::type
uint8_t type
type (must be ZEP_V2_TYPE_DATA)
Definition:
zep.h:78
zep_v2_ack_hdr_t::hdr
zep_hdr_t hdr
common header fields
Definition:
zep.h:94
zep_v2_ack_hdr_t::type
uint8_t type
type (must be ZEP_V2_TYPE_ACK)
Definition:
zep.h:95
zep_v2_ack_hdr_t
ZEPv2 header definition (type == Ack)
Definition:
zep.h:93
zep_v1_hdr_t::length
uint8_t length
length of the frame
Definition:
zep.h:69
ntp_packet.h
NTP packet definitions.
zep_v1_hdr_t::dev
network_uint16_t dev
device ID
Definition:
zep.h:65
Generated on Tue Nov 24 2020 19:46:52 by
1.8.17