summaryrefslogtreecommitdiff
path: root/ACE/protocols/ace/RMCast/Link.h
blob: 35ca7fb2f1579aa43c45577399f9c6ca6bfdfe71 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
// $Id$
// author    : Boris Kolpackov <boris@kolpackov.net>

#ifndef ACE_RMCAST_LINK_H
#define ACE_RMCAST_LINK_H

#include "ace/SOCK_Dgram.h"
#include "ace/SOCK_Dgram_Mcast.h"

#include "ace/Thread_Manager.h"

#include "Stack.h"
#include "Protocol.h"
#include "Parameters.h"

namespace ACE_RMCast
{
  class Link : public Element
  {
  public:
    ~Link ();

    Link (Address const& addr, Parameters const& params);

    virtual void
    in_start (In_Element* in);

    virtual void
    out_start (Out_Element* out);

    virtual void
    in_stop ();

  public:
    virtual void
    send (Message_ptr m);

  private:
    virtual void
    send_ (Message_ptr m);

  private:
    void
    recv ();

    static ACE_THR_FUNC_RETURN
    recv_thunk (void* obj);

  private:
    virtual void
    recv (Message_ptr);

  private:
    Parameters const& params_;

    Address addr_, self_;
    ACE_SOCK_Dgram_Mcast rsock_;
    ACE_SOCK_Dgram ssock_;

    bool stop_;
    ACE_Thread_Manager recv_mgr_;

    // Simulator.
    //
    Message_ptr hold_;

    Mutex mutex_;
  };
}


#endif  // ACE_RMCAST_LINK_H