summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/RtecEventChannelAdmin.idl
blob: e6cfb8e073b0c4708f4488c79ccc59036d3bf426 (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
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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
/**
 * @file RtecEventChannelAdmin.idl
 *
 * @brief Define the RtecEventChannelAdmin module
 *
 * TAO's Real-time Event Service is described in:
 *
 * http://doc.ece.uci.edu/~coryan/EC/
 *
 * @author Carlos O'Ryan <coryan@uci.edu>
 * @author Tim Harrison <harrison@cs.wustl.edu>
 */

#ifndef TAO_RTEC_EVENTCHANNELADMIN_IDL
#define TAO_RTEC_EVENTCHANNELADMIN_IDL

#include "RtecEventComm.idl"
#include "RtecBase.idl"

/**
 * @namespace RtecEventChannelAdmin
 *
 * @brief Interfaces and data structures provided by TAO's Real-time
 *   Event Service implementation
 */
module RtecEventChannelAdmin
{
  /**
   * @exception AlreadyConnected
   *
   * @brief Exception raised if a consumer or supplier tries to
   *        reconnect even though it is connected already.
   *
   * In some configurations the Event Channel implementation allows
   * reconnections, and treats them as changes in the QoS properties
   * of the client.  This exception is not used in those cases.
   */
  exception AlreadyConnected {};

  /**
   * @struct Dependency
   *
   * @brief Encapsulate the parameters of a consumer QoS property
   *
   * This structure is used to represent both filtering information
   * and the QoS requirements that the consumer has for events that
   * pass the filter.
   *
   * @todo It has become painfully obvious that we don't need a
   * complete RtecEventComm::Event to declare the dependency, simply
   * the EventHeader would do.
   */
  struct Dependency
  {
    /// The filtering information, usually takes the form of an event
    /// type and/or source that the consumer is interested in.
    RtecEventComm::Event event;

    /// The handle to the RT_Info structure that describes the
    /// behavior of the consumer upon receiving such an event
    /**
     * This handle is ignored for Event Channels configured without an
     * scheduling service.
     */
    RtecBase::handle_t rt_info;
  };

  /// Define a list of consumer QoS properties
  typedef sequence<Dependency> DependencySet;

  /**
   * @struct ConsumerQOS
   *
   * @brief Define the complete QoS properties of a consumer
   *
   * Consumers declared their QoS properties using a DependencySet and
   * a special flag to indicate if they are a gateway consumer.
   * Gateway consumers are ignored in the computation of changes to
   * the subscription list.
   */
  struct ConsumerQOS
  {
    /// List of QoS, filtering, correlation and timeouts for this
    /// consumer.
    DependencySet dependencies;

    /// If TRUE the consumer is a gateway, i.e., it forwards events
    /// from a remote peer.
    boolean is_gateway;
  };

  /**
   * @struct Publication
   *
   * @brief Encapsulate one supplier publication and the QoS
   * properties for that publication.
   *
   * Suppliers can publish multiple event types, each one with
   * different QoS properties.
   *
   * @todo It has become painfully obvious that we don't need a
   * complete RtecEventComm::Event to declare the publication, simply
   * the EventHeader would do.
   */
  struct Publication
  {
    /// The event publication, normally only the event source and type
    /// (from the header) is considered.
    RtecEventComm::Event event;

    /// The dependency information, this includes the RT_Info handle,
    /// the type of request and other details.
    /**
     * This field is ignored by event channels configured without an
     * scheduling service.
     */
    RtecBase::Dependency_Info dependency_info;
  };

  /// A list of Publication structures
  typedef sequence<Publication> PublicationSet;

  /**
   * @struct SupplierQOS
   *
   * @brief Describe the complete QoS and filtering properties for a
   * supplier
   *
   * Consumers declared their QoS properties and publications using a
   * PublicationSet and a special flag to indicate if they are a
   * gateway supplier.
   * Gateway suppliers are ignored in the computation of changes to
   * the publication list.
   */
  struct SupplierQOS
  {
    /// The publications
    PublicationSet publications;

    /// Set to TRUE if the supplier is a gateway.
    boolean is_gateway;
  };

  /**
   * @exception TypeError
   *
   * @brief Obsolete exception
   */
  exception TypeError {};

  /**
   * @interface ProxyPushSupplier
   *
   * @brief Interface used to implement the Abstract Session pattern
   *   for the consumers
   *
   * Each consumer converse with the Event Channel via a different
   * object that implements the ProxyPushSupplier interface.  This is
   * a common idiom in CORBA, as it allows the identification of the
   * remove consumer efficiently.
   */
  interface ProxyPushSupplier : RtecEventComm::PushSupplier
  {
    /// Connect a consumer with the Event Channel
    /**
     * The ConsumerQOS argument is used to setup the filtering and
     * QoS properties of the consumer.
     *
     * @param push_consumer The consumer that will receive the events.
     * @param qos The QoS properties for this consumer
     * @throws CORBA::BAD_PARAM if push_consumer is nil
     * @throws AlreadyConnected if this operation is invoked multiple
     *   times
     * @todo The TypeError exception is not used and should be
     * removed.
     */
    void connect_push_consumer(in RtecEventComm::PushConsumer push_consumer,
                               in ConsumerQOS qos)
      raises(AlreadyConnected, TypeError);

    /// Temporarily suspend reception of events from the Event
    /// Channel.
    /**
     * Calling this method is more efficient than dropping the
     * events when received by the consumer, and less expensive than
     * disconnecting and connecting again (but it is not free!!)
     */
    void suspend_connection ();

    /// Resume the reception of events.
    void resume_connection ();

/*
      //@{
      void checkpoint (in RtecEventComm::SequenceNumber last_received)
        raises (Invalid_Checkpoint);
      void resend_by_sequence (in RtecEventComm::SequenceNumber last_received)
        raises (Invalid_Resend_Request);
      void resend_by_date (in RtecEventComm::Time last_timestamp)
        raises (Invalid_Resend_Request);
      //@}
*/
    };

  /**
   * @interface ProxyPushConsumer
   *
   * @brief Interface used to implement the Abstract Session pattern
   *   for the suppliers.
   *
   * Each supplier converse with the Event Channel via a different
   * object that implements the ProxyPushConsumer interface.  This is
   * a common idiom in CORBA, as it allows identification of the
   * remote supplier efficiently.
   */
  interface ProxyPushConsumer : RtecEventComm::PushConsumer
  {
    /// Connect a supplier with the Event Channel
    /**
     * @param push_supplier A callback interface, the
     *   disconnect_push_supplier operation is called when the Event
     *   Channel is destroyed.
     * @param qos This argument is used to pre-compute filtering and
     *   QoS properties for the supplier.
     *
     * @throws CORBA::BAD_PARAM if the push_supplier argument is nil
     * @throws AlreadyConnected if this operation is invoked multiple
     *   times.
     */
    void connect_push_supplier (in RtecEventComm::PushSupplier push_supplier,
                                in SupplierQOS qos)
      raises (AlreadyConnected);
  };

  /**
   * @interface ConsumerAdmin
   *
   * @brief Implement an Abstract Factory to create ProxyPushSupplier
   *   objects.
   */
  interface ConsumerAdmin
  {
    /// Create a new ProxyPushSupplier object
    /**
     * There is an inherent risk of leaking a ProxyPushSupplier
     * here, i.e. if the application does not call
     * connect_push_consumer() at all.  The Event Service may choose
     * to reclaim ProxyPushSupplier objects that have been idle for
     * too long.
     */
    ProxyPushSupplier obtain_push_supplier ();
  };

  /**
   * @class SupplierAdmin
   *
   * @brief Implement an Abstract Factory to create ProxyPushConsumer
   * objects.
   */
  interface SupplierAdmin
  {
    /// Create a new ProxyPushConsumer object
    /**
     * There is an inherent risk of leaking a ProxyPushConsumer
     * here, i.e. if the application does not call
     * connect_push_supplier() at all.  The Event Service may choose
     * to reclaim ProxyPushConsumer objects that have been idle for
     * too long.
     */
    ProxyPushConsumer obtain_push_consumer ();
  };

  /**
   * @class Observer
   *
   * @brief Monitor changes in the consumer subscriptions and/or
   * supplier publciations.
   *
   * The event channel reports changes in its internal subscription
   * and/or publication list via this interface.
   */
  interface Observer
  {
    /// A change in the list of consumers has occurred.
    /**
     * The disjunction of the subscriptions is sent to the
     * observer.
     */
    void update_consumer (in ConsumerQOS sub);

    /// A change in the list of suppliers has occurred.
    /**
     * The list of all the event publications is passed to the
     * observer.
     */
    void update_supplier (in SupplierQOS pub);
  };

  /// Opaque identifier for a connected Observer.
  typedef unsigned long Observer_Handle;

  /**
   * @class EventChannel
   *
   * @brief The main interface for the event service
   *
   * This class provides the main entry point for the Event Service.
   * The class follows a protocol similar to the COS Events Service as
   * described in the CORBAservices spec.
   */
  interface EventChannel
  {
    /**
     * @exception SYNCHRONIZATION_ERROR
     *
     * @brief Exception raised if the Event Channel cannot acquire its
     *   internal locks.
     */
    exception SYNCHRONIZATION_ERROR {};

    /**
     * @exception CANT_APPEND_OBSERVER
     *
     * @brief Exception raised if the Event Channel is unable to add
     *   an observer due to some internal limitation.
     */
    exception CANT_APPEND_OBSERVER {};

    /**
     * @exception CANT_REMOVE_OBSERVER
     *
     * @brief Exception raised if the Event Channel is unable to remove
     *   an observer due to some internal limitation or because the
     *   observer cannot be found.
     */
    exception CANT_REMOVE_OBSERVER {};

    //@{
    /**
     * @name Unused exceptions
     *
     * @todo The following exceptions are not declared in any raises()
     *   clause, therefore they cannot be raised!  They should be
     *   removed or added to the right places.
     */

    /// Exception raised if the QOS properties required are invalid or
    /// cannot be satisfied
    exception QOS_ERROR {};

    /// Exception raised if the subscriptions are invalid
    exception SUBSCRIPTION_ERROR {};

    /// Exception raised if the requested correlation (a form of
    /// filtering) is invalid
    exception CORRELATION_ERROR {};

    /// Exception raised if the event cannot be dispatched
    exception DISPATCH_ERROR {};
    //@}

    /// Consumers call this method to gain access to the
    /// ProxyPushSupplier factory.
    ConsumerAdmin for_consumers ();

    /// Suppliers call this method to gain access to the
    /// ProxyPushConsumer factory.
    SupplierAdmin for_suppliers ();

    /// Shuts down the Event Channel.
    /**
     * Calling this methods destroys the event service, all its
     * resource and results in a call to disconnect_push_XXX() on all
     * connected clients.
     */
    void destroy ();

    /// Add an observer to the event channel.
    /**
     * Return the handle used in the remove_observer() call.
     */
    Observer_Handle append_observer (in Observer gw)
      raises (SYNCHRONIZATION_ERROR,CANT_APPEND_OBSERVER);

    /// Remove the observer.
    void remove_observer (in Observer_Handle gw)
      raises (SYNCHRONIZATION_ERROR,CANT_REMOVE_OBSERVER);
  };
};

#endif /* TAO_RTEC_EVENTCHANNELADMIN_IDL */