3 //==========================================================================
7 * @author Joe Hoffert <joeh@cs.wustl.edu>
9 //==========================================================================
11 #ifndef ACE_ATM_ADDR_H
12 #define ACE_ATM_ADDR_H
13 #include /**/ "ace/pre.h"
15 #include /**/ "ace/config-all.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #if defined (ACE_HAS_ATM)
23 #include /**/ "ace/ACE_export.h"
26 #if defined (ACE_HAS_FORE_ATM_XTI)
27 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
28 typedef ATMSAPAddress ATM_Addr
;
29 ACE_END_VERSIONED_NAMESPACE_DECL
30 #elif defined (ACE_HAS_FORE_ATM_WS2)
31 #define FORE_NAME_SPACE NS_ALL
32 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
33 typedef struct sockaddr_atm ATM_Addr
;
34 ACE_END_VERSIONED_NAMESPACE_DECL
35 #elif defined (ACE_HAS_LINUX_ATM)
39 // Open versioned namespace, if enabled by the user.
40 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
42 //pbrandao:as Linux has this 2 structs separeted we "link it" here
43 typedef struct _linux_atm_addr
45 struct sockaddr_atmsvc sockaddratmsvc
;
46 struct atm_sap atmsap
;
50 #endif /* ACE_HAS_FORE_ATM_XTI/ACE_HAS_FORE_ATM_WS2/ACE_HAS_LINUX_ATM */
55 * @brief Defines the ATM domain address family address format.
57 class ACE_Export ACE_ATM_Addr
: public ACE_Addr
60 // Constants used for ATM options
61 static const long LINE_RATE
;
62 static const int OPT_FLAGS_CPID
;
63 static const int OPT_FLAGS_PMP
;
64 static const int DEFAULT_SELECTOR
;
66 /// Default constructor.
67 ACE_ATM_Addr (u_char selector
= DEFAULT_SELECTOR
);
70 ACE_ATM_Addr (const ACE_ATM_Addr
&,
71 u_char selector
= DEFAULT_SELECTOR
);
74 * Creates an ACE_ATM_Addr from an ATMSAPAddress structure. This
75 * is vendor specific (FORE systems). May need to change when other
76 * vendors are supported.
78 ACE_ATM_Addr (const ATM_Addr
*,
79 u_char selector
= DEFAULT_SELECTOR
);
82 * Initializes an ACE_ATM_Addr from the <sap> which can be
83 * "atm-address" (e.g.,
84 * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname"
85 * (e.g., "frisbee.cs.wustl.edu").
87 ACE_ATM_Addr (const ACE_TCHAR sap
[],
88 u_char selector
= DEFAULT_SELECTOR
);
91 ~ACE_ATM_Addr () = default;
93 /// Default initialization for non-address values (e.g.,
94 /// t_atm_sap_addr.SVE_tag_addr, t_atm_sap_addr.SVE_tag_selector)
95 void init (u_char selector
= DEFAULT_SELECTOR
);
97 /// Initializes from another ACE_ATM_Addr.
98 int set (const ACE_ATM_Addr
&,
99 u_char selector
= DEFAULT_SELECTOR
);
102 * Initializes an ACE_ATM_Addr from an ATMSAPAddress/sockaddr_atm
103 * structure. This is vendor specific (FORE systems). May need to
104 * change when other vendors are supported.
106 int set (const ATM_Addr
*,
107 u_char selector
= DEFAULT_SELECTOR
);
110 * Initializes an ACE_ATM_Addr from the <sap> which can be
111 * "atm-address" (e.g.,
112 * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname"
113 * (e.g., "frisbee.cs.wustl.edu").
115 int set (const ACE_TCHAR sap
[],
116 u_char selector
= DEFAULT_SELECTOR
);
119 * Initializes an ACE_ATM_Addr from the <sap> which can be
120 * "atm-address" (e.g.,
121 * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname"
122 * (e.g., "frisbee.cs.wustl.edu").
124 virtual int string_to_addr (const ACE_TCHAR sap
[]);
127 * Return the character representation of the ATM address (e.g.,
128 * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") storing it in
129 * the @a addr (which is assumed to be <addrlen> bytes long). This
130 * version is reentrant. Returns -1 if the <addrlen> of the @a addr
131 * is too small, else 0.
133 virtual int addr_to_string (ACE_TCHAR addr
[],
134 size_t addrlen
) const;
137 * Return the character representation of the ATM address (e.g.,
138 * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00"). Returns -1
139 * if the <size> of the <buffer> is too small, else 0.(This version
140 * is non-reentrant since it returns a pointer to a static data
143 const ACE_TCHAR
*addr_to_string () const;
145 /// Return a pointer to the underlying network address.
146 virtual void *get_addr () const;
148 /// Set a pointer to the address.
149 virtual void set_addr (const void *, int);
151 /// Return the selector for network address.
152 u_char
get_selector () const;
154 /// Set the selector for the network address.
155 void set_selector (u_char selector
);
158 * Compare two addresses for equality. The addresses are considered
159 * equal if they contain the same ATM address. Q: Is there any
160 * other check for equality needed for ATM?
162 bool operator == (const ACE_ATM_Addr
&SAP
) const;
164 /// Compare two addresses for inequality.
165 bool operator != (const ACE_ATM_Addr
&SAP
) const;
167 /// Dump the state of an object.
170 /// Declare the dynamic allocation hooks.
171 ACE_ALLOC_HOOK_DECLARE
;
173 // char *construct_options (ACE_HANDLE fd,
177 // // Construct options for ATM connections
183 // Close versioned namespace, if enabled by the user.
184 ACE_END_VERSIONED_NAMESPACE_DECL
187 #if defined (__ACE_INLINE__)
188 #include "ace/ATM_Addr.inl"
189 #endif /* __ACE_INLINE__ */
191 #endif /* ACE_HAS_ATM */
192 #include /**/ "ace/post.h"
193 #endif /* ACE_ATM_ADDR_H */