socket_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 
57 #include "net/netdev.h"
58 #include "net/netdev/ieee802154.h"
59 #include "net/ieee802154/radio.h"
60 #include "net/zep.h"
61 #include "ztimer.h"
62 
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 
70 typedef struct {
71  char *local_addr;
72  char *local_port;
73  char *remote_addr;
74  char *remote_port;
76 
80 typedef enum {
86 
90 typedef struct {
96  int sock_fd;
97  uint32_t seq;
101  uint8_t rcv_buf[sizeof(zep_v2_data_hdr_t) + IEEE802154_FRAME_LEN_MAX];
105  uint8_t snd_buf[sizeof(zep_v2_data_hdr_t) + IEEE802154_FRAME_LEN_MAX];
106  uint8_t snd_len;
107  uint8_t rcv_len;
108  uint16_t pan_id;
109  uint16_t chan;
113  uint8_t addr_short[IEEE802154_SHORT_ADDRESS_LEN];
117  uint8_t addr_long[IEEE802154_LONG_ADDRESS_LEN];
120  bool send_hello;
121 } socket_zep_t;
122 
130 
137 
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
Definitions for netdev common IEEE 802.15.4 code.
Definitions low-level network driver interface.
ieee802154_filter_mode_t
Frame Filter mode.
Definition: radio.h:340
zepdev_state_t
ZEP device RX state.
Definition: socket_zep.h:80
void socket_zep_cleanup(socket_zep_t *dev)
Cleanup socket resources.
void socket_zep_setup(socket_zep_t *dev, const socket_zep_params_t *params)
Setup socket_zep_t structure.
void socket_zep_hal_setup(socket_zep_t *dev, ieee802154_dev_t *hal)
Setup socket ZEP in order to be used with the IEEE 802.15.4 Radio HAL.
@ ZEPDEV_STATE_TX
ZEP is currently sending a frame.
Definition: socket_zep.h:84
@ ZEPDEV_STATE_RX_ON
ZEP is able to receive frames.
Definition: socket_zep.h:82
@ ZEPDEV_STATE_RX_RECV
unprocessed frame is in RX buffer, rx stopped
Definition: socket_zep.h:83
@ ZEPDEV_STATE_IDLE
ZEP is not doing anything, not receiving frames.
Definition: socket_zep.h:81
#define IEEE802154_FRAME_LEN_MAX
maximum 802.15.4 frame length
Definition: ieee802154.h:98
#define IEEE802154_SHORT_ADDRESS_LEN
IEEE 802.15.4 address lengths.
Definition: ieee802154.h:44
#define IEEE802154_LONG_ADDRESS_LEN
long address (EUI-64)
Definition: ieee802154.h:45
the IEEE802.15.4 device descriptor
Definition: radio.h:414
ZEP device initialization parameters.
Definition: socket_zep.h:70
char * remote_addr
remote address string
Definition: socket_zep.h:73
char * remote_port
local address string
Definition: socket_zep.h:74
char * local_port
local address string
Definition: socket_zep.h:72
char * local_addr
local address string
Definition: socket_zep.h:71
ZEP device state.
Definition: socket_zep.h:90
ieee802154_filter_mode_t filter_mode
frame filter mode
Definition: socket_zep.h:118
uint8_t rcv_len
bytes received
Definition: socket_zep.h:107
uint32_t seq
ZEP sequence number.
Definition: socket_zep.h:97
const socket_zep_params_t * params
command line parameters
Definition: socket_zep.h:94
int sock_fd
socket fd
Definition: socket_zep.h:96
zepdev_state_t state
device state machine
Definition: socket_zep.h:119
ztimer_t ack_timer
timer to send delayed ACK
Definition: socket_zep.h:95
uint16_t chan
virtual radio channel
Definition: socket_zep.h:109
bool send_hello
send HELLO packet on connect
Definition: socket_zep.h:120
uint16_t pan_id
PAN ID of the ZEP network.
Definition: socket_zep.h:108
uint8_t snd_len
bytes to send
Definition: socket_zep.h:106
ZEPv2 header definition (type == Data)
Definition: zep.h:76
ztimer structure
Definition: ztimer.h:319
Definitions for the ZigBee Encapsulation Protocol.
ztimer API