00001 /* 00002 * AckRoutedFrame.h 00003 * 00004 * Created on: 29.07.2013 00005 * Author: cwioro 00006 * 00007 * Structure from acknowledgment of a routed frame looks like: 00008 * 00009 * BROADCAST MAC // -> ff:ff:ff:ff:ff:ff 6Byte 00010 * SOURCE MAC // MAC of the using interface 6Byte 00011 * ETH TYPE FIELD // 0x4148 (AH as string) 2Byte 00012 * FRAME TYPE // 0x41 (A as string) 1Byte 00013 * DESTINATION MAC // next hop to forward the frame to the root source 6Byte 00014 * FRAME ID // ID of the frame to acknowledge or packet id (if mc) 4Byte 00015 * ROUTE ID // ID of the Route or packet sequence (if mc) 4Byte 00016 * FLAG FIELD 1Byte 00017 * SOURCE HOST LENGTH 4Byte 00018 * SOURCE HOST VAR 00019 * CRC 4Byte 00020 * 00021 * This frame type is used to acknowledge end-to-end routed frames 00022 */ 00023 00024 #ifndef ACKROUTEDFRAME_H_ 00025 #define ACKROUTEDFRAME_H_ 00026 00027 struct ack_rf_header { 00028 uint8_t frame_type; 00029 unsigned char mac_destination_[6]; 00030 uint32_t frame_id; 00031 uint32_t route_id; 00032 uint8_t flag_field; 00033 uint32_t hostname_source_len; 00034 uint32_t mc_group_len; 00035 00036 } __attribute__((packed)); 00037 00038 class AckRoutedFrame : public EthernetFrame { 00039 public: 00040 AckRoutedFrame(RoutedFrame rf); 00041 AckRoutedFrame(unsigned char* buffer); 00042 virtual ~AckRoutedFrame(); 00043 00044 struct ack_rf_header header_; 00045 std::string hostname_source_; 00046 std::string mc_group_; 00047 00048 uint32_t buffer_str_len_; 00049 00050 bool cr_flag; 00051 bool mc_flag; 00052 00053 00054 static uint32_t HEADER_FIXED_LEN; 00055 stc_frame getFrameStruct(); 00056 std::string getFrameAsNetworkString(uint32_t route_id, unsigned char next_hop[6], string source_host, unsigned char source[6]); 00057 std::string getFrameAsNetworkString(routing_entry r, unsigned char src[6]); 00058 00059 using EthernetFrame::GetCrc32; 00060 }; 00061 00062 00063 uint32_t AckRoutedFrame::HEADER_FIXED_LEN = sizeof (eh_header) + sizeof (ack_rf_header); //38; 00064 00065 #endif /* ACKROUTEDFRAME_H_ */