00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Policy.h 00006 * 00007 * $Id: Policy.h 73791 2006-07-27 20:54:56Z wotte $ 00008 * 00009 * @author Nagarajan Surendran <naga@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef TAO_AV_POLICY_H 00015 #define TAO_AV_POLICY_H 00016 00017 #include /**/ "ace/pre.h" 00018 00019 #include "ace/Addr.h" 00020 #include "tao/Basic_Types.h" 00021 #include "tao/CORBA_String.h" 00022 #include "tao/Sequence_T.h" 00023 #include "ace/Time_Value.h" 00024 #include "orbsvcs/AV/AV_export.h" 00025 00026 00027 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00028 class ACE_Message_Block; 00029 ACE_END_VERSIONED_NAMESPACE_DECL 00030 00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00032 00033 struct TAO_AV_frame_info 00034 { 00035 CORBA::Boolean boundary_marker; 00036 CORBA::Octet format; 00037 // @@ Shouldn't this be a string. 00038 CORBA::ULong timestamp; 00039 CORBA::ULong ssrc; 00040 CORBA::ULong sequence_num; 00041 }; 00042 00043 #define TAO_AV_SSRC_POLICY 100 00044 #define TAO_AV_PAYLOAD_TYPE_POLICY 101 00045 #define TAO_AV_TIMEOUT_POLICY 102 00046 #define TAO_AV_RTCP_SDES_POLICY 103 00047 #define TAO_AV_SFP_CREDIT_POLICY 104 00048 00049 struct TAO_AV_RTCP_Sdes 00050 { 00051 CORBA::String_var name_; 00052 CORBA::String_var value_; 00053 }; 00054 00055 class TAO_AV_Export TAO_AV_Policy 00056 { 00057 public: 00058 TAO_AV_Policy (CORBA::ULong type); 00059 CORBA::ULong type (void); 00060 protected: 00061 CORBA::ULong type_; 00062 }; 00063 00064 class TAO_AV_Export TAO_AV_SSRC_Policy : public TAO_AV_Policy 00065 { 00066 public: 00067 TAO_AV_SSRC_Policy (CORBA::ULong ssrc = 0); 00068 CORBA::ULong value (void); 00069 void value (CORBA::ULong ssrc); 00070 protected: 00071 CORBA::ULong ssrc_; 00072 }; 00073 00074 class TAO_AV_Export TAO_AV_Payload_Type_Policy : public TAO_AV_Policy 00075 { 00076 public: 00077 TAO_AV_Payload_Type_Policy (int payload_type = -1); 00078 int value (void); 00079 void value (int pt); 00080 protected: 00081 int payload_type_; 00082 }; 00083 00084 class TAO_AV_Export TAO_AV_RTCP_Sdes_Policy : public TAO_AV_Policy 00085 { 00086 public: 00087 TAO_AV_RTCP_Sdes_Policy (void); 00088 TAO_AV_RTCP_Sdes &value (void); 00089 void value (const TAO_AV_RTCP_Sdes& sdes_val); 00090 protected: 00091 TAO_AV_RTCP_Sdes sdes_; 00092 }; 00093 00094 class TAO_AV_Export TAO_AV_SFP_Credit_Policy : public TAO_AV_Policy 00095 { 00096 public: 00097 TAO_AV_SFP_Credit_Policy (void); 00098 int value (void); 00099 void value (int val); 00100 protected: 00101 int value_; 00102 }; 00103 00104 typedef TAO::unbounded_value_sequence<TAO_AV_Policy*> TAO_AV_PolicyList; 00105 00106 class TAO_AV_Protocol_Object; 00107 class TAO_AV_Transport; 00108 class TAO_AV_Flow_Handler; 00109 00110 /** 00111 * @class TAO_AV_Callback 00112 * 00113 * @brief Callback class that the user will be implementing for receiving 00114 * frames from the network and also for timer events. 00115 */ 00116 class TAO_AV_Export TAO_AV_Callback 00117 { 00118 public: 00119 TAO_AV_Callback (void); 00120 virtual ~TAO_AV_Callback (void); 00121 00122 /// Called for opening the callback. 00123 int open (TAO_AV_Protocol_Object *object, 00124 TAO_AV_Flow_Handler *handler); 00125 00126 /// Called during Streamctrl->start. 00127 virtual int handle_start (void); 00128 00129 /// Called during Streamctrl->stop. 00130 virtual int handle_stop (void); 00131 00132 /// Called during timeout for Flow Producers. 00133 virtual int handle_timeout (void *arg); 00134 00135 virtual int schedule_timer (void); 00136 00137 virtual int receive_frame (ACE_Message_Block *frame, 00138 TAO_AV_frame_info *frame_info = 0, 00139 const ACE_Addr &address = ACE_Addr::sap_any); 00140 00141 // Called when a frame arrives for a FlowConsumer. 00142 00143 /// address from which the frame was received. 00144 virtual int receive_control_frame (ACE_Message_Block *frame, 00145 const ACE_Addr &address = ACE_Addr::sap_any); 00146 00147 /// Called during Streamctrl->destroy i.e tear_down of the stream 00148 virtual int handle_destroy (void); 00149 00150 /** 00151 * Called to get the timeout. If tv is 0 then the framework stop 00152 * calling this. This will be called during the start of the frame 00153 * and also if schedule_timer is called to get the timeout. 00154 */ 00155 virtual void get_timeout (ACE_Time_Value *&tv, 00156 void *&arg); 00157 00158 /// Accessor to protocol object. 00159 TAO_AV_Protocol_Object *protocol_object (void); 00160 00161 /// get the policies for the protocol object. 00162 virtual TAO_AV_PolicyList get_policies (void); 00163 protected: 00164 TAO_AV_Protocol_Object *protocol_object_; 00165 TAO_AV_Flow_Handler *handler_; 00166 }; 00167 00168 TAO_END_VERSIONED_NAMESPACE_DECL 00169 00170 #if defined(__ACE_INLINE__) 00171 #include "orbsvcs/AV/Policy.inl" 00172 #endif /* __ACE_INLINE__ */ 00173 00174 #include /**/ "ace/post.h" 00175 00176 #endif /* TAO_AV_POLICY_H */