Start defining layer2 structures

This commit is contained in:
Thomas Kolb 2024-06-30 16:18:11 +02:00
parent 2fefbc7f8c
commit cadfd63997

View file

@ -0,0 +1,43 @@
#ifndef LAYER2_STRUCTS_H
#define LAYER2_STRUCTS_H
#include <stdint.h>
#include <stdbool.h>
/* Common Link-layer Header */
typedef enum {
L2_MSG_TYPE_DATA = 0x0,
L2_MSG_TYPE_CONN_MGMT = 0x1,
L2_MSG_TYPE_CONNECTIONLESS = 0x4
} layer2_message_type_t;
typedef struct layer2_packet_header_s {
layer2_message_type_t msg_type; //!< message type
bool tx_request; //!< transmission request (marks the end of the burst)
uint8_t src_addr_len; //!< source address length (in 16-bit words)
uint8_t dst_addr_len; //!< destination address length (in 16-bit words)
uint8_t tx_seq_nr; //!< sequence number of this packet
uint8_t rx_seq_nr; //!< sequence number expected next from he other side
uint8_t src_addr[8]; //!< source HAM-64 address
uint8_t dst_addr[8]; //!< destination HAM-64 address
} layer2_packet_header_t;
/* Data Packet Structs */
typedef enum {
L2_PAYLOAD_TYPE_IPV4 = 0x00,
L2_PAYLOAD_TYPE_IPV6 = 0x01
} layer2_payload_type_t;
typedef struct layer2_data_header_s {
layer2_payload_type_t payload_type; //!< Type of the contained layer 3 packet
} layer2_data_header_t;
/* Connection Management Structs */
// TODO
#endif // LAYER2_STRUCTS_H