00001 00026 #ifndef ODVA_ETHERNETIP_IDENTITY_ITEM_DATA_H 00027 #define ODVA_ETHERNETIP_IDENTITY_ITEM_DATA_H 00028 00029 #include <string> 00030 00031 #include "odva_ethernetip/eip_types.h" 00032 #include "odva_ethernetip/serialization/reader.h" 00033 #include "odva_ethernetip/serialization/writer.h" 00034 #include "odva_ethernetip/serialization/serializable.h" 00035 00036 namespace eip { 00037 00038 using std::string; 00039 using serialization::Serializable; 00040 using serialization::Reader; 00041 using serialization::Writer; 00042 00046 class RegisterSessionData : public Serializable 00047 { 00048 public: 00049 EIP_UINT protocol_version; 00050 EIP_UINT options; 00051 00052 RegisterSessionData() : protocol_version(EIP_PROTOCOL_VERSION), options(0) { } 00053 00058 virtual size_t getLength() const 00059 { 00060 return 4; 00061 } 00062 00069 virtual Writer& serialize(Writer& writer) const 00070 { 00071 writer.write(protocol_version); 00072 writer.write(options); 00073 return writer; 00074 } 00075 00079 virtual Reader& deserialize(Reader& reader, size_t length) 00080 { 00081 deserialize(reader); 00082 return reader; 00083 } 00084 00091 virtual Reader& deserialize(Reader& reader) 00092 { 00093 reader.read(protocol_version); 00094 reader.read(options); 00095 return reader; 00096 } 00097 }; 00098 00099 } // namespace eip 00100 00101 #endif // ODVA_ETHERNETIP_IDENTITY_ITEM_DATA_H