summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/AV/Policy.h
blob: 926f9c711b1be17baba5797f423c30e9ed287600 (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
/* -*- C++ -*- */

// $Id$

// ============================================================================
//
// = LIBRARY
//   ORBSVCS AVStreams
//
// = FILENAME
//   Policy.h
//
// = AUTHOR
//    Nagarajan Surendran <naga@cs.wustl.edu>
//
//
// ============================================================================

#ifndef TAO_AV_POLICY_H
#define TAO_AV_POLICY_H

#include "ace/Addr.h"
#include "tao/TAO.h"
#include "tao/debug.h"
#include "orbsvcs/orbsvcs_export.h"

struct TAO_AV_frame_info
{
  CORBA::Boolean boundary_marker;
  CORBA::Octet format;
  // @@ Shouldn't this be a string.
  CORBA::ULong timestamp;
  CORBA::ULong ssrc;
  CORBA::ULong sequence_num;
};

class TAO_ORBSVCS_Export TAO_AV_Policy
{
public:
  struct sdes
  {
    CORBA::String_var name_;
    CORBA::String_var value_;
  };

  enum PolicyType
  {
    TAO_AV_SSRC_POLICY,
    TAO_AV_PAYLOAD_TYPE_POLICY,
    TAO_AV_TIMEOUT_POLICY,
    TAO_AV_RTCP_SDES_POLICY,
    TAO_AV_TIMESTAMP_POLICY
  };

  TAO_AV_Policy (PolicyType type);
  PolicyType type (void);
protected:
  PolicyType type_;
};

class TAO_AV_SSRC_Policy
  :public TAO_AV_Policy
{
public:
  TAO_AV_SSRC_Policy (CORBA::ULong ssrc = 0);
  CORBA::ULong value (void);
  void value (CORBA::ULong ssrc);
protected:
  CORBA::ULong ssrc_;
};

class TAO_AV_Payload_Type_Policy
  :public TAO_AV_Policy
{
public:
  TAO_AV_Payload_Type_Policy (int payload_type = -1);
  int value (void);
  void value (int pt);
protected:
  int payload_type_;
};


class TAO_AV_RTCP_Sdes_Policy
  :public TAO_AV_Policy
{
public:
  TAO_AV_RTCP_Sdes_Policy (void);
  TAO_AV_Policy::sdes &value (void);
  void value (const TAO_AV_Policy::sdes& sdes_val);
protected:
  TAO_AV_Policy::sdes sdes_;
};

class TAO_AV_Timestamp_Policy
  :public TAO_AV_Policy
{
public:
  TAO_AV_Timestamp_Policy (void);
  ACE_UINT32 value (void);
  void value (ACE_UINT32 timestamp);
protected:
  ACE_UINT32 timestamp_;
};

typedef TAO_Unbounded_Sequence<TAO_AV_Policy*> PolicyList;

class TAO_AV_Policy_Manager
{
public:
  TAO_AV_Policy *create_policy (TAO_AV_Policy::PolicyType type,
                                void *value);
};

class TAO_AV_Protocol_Object;
class TAO_AV_Transport;
class TAO_AV_Flow_Handler;

class TAO_AV_Callback
{
  // = TITLE
  //     Callback class that the user will be implementing for receiving
  //     frames from the network and also for timer events.
public:
  TAO_AV_Callback (void);

  int open (TAO_AV_Protocol_Object *object,
            TAO_AV_Flow_Handler *handler);
  // Called for opening the callback.

  virtual int handle_start (void);
  // Called during Streamctrl->start.

  virtual int handle_stop (void);
  // Called during Streamctrl->stop.

  virtual int handle_timeout (void *arg);
  // Called during timeout for Flow Producers.

  virtual int schedule_timer (void);

  virtual int receive_frame (ACE_Message_Block *frame,
                             TAO_AV_frame_info *frame_info = 0,
                             const ACE_Addr &address = ACE_Addr::sap_any);

  // Called when a frame arrives for a FlowConsumer.

  virtual int receive_control_frame (ACE_Message_Block *frame,
                                     const ACE_Addr &address = ACE_Addr::sap_any);
  // address from which the frame was received.

  virtual int handle_destroy (void);
  // Called during Streamctrl->destroy i.e tear_down  of the stream

  virtual void get_timeout (ACE_Time_Value *&tv,
                            void *&arg);
  // Called to get the timeout. If tv is 0 then the framework stop
  // calling this. This will be called during the start of the frame
  // and also if schedule_timer is called to get the timeout.

  TAO_AV_Protocol_Object *protocol_object (void);
  // Accessor to protocol object.
protected:
  TAO_AV_Protocol_Object *protocol_object_;
  TAO_AV_Flow_Handler *handler_;
};

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