summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Endpoint.h
blob: 1d8b07eb9722b653bc674208d9e78cb6c7fc1fa6 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// -*- C++ -*-

//=============================================================================
/**
 *  @file     UIPMC_Endpoint.h
 *
 *  UIPMC implementation of PP Framework Endpoint interface.
 *
 *  @author Frank Hunleth <fhunleth@cs.wustl.edu>
 */
//=============================================================================

#ifndef TAO_UIPMC_ENDPOINT_H
#define TAO_UIPMC_ENDPOINT_H

#include /**/ "ace/pre.h"

#include "tao/Endpoint.h"
#include "tao/IIOP_Endpoint.h"

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

#include "tao/CORBA_String.h"
#include "ace/INET_Addr.h"

#include "orbsvcs/PortableGroup/portablegroup_export.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

/**
 * @class TAO_UIPMC_Endpoint
 *
 * @brief TAO_UIPMC_Endpoint
 *
 * UIPMC-specific implementation of PP Framework Endpoint interface.
 */
class TAO_PortableGroup_Export TAO_UIPMC_Endpoint : public TAO_Endpoint
{
public:
  /// Default constructor.
  TAO_UIPMC_Endpoint (void);

  /// Constructor.
  TAO_UIPMC_Endpoint (const ACE_INET_Addr &addr);

  /// Constructor. @@ Frank - deprecate this.
  TAO_UIPMC_Endpoint (const CORBA::Octet class_d_address[4],
                      CORBA::UShort port);

  /// Destructor.
  ~TAO_UIPMC_Endpoint (void);

  // = Implementation of abstract TAO_Endpoint methods.  See
  // Endpoint.h for their documentation.

  virtual TAO_Endpoint *next (void);
  virtual int addr_to_string (char *buffer, size_t length);

  /// Makes a copy of this TAO_Endpoint.
  virtual TAO_Endpoint *duplicate (void);

  /// Return true if this endpoint is equivalent to @a other_endpoint.  Two
  /// endpoints are equivalent if their port and host are the same.
  CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint);

  /// Return a hash value for this object.
  CORBA::ULong hash (void);

  // Allocates memory and returns a copy of <this>

  // = UIPMC_Endpoint-specific methods.

  /// Return a reference to the  object_addr .
  const ACE_INET_Addr &object_addr (void) const;

  /// Set the IP multicast address and port.
  void object_addr (const ACE_INET_Addr &addr);

  /// Return a pointer to the stringified host address (not including the
  /// port).  This class retains ownership of the address memory.
  const char *host (void) const;

  /// Return the port number.
  CORBA::UShort port (void) const;

  /// Set the port number.
  CORBA::UShort port (CORBA::UShort p); //@@ Frank - deprecate this.

  //TAO_UIPMC_Connection_Handler *&hint (void);
  // Access to our <hint_>.
  /// Do we have a preferred local network interface set for this target?
  bool is_preferred_network (void) const;

  /// Return the preferred network interface if any.
  const char *preferred_network (void) const;

  /// Transform this endpoint into (potentially) a chain of endpoints
  /// in preferrence order of specific local interface bind address (if
  /// the ORB is thus configured)
  CORBA::ULong preferred_interfaces (TAO_ORB_Core *oc);

  /// Acessor for the preferred network interface name if set
  const char *preferred_if (void) const;

private:

  /// Helper methods for getting and setting the IP address.  @@ Vadym - deprecate these.
  ACE_UINT32 uint_ip_addr (void) const;
  void uint_ip_addr (ACE_UINT32 ip_addr);

  /// Helper method to update the cached object address.  @@ Vadym - deprecate this.
  void update_object_addr (void);

  /// IP Multicast address.  @@ Frank - deprecate this.
  CORBA::Octet class_d_address_[4];

  /// String representing the host address.
  CORBA::String_var host_;

  /// UDP port number.
  CORBA::UShort port_;

  /// Cached instance of ACE_INET_Addr for use in making
  /// invocations, etc.
  ACE_INET_Addr object_addr_;

  /// Preferred path for routing this endpoint.
  TAO::IIOP_Endpoint_Info preferred_path_;

  /// UIPMC Endpoints can be strung into a list.  Return the next
  /// endpoint in the list, if any.
  TAO_UIPMC_Endpoint *next_;

  /// Preferred interface name (if set)
  CORBA::String_var preferred_if_;
};

TAO_END_VERSIONED_NAMESPACE_DECL

#if defined (__ACE_INLINE__)
# include "orbsvcs/PortableGroup/UIPMC_Endpoint.inl"
#endif /* __ACE_INLINE__ */

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

#endif  /* TAO_UIPMC_PROFILE_H */