EthernetFrame.h
Go to the documentation of this file.
00001 /*
00002  * EthernetFrame.h
00003  *
00004  *  Created on: Mar 28, 2014
00005  *      Author: cwioro
00006  */
00007 
00008 #ifndef ETHERNETFRAME_H_
00009 #define ETHERNETFRAME_H_
00010 
00011 #include "functions.h"
00012 
00013 
00014 struct stc_frame
00015 {
00016         std::string network_string;
00017         uint32_t frame_id;
00018         
00019         uint8_t retransmitted;
00020         //bool mc_frame;// = false;;
00021         bool cr;
00022         unsigned char mac[6];
00023         uint8_t type;
00024         std::string hostname_source;
00025         std::string mc_group;
00026         unsigned long ts;
00027         //ecl::TimeStamp time_stamp;
00028         // Assignment operator.
00029         
00030         void print_frame()
00031         {
00032             ROS_ERROR("ID:[%u] SOURCE[%s] MAC[%s] TYPE[%u] GROUP[%s]",frame_id, hostname_source.c_str() , getMacAsCStr(mac), type, mc_group.c_str());
00033         }
00034         
00035         stc_frame()
00036         {
00037             ts = getMillisecondsTime();
00038         }
00039         
00040         bool operator ==(const stc_frame& st)
00041         {
00042                 //ROS_DEBUG("compare");
00043 
00044                 if (mc_group.compare("")==0 )
00045                         return ( compareMac(st.mac,mac) && hostname_source.compare(st.hostname_source)==0&&frame_id==st.frame_id) && type == st.type;
00046                 else
00047                 {
00048 
00049                         return (hostname_source.compare(st.hostname_source)==0 && frame_id==st.frame_id && mc_group.compare(st.mc_group)==0);
00050                 }
00051         }
00052 };
00053 
00054 
00055 struct eh_header{
00056         unsigned char eh_dest[6];
00057         unsigned char eh_source[6];
00058         uint16_t eh_protocol_id;
00059 }  __attribute__((packed));
00060 
00061 class EthernetFrame {
00062 public:
00063         EthernetFrame();
00064         virtual ~EthernetFrame();
00065 
00066         struct eh_header eh_h_; 
00067         bool correct_crc_;
00068 
00069 
00070 
00071 
00076         int GetCrc32(const std::string& string);
00077 
00078 
00079 };
00080 
00081 
00082 
00083 #endif /* ETHERNETFRAME_H_ */


adhoc_communication
Author(s): Guenter Cwioro , Torsten Andre
autogenerated on Thu Aug 27 2015 11:56:40