summaryrefslogtreecommitdiff
path: root/ace/RMCast/RMCast_Receiver_Module.h
blob: 35ae8c642c72f38a3676e2b729e4b2cf87e88576 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    ace/RMCast
//
// = AUTHOR
//    Carlos O'Ryan <coryan@uci.edu>
//
// ============================================================================

#ifndef ACE_RMCAST_RECEIVER_MODULE_H
#define ACE_RMCAST_RECEIVER_MODULE_H
#include "ace/pre.h"

#include "RMCast_Module.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

/// Keep track of the receiver module.
/**
 * A receiver proxy must reject invalid messages and communicate with
 * the sender to join and leave the multicast group.
 *
 * This module performs all the task related to 
 *
 */
class ACE_RMCast_Export ACE_RMCast_Receiver_Module : public ACE_RMCast_Module
{
public:
  //! Constructor
  ACE_RMCast_Receiver_Module (void);

  //! Destructor
  virtual ~ACE_RMCast_Receiver_Module (void);

  virtual int data (ACE_RMCast::Data &);
  virtual int poll (ACE_RMCast::Poll &);
  virtual int ack_join (ACE_RMCast::Ack_Join &);
  virtual int ack_leave (ACE_RMCast::Ack_Leave &);
  virtual int ack (ACE_RMCast::Ack &);
  virtual int join (ACE_RMCast::Join &);
  virtual int leave (ACE_RMCast::Leave &);

  /// Simple enum used to describe the receiver state transitions
  /**
   * Receivers go through several states before they can fully accept
   * messages, the following comments describe those states, as well as
   * the possible transitions
   * This configuration is pesimistic, any invalid message is cause
   * enough to reclaim all the resources.  This partially addresses
   * situations where either accidentally or intentionally a sender is
   * multicasting packets to the wrong group.

   <CODE>
              NON_EXISTENT JOINING      JOINED       LEAVING<BR>
   ----------------------------------------------------------------<BR>
  <BR>
   DATA       JOINING      JOINING      JOINED       LEAVING<BR>
              Send/Join    Send/Join    Recv/Data    Send/Leave<BR>
  <BR>
   POLL       JOINING      JOINING      JOINED       LEAVING<BR>
              Send/Join    Send/Join    Send/Ack     Send/Leave<BR>
  <BR>
   ACK_JOIN   JOINING      JOINED       JOINED       LEAVING<BR>
              Send/Join    Receive Msg  Receive Msg  Send/Leave<BR>
  <BR>
   ACK_LEAVE  NON_EXISTENT NON_EXISTENT NON_EXISTENT NON_EXISTENT<BR>
              Noop         Destroy      Destroy      Destroy<BR>
  <BR>
   ACK        NON_EXISTENT NON_EXISTENT NON_EXISTENT NON_EXISTENT<BR>
              Noop         Destroy      Destroy      Destroy<BR>
  <BR>
   JOIN       NON_EXISTENT NON_EXISTENT NON_EXISTENT NON_EXISTENT<BR>
              Noop         Destroy      Destroy      Destroy<BR>
  <BR>
   LEAVE      NON_EXISTENT NON_EXISTENT NON_EXISTENT NON_EXISTENT<BR>
              Noop         Destroy      Destroy      Destroy<BR>
  <BR>
  </CODE>
  */
  enum Receiver_State
  {
    RS_NON_EXISTENT,
    RS_JOINING,
    RS_JOINED,
    RS_LEAVING
  };

private:
  /// Enter the leaving state, prepare for termination
  void leaving (ACE_RMCast_Proxy *proxy);

private:
  /// The current state of the receiver
  int state_;
};

#if defined (__ACE_INLINE__)
#include "RMCast_Receiver_Module.i"
#endif /* __ACE_INLINE__ */

#include "ace/post.h"
#endif /* ACE_RMCAST_RECEIVER_MODULE_H */