forward_close_request.h
Go to the documentation of this file.
00001 
00026 #ifndef ODVA_ETHERNETIP_FORWARD_CLOSE_REQUEST_H
00027 #define ODVA_ETHERNETIP_FORWARD_CLOSE_REQUEST_H
00028 
00029 #include <string>
00030 #include <boost/shared_ptr.hpp>
00031 
00032 #include "odva_ethernetip/eip_types.h"
00033 #include "odva_ethernetip/serialization/serializable.h"
00034 #include "odva_ethernetip/serialization/reader.h"
00035 #include "odva_ethernetip/serialization/writer.h"
00036 #include "odva_ethernetip/path.h"
00037 
00038 using boost::shared_ptr;
00039 
00040 namespace eip {
00041 
00042 using serialization::Serializable;
00043 using serialization::Reader;
00044 using serialization::Writer;
00045 
00049 class ForwardCloseRequest : public Serializable
00050 {
00051 public:
00052 
00053   EIP_BYTE timeout_tick_size;
00054   EIP_USINT timeout_ticks;
00055   EIP_UINT connection_sn;
00056   EIP_UINT originator_vendor_id;
00057   EIP_UDINT originator_sn;
00058 
00063   Path& getPath()
00064   {
00065     return path_;
00066   }
00067 
00072   virtual size_t getLength() const
00073   {
00074     return sizeof(timeout_tick_size)
00075           + sizeof(timeout_ticks)
00076           + sizeof(connection_sn)
00077           + sizeof(originator_vendor_id)
00078           + sizeof(originator_sn)
00079           + 1 // reserved byte
00080           + path_.getLength();
00081   }
00082 
00089   virtual Writer& serialize(Writer& writer) const
00090   {
00091     writer.write(timeout_tick_size);
00092     writer.write(timeout_ticks);
00093     writer.write(connection_sn);
00094     writer.write(originator_vendor_id);
00095     writer.write(originator_sn);
00096     // add reserved byte should be after the path size.
00097     // seriously. Who thought this out? Dumbest standard ever.
00098     path_.serialize(writer, true);
00099     return writer;
00100   }
00101 
00105   virtual Reader& deserialize(Reader& reader, size_t length)
00106   {
00107     throw std::logic_error("Not implemented");
00108   }
00109 
00113   virtual Reader& deserialize(Reader& reader)
00114   {
00115     throw std::logic_error("Not implemented");
00116   }
00117 
00118 private:
00119   Path path_;
00120 };
00121 
00122 } // namespace eip
00123 
00124 #endif  // ODVA_ETHERNETIP_FORWARD_CLOSE_REQUEST_H


odva_ethernetip
Author(s): Kareem Shehata
autogenerated on Sat Jun 8 2019 20:21:23