socket_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 
57 #ifndef SOCKET_ZEP_H
58 #define SOCKET_ZEP_H
59 
60 #include "net/netdev.h"
61 #include "net/netdev/ieee802154.h"
62 #include "net/ieee802154/radio.h"
63 #include "net/zep.h"
64 #include "ztimer.h"
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
73 typedef struct {
74  char *local_addr;
75  char *local_port;
76  char *remote_addr;
77  char *remote_port;
79 
83 typedef enum {
89 
93 typedef struct {
99  int sock_fd;
100  uint32_t seq;
104  uint8_t rcv_buf[sizeof(zep_v2_data_hdr_t) + IEEE802154_FRAME_LEN_MAX];
108  uint8_t snd_buf[sizeof(zep_v2_data_hdr_t) + IEEE802154_FRAME_LEN_MAX];
109  uint8_t snd_len;
110  uint8_t rcv_len;
111  uint16_t pan_id;
112  uint16_t chan;
116  uint8_t addr_short[IEEE802154_SHORT_ADDRESS_LEN];
120  uint8_t addr_long[IEEE802154_LONG_ADDRESS_LEN];
123  bool send_hello;
124 } socket_zep_t;
125 
133 
140 
148 
149 #ifdef __cplusplus
150 }
151 #endif
152 
153 #endif /* SOCKET_ZEP_H */
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:341
zepdev_state_t
ZEP device RX state.
Definition: socket_zep.h:83
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:87
@ ZEPDEV_STATE_RX_ON
ZEP is able to receive frames.
Definition: socket_zep.h:85
@ ZEPDEV_STATE_RX_RECV
unprocessed frame is in RX buffer, rx stopped
Definition: socket_zep.h:86
@ ZEPDEV_STATE_IDLE
ZEP is not doing anything, not receiving frames.
Definition: socket_zep.h:84
#define IEEE802154_FRAME_LEN_MAX
maximum 802.15.4 frame length
Definition: ieee802154.h:99
#define IEEE802154_SHORT_ADDRESS_LEN
IEEE 802.15.4 address lengths.
Definition: ieee802154.h:45
#define IEEE802154_LONG_ADDRESS_LEN
long address (EUI-64)
Definition: ieee802154.h:46
the IEEE802.15.4 device descriptor
Definition: radio.h:415
ZEP device initialization parameters.
Definition: socket_zep.h:73
char * remote_addr
remote address string
Definition: socket_zep.h:76
char * remote_port
local address string
Definition: socket_zep.h:77
char * local_port
local address string
Definition: socket_zep.h:75
char * local_addr
local address string
Definition: socket_zep.h:74
ZEP device state.
Definition: socket_zep.h:93
ieee802154_filter_mode_t filter_mode
frame filter mode
Definition: socket_zep.h:121
uint8_t rcv_len
bytes received
Definition: socket_zep.h:110
uint32_t seq
ZEP sequence number.
Definition: socket_zep.h:100
const socket_zep_params_t * params
command line parameters
Definition: socket_zep.h:97
int sock_fd
socket fd
Definition: socket_zep.h:99
zepdev_state_t state
device state machine
Definition: socket_zep.h:122
ztimer_t ack_timer
timer to send delayed ACK
Definition: socket_zep.h:98
uint16_t chan
virtual radio channel
Definition: socket_zep.h:112
bool send_hello
send HELLO packet on connect
Definition: socket_zep.h:123
uint16_t pan_id
PAN ID of the ZEP network.
Definition: socket_zep.h:111
uint8_t snd_len
bytes to send
Definition: socket_zep.h:109
ZEPv2 header definition (type == Data)
Definition: zep.h:76
ztimer structure
Definition: ztimer.h:319
Definitions for the ZigBee Encapsulation Protocol.
ztimer API