summaryrefslogtreecommitdiff
path: root/ace/QoS_Session_Impl.h
blob: a657dbb837b4734afbc0ba1841fab461cd1a7f1f (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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/* -*- C++ -*- */
// $Id$

// ===========================================================================
//
// = LIBRARY
//    ace
//
// = FILENAME
//    QoS_Session_Impl.h
//
// = AUTHOR
//    Vishal Kachroo <vishal@cs.wustl.edu>
//
// ===========================================================================

#ifndef ACE_QOS_SESSION_IMPL_H
#define ACE_QOS_SESSION_IMPL_H
#include "ace/pre.h"

#include "ace/QoS_Session.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */


#if defined (ACE_HAS_RAPI)
#include "rapi_lib.h"

#define DEFAULT_SOURCE_SENDER_PORT 10001

class ACE_Export ACE_RAPI_Session : public ACE_QoS_Session
{
  // = TITLE
  //    A RAPI QoS session object.
  //
  // = DESCRIPTION
  //    This class is a RAPI (RSVP API, an implementation of RSVP on UNIX) 
  //    implementation of the ACE_QoS_Session interface.
  
public:
  
  ~ACE_RAPI_Session (void);
  // Default destructor.

  static int rsvp_error;
  // Error handling for RSVP callback

  virtual int open (ACE_INET_Addr dest_addr,
                    ACE_Protocol_ID protocol_id);
  // Open a RAPI QoS session [dest IP, dest port, Protocol ID].

  virtual int close (void);
  // Close the RAPI QoS Session.
  
  virtual ACE_QoS qos (void) const;
  // Returns the QoS for this RAPI session.
  
  virtual int qos (ACE_SOCK *socket,
                   ACE_QoS_Manager *qos_manager,
                   const ACE_QoS &ace_qos);
  // Set QoS for this RAPI session. The socket parameter is used to confirm if
  // this QoS session was subscribed to by the socket.

  virtual void qos (const ACE_QoS &ace_qos);
  // Sets the QoS for this session object to ace_qos. Does not interfere with the 
  // QoS in the underlying socket. This call is useful to update the QoS object 
  // when the underlying socket QoS is being set through a mechanism other than
  // the previous qos () method e.g. inside the dgram_mcast.subscribe () where the 
  // QoS for the socket is set through ACE_OS::join_leaf ().

  virtual int update_qos (void);
  // Calls rapi_dispatch () that further triggers the call back function.    
  // It is a mechanism of updating the QoS for this session asynchronously, as
  // RSVP events occur.

  virtual ACE_End_Point_Type flags (void) const;
  virtual void flags (const ACE_End_Point_Type flags);
  // Get/Set methods for the flags_.

  virtual int session_id (void) const;
  // Get the RAPI session id.
  
  virtual void session_id (const int session_id);
  // Set the RAPI session id.

  virtual ACE_HANDLE rsvp_events_handle (void);
  // Get the RAPI file descriptor for RSVP events.

  virtual ACE_INET_Addr dest_addr (void) const;
  // Get the destination address for this RAPI session.

  virtual void dest_addr (const ACE_INET_Addr &dest_addr);
  // Set the destination address for this RAPI session.

  virtual u_short source_port (void) const;
  // Get the source port for this session.
  
  virtual void source_port (const u_short &source_port);
  // Set the source port for this session.
  
  virtual int version ();
  // RAPI version. Returned value = 100 * major-version + minor-version.

  friend class ACE_QoS_Session_Factory;
  // The factory is a friend so it can create this object through
  // the only private constructor.
  
private:
  
  ACE_RAPI_Session (void);
  // Default constuctor. Constructor is defined private so that only 
  // the friend factory can instantiate this class.

  rapi_tspec_t *init_tspec_simplified (const ACE_Flow_Spec &flow_spec);
  // Construct a simplified RAPI Sender TSpec object 
  // from an ACE_Flow_Spec object. Used internally by this class.

  rapi_flowspec_t *init_flowspec_simplified(const ACE_Flow_Spec &flow_spec);
  // Construct a simplified RAPI Receiver FlowSpec object 
  // from an ACE_Flow_Spec object. Used internally by the class.

  int sending_qos (const ACE_QoS &ace_qos);
  // Set sending QoS for this RAPI session.
  
  int receiving_qos (const ACE_QoS &ace_qos);
  // Set receiving  QoS for this RAPI session.
  
};

#endif /* ACE_HAS_RAPI */

class ACE_Export ACE_GQoS_Session : public ACE_QoS_Session
{
  // = TITLE
  //    A GQoS session object.
  //
  // = DESCRIPTION
  //    This class is a GQoS (Generic QoS, an implementation of RSVP on 
  //    Win2K) implementation of the ACE_QoS_Session interface.

public:
  
  ~ACE_GQoS_Session (void);
  // Default destructor.

  static int GQoS_session_id;
  // This is a session ID generator. It does a lot more than expected 
  // from an int!.

  virtual int open (ACE_INET_Addr dest_addr,
                    ACE_Protocol_ID protocol_id);
  // Open a GQoS session [dest IP, dest port, Protocol ID].

  virtual int close (void);
  // Close the GQoS Session.
  
  virtual ACE_QoS qos (void) const;
  // Returns the QoS for this GQoS session.

  virtual int qos (ACE_SOCK *socket,
                   ACE_QoS_Manager *qos_manager,
                   const ACE_QoS &ace_qos);
  // Set QoS for this GQoS session. The socket parameter is used to confirm if
  // this QoS session was subscribed to by the socket.
  
  virtual void qos (const ACE_QoS &ace_qos);
  // Sets the QoS for this session object to ace_qos. Does not interfere with the 
  // QoS in the underlying socket. This call is useful to update the QoS object 
  // when the underlying socket QoS is being set through a mechanism other than
  // the previous qos () method e.g. inside the dgram_mcast.subscribe () where the 
  // QoS for the socket is set through ACE_OS::join_leaf ().
  
  virtual int update_qos (void);
  // Calls the ioctl (ACE_SIO_GET_QOS). It is a mechanism of updating the 
  // QoS for this session asynchronously, as RSVP events occur.

  virtual ACE_End_Point_Type flags (void) const;
  virtual void flags (const ACE_End_Point_Type flags);
  // Get/Set methods for the flags_.

  virtual ACE_INET_Addr dest_addr (void) const;
  // Get the destination address for this GQoS session.

  virtual void dest_addr (const ACE_INET_Addr &dest_addr);
  // Set the destination address for this GQoS session.

  virtual u_short source_port (void) const;
  // Get the source port for this session.
  
  virtual void source_port (const u_short &source_port);
  // Set the source port for this session.
  
  virtual int session_id (void) const;
  // Get the GQoS session id.
  
  virtual void session_id (const int session_id);
  // Set the GQoS session id.

  virtual ACE_HANDLE rsvp_events_handle (void);
  // Get the file descriptor of the underlying socket.

  virtual int version ();
  // GQoS version.

  friend class ACE_QoS_Session_Factory;
  // The factory is a friend so it can create this object through
  // the only private constructor.

private:
  
  ACE_GQoS_Session (void);
  // Default constructor. Constructor is defined private so that only 
  // the friend factory can instantiate this class.
  
};

#if defined (__ACE_INLINE__)
#include "ace/QoS_Session_Impl.i"
#endif /* __ACE_INLINE__ */

#include "ace/post.h"
#endif /* ACE_QOS_SESSION_IMPL_H */