AckLinkFrame.h
Go to the documentation of this file.
00001 /*
00002  * AckLinkFrame.h
00003  *
00004  *  Created on: 29.07.2013
00005  *      Author: Günther Cwioro
00006  * 
00007  * 
00008  * Structure from acknowledgment of a link frame looks like:
00009  *
00010  * BROADCAST MAC        // -> ff:ff:ff:ff:ff:ff                                                 6Byte
00011  * SOURCE MAC           // MAC of the using interface                                           6Byte
00012  * ETH TYPE FIELD       // 0x4148 (AH as string)                                                2Byte
00013  * FRAME TYPE           // 0x61   (a as string)                                                 1Byte
00014  * DESTINATION MAC      // the source mac of the frame to acknowledge   | or bcast mac          6Byte
00015  * FRAME ID                     // ID of the frame to acknowledge | or sequence num             4Byte
00016  * PACKET ID            //only for neg ack (otherwise highest possible value of the type        4Byte
00017  * FLAG FIELD           /                                                                       1Byte
00018  * SOURCE HOST_LENGTH                                                                           4Byte
00019  * MC GROUP LENGTH                                                                              4Byte
00020  * SOURCE HOST                                                                                  VAR             
00021  * MC GROUP                                                                                     VAR
00022  * CRC                                                                                          4Byte
00023  *
00024  * FLAG FIELD:  0       0             00 0000
00025  *              128     64              
00026  *              MC_FLAG POS_ACK_FLAG  UNDIFINED
00027  * 
00028  * This frame-type is to acknowledge incoming frames. Every time a i get a frame i should immediately send an acknowledgment, except route requests, route responses and broadcasts.
00029  *
00030 */
00031 #ifndef AckLinkFrame_H_
00032 #define AckLinkFrame_H_
00033 
00034 
00035 struct ack_lf_header
00036 {
00037         uint8_t frame_type;
00038         unsigned char mac_destination_[6];
00039         unsigned char mac_confirmer[6];
00040         uint8_t ack_frame_type;
00041         uint32_t frame_id;
00042         uint8_t  flag_field;
00043         uint32_t hostname_source_len;
00044 
00045 
00046 }__attribute__((packed));
00047 
00048 
00049 class AckLinkFrame  : public EthernetFrame {
00050 public:
00051         AckLinkFrame(unsigned char* source,unsigned char* confirmer_mac,unsigned char* dest,uint32_t frame_id,std::string hostname,uint8_t type);
00052         
00053         AckLinkFrame(unsigned char* buffer);
00054         virtual ~AckLinkFrame();
00055         
00056         
00057         struct ack_lf_header header_;
00058         std::string hostname_source_;        
00059        
00060         bool pos_ack_flag_;
00061         bool cr_flag_;
00062         
00063         uint16_t buffer_str_len_;
00064 
00065         static uint32_t HEADER_FIXED_LEN;
00066         
00067         
00068         using EthernetFrame::GetCrc32;
00069         std::string getFrameAsNetworkString();
00070        
00071         void print_frame();
00072 
00073 };
00074 
00075 uint32_t AckLinkFrame::HEADER_FIXED_LEN = sizeof(eh_header) + sizeof(ack_lf_header); //41;
00076 
00077 #endif /* AckLinkFrame_H_ */


adhoc_communication
Author(s): Guenter Cwioro , Torsten Andre
autogenerated on Thu Jun 6 2019 20:59:42