00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TAO_AV_UDP_H
00015 #define TAO_AV_UDP_H
00016
00017 #include "ace/pre.h"
00018
00019 #include "orbsvcs/AV/Protocol_Factory.h"
00020
00021 #include "ace/Service_Config.h"
00022
00023 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00024
00025
00026
00027
00028
00029 class TAO_AV_Export TAO_AV_UDP_Factory : public TAO_AV_Transport_Factory
00030 {
00031 public:
00032
00033 TAO_AV_UDP_Factory (void);
00034 virtual ~TAO_AV_UDP_Factory (void);
00035 virtual int init (int argc, char *argv[]);
00036 virtual int match_protocol (const char *protocol_string);
00037 virtual TAO_AV_Acceptor *make_acceptor (void);
00038 virtual TAO_AV_Connector *make_connector (void);
00039 };
00040
00041 class TAO_AV_UDP_Flow_Handler;
00042
00043
00044
00045
00046
00047
00048 class TAO_AV_Export TAO_AV_UDP_Transport
00049 :public TAO_AV_Transport
00050 {
00051
00052 public:
00053 TAO_AV_UDP_Transport (void);
00054
00055 TAO_AV_UDP_Transport (TAO_AV_UDP_Flow_Handler *handler);
00056
00057 virtual ~TAO_AV_UDP_Transport (void);
00058 virtual int open (ACE_Addr *addr);
00059
00060 virtual int close (void);
00061
00062 virtual int mtu (void);
00063
00064 virtual ACE_Addr *get_peer_addr (void);
00065
00066 virtual int set_remote_address (const ACE_INET_Addr &address);
00067
00068
00069 virtual ssize_t send (const ACE_Message_Block *mblk,
00070 ACE_Time_Value *s = 0);
00071
00072
00073 virtual ssize_t send (const char *buf,
00074 size_t len,
00075 ACE_Time_Value *s = 0);
00076
00077
00078 virtual ssize_t send (const iovec *iov,
00079 int iovcnt,
00080 ACE_Time_Value *s = 0);
00081
00082
00083 virtual ssize_t recv (char *buf,
00084 size_t len,
00085 ACE_Time_Value *s = 0);
00086
00087
00088 virtual ssize_t recv (char *buf,
00089 size_t len,
00090 int flags,
00091 ACE_Time_Value *s = 0);
00092
00093
00094 virtual ssize_t recv (iovec *iov,
00095 int iovcnt,
00096 ACE_Time_Value *s = 0);
00097
00098 TAO_AV_UDP_Flow_Handler *handler (void) { return this->handler_; }
00099
00100 protected:
00101 TAO_AV_UDP_Flow_Handler *handler_;
00102 ACE_Addr *addr_;
00103 ACE_INET_Addr peer_addr_;
00104 };
00105
00106
00107
00108
00109
00110 class TAO_AV_Export TAO_AV_UDP_Flow_Handler
00111 :public virtual TAO_AV_Flow_Handler,
00112 public virtual ACE_Event_Handler
00113 {
00114 public:
00115
00116
00117 TAO_AV_UDP_Flow_Handler (void);
00118 virtual ~TAO_AV_UDP_Flow_Handler (void);
00119 int open (ACE_Addr &address);
00120 int close (void);
00121 virtual TAO_AV_Transport *transport (void);
00122 virtual int set_remote_address (ACE_Addr *address);
00123 virtual ACE_HANDLE get_handle (void) const;
00124 virtual int handle_input (ACE_HANDLE fd);
00125 virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg = 0);
00126 const ACE_SOCK_Dgram *get_socket (void) const;
00127 virtual ACE_Event_Handler* event_handler (void){ return this; }
00128
00129 virtual int change_qos (AVStreams::QoS);
00130
00131 protected:
00132 TAO_AV_Core *av_core_;
00133 ACE_INET_Addr peer_addr_;
00134 ACE_SOCK_Dgram sock_dgram_;
00135 };
00136
00137
00138
00139
00140
00141 class TAO_AV_Export TAO_AV_UDP_Acceptor
00142 :public TAO_AV_Acceptor
00143 {
00144 public:
00145 TAO_AV_UDP_Acceptor (void);
00146 virtual ~TAO_AV_UDP_Acceptor (void);
00147 virtual int open (TAO_Base_StreamEndPoint *endpoint,
00148 TAO_AV_Core *av_core,
00149 TAO_FlowSpec_Entry *entry,
00150 TAO_AV_Flow_Protocol_Factory *factory,
00151 TAO_AV_Core::Flow_Component flow_comp =
00152 TAO_AV_Core::TAO_AV_DATA);
00153
00154 virtual int open_default (TAO_Base_StreamEndPoint *endpoint,
00155 TAO_AV_Core *av_core,
00156 TAO_FlowSpec_Entry *entry,
00157 TAO_AV_Flow_Protocol_Factory *factory,
00158 TAO_AV_Core::Flow_Component flow_comp =
00159 TAO_AV_Core::TAO_AV_DATA);
00160
00161 virtual int open_i (ACE_INET_Addr *address, int is_default_open);
00162
00163 virtual int close (void);
00164 virtual int activate_svc_handler (TAO_AV_Flow_Handler *handler);
00165
00166
00167 protected:
00168 ACE_INET_Addr *address_;
00169 ACE_INET_Addr *control_inet_address_;
00170 TAO_Base_StreamEndPoint *endpoint_;
00171 TAO_FlowSpec_Entry *entry_;
00172 TAO_AV_Flow_Protocol_Factory *flow_protocol_factory_;
00173 TAO_AV_Core::Flow_Component flow_component_;
00174
00175
00176 };
00177
00178
00179
00180
00181
00182 class TAO_AV_Export TAO_AV_UDP_Connector
00183 :public TAO_AV_Connector
00184 {
00185 public:
00186 TAO_AV_UDP_Connector (void);
00187 ~TAO_AV_UDP_Connector (void);
00188 virtual int open (TAO_Base_StreamEndPoint *endpoint,
00189 TAO_AV_Core *av_core,
00190 TAO_AV_Flow_Protocol_Factory *factory);
00191
00192 virtual int connect (TAO_FlowSpec_Entry *entry,
00193 TAO_AV_Transport *&transport,
00194 TAO_AV_Core::Flow_Component flow_comp =
00195 TAO_AV_Core::TAO_AV_DATA);
00196 virtual int activate_svc_handler (TAO_AV_Flow_Handler *handler);
00197 virtual int close (void);
00198 protected:
00199 ACE_INET_Addr *control_inet_address_;
00200 TAO_Base_StreamEndPoint *endpoint_;
00201 TAO_AV_Core *av_core_;
00202 TAO_FlowSpec_Entry *entry_;
00203 TAO_AV_Flow_Protocol_Factory *flow_protocol_factory_;
00204 TAO_AV_Core::Flow_Component flow_component_;
00205
00206 };
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216 class TAO_AV_Export TAO_AV_UDP_Connection_Setup
00217 {
00218 public:
00219
00220 enum ConnectionType {CONNECTOR, ACCEPTOR};
00221
00222 static int setup (TAO_AV_Flow_Handler *&flow_handler,
00223 ACE_INET_Addr *inet_addr,
00224 ACE_INET_Addr *&local_addr,
00225 int is_multicast,
00226 ConnectionType ct);
00227 };
00228
00229
00230
00231
00232
00233 class TAO_AV_Export TAO_AV_UDP_Object : public TAO_AV_Protocol_Object
00234 {
00235 public:
00236 TAO_AV_UDP_Object (TAO_AV_Callback *callback,
00237 TAO_AV_Transport *transport = 0);
00238
00239
00240 virtual ~TAO_AV_UDP_Object (void);
00241
00242 virtual int handle_input (void);
00243
00244
00245 virtual int send_frame (ACE_Message_Block *frame,
00246 TAO_AV_frame_info *frame_info = 0);
00247
00248 virtual int send_frame (const iovec *iov,
00249 int iovcnt,
00250 TAO_AV_frame_info *frame_info = 0);
00251
00252 virtual int send_frame (const char*buf,
00253 size_t len);
00254
00255
00256 virtual int destroy (void);
00257
00258 private:
00259
00260 ACE_Message_Block frame_;
00261 };
00262
00263
00264
00265
00266
00267 class TAO_AV_Export TAO_AV_UDP_Flow_Factory : public TAO_AV_Flow_Protocol_Factory
00268 {
00269 public:
00270
00271 TAO_AV_UDP_Flow_Factory (void);
00272 virtual ~TAO_AV_UDP_Flow_Factory (void);
00273 virtual int init (int argc, char *argv[]);
00274 virtual int match_protocol (const char *flow_string);
00275 TAO_AV_Protocol_Object* make_protocol_object (TAO_FlowSpec_Entry *entry,
00276 TAO_Base_StreamEndPoint *endpoint,
00277 TAO_AV_Flow_Handler *handler,
00278 TAO_AV_Transport *transport);
00279 };
00280
00281 TAO_END_VERSIONED_NAMESPACE_DECL
00282
00283 ACE_STATIC_SVC_DECLARE (TAO_AV_UDP_Flow_Factory)
00284 ACE_FACTORY_DECLARE (TAO_AV, TAO_AV_UDP_Flow_Factory)
00285
00286 ACE_STATIC_SVC_DECLARE (TAO_AV_UDP_Factory)
00287 ACE_FACTORY_DECLARE (TAO_AV, TAO_AV_UDP_Factory)
00288
00289
00290 #if defined(__ACE_INLINE__)
00291 #include "orbsvcs/AV/UDP.inl"
00292 #endif
00293
00294 #include "ace/post.h"
00295
00296 #endif