summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/AVStreams/Latency/pong.h
blob: 637140564ed24152e42f8ab03a1fe5a63f081773 (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

//=============================================================================
/**
 *  @file   pong.h
 *
 *  @author Carlos O'Ryan
 */
//=============================================================================

#ifndef TAO_PONG_H
#define TAO_PONG_H

#include "orbsvcs/AV/AVStreams_i.h"
#include "orbsvcs/AV/Policy.h"
#include "orbsvcs/AV/Flows_T.h"

class Pong_Recv_Callback : public TAO_AV_Callback
{
public:
  virtual int handle_stop (void);
  virtual int receive_frame (ACE_Message_Block *frame,
                             TAO_AV_frame_info *frame_info = 0,
                             const ACE_Addr &peer_address = ACE_Addr::sap_any);
  virtual int handle_destroy (void);
};

class Pong_Recv : public TAO_FlowConsumer
{
public:
  Pong_Recv (void);

  virtual int get_callback (const char *flowname,
                            TAO_AV_Callback *&callback);

private:
  /// The callback object...
  Pong_Recv_Callback callback_;
};

class Ping_Send_Callback : public TAO_AV_Callback
{
public:
  Ping_Send_Callback (void);

  virtual int handle_timeout (void *arg);
  virtual int handle_end_stream (void);
  virtual void get_timeout (ACE_Time_Value *&tv,
                            void *&arg);

private:
  /// the timeout value
  ACE_Time_Value timeout_;

  /// Pre-allocate the message block to send...
  ACE_Message_Block frame_;
  int count_;

};

class Ping_Send : public TAO_FlowProducer
{
public:
  Ping_Send (void);
  virtual int get_callback (const char *flowname,
                            TAO_AV_Callback *&callback);

private:
  /// The callback object...
  Ping_Send_Callback callback_;
};

typedef TAO_AV_Endpoint_Reactive_Strategy_A <TAO_StreamEndPoint_A,TAO_VDev,AV_Null_MediaCtrl> Reactive_Strategy;

typedef TAO_FDev<TAO_FlowProducer,Pong_Recv> Pong_Recv_FDev;
typedef TAO_FDev<Ping_Send,TAO_FlowConsumer> Ping_Send_FDev;

#endif /* TAO_PONG_H */