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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
// This may look like C, but it's really -*- C++ -*-
// $Id$
// ============================================================================
//
// = LIBRARY
// TAO
//
// = FILENAME
// Invocation_Endpoint_Selectors.h
//
// = DESCRIPTION
// Strategies for selecting profile/endpoint from an IOR for making an
// invocation.
//
// = AUTHOR
// Marina Spivak <marina@cs.wustl.edu>
//
// ============================================================================
#ifndef TAO_INVOCATION_ENDPOINT_SELECTOR_H
#define TAO_INVOCATION_ENDPOINT_SELECTOR_H
#include "ace/pre.h"
#include "tao/corbafwd.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "tao/MProfile.h"
class TAO_GIOP_Invocation;
class TAO_Endpoint;
class TAO_PrivateConnectionPolicy;
class TAO_PriorityModelPolicy;
class TAO_ClientProtocolPolicy;
class TAO_PriorityBandedConnectionPolicy;
class TAO_Export TAO_Endpoint_Selector_Factory
{
// = TITLE
// Factory for initializing <Endpoint_Selection_State> and
// obtaining appropriate <Invocation_Endpoint_Selector>.
//
// = DESCRIPTION
// Used by Invocation classes to intialize its endpoint selection
// strategy and state based on the effective policies.
// Endpoint selection strategies are stateless objects - all the
// state they need is contained by Invocation in
// <Endpoint_Selection_State>. Thus, rather than allocating an
// endpoint selection strategy object for each Invocation, the
// factory simply returns the appropriate one from the
// set preallocated in the ORB_Core. One endpoint selection
// strategy object can be used by many invocations concurrently.
//
public:
TAO_Endpoint_Selector_Factory (void);
// Constructor.
~TAO_Endpoint_Selector_Factory (void);
// Destructor.
void get_selector (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ());
// Initialize Invocation's endpoint selection strategy and
// state.
private:
// = Helpers for <get_selector>.
#if (TAO_HAS_RT_CORBA == 1)
void check_client_priority_policy (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV);
// Gets the appropriate selector if TAO_HAS_CLIENT_PRIORITY_POLICY
// is enabled. Also initializes endpoint selection state as
// necessary. WARNING: TAO::Client_Pririority_Policy is
// deprecated. See TAO RTCORBA documentation for more details.
void init_state (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV);
// Initializes <invocation>'s endpoint selection state.
int is_in_bands_range (TAO_PriorityBandedConnectionPolicy
*bands_policy,
CORBA::Short priority);
// Returns true if <priority> is within the range of any of the
// bands specified by the <bands_policy>. Returns false otherwise.
#endif /* TAO_HAS_RT_CORBA == 1 */
};
// ****************************************************************
#if (TAO_HAS_RT_CORBA == 1)
class TAO_Export TAO_Endpoint_Selection_State
{
// = TITLE
//
//
public:
// = Initialization and termination.
TAO_Endpoint_Selection_State (void);
// Constructor.
~TAO_Endpoint_Selection_State (void);
// Destructor.
// = State.
// RTCORBA policies that affect profile/endpoint selection.
TAO_PriorityModelPolicy *priority_model_policy_;
// Can be 0.
TAO_ClientProtocolPolicy *client_protocol_policy_;
// Should never be 0 because of ORB default.
TAO_PrivateConnectionPolicy *private_connection_;
// Can be 0.
TAO_PriorityBandedConnectionPolicy *bands_policy_;
// Can be 0.
CORBA::ULong client_protocol_index_;
// Index into the RTCORBA::ProtocolList of the client protocol
// policy, identifying the protocol we should attempt using next.
int valid_endpoint_found_;
// Flag indicating whether at least one endpoint satisfying all the
// policies was found during the lifetime of this object.
CORBA::Short client_priority_;
// If using RTCORBA::CLIENT_PROPAGATED priority model, cache our
// client priority here.
CORBA::Short min_priority_;
CORBA::Short max_priority_;
};
#endif /* TAO_HAS_RT_CORBA == 1 */
// ****************************************************************
class TAO_Export TAO_Invocation_Endpoint_Selector
{
// = TITLE
// Defines the Endpoint interface in the Pluggable Protocol
// framework.
//
// = DESCRIPTION
// Lightweight encapsulation of addressing information for a
// single acceptor endpoint. In other words, Endpoint represents
// a single point of contact for the server, and is the smallest
// unit of addressing information necessary for a client to connect
// to a server.
// A Profile contains one or more Endpoints, i.e., knows of
// one or more ways to contact server(s).
//
public:
TAO_Invocation_Endpoint_Selector (void);
// Constructor.
virtual ~TAO_Invocation_Endpoint_Selector (void);
// Destructor.
virtual void select_endpoint (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ()) = 0;
//
virtual void next (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ()) = 0;
//
virtual void forward (TAO_GIOP_Invocation *invocation,
const TAO_MProfile &mprofile,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ()) = 0;
//
virtual void success (TAO_GIOP_Invocation *invocation) = 0;
//
virtual void close_connection (TAO_GIOP_Invocation *invocation) = 0;
//
};
// ****************************************************************
class TAO_Export TAO_Default_Endpoint_Selector :
public TAO_Invocation_Endpoint_Selector
{
public:
TAO_Default_Endpoint_Selector (void);
// Constructor.
virtual ~TAO_Default_Endpoint_Selector (void);
// Destructor.
virtual void select_endpoint (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ());
virtual void next (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ());
virtual void forward (TAO_GIOP_Invocation *invocation,
const TAO_MProfile &mprofile,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ());
virtual void success (TAO_GIOP_Invocation *invocation);
virtual void close_connection (TAO_GIOP_Invocation *invocation);
};
// ****************************************************************
#if (TAO_HAS_RT_CORBA == 1)
class TAO_Export TAO_Priority_Endpoint_Selector :
public TAO_Default_Endpoint_Selector
{
public:
TAO_Priority_Endpoint_Selector (void);
// Constructor.
virtual ~TAO_Priority_Endpoint_Selector (void);
// Destructor.
virtual void select_endpoint (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ());
private:
int is_multihomed (TAO_Endpoint *endpoint);
// Helper for <select_endpoint>.
};
// ****************************************************************
class TAO_Export TAO_Protocol_Endpoint_Selector :
public TAO_Invocation_Endpoint_Selector
{
public:
TAO_Protocol_Endpoint_Selector (void);
// Constructor.
virtual ~TAO_Protocol_Endpoint_Selector (void);
// Destructor.
virtual void select_endpoint (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ());
virtual void next (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ());
virtual void forward (TAO_GIOP_Invocation *invocation,
const TAO_MProfile &mprofile,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ());
virtual void success (TAO_GIOP_Invocation *invocation);
virtual void close_connection (TAO_GIOP_Invocation *invocation);
protected:
virtual void endpoint (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ());
// Helper for <select_endpoint>.
};
// ****************************************************************
class TAO_Export TAO_Client_Priority_Policy_Selector :
public TAO_Invocation_Endpoint_Selector
{
public:
TAO_Client_Priority_Policy_Selector (void);
// Constructor.
virtual ~TAO_Client_Priority_Policy_Selector (void);
// Destructor.
virtual void select_endpoint (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ());
virtual void next (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ());
virtual void forward (TAO_GIOP_Invocation *invocation,
const TAO_MProfile &mprofile,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ());
virtual void success (TAO_GIOP_Invocation *invocation);
virtual void close_connection (TAO_GIOP_Invocation *invocation);
};
// ****************************************************************
class TAO_Export TAO_Priority_Protocol_Selector :
public TAO_Protocol_Endpoint_Selector
{
public:
TAO_Priority_Protocol_Selector (void);
// Constructor.
virtual ~TAO_Priority_Protocol_Selector (void);
// Destructor.
protected:
virtual void endpoint (TAO_GIOP_Invocation *invocation,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ());
//
int is_multihomed (TAO_Endpoint *endpoint);
// Helper for <select_endpoint>.
};
#endif /* TAO_HAS_RT_CORBA == 1 */
#if defined (__ACE_INLINE__)
# include "tao/Invocation_Endpoint_Selectors.i"
#endif /* __ACE_INLINE__ */
#include "ace/post.h"
#endif /* TAO_INVOCATION_ENDPOINT_SELECTOR_H */
|