26 #ifndef ODVA_ETHERNETIP_SESSION_H 27 #define ODVA_ETHERNETIP_SESSION_H 30 #include <gtest/gtest_prod.h> 31 #include <boost/shared_ptr.hpp> 32 #include <boost/make_shared.hpp> 33 #include <boost/asio.hpp> 46 using boost::shared_ptr;
47 using boost::make_shared;
51 using serialization::Serializable;
52 using serialization::SerializablePrimitive;
55 #define DEFAULT_VENDOR_ID 0x1234 56 #define DEFAULT_SERIAL_NUM 0x6789 72 Session(shared_ptr<Socket> socket, shared_ptr<Socket> io_socket,
83 void open(
string hostname,
string port =
"44818",
string io_port =
"2222");
107 EIP_USINT attribute_id, Serializable& result);
116 template <
typename T>
119 SerializablePrimitive<T> data;
132 EIP_USINT attribute_id, shared_ptr<Serializable> data);
141 template <
typename T>
145 shared_ptr< SerializablePrimitive<T> > data =
146 make_shared< SerializablePrimitive<T> > (v);
246 shared_ptr<Serializable> data);
251 #endif // ODVA_ETHERNETIP_SESSION_H
EIP_BYTE recv_buffer_[4 *1024]
shared_ptr< Socket > io_socket_
CPFPacket receiveIOPacket()
RRDataResponse sendRRDataCommand(EIP_USINT service, const Path &path, shared_ptr< Serializable > data)
#define DEFAULT_SERIAL_NUM
void closeConnection(size_t n)
void open(string hostname, string port="44818", string io_port="2222")
void check_packet(EncapPacket &pkt, EIP_UINT exp_cmd)
void sendIOPacket(CPFPacket &pkt)
FRIEND_TEST(SessionTest, test_create_connection)
EIP_UDINT next_connection_id_
vector< Connection > connections_
void setSingleAttributeSerializable(EIP_USINT class_id, EIP_USINT instance_id, EIP_USINT attribute_id, shared_ptr< Serializable > data)
int createConnection(const EIP_CONNECTION_INFO_T &o_to_t, const EIP_CONNECTION_INFO_T &t_to_o)
void setSingleAttribute(EIP_USINT class_id, EIP_USINT instance_id, EIP_USINT attribute_id, T v)
const Connection & getConnection(size_t n)
EIP_UINT next_connection_sn_
Session(shared_ptr< Socket > socket, shared_ptr< Socket > io_socket, EIP_UINT vendor_id=DEFAULT_VENDOR_ID, EIP_UDINT serial_num=DEFAULT_SERIAL_NUM)
T getSingleAttribute(EIP_USINT class_id, EIP_USINT instance_id, EIP_USINT attribute_id, T v)
EIP_UINT getVendorID() const
#define DEFAULT_VENDOR_ID
void getSingleAttributeSerializable(EIP_USINT class_id, EIP_USINT instance_id, EIP_USINT attribute_id, Serializable &result)
EIP_UDINT getSerialNum() const
EncapPacket sendCommand(EncapPacket &req)
shared_ptr< Socket > socket_