Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / ACE / ace / ATM_Params.h
blob32ff0a99e364d1a1a088254567851b36b33db268
1 // -*- C++ -*-
3 //==========================================================================
4 /**
5 * @file ATM_Params.h
7 * @author Joe Hoffert <joeh@cs.wustl.edu>
8 */
9 //==========================================================================
12 #ifndef ACE_ATM_PARAMS_H
13 #define ACE_ATM_PARAMS_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/config-all.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #if defined (ACE_HAS_ATM)
24 #include /**/ "ace/ACE_export.h"
26 #if defined (ACE_HAS_FORE_ATM_XTI)
27 #include "ace/TLI.h"
28 #define ATM_PROTOCOL_DEFAULT 0
29 typedef struct t_info Param_Info;
30 typedef struct netbuf Param_Udata;
31 #elif defined (ACE_HAS_FORE_ATM_WS2)
32 #include "ace/SOCK.h"
33 #define ATM_PROTOCOL_DEFAULT ATMPROTO_AAL5
34 #define ACE_XTI_ATM_DEVICE ""
35 typedef int Param_Info;
36 typedef int Param_Udata;
37 #elif defined (ACE_HAS_LINUX_ATM)
38 #include /**/ "atm.h"
39 #define AF_ATM PF_ATMSVC
40 #define ACE_XTI_ATM_DEVICE ""
41 #define ATM_PROTOCOL_DEFAULT ATM_AAL5
42 typedef int Param_Info;
43 typedef int Param_Udata;
44 #else
45 #define ACE_XTI_ATM_DEVICE ""
46 typedef int Param_Info;
47 typedef int Param_Udata;
48 #endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
50 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
52 /**
53 * @class ACE_ATM_Params
55 * @brief Wrapper class that simplifies the information passed to the ATM
56 * enabled ACE_ATM_Connector class.
58 class ACE_Export ACE_ATM_Params
60 public:
61 /**
62 * Initialize the data members. This class combines options from
63 * ACE_SOCK_Connector (@a protocol_family, @a protocol, <type>,
64 * @a protocol_info, <group>, and @a flags) and
65 * ACE_TLI_Connector (<device>, <info>, <rw_flag>, <oflag>, and <udata>)
66 * so that either mechanism can be used transparently for ATM.
68 ACE_ATM_Params (int rw_flag = 1,
69 const char device[] = ACE_XTI_ATM_DEVICE,
70 Param_Info *info = 0,
71 Param_Udata *udata = 0,
72 int oflag = O_RDWR,
73 int protocol_family = AF_ATM,
74 int protocol = ATM_PROTOCOL_DEFAULT,
75 int type =
76 #if defined (ACE_HAS_LINUX_ATM)
77 SOCK_DGRAM,
78 #else
79 SOCK_RAW,
80 #endif /* ACE_HAS_LINUX_ATM */
81 ACE_Protocol_Info *protocol_info = 0,
82 ACE_SOCK_GROUP g = 0,
83 u_long flags
84 = ACE_FLAG_MULTIPOINT_C_ROOT
85 | ACE_FLAG_MULTIPOINT_D_ROOT, // connector by default
86 int reuse_addr = 0);
88 /// Destructor.
89 ~ACE_ATM_Params ();
91 /// Get protocol family.
92 int get_protocol_family () const;
94 /// Set protocol family.
95 void set_protocol_family (int);
97 /// Get protocol.
98 int get_protocol () const;
100 /// Set protocol.
101 void set_protocol (int);
103 /// Get type.
104 int get_type () const;
106 /// Set type.
107 void set_type (int);
109 /// Get protocol info.
110 ACE_Protocol_Info *get_protocol_info();
112 /// Set protocol info.
113 void set_protocol_info( ACE_Protocol_Info *);
115 /// Get socket group.
116 ACE_SOCK_GROUP get_sock_group();
118 /// Set socket group.
119 void set_sock_group( ACE_SOCK_GROUP );
121 /// Get socket flags.
122 u_long get_flags();
124 /// Set socket flags.
125 void set_flags(u_long);
127 /// Get reuse_addr flag.
128 int get_reuse_addr () const;
130 /// Set reuse_addr flag.
131 void set_reuse_addr (int);
133 /// Get device.
134 const char* get_device () const;
136 /// Get info.
137 Param_Info* get_info () const;
139 /// Set info.
140 void set_info (Param_Info *);
142 /// Get r/w flag.
143 int get_rw_flag () const;
145 /// Set r/w flag.
146 void set_rw_flag (int);
148 /// Get user data.
149 Param_Udata* get_user_data () const;
151 /// Set user data.
152 void set_user_data (Param_Udata*);
154 /// Get open flag.
155 int get_oflag () const;
157 /// Set open flag.
158 void set_oflag (int);
160 /// Dump the state of an object.
161 void dump () const;
163 /// Declare the dynamic allocation hooks.
164 ACE_ALLOC_HOOK_DECLARE;
166 private:
167 /// Protocol family for sockets connections.
168 int protocol_family_;
170 /// Protocol for sockets connections.
171 int protocol_;
173 /// Type for opening sockets.
174 int type_;
176 /// Information about the protocol.
177 ACE_Protocol_Info *protocol_info_;
179 /// Socket group used (for sockets only).
180 ACE_SOCK_GROUP group_;
182 /// Flags for sockets (for sockets only).
183 u_long flags_;
185 /// Flag for reusing address for opening sockets.
186 int reuse_addr_;
188 /// Device name for XTI/ATM connections.
189 const char *device_;
191 /// Info for XTI/ATM connections.
192 Param_Info *info_;
194 /// R/W flag for XTI/ATM connections.
195 int rw_flag_;
197 /// User data for XTI/ATM connections.
198 Param_Udata *udata_;
200 /// Open flag for XTI/ATM connections.
201 int oflag_;
204 ACE_END_VERSIONED_NAMESPACE_DECL
206 #if defined (__ACE_INLINE__)
207 #include "ace/ATM_Params.inl"
208 #endif /* __ACE_INLINE__ */
210 #endif /* ACE_HAS_ATM */
211 #include /**/ "ace/post.h"
212 #endif /* ACE_ATM_PARAMS_H */