Loading...
Searching...
No Matches
zep.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
20
21#include <stdint.h>
22
23#include "byteorder.h"
24#include "compiler_hints.h"
25#include "net/ntp_packet.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#define ZEP_PORT_DEFAULT (17754)
32
36#define ZEP_V2_TYPE_DATA (1)
37
41#define ZEP_V2_TYPE_ACK (2)
42
46#define ZEP_LENGTH_MASK (0x7f)
47
51typedef struct __attribute__((packed)) {
53 char preamble[2];
54 uint8_t version;
55} zep_hdr_t;
56
61typedef struct __attribute__((packed)) {
63 uint8_t chan;
65 uint8_t lqi_mode;
66 uint8_t lqi_val;
67 uint8_t resv[7];
68 uint8_t length;
70
75typedef struct __attribute__((packed)) {
77 uint8_t type;
78 uint8_t chan;
80 uint8_t lqi_mode;
81 uint8_t lqi_val;
84 uint8_t resv[10];
85 uint8_t length;
87
92typedef struct __attribute__((packed)) {
94 uint8_t type;
97
98#ifdef __cplusplus
99}
100#endif
101
Functions to work with different byte orders.
be_uint32_t network_uint32_t
A 32 bit integer in network byte order.
Definition byteorder.h:109
be_uint16_t network_uint16_t
A 16 bit integer in network byte order.
Definition byteorder.h:104
Common macros and compiler attributes/pragmas configuration.
#define NONSTRING
The NONSTRING keyword tells the compiler to assume that a char array is not used as c string.
NTP packet definitions.
NTP timestamp.
Definition ntp_packet.h:71
ZEP header definition.
Definition zep.h:51
uint8_t version
Protocol Version (must be 1 or 2)
Definition zep.h:54
NONSTRING char preamble[2]
Preamble code (must be "EX")
Definition zep.h:53
ZEPv1 header definition.
Definition zep.h:61
uint8_t lqi_mode
CRC/LQI Mode (0: append LQI to frame, 1: append FCS)
Definition zep.h:65
uint8_t lqi_val
LQI value.
Definition zep.h:66
network_uint16_t dev
device ID
Definition zep.h:64
zep_hdr_t hdr
common header fields
Definition zep.h:62
uint8_t chan
channel ID
Definition zep.h:63
uint8_t length
length of the frame
Definition zep.h:68
uint8_t resv[7]
reserved field, must always be 0
Definition zep.h:67
ZEPv2 header definition (type == Ack)
Definition zep.h:92
network_uint32_t seq
Sequence number.
Definition zep.h:95
zep_hdr_t hdr
common header fields
Definition zep.h:93
uint8_t type
type (must be ZEP_V2_TYPE_ACK)
Definition zep.h:94
ZEPv2 header definition (type == Data)
Definition zep.h:75
ntp_timestamp_t time
NTP timestamp.
Definition zep.h:82
uint8_t chan
channel ID
Definition zep.h:78
zep_hdr_t hdr
common header fields
Definition zep.h:76
uint8_t type
type (must be ZEP_V2_TYPE_DATA)
Definition zep.h:77
uint8_t lqi_val
LQI value.
Definition zep.h:81
uint8_t resv[10]
reserved field, must always be 0
Definition zep.h:84
network_uint16_t dev
device ID
Definition zep.h:79
uint8_t length
length of the frame
Definition zep.h:85
network_uint32_t seq
Sequence number.
Definition zep.h:83
uint8_t lqi_mode
CRC/LQI Mode.
Definition zep.h:80