00001 00009 #ifndef ROUTEDFRAME_H_ 00010 #define ROUTEDFRAME_H_ 00011 00012 struct rf_header 00013 { 00014 uint8_t frame_type; 00015 unsigned char mac_destination_[6]; 00016 uint32_t frame_id; 00017 uint32_t route_id; 00018 uint32_t packet_id; 00019 uint32_t packet_sequence_num; 00020 uint32_t packet_size; 00021 uint8_t flag_field; 00022 uint8_t payload_type; 00023 uint32_t hostname_source_len; 00024 uint32_t mc_group_len; 00025 uint32_t topic_len; 00026 uint32_t payload_len; 00027 00028 }__attribute__((packed)); 00029 00082 class RoutedFrame : public EthernetFrame { 00083 public: 00084 00085 RoutedFrame(std::string topic_to_publish, std::string data,uint8_t payload_type_field,uint32_t pack_id,uint32_t pack_sequence_num,uint32_t frames_in_pack); 00086 RoutedFrame(unsigned char* buffer); 00087 RoutedFrame(); 00088 virtual ~RoutedFrame(); 00089 unsigned long getSize(); 00090 00091 struct rf_header header_; 00092 std::string hostname_source_; 00093 std::string mc_g_name_; 00094 std::string topic_; 00095 std::string payload_; 00096 00097 00098 // bool correct_crc_; 00099 bool cr_flag; 00100 bool mc_flag; 00101 bool negative_ack_type; 00102 bool resend_flag; 00103 00104 uint16_t buffer_str_len_; 00105 00106 00107 static uint32_t frame_count_stat; 00108 static uint32_t HEADER_FIXED_LEN; 00109 static bool enable_cooperative_relaying; 00110 00111 using EthernetFrame::GetCrc32; 00112 stc_frame getFrameStruct(); 00113 std::string getFrameAsNetworkString(routing_entry rou, unsigned char source[6]); 00114 std::string getFrameAsNetworkString(uint32_t route_id, unsigned char next_hop[6] ,string source_host, unsigned char source[6]); 00115 00116 }; 00117 00118 uint32_t RoutedFrame::frame_count_stat = 0; 00119 uint32_t RoutedFrame::HEADER_FIXED_LEN = sizeof(eh_header) + sizeof(rf_header); //63 00120 bool RoutedFrame::enable_cooperative_relaying = false; 00121 00122 00123 00124 #endif /* ROUTEDFRAME_H_ */