00001 00026 #ifndef ODVA_ETHERNETIP_MESSAGE_ROUTER_RESPONSE_H 00027 #define ODVA_ETHERNETIP_MESSAGE_ROUTER_RESPONSE_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 00037 using boost::shared_ptr; 00038 00039 namespace eip { 00040 00041 using serialization::Serializable; 00042 using serialization::Reader; 00043 using serialization::Writer; 00044 00048 class MessageRouterResponse : public Serializable 00049 { 00050 public: 00051 00052 EIP_USINT service; 00053 EIP_USINT general_status; 00054 00058 MessageRouterResponse() : service(0), general_status(0) { } 00059 00064 shared_ptr<Serializable> getAdditionalStatus() const 00065 { 00066 return additional_status_; 00067 } 00068 00073 shared_ptr<Serializable> getResponseData() const 00074 { 00075 return response_data_; 00076 } 00077 00082 virtual size_t getLength() const; 00083 00090 virtual Writer& serialize(Writer& writer) const 00091 { 00092 throw std::logic_error("Not implemented"); 00093 } 00094 00098 virtual Reader& deserialize(Reader& reader, size_t length); 00099 00103 virtual Reader& deserialize(Reader& reader) 00104 { 00105 throw std::logic_error("Must have size to deserialize"); 00106 } 00107 00108 private: 00109 shared_ptr<Serializable> additional_status_; 00110 shared_ptr<Serializable> response_data_; 00111 00120 shared_ptr<Serializable> readData(Reader& reader, int length); 00121 }; 00122 00123 } // namespace eip 00124 00125 #endif // ODVA_ETHERNETIP_MESSAGE_ROUTER_RESPONSE_H