summaryrefslogtreecommitdiff
path: root/TAO/tao/Request_Mux_Strategy.cpp
blob: e6f3839719ff73e141d0959b98d2f271e4554740 (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
// $Id$

#include "tao/Request_Mux_Strategy.h"

// @@ Alex: there is another aspect that is controlled by this
//    strategy: the demuxed version must idle() the transport
//    right after the request is sent, otherwise nobody else will be
//    able to use it.
//    The exclusive version must idle it after the reply is received,
//    to guarantee that nobody else is using it.
//    We may need to add a couple of methods to implement that.

TAO_Request_Mux_Strategy::TAO_Request_Mux_Strategy (void)
  : cdr_ (0)
{
}

TAO_Request_Mux_Strategy::~TAO_Request_Mux_Strategy (void)
{
}

TAO_InputCDR *
TAO_Request_Mux_Strategy::get_cdr_stream (void)
{
  return cdr_;
}

// *********************************************************************

TAO_Muxed_RMS::TAO_Muxed_RMS (void)
{
}

TAO_Muxed_RMS::~TAO_Muxed_RMS (void)
{
  // @@ delete ???
}

// Generate and return an unique request id for the current
// invocation.
CORBA::ULong
TAO_Muxed_RMS::request_id (void)
{
  // @@
  return 0;
}

// Bind the dispatcher with the request id.
int
TAO_Muxed_RMS::bind_dispatcher (CORBA::ULong request_id,
                                TAO_Reply_Dispatcher *rh)
{
  // @@
  return 0;
}

// Find the Reply Dispatcher.
TAO_Reply_Dispatcher*
TAO_Muxed_RMS::find_dispatcher (CORBA::ULong request_id)
{
  // @@
  return 0;
}

void
TAO_Muxed_RMS::set_cdr_stream (TAO_InputCDR *Cdr)
{
  // @@
}


void
TAO_Muxed_RMS::destroy_cdr_stream (TAO_InputCDR *)
{
  // @@ Implement.
  // delete cdr;
  // cdr = 0;
}

// *********************************************************************

TAO_Exclusive_RMS::TAO_Exclusive_RMS (void)
  : request_id_generator_ (0),
    request_id_ (0),
    rd_ (0)
{
}

TAO_Exclusive_RMS::~TAO_Exclusive_RMS (void)
{
}

// Generate and return an unique request id for the current
// invocation. We can actually return a predecided ULong, since we
// allow only one invocation over this connection at a time.
CORBA::ULong
TAO_Exclusive_RMS::request_id (void)
{
  return this->request_id_generator_++;
}

// Bind the handler with the request id.
int
TAO_Exclusive_RMS::bind_dispatcher (CORBA::ULong request_id,
                                    TAO_Reply_Dispatcher *rd)
{
  this->request_id_ = request_id;
  this->rd_ = rd;
  return 0;
}

// Find the Reply Handler.
TAO_Reply_Dispatcher *
TAO_Exclusive_RMS::find_dispatcher (CORBA::ULong request_id)
{
  if (this->request_id_ != request_id)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "%N:%l:TAO_Exclusive_RMS::find_handler: "
                       "Failed to find the handler\n"),
                      0);

  return this->rd_;
}


// Set the CDR stream.
void
TAO_Exclusive_RMS::set_cdr_stream (TAO_InputCDR *cdr)
{
  this->cdr_ = cdr;
}

// NOOP function.
void
TAO_Exclusive_RMS::destroy_cdr_stream (TAO_InputCDR *)
{
  this->cdr_ = 0;
}