18 #ifndef INCLUDE_RCF_UDPSERVERTRANSPORT_HPP 19 #define INCLUDE_RCF_UDPSERVERTRANSPORT_HPP 25 #include <RCF/Export.hpp> 26 #include <RCF/IpAddress.hpp> 27 #include <RCF/Service.hpp> 28 #include <RCF/ServerTransport.hpp> 30 #include <RCF/Tools.hpp> 34 class UdpServerTransport;
35 class UdpNetworkSession;
37 typedef std::shared_ptr<UdpServerTransport> UdpServerTransportPtr;
38 typedef std::shared_ptr<UdpNetworkSession> UdpNetworkSessionPtr;
41 typedef std::shared_ptr<ReallocBuffer> ReallocBufferPtr;
43 class RCF_EXPORT UdpNetworkSession :
public NetworkSession
47 UdpNetworkSession(UdpServerTransport & transport);
49 int getNativeHandle()
const;
51 typedef UdpNetworkSessionPtr NetworkSessionPtr;
55 ReallocBufferPtr mReadVecPtr;
56 ReallocBufferPtr mWriteVecPtr;
57 IpAddress mRemoteAddress;
58 UdpServerTransport & mTransport;
59 SessionPtr mRcfSessionPtr;
61 friend class UdpServerTransport;
66 const RemoteAddress & getRemoteAddress()
const;
67 ServerTransport & getServerTransport();
68 const RemoteAddress & getRemoteAddress();
70 void setTransportFilters(
71 const std::vector<FilterPtr> &filters);
73 void getTransportFilters(
74 std::vector<FilterPtr> &filters);
76 ByteBuffer getReadByteBuffer();
80 std::vector<ByteBuffer> &byteBuffers);
87 class RCF_EXPORT UdpServerTransport :
88 public ServerTransport,
89 public IpServerTransport,
95 typedef UdpNetworkSession NetworkSession;
96 typedef UdpNetworkSessionPtr NetworkSessionPtr;
101 const IpAddress & ipAddress,
102 const IpAddress & multicastIpAddress = IpAddress());
112 void setSessionManager(RcfServer & sessionManager);
116 void cycle(
int timeoutMs);
118 void tryReadMessage(NetworkSessionPtr networkSessionPtr);
120 void cycleTransportAndServer(
int timeoutMs);
122 UdpServerTransport & enableSharedAddressBinding();
126 void onServiceAdded(RcfServer &server);
127 void onServiceRemoved(RcfServer &server);
128 void onServerStart(RcfServer &server);
129 void onServerStop(RcfServer &server);
131 RcfServer * mpRcfServer;
132 IpAddress mIpAddress;
133 IpAddress mMulticastIpAddress;
135 unsigned int mPollingDelayMs;
136 bool mEnableSharedAddressBinding;
138 friend class UdpNetworkSession;
144 #endif // ! INCLUDE_RCF_UDPSERVERTRANSPORT_HPP
Definition: AmiIoHandler.hpp:23
TransportType
Describes the transport types used by a RCF connection.
Definition: Enums.hpp:33
std::shared_ptr< ServerTransport > ServerTransportPtr
Unique pointer wrapper for RCF::ServerTransport.
Definition: RcfFwd.hpp:46