summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.h
blob: 2d441017466e677d106388a7bff376476c7fd0f2 (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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
/* -*- C++ -*- */

// $Id$

// ============================================================================
//
// = LIBRARY
//    cos
// 
// = FILENAME
//   AVStreams_i.h
//
// = AUTHOR
//    Sumedh Mungee <sumedh@cs.wustl.edu>
//    
// 
// ============================================================================

#if !defined (AVSTREAMS_I_H)
#define	AVSTREAMS_I_H

#include "orbsvcs/orbsvcs_export.h"
#include "orbsvcs/CosPropertyServiceS.h"
#include "orbsvcs/AVStreamsS.h"
#include "orbsvcs/Property/CosPropertyService_i.h"

class TAO_ORBSVCS_Export TAO_Basic_StreamCtrl 
  : public virtual POA_AVStreams::Basic_StreamCtrl
// = DESCRIPTION
//    Base class for StreamCtrl, implements basic stream start
//    and stop functionality 
{
 public:
  TAO_Basic_StreamCtrl (CORBA::ORB_var orb);
  // Constructor

  virtual void stop (const AVStreams::flowSpec &the_spec,  
                     CORBA::Environment &env);
  // Stop the transfer of data of the stream
  // Empty the_spec means apply operation to all flows


  virtual void start (const AVStreams::flowSpec &the_spec,  
                      CORBA::Environment &env);
  // Start the transfer of data in the stream. 
  // Empty the_spec means apply operation to all flows   

  virtual void destroy (const AVStreams::flowSpec &the_spec,  
                        CORBA::Environment &env);
  // Tears down the stream. This will close the connection, and delete 
  // the streamendpoint and vdev associated with this stream
  // Empty the_spec means apply operation to all flows

  virtual CORBA::Boolean modify_QoS (AVStreams::streamQoS &new_qos, 
                                     const AVStreams::flowSpec &the_spec,  
                                     CORBA::Environment &env);
  // Changes the QoS associated with the stream
  // Empty the_spec means apply operation to all flows

  virtual void push_event (const char *the_event,  
                           CORBA::Environment &env);
  // Used by StreamEndPoint and VDev to inform StreamCtrl of events.
  // E.g., loss of flow, reestablishment of flow, etc..
   
  virtual void set_FPStatus (const AVStreams::flowSpec &the_spec, 
                             const char *fp_name, 
                             const CORBA::Any &fp_settings,  
                             CORBA::Environment &env);
  // Used to control the flow protocol parameters.

  virtual CORBA::Object_ptr get_flow_connection (const char *flow_name,  
                                                 CORBA::Environment &env);
  // Not implemented in the light profile, will raise the notsupported 
  // exception 
   
  virtual void set_flow_connection (const char *flow_name, 
                                    CORBA::Object_ptr flow_connection,  
                                    CORBA::Environment &env);
  // Not implemented in the light profile, will raise the notsupported
  // exception
   
  virtual ~TAO_Basic_StreamCtrl (void);
  // Destructor

 protected:
  CORBA::ORB_var orb_;
  // ORB reference
   
  AVStreams::VDev_var vdev_a_;
  AVStreams::VDev_var vdev_b_;
  // The Virtual Devices for this stream
   
  AVStreams::StreamEndPoint_A_var stream_endpoint_a_;
  AVStreams::StreamEndPoint_B_var stream_endpoint_b_;
  // The Endpoints for this stream
};

class TAO_ORBSVCS_Export TAO_StreamCtrl 
  : public virtual POA_AVStreams::StreamCtrl, 
    public virtual TAO_Basic_StreamCtrl
// = DESCRIPTION
//    Implementation the A/V StreamCtrl class. this class
//    is used to control the stream. It should be subclassed
//    by applications that want to provide more control features.
{
public:
  TAO_StreamCtrl (CORBA::ORB_var orb);
  // Constructor
   
  virtual CORBA::Boolean bind_devs (AVStreams::MMDevice_ptr a_party, 
                                    AVStreams::MMDevice_ptr b_party, 
                                    AVStreams::streamQoS &the_qos, 
                                    const AVStreams::flowSpec &the_flows,  
                                    CORBA::Environment &env);
  // Establish a stream between a_party and b_party,
  // with qos the_qos, and for the flows in the_flows
  // if the_flows is empty, bind all the flows
  // Causes a connection to be established between the StreamEndpoints.
  // Returns success/failure

  virtual CORBA::Boolean bind (AVStreams::StreamEndPoint_A_ptr a_party, 
                               AVStreams::StreamEndPoint_B_ptr b_party, 
                               AVStreams::streamQoS &the_qos, 
                               const AVStreams::flowSpec &the_flows,  
                               CORBA::Environment &env);
  // Establish a connection between two streamendpoints. This can
  // be used if the streamendpoints have been created independent of
  // a MMDevice
   
  virtual void unbind_party (AVStreams::StreamEndPoint_ptr the_ep, 
                             const AVStreams::flowSpec &the_spec,  
                             CORBA::Environment &env);
  // Unbind the_ep from the stream. Empty the_spec means apply to all flows. 
   
  virtual void unbind (CORBA::Environment &env);
  // unbind the stream. Same effect as Basic_StreamCtrl::destroy ()
   
  virtual ~TAO_StreamCtrl (void);
  // Destructor

};  


class TAO_ORBSVCS_Export TAO_Base_StreamEndPoint
// = DESCRIPTION
//    Base class for the A/V StreamEndPoint class. this class
//    is used to control the stream. It should be subclassed
//    by applications that want to provide more control features.
{

public:

  virtual void handle_stop (const AVStreams::flowSpec &the_spec,
                            CORBA::Environment &env) = 0;
  // Application needs to define this
  
  virtual void handle_start (const AVStreams::flowSpec &the_spec,  
                             CORBA::Environment &env) = 0;
  // Application needs to define this

  
  virtual void handle_destroy (const AVStreams::flowSpec &the_spec,  
                               CORBA::Environment &env) = 0;
  // Application needs to define this
};

class TAO_ORBSVCS_Export TAO_Client_Base_StreamEndPoint
  : public virtual TAO_Base_StreamEndPoint
{
public:
  virtual CORBA::Boolean handle_connection_established (AVStreams::StreamEndPoint_ptr responder, 
                                                        AVStreams::streamQoS &qos_spec, 
                                                        const AVStreams::flowSpec &the_spec,  
                                                        CORBA::Environment &env) = 0;
  // Application needs to define this
};

class TAO_ORBSVCS_Export TAO_Server_Base_StreamEndPoint
  : public virtual TAO_Base_StreamEndPoint
{
public:
  virtual CORBA::Boolean handle_connection_requested (AVStreams::StreamEndPoint_ptr initiator, 
                                                      CORBA::Boolean is_mcast, 
                                                      AVStreams::streamQoS &qos, 
                                                      AVStreams::flowSpec &the_spec,  
                                                      CORBA::Environment &env) = 0;
  // Application needs to define this
};

class TAO_ORBSVCS_Export TAO_StreamEndPoint 
  : public virtual POA_AVStreams::StreamEndPoint, // The POA class
    public virtual TAO_Base_StreamEndPoint
{
  // = DESCRIPTION
  //    The Stream EndPoint. Used to implement one endpoint of a stream
  //    that implements the transport layer.
public:
  TAO_StreamEndPoint (void);
  // Constructor

  virtual void stop (const AVStreams::flowSpec &the_spec,  
                     CORBA::Environment &env);
   // Stop the stream. Empty the_spec means, for all the flows
  
  virtual void start (const AVStreams::flowSpec &the_spec,  
                      CORBA::Environment &env);
  // Start the stream, Empty the_spec means, for all the flows

  virtual void destroy (const AVStreams::flowSpec &the_spec,  
                        CORBA::Environment &env);
  // Destroy the stream, Empty the_spec means, for all the flows


  virtual CORBA::Boolean connect (AVStreams::StreamEndPoint_ptr responder, 
                                  AVStreams::streamQoS &qos_spec, 
                                  const AVStreams::flowSpec &the_spec,  
                                  CORBA::Environment &env);
  // Called by StreamCtrl. responder is the peer to connect to

  virtual CORBA::Boolean request_connection (AVStreams::StreamEndPoint_ptr initiator, 
                                             CORBA::Boolean is_mcast, 
                                             AVStreams::streamQoS &qos, 
                                             AVStreams::flowSpec &the_spec,  
                                             CORBA::Environment &env);
  // Called by the peer StreamEndPoint. The flow_spec indicates the
  // flows (which contain transport addresses etc.)

  virtual CORBA::Boolean modify_QoS (AVStreams::streamQoS &new_qos, 
                                     const AVStreams::flowSpec &the_flows,  
                                     CORBA::Environment &env);
  // Change the transport qos on a stream
   
  virtual CORBA::Boolean set_protocol_restriction (const AVStreams::protocolSpec &the_pspec,  
                                                   CORBA::Environment &env);
  // Used to restrict the set of protocols
   
  virtual void disconnect (const AVStreams::flowSpec &the_spec,  
                           CORBA::Environment &env);
  // disconnect the flows
   
  virtual void set_FPStatus (const AVStreams::flowSpec &the_spec, 
                             const char *fp_name, 
                             const CORBA::Any &fp_settings,  
                             CORBA::Environment &env);
  // Used to control the flow
   
  virtual CORBA::Object_ptr get_fep (const char *flow_name,  
                                     CORBA::Environment &env);
  // Not implemented in the light profile, throws notsupported

  virtual char * add_fep (CORBA::Object_ptr the_fep,  
                          CORBA::Environment &env);
  // Not implemented in the light profile, throws notsupported
   
  virtual void remove_fep (const char *fep_name,  
                           CORBA::Environment &env);
  // Not implemented in the light profile, throws notsupported
   
  virtual void set_negotiator (AVStreams::Negotiator_ptr new_negotiator,  
                               CORBA::Environment &env);
  // Used to "attach" a negotiator to the endpoint
   
  virtual void set_key (const char *flow_name, 
                        const encryption_key & the_key,
                        CORBA::Environment &env);
  // Used for public key encryption. 
    
  virtual void set_source_id (CORBA::Long source_id,  
                              CORBA::Environment &env);
  // Used to set a unique id for packets sent by this streamendpoint

  virtual ~TAO_StreamEndPoint (void);
  // Destructor
   
};

class TAO_ORBSVCS_Export TAO_Client_StreamEndPoint : 
  public virtual POA_AVStreams::StreamEndPoint_A, 
  public virtual TAO_StreamEndPoint,
  public virtual TAO_Client_Base_StreamEndPoint
{
  // = DESCRIPTION
  //     The "A" side of a streamendpoint
public:
  TAO_Client_StreamEndPoint (void);
  // Constructor

  virtual CORBA::Boolean connect (AVStreams::StreamEndPoint_ptr responder, 
                                  AVStreams::streamQoS &qos_spec, 
                                  const AVStreams::flowSpec &the_spec,  
                                  CORBA::Environment &env);
  // Called by StreamCtrl. responder is the peer to connect to

  virtual CORBA::Boolean multiconnect (AVStreams::streamQoS &the_qos, 
                                       AVStreams::flowSpec &the_spec,  
                                       CORBA::Environment &env);
  // Used for ATM-style multicast
  
  virtual CORBA::Boolean connect_leaf (AVStreams::StreamEndPoint_B_ptr the_ep, 
                                       AVStreams::streamQoS &the_qos, 
                                       const AVStreams::flowSpec &the_flows,  
                                       CORBA::Environment &env);
  // Used for ATM-style multicast

  virtual void disconnect_leaf (AVStreams::StreamEndPoint_B_ptr the_ep, 
                                const AVStreams::flowSpec &theSpec,  
                                CORBA::Environment &env);
  // Used to remove a multicast leaf

  virtual ~TAO_Client_StreamEndPoint (void);
  // Destructor

};

class TAO_ORBSVCS_Export TAO_Server_StreamEndPoint : 
  public virtual POA_AVStreams::StreamEndPoint_B, 
  public virtual TAO_StreamEndPoint,
  public virtual TAO_Server_Base_StreamEndPoint // Abstract interface
{
  // = DESCRIPTION
  //     The "B" side of a streamendpoint
public:
  TAO_Server_StreamEndPoint (void);
  // Constructor

  virtual CORBA::Boolean request_connection (AVStreams::StreamEndPoint_ptr initiator, 
                                             CORBA::Boolean is_mcast, 
                                             AVStreams::streamQoS &qos, 
                                             AVStreams::flowSpec &the_spec,  
                                             CORBA::Environment &env);
  // Called by the peer StreamEndPoint. The flow_spec indicates the
  // flows (which contain transport addresses etc.)

  virtual CORBA::Boolean multiconnect (AVStreams::streamQoS &the_qos, 
                                       AVStreams::flowSpec &the_spec,  
                                       CORBA::Environment &env);
  // Used for internet-style multicast

  virtual ~TAO_Server_StreamEndPoint (void);
  // Destructor
};

class TAO_ORBSVCS_Export TAO_VDev 
  : public virtual POA_AVStreams::VDev
// = DESCRIPTION
//    Implements the VDev interface. One of these is created per connection,
//    and represents device-specific parameters
{
 public:
  TAO_VDev (void);
  // Constructor

  virtual CORBA::Boolean set_peer (AVStreams::StreamCtrl_ptr the_ctrl, 
                                   AVStreams::VDev_ptr the_peer_dev, 
                                   AVStreams::streamQoS &the_qos, 
                                   const AVStreams::flowSpec &the_spec,  
                                   CORBA::Environment &env);
  // Called to tell the vdev who the streamctrl, peer vdev is

  virtual CORBA::Boolean set_Mcast_peer (AVStreams::StreamCtrl_ptr the_ctrl, 
                                         AVStreams::MCastConfigIf_ptr a_mcastconfigif, 
                                         AVStreams::streamQoS &the_qos, 
                                         const AVStreams::flowSpec &the_spec,  
                                         CORBA::Environment &env);
  // Used to set the streamctrl and multicast device
   
  virtual void configure (const CosPropertyService::Property &the_config_mesg,  
                          CORBA::Environment &env);
  // Called by the peer VDev to configure the device (catch all)
  
  virtual void set_format (const char *flowName, 
                           const char *format_name,  
                           CORBA::Environment &env);
  // Used to set a format on a flowname
   
  virtual void set_dev_params (const char *flowName, 
                               const CosPropertyService::Properties &new_params,  
                               CORBA::Environment &env);
  // Used to set device parameters
  
  virtual CORBA::Boolean modify_QoS (AVStreams::streamQoS &the_qos, 
                                     const AVStreams::flowSpec &the_spec,  
                                     CORBA::Environment &env);
  // Called to change QoS of the device

  virtual ~TAO_VDev (void);
  // Destructor

 private:
  AVStreams::StreamCtrl_var streamctrl_;
  // My stream controller
   
  AVStreams::VDev_var peer_;
  // My peer
};

class TAO_ORBSVCS_Export TAO_MMDevice 
  : public virtual TAO_PropertySet, 
    public virtual POA_AVStreams::MMDevice
// = DESCRIPTION
//     Implements a factory to create Endpoints and VDevs
{
 protected:
  TAO_MMDevice (void);
  // Constructor

 public:

  virtual AVStreams::StreamCtrl_ptr  bind (AVStreams::MMDevice_ptr peer_device,
                                           AVStreams::streamQoS &the_qos,
                                           CORBA::Boolean_out is_met,
                                           const AVStreams::flowSpec &the_spec,
                                           CORBA::Environment &env);
  // Can be used to request the MMDevice to create a new StreamCtrl,
  // and call bind_devs on it

  virtual AVStreams::StreamCtrl_ptr  bind_mcast (AVStreams::MMDevice_ptr first_peer,
                                                 AVStreams::streamQoS &the_qos,
                                                 CORBA::Boolean_out is_met,
                                                 const AVStreams::flowSpec &the_spec,
                                                 CORBA::Environment &env);
  // Multicast bind

  virtual void destroy (AVStreams::StreamEndPoint_ptr the_ep,
                        const char *vdev_name,
                        CORBA::Environment &env);
  // Remove the StreamEndPoint and the related vdev

  virtual char * add_fdev (CORBA::Object_ptr the_fdev,
                           CORBA::Environment &env);
  // Not supported in the light profile, raises notsupported

  virtual CORBA::Object_ptr get_fdev (const char *flow_name,  
                                      CORBA::Environment &env);
  // Not supported in the light profile, raises notsupported

  virtual void remove_fdev (const char *flow_name,  
                            CORBA::Environment &env);
  // Not supported in the light profile, raises notsupported
  
  virtual ~TAO_MMDevice (void);
  // Destructor
};


template<class T>
class TAO_ORBSVCS_Export TAO_Client_MMDevice 
  : public virtual TAO_MMDevice
// = DESCRIPTION
//     Specialiized MMDevice, meant to generate type "A"
//     endpoints. This is meant to be used on the client side
//     Trying to create a B type endpoint using this  class will
//     result in an  error
//     This class is templatized by the Stream endpoint
//     that is to be created using create_A. The user
//     of this class can thus use this as a factory to create
//     user-defined stream-endpoints
{
public:
  TAO_Client_MMDevice ();
  // Constructor
  
  virtual AVStreams::StreamEndPoint_A_ptr  create_A (AVStreams::StreamCtrl_ptr the_requester, 
                                                     AVStreams::VDev_out the_vdev, 
                                                     AVStreams::streamQoS &the_qos, 
                                                     CORBA::Boolean_out met_qos, 
                                                     char *&named_vdev, 
                                                     const AVStreams::flowSpec &the_spec,  
                                                     CORBA::Environment &env);
  // Called by StreamCtrl to create a "A" type streamandpoint and vdev
  
  virtual AVStreams::StreamEndPoint_B_ptr  create_B (AVStreams::StreamCtrl_ptr the_requester, 
                                                     AVStreams::VDev_out the_vdev, 
                                                     AVStreams::streamQoS &the_qos, 
                                                     CORBA::Boolean_out met_qos, 
                                                     char *&named_vdev, 
                                                     const AVStreams::flowSpec &the_spec,  
                                                     CORBA::Environment &env);
  // Called by StreamCtrl to create a "B" type streamandpoint and vdev
};

template<class T>
class TAO_ORBSVCS_Export TAO_Server_MMDevice 
  : public virtual TAO_MMDevice
// = DESCRIPTION
//     Specialiized MMDevice, meant to generate type "B"
//     endpoints. This is meant to be used on the server side
//     Trying to create a A type endpoint using this  class will
//     result in an  error
//     This class is templatized by the Stream endpoint
//     that is to be created using create_A. The user
//     of this class can thus use this as a factory to create
//     user-defined stream-endpoints
{
public:
  TAO_Server_MMDevice (void);

  virtual AVStreams::StreamEndPoint_A_ptr  create_A (AVStreams::StreamCtrl_ptr the_requester, 
                                                     AVStreams::VDev_out the_vdev, 
                                                     AVStreams::streamQoS &the_qos, 
                                                     CORBA::Boolean_out met_qos, 
                                                     char *&named_vdev, 
                                                     const AVStreams::flowSpec &the_spec,  
                                                     CORBA::Environment &env);
  // Called by StreamCtrl to create a "A" type streamandpoint and vdev

  virtual AVStreams::StreamEndPoint_B_ptr  create_B (AVStreams::StreamCtrl_ptr the_requester, 
                                                     AVStreams::VDev_out the_vdev, 
                                                     AVStreams::streamQoS &the_qos, 
                                                     CORBA::Boolean_out met_qos, 
                                                     char *&named_vdev, 
                                                     const AVStreams::flowSpec &the_spec,  
                                                     CORBA::Environment &env);
  // Called by StreamCtrl to create a "B" type streamandpoint and vdev

};
#endif /* AVSTREAMS_I_H */