Loading...
Searching...
No Matches
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
9#pragma once
10
23
24#include <stdint.h>
25
26#include "byteorder.h"
27#include "compiler_hints.h"
28#include "net/ntp_packet.h"
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#define ZEP_PORT_DEFAULT (17754)
35
39#define ZEP_V2_TYPE_DATA (1)
40
44#define ZEP_V2_TYPE_ACK (2)
45
49#define ZEP_LENGTH_MASK (0x7f)
50
54typedef struct __attribute__((packed)) {
56 char preamble[2];
57 uint8_t version;
58} zep_hdr_t;
59
64typedef struct __attribute__((packed)) {
66 uint8_t chan;
68 uint8_t lqi_mode;
69 uint8_t lqi_val;
70 uint8_t resv[7];
71 uint8_t length;
73
78typedef struct __attribute__((packed)) {
80 uint8_t type;
81 uint8_t chan;
83 uint8_t lqi_mode;
84 uint8_t lqi_val;
87 uint8_t resv[10];
88 uint8_t length;
90
95typedef struct __attribute__((packed)) {
97 uint8_t type;
100
101#ifdef __cplusplus
102}
103#endif
104
Functions to work with different byte orders.
be_uint32_t network_uint32_t
A 32 bit integer in network byte order.
Definition byteorder.h:112
be_uint16_t network_uint16_t
A 16 bit integer in network byte order.
Definition byteorder.h:107
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:74
ZEP header definition.
Definition zep.h:54
uint8_t version
Protocol Version (must be 1 or 2)
Definition zep.h:57
NONSTRING char preamble[2]
Preamble code (must be "EX")
Definition zep.h:56
ZEPv1 header definition.
Definition zep.h:64
uint8_t lqi_mode
CRC/LQI Mode (0: append LQI to frame, 1: append FCS)
Definition zep.h:68
uint8_t lqi_val
LQI value.
Definition zep.h:69
network_uint16_t dev
device ID
Definition zep.h:67
zep_hdr_t hdr
common header fields
Definition zep.h:65
uint8_t chan
channel ID
Definition zep.h:66
uint8_t length
length of the frame
Definition zep.h:71
uint8_t resv[7]
reserved field, must always be 0
Definition zep.h:70
ZEPv2 header definition (type == Ack)
Definition zep.h:95
network_uint32_t seq
Sequence number.
Definition zep.h:98
zep_hdr_t hdr
common header fields
Definition zep.h:96
uint8_t type
type (must be ZEP_V2_TYPE_ACK)
Definition zep.h:97
ZEPv2 header definition (type == Data)
Definition zep.h:78
ntp_timestamp_t time
NTP timestamp.
Definition zep.h:85
uint8_t chan
channel ID
Definition zep.h:81
zep_hdr_t hdr
common header fields
Definition zep.h:79
uint8_t type
type (must be ZEP_V2_TYPE_DATA)
Definition zep.h:80
uint8_t lqi_val
LQI value.
Definition zep.h:84
uint8_t resv[10]
reserved field, must always be 0
Definition zep.h:87
network_uint16_t dev
device ID
Definition zep.h:82
uint8_t length
length of the frame
Definition zep.h:88
network_uint32_t seq
Sequence number.
Definition zep.h:86
uint8_t lqi_mode
CRC/LQI Mode.
Definition zep.h:83