summaryrefslogtreecommitdiff
path: root/protocols/ace/RMCast/Socket.h
blob: 62f72b9597e6519b7fd50d8891bc99789cc3401a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// file      : ace/RMCast/Socket.h
// author    : Boris Kolpackov <boris@kolpackov.net>
// cvs-id    : $Id$

#ifndef ACE_RMCAST_SOCKET_H
#define ACE_RMCAST_SOCKET_H

#include <ace/Unbounded_Queue.h>

#include <ace/RMCast/Stack.h>
#include <ace/RMCast/Protocol.h>
#include <ace/RMCast/Bits.h>

#include <ace/RMCast/Link.h>
#include <ace/RMCast/Simulator.h>
#include <ace/RMCast/Retransmit.h>
#include <ace/RMCast/Acknowledge.h>

namespace ACE_RMCast
{
  class Socket : protected Element
  {
  public:
    ~Socket ();

    Socket (Address const& a, bool loop = true);

  public:
    virtual void
    send (void const* buf, size_t s);

    virtual size_t
    recv (void* buf, size_t s);

  private:
    using Element::send;

    virtual void
    recv (Message_ptr m);

  private:
    bool loop_;

    u64 sn_; //@@ lock?

    Mutex mutex_;
    Condition cond_;

    ACE_Unbounded_Queue<Message_ptr> queue_;

    auto_ptr<Acknowledge> acknowledge_;
    auto_ptr<Retransmit> retransmit_;
    auto_ptr<Simulator> simulator_;
    auto_ptr<Link> link_;
  };
}


#endif  // ACE_RMCAST_SOCKET_H