summaryrefslogtreecommitdiff
path: root/examples/QOS/Change_Sender_TSpec/Fill_ACE_QoS.h
blob: 79568dafb78a076efe1331d8210d4982a7df51b9 (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
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    Fill_ACE_QoS.h
 *
 *  $Id$
 *
 *  @author Vishal Kachroo <vishal@cs.wustl.edu>
 */
//=============================================================================


#ifndef FILL_ACE_QOS_H
#define FILL_ACE_QOS_H

#include "ace/SString.h"
#include "ace/Hash_Map_Manager.h"
#include "ace/Null_Mutex.h"
#include "ace/ACE.h"
#include "ace/OS_QoS.h"

/**
 * @class Fill_ACE_QoS
 TITLE
 * This class helps users to add new flow specs and provides
 * utility functions for filling up the flow specs for simplex/duplex
 * sessions.
 */
class Fill_ACE_QoS
{

public:
  typedef ACE_Hash_Map_Manager <ACE_CString, ACE_Flow_Spec *, ACE_Null_Mutex> FLOW_SPEC_HASH_MAP;

  //Initialization and termination methods.
  /// constructor.
  Fill_ACE_QoS (void);

  /// destructor.
  ~Fill_ACE_QoS (void);

  /// To be used by receivers. Fills the receiver qos and sets the
  /// sender qos to NO_TRAFFIC.
  int fill_simplex_receiver_qos (ACE_QoS &ace_qos,
                                 const ACE_CString &recv_flow_name);

  /// To be used by senders. Fills the sender qos and sets the receiver
  /// qos to NO_TRAFFIC.
  int fill_simplex_sender_qos (ACE_QoS &ace_qos,
                               const ACE_CString &send_flow_name);

  /// To be used by applications that wish to be both receivers and
  /// senders.
  int fill_duplex_qos (ACE_QoS &ace_qos,
                       const ACE_CString &recv_flow_name,
                       const ACE_CString &send_flow_name);

  /// Returns the hash map of flowspecs indexed by flowspec name.
  FLOW_SPEC_HASH_MAP& map (void);

private:

  // The Service Provider is currently set to NULL for all ACE_QoS.
  static const iovec iov_;

  // A NO_TRAFFIC flow spec. Senders set the receiving qos to this
  // while the receivers set the sending qos to this.
  ACE_Flow_Spec *default_traffic_;

  // A list of flowspecs indexed by the flowspec name.
  FLOW_SPEC_HASH_MAP flow_spec_map_;
};

#endif /* FILL_ACE_QOS_H */