#include #include #define PWSN_PROTOCOL_NR 6 typedef enum {PWSN_HELLO, PWSN_CHAT, PWSN_DATA_REQ, PWSN_DATA_RESP, PWSN_SERVICE_REQ, PWSN_SERVICE_RESP, PWSN_SERVICE_SET } packet_types; typedef struct { uint16_t seq_nr; uint16_t dst; uint16_t src; uint16_t type; } pwsn_packet_header_t; typedef struct __attribute__ ((packed)) { pwsn_packet_header_t header; double energy; uint8_t nb_size; uint16_t neighbors[16]; } pwsn_hello_pkt_t; typedef struct { pwsn_packet_header_t header; uint8_t len; char mesg[50]; } pwsn_chat_pkt_t; typedef struct { pwsn_packet_header_t header; uint16_t id; uint8_t type; } pwsn_data_req_pkt_t; typedef struct { pwsn_packet_header_t header; uint16_t id; uint8_t data_len; char data_buf[50]; } pwsn_data_resp_pkt_t; typedef struct { pwsn_packet_header_t header; uint16_t id; } pwsn_service_resp_pkt_t; typedef struct { pwsn_packet_header_t header; } pwsn_service_req_pkt_t; typedef struct { pwsn_packet_header_t header; uint8_t id; uint8_t value; } pwsn_service_set_pkt_t;