Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Threaded_LoRa_Modem
RHTcpProtocol.h
00001 // RH_TcpProtocol.h 00002 // Author: Mike McCauley (mikem@aierspayce.com) 00003 // Definition of protocol messages sent and received by RH_TCP 00004 // Copyright (C) 2014 Mike McCauley 00005 // $Id: RHTcpProtocol.h,v 1.3 2014/05/22 06:07:09 mikem Exp $ 00006 00007 /// This file contains the definitions of message structures passed between 00008 /// RH_TCP and the etherSimulator 00009 #ifndef RH_TcpProtocol_h 00010 #define RH_TcpProtocol_h 00011 00012 #define RH_TCP_MESSAGE_TYPE_NOP 0 00013 #define RH_TCP_MESSAGE_TYPE_THISADDRESS 1 00014 #define RH_TCP_MESSAGE_TYPE_PACKET 2 00015 00016 // Maximum message length (including the headers) we are willing to support 00017 #define RH_TCP_MAX_PAYLOAD_LEN 255 00018 00019 // The length of the headers we add. 00020 // The headers are inside the RF69's payload and are therefore encrypted if encryption is enabled 00021 #define RH_TCP_HEADER_LEN 4 00022 00023 00024 // This is the maximum message length that can be supported by this protocol. 00025 #define RH_TCP_MAX_MESSAGE_LEN (RH_TCP_MAX_PAYLOAD_LEN - RH_TCP_HEADER_LEN) 00026 00027 #pragma pack(push, 1) // No padding 00028 00029 /// \brief Generic RH_TCP simulator message structure 00030 typedef struct 00031 { 00032 uint32_t length; ///< Number of octets following, in network byte order 00033 uint8_t payload[RH_TCP_MAX_PAYLOAD_LEN + 1]; ///< Payload 00034 } RHTcpMessage; 00035 00036 /// \brief Generic RH_TCP message structure with message type 00037 typedef struct 00038 { 00039 uint32_t length; ///< Number of octets following, in network byte order 00040 uint8_t type; ///< One of RH_TCP_MESSAGE_TYPE_* 00041 uint8_t payload[RH_TCP_MAX_PAYLOAD_LEN]; ///< Payload 00042 } RHTcpTypeMessage; 00043 00044 /// \brief RH_TCP message Notifies the server of thisAddress of this client 00045 typedef struct 00046 { 00047 uint32_t length; ///< Number of octets following, in network byte order 00048 uint8_t type; ///< == RH_TCP_MESSAGE_TYPE_THISADDRESS 00049 uint8_t thisAddress; ///< Node address 00050 } RHTcpThisAddress; 00051 00052 /// \brief RH_TCP radio message passed to or from the simulator 00053 typedef struct 00054 { 00055 uint32_t length; ///< Number of octets following, in network byte order 00056 uint8_t type; ///< == RH_TCP_MESSAGE_TYPE_PACKET 00057 uint8_t to; ///< Node address of the recipient 00058 uint8_t from; ///< Node address of the sender 00059 uint8_t id; ///< Message sequence number 00060 uint8_t flags; ///< Message flags 00061 uint8_t payload[RH_TCP_MAX_MESSAGE_LEN]; ///< 0 or more, length deduced from length above 00062 } RHTcpPacket; 00063 00064 #pragma pack(pop) 00065 00066 #endif
Generated on Thu Jul 14 2022 12:14:50 by
1.7.2