19 #ifndef INCLUDE_RCF_UDPSERVERTRANSPORT_HPP
20 #define INCLUDE_RCF_UDPSERVERTRANSPORT_HPP
25 #include <boost/noncopyable.hpp>
26 #include <boost/shared_ptr.hpp>
28 #include <RCF/Export.hpp>
29 #include <RCF/IpAddress.hpp>
30 #include <RCF/Service.hpp>
31 #include <RCF/ServerTransport.hpp>
32 #include <RCF/IpServerTransport.hpp>
33 #include <RCF/ThreadLibrary.hpp>
37 class UdpServerTransport;
38 class UdpSessionState;
40 typedef boost::shared_ptr<UdpServerTransport> UdpServerTransportPtr;
41 typedef boost::shared_ptr<UdpSessionState> UdpSessionStatePtr;
43 class UdpSessionState :
public SessionState
47 UdpSessionState(UdpServerTransport & transport);
49 int getNativeHandle()
const;
51 typedef UdpSessionStatePtr SessionStatePtr;
55 ReallocBufferPtr mReadVecPtr;
56 ReallocBufferPtr mWriteVecPtr;
57 IpAddress mRemoteAddress;
58 UdpServerTransport & mTransport;
59 SessionPtr mSessionPtr;
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,
96 const IpAddress & ipAddress,
97 const IpAddress & multicastIpAddress = IpAddress());
99 TransportType getTransportType();
107 void setSessionManager(RcfServer & sessionManager);
111 void cycle(
int timeoutMs);
113 void cycleTransportAndServer(
int timeoutMs);
115 UdpServerTransport & enableSharedAddressBinding();
119 void onServiceAdded(RcfServer &server);
120 void onServiceRemoved(RcfServer &server);
121 void onServerStart(RcfServer &server);
122 void onServerStop(RcfServer &server);
126 typedef UdpSessionState SessionState;
127 typedef UdpSessionStatePtr SessionStatePtr;
129 RcfServer * mpRcfServer;
130 IpAddress mIpAddress;
131 IpAddress mMulticastIpAddress;
133 unsigned int mPollingDelayMs;
134 bool mEnableSharedAddressBinding;
136 friend class UdpSessionState;
142 #endif // ! INCLUDE_RCF_UDPSERVERTRANSPORT_HPP