00001 /* 00002 * RouteRequest.h 00003 * 00004 * Created on: 29.07.2013 00005 * Author: Günther Cwioro 00006 * 00007 * 00008 */ 00009 00010 #ifndef ROUTEREQUEST_H_ 00011 #define ROUTEREQUEST_H_ 00012 00013 00014 struct rreq_header 00015 { 00016 uint8_t frame_type; 00017 uint32_t id; 00018 uint32_t hop_count; 00019 uint32_t hop_limit; 00020 uint8_t flag_field; 00021 00022 uint32_t hostname_source_len; 00023 uint32_t hostname_destination_len; 00024 00025 }__attribute__((packed)); 00026 00027 00028 class RouteRequest : public EthernetFrame { 00029 public: 00030 RouteRequest(std::string my_hostname, std::string destination,uint16_t max_hops, bool is_multicast); 00031 RouteRequest(route_request req); 00032 RouteRequest(unsigned char* buffer); 00033 00034 virtual ~RouteRequest(); 00035 00036 struct rreq_header header_; 00037 std::string hostname_destination_; 00038 std::string hostname_source_; 00039 std::list<mac> path_l_; 00040 00041 uint16_t buffer_str_len_; 00042 00043 bool correct_crc_; 00044 bool mc_flag_; 00045 00046 00047 00048 00049 00050 static uint32_t req_count_stat; 00051 static uint32_t HEADER_FIXED_LEN; 00052 00053 using EthernetFrame::GetCrc32; 00054 std::string getRequestAsNetworkString(unsigned char source_mac[6]); 00055 bool isMacInPath(unsigned char mac[]) ; 00056 00057 }; 00058 00059 uint32_t RouteRequest::req_count_stat = 0; 00060 uint32_t RouteRequest::HEADER_FIXED_LEN = sizeof(eh_header) + sizeof(rreq_header); 00061 00062 #endif /* ROUTEREQUEST_H_ */