19 #ifndef INCLUDE_RCF_UDPSERVERTRANSPORT_HPP 20 #define INCLUDE_RCF_UDPSERVERTRANSPORT_HPP 26 #include <RCF/Export.hpp> 27 #include <RCF/IpAddress.hpp> 28 #include <RCF/Service.hpp> 29 #include <RCF/ServerTransport.hpp> 31 #include <RCF/Tools.hpp> 35 class UdpServerTransport;
36 class UdpNetworkSession;
38 typedef std::shared_ptr<UdpServerTransport> UdpServerTransportPtr;
39 typedef std::shared_ptr<UdpNetworkSession> UdpNetworkSessionPtr;
42 typedef std::shared_ptr<ReallocBuffer> ReallocBufferPtr;
44 class RCF_EXPORT UdpNetworkSession :
public NetworkSession
48 UdpNetworkSession(UdpServerTransport & transport);
50 int getNativeHandle()
const;
52 typedef UdpNetworkSessionPtr NetworkSessionPtr;
56 ReallocBufferPtr mReadVecPtr;
57 ReallocBufferPtr mWriteVecPtr;
58 IpAddress mRemoteAddress;
59 UdpServerTransport & mTransport;
60 SessionPtr mRcfSessionPtr;
62 friend class UdpServerTransport;
67 const RemoteAddress & getRemoteAddress()
const;
68 ServerTransport & getServerTransport();
69 const RemoteAddress & getRemoteAddress();
71 void setTransportFilters(
72 const std::vector<FilterPtr> &filters);
74 void getTransportFilters(
75 std::vector<FilterPtr> &filters);
77 ByteBuffer getReadByteBuffer();
81 std::vector<ByteBuffer> &byteBuffers);
88 class RCF_EXPORT UdpServerTransport :
89 public ServerTransport,
90 public IpServerTransport,
96 typedef UdpNetworkSession NetworkSession;
97 typedef UdpNetworkSessionPtr NetworkSessionPtr;
102 const IpAddress & ipAddress,
103 const IpAddress & multicastIpAddress = IpAddress());
113 void setSessionManager(RcfServer & sessionManager);
117 void cycle(
int timeoutMs);
119 void tryReadMessage(NetworkSessionPtr networkSessionPtr);
121 void cycleTransportAndServer(
int timeoutMs);
123 UdpServerTransport & enableSharedAddressBinding();
127 void onServiceAdded(RcfServer &server);
128 void onServiceRemoved(RcfServer &server);
129 void onServerStart(RcfServer &server);
130 void onServerStop(RcfServer &server);
132 RcfServer * mpRcfServer;
133 IpAddress mIpAddress;
134 IpAddress mMulticastIpAddress;
136 unsigned int mPollingDelayMs;
137 bool mEnableSharedAddressBinding;
139 friend class UdpNetworkSession;
145 #endif // ! INCLUDE_RCF_UDPSERVERTRANSPORT_HPP
Definition: AmiIoHandler.hpp:24
TransportType
Describes the transport types used by a RCF connection.
Definition: Enums.hpp:34
std::shared_ptr< ServerTransport > ServerTransportPtr
Unique pointer wrapper for RCF::ServerTransport.
Definition: RcfFwd.hpp:46