00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 #ifndef __JAUS_CORE_HEADER__H 00042 #define __JAUS_CORE_HEADER__H 00043 00044 #include "jaus/core/address.h" 00045 #include <string> 00046 #include <vector> 00047 #include <cxutils/packet.h> 00048 00049 namespace JAUS 00050 { 00059 class JAUS_CORE_DLL Header 00060 { 00061 public: 00069 class Priority 00070 { 00071 public: 00072 const static Byte Low = 0; 00073 const static Byte Standard = 1; 00074 const static Byte High = 2; 00075 const static Byte SafetyCritical = 3; 00076 }; 00087 class DataControl 00088 { 00089 public: 00090 const static Byte Single = 0; 00091 const static Byte First = 1; 00092 const static Byte Normal = 2; 00093 const static Byte Last = 3; 00094 }; 00102 class MessageType 00103 { 00104 public: 00105 const static Byte Normal = 0; 00106 }; 00114 class AckNack 00115 { 00116 public: 00117 const static Byte None = 0; 00118 const static Byte Request = 1; 00119 const static Byte Nack = 2; 00120 const static Byte Ack = 3; 00121 }; 00128 class Broadcast 00129 { 00130 public: 00131 const static UShort None = 0; 00132 const static UShort Local = 1; 00133 const static UShort Global = 2; 00134 }; 00141 class Compression 00142 { 00143 public: 00144 const static Byte None = 0; 00145 const static Byte Request = 1; 00146 }; 00147 static const UShort MinSize = 14; 00148 static const UShort PayloadOffset = MinSize - USHORT_SIZE; 00149 static const UShort MaxPacketSize = JAUS_USHORT_MAX; 00150 typedef std::vector<Header> List; 00151 Header(); 00152 Header(const Header& header); 00153 ~Header(); 00154 int Write(Packet& packet) const; 00155 int Read(const Packet& packet); 00156 bool IsValid(std::string* errorMessage) const; 00157 Header& operator=(const Header& header); 00158 Byte mMessageType; 00159 Address mDestinationID; 00160 Address mSourceID; 00161 UShort mSequenceNumber; 00162 UShort mSize; 00163 Byte mPriorityFlag; 00164 Byte mBroadcastFlag; 00165 Byte mAckNackFlag; 00166 Byte mControlFlag; 00167 Byte mCompressionFlag; 00168 00169 }; 00170 } 00171 00172 #endif 00173 00174 /* End of File */