diff options
author | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-03-02 19:34:13 +0000 |
---|---|---|
committer | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-03-02 19:34:13 +0000 |
commit | 0f63efd0254bd297b664684c176bfa5e87e9fc40 (patch) | |
tree | f937115b682f6fbd235c2a7fded94cfe1d035634 /protocols | |
parent | b1bb3e32afa33d8f88d12f048dfc16731f932e6d (diff) | |
download | ATCD-0f63efd0254bd297b664684c176bfa5e87e9fc40.tar.gz |
ChangeLogTag: Wed Mar 2 21:44:22 2005 Boris Kolpackov <boris@kolpackov.net>
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/ace/RMCast/Socket.cpp | 93 | ||||
-rw-r--r-- | protocols/ace/RMCast/Socket.h | 39 | ||||
-rw-r--r-- | protocols/ace/RMCast/Stack.h | 7 |
3 files changed, 95 insertions, 44 deletions
diff --git a/protocols/ace/RMCast/Socket.cpp b/protocols/ace/RMCast/Socket.cpp index 8d25bc77295..79c40defd67 100644 --- a/protocols/ace/RMCast/Socket.cpp +++ b/protocols/ace/RMCast/Socket.cpp @@ -5,12 +5,61 @@ #include "ace/OS_Memory.h" #include "ace/OS_NS_string.h" +#include "ace/Unbounded_Queue.h" +#include "ace/Thread_Mutex.h" +#include "ace/Condition_T.h" + +#include "Stack.h" +#include "Protocol.h" +#include "Bits.h" + +#include "Link.h" +#include "Simulator.h" +#include "Retransmit.h" +#include "Acknowledge.h" + + #include "Socket.h" namespace ACE_RMCast { - Socket:: - Socket (Address const& a, bool loop) + class Socket_Impl : protected Element + { + public: + ~Socket_Impl (); + + Socket_Impl (Address const& a, bool loop); + + public: + void + send_ (void const* buf, size_t s); + + size_t + recv_ (void* buf, size_t s); + + private: + virtual void + recv (Message_ptr m); + + private: + bool loop_; + + u64 sn_; //@@ lock? + + Mutex mutex_; + Condition cond_; + + ACE_Unbounded_Queue<Message_ptr> queue_; + + ACE_Auto_Ptr<Acknowledge> acknowledge_; + ACE_Auto_Ptr<Retransmit> retransmit_; + ACE_Auto_Ptr<Simulator> simulator_; + ACE_Auto_Ptr<Link> link_; + }; + + + Socket_Impl:: + Socket_Impl (Address const& a, bool loop) : loop_ (loop), sn_ (1), cond_ (mutex_) { acknowledge_.reset (new Acknowledge ()); @@ -35,8 +84,8 @@ namespace ACE_RMCast out_start (acknowledge_.get ()); } - Socket:: - ~Socket () + Socket_Impl:: + ~Socket_Impl () { // Stop OUT stack from top to bottom. // @@ -56,8 +105,8 @@ namespace ACE_RMCast } - void Socket:: - send (void const* buf, size_t s) + void Socket_Impl:: + send_ (void const* buf, size_t s) { Message_ptr m (new Message); @@ -69,8 +118,8 @@ namespace ACE_RMCast Element::send (m); } - size_t Socket:: - recv (void* buf, size_t s) + size_t Socket_Impl:: + recv_ (void* buf, size_t s) { Lock l (mutex_); @@ -88,7 +137,7 @@ namespace ACE_RMCast return r; } - void Socket:: + void Socket_Impl:: recv (Message_ptr m) { if (m->find (Data::id) != 0) @@ -112,4 +161,30 @@ namespace ACE_RMCast if (signal) cond_.signal (); } } + + // Socket + // + // + Socket:: + ~Socket () + { + } + + Socket:: + Socket (Address const& a, bool loop) + : impl_ (new Socket_Impl (a, loop)) + { + } + + void Socket:: + send (void const* buf, size_t s) + { + impl_->send_ (buf, s); + } + + size_t Socket:: + recv (void* buf, size_t s) + { + return impl_->recv_ (buf, s); + } } diff --git a/protocols/ace/RMCast/Socket.h b/protocols/ace/RMCast/Socket.h index 0a125b73d7a..e2631659132 100644 --- a/protocols/ace/RMCast/Socket.h +++ b/protocols/ace/RMCast/Socket.h @@ -7,30 +7,23 @@ #ifndef ACE_RMCAST_SOCKET_H #define ACE_RMCAST_SOCKET_H -#include "ace/Unbounded_Queue.h" -#include "ace/Thread_Mutex.h" -#include "ace/Condition_T.h" - -#include "Stack.h" -#include "Protocol.h" -#include "Bits.h" - -#include "Link.h" -#include "Simulator.h" -#include "Retransmit.h" -#include "Acknowledge.h" +#include "ace/Auto_Ptr.h" +#include "ace/INET_Addr.h" #include "RMCast_Export.h" namespace ACE_RMCast { - class ACE_RMCast_Export Socket : protected Element + class Socket_Impl; + + class ACE_RMCast_Export Socket { public: + virtual ~Socket (); - Socket (Address const& a, bool loop = true); + Socket (ACE_INET_Addr const& a, bool loop = true); public: virtual void @@ -40,23 +33,7 @@ namespace ACE_RMCast recv (void* buf, size_t s); private: - virtual void - recv (Message_ptr m); - - private: - bool loop_; - - u64 sn_; //@@ lock? - - Mutex mutex_; - Condition cond_; - - ACE_Unbounded_Queue<Message_ptr> queue_; - - ACE_Auto_Ptr<Acknowledge> acknowledge_; - ACE_Auto_Ptr<Retransmit> retransmit_; - ACE_Auto_Ptr<Simulator> simulator_; - ACE_Auto_Ptr<Link> link_; + ACE_Auto_Ptr<Socket_Impl> impl_; }; } diff --git a/protocols/ace/RMCast/Stack.h b/protocols/ace/RMCast/Stack.h index 2ddf60d3754..322fe0dc501 100644 --- a/protocols/ace/RMCast/Stack.h +++ b/protocols/ace/RMCast/Stack.h @@ -6,11 +6,10 @@ #define ACE_RMCAST_STACK_H #include "Protocol.h" -#include "RMCast_Export.h" namespace ACE_RMCast { - struct ACE_RMCast_Export Out_Element + struct Out_Element { virtual ~Out_Element (); @@ -31,7 +30,7 @@ namespace ACE_RMCast }; - struct ACE_RMCast_Export In_Element + struct In_Element { virtual ~In_Element (); @@ -52,7 +51,7 @@ namespace ACE_RMCast }; - struct ACE_RMCast_Export Element : In_Element, Out_Element + struct Element : In_Element, Out_Element { }; } |