3 //=============================================================================
9 //=============================================================================
12 #ifndef ACE_UNIX_ADDR_H
13 #define ACE_UNIX_ADDR_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/ACE_export.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
26 #include "ace/Log_Category.h"
28 #include "ace/os_include/sys/os_un.h"
30 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
33 * @class ACE_UNIX_Addr
35 * @brief Defines the ``UNIX domain address family'' address format.
37 class ACE_Export ACE_UNIX_Addr
: public ACE_Addr
40 /// Default constructor.
44 ACE_UNIX_Addr (const ACE_UNIX_Addr
&sa
);
46 /// Assignment operator
47 ACE_UNIX_Addr
& operator= (const ACE_UNIX_Addr
&) = default;
49 /// Creates an ACE_UNIX_Addr from a string.
50 ACE_UNIX_Addr (const char rendezvous_point
[]);
52 /// Creates an ACE_INET_Addr from a sockaddr_un structure.
53 ACE_UNIX_Addr (const sockaddr_un
*, int len
);
55 /// Creates an ACE_UNIX_Addr from another ACE_UNIX_Addr.
56 int set (const ACE_UNIX_Addr
&sa
);
58 /// Creates an ACE_UNIX_Addr from a string.
59 int set (const char rendezvous_point
[]);
61 /// Creates an ACE_UNIX_Addr from a sockaddr_un structure.
62 int set (const sockaddr_un
*, int len
);
64 /// Return a pointer to the underlying network address.
65 virtual void *get_addr () const;
67 /// Set a pointer to the underlying network address.
68 virtual void set_addr (const void *addr
, int len
);
70 /// Transform the current address into string format.
71 virtual int addr_to_string (ACE_TCHAR addr
[], size_t) const;
73 /// Transform the string into the current addressing format.
74 virtual int string_to_addr (const char addr
[]);
76 #if defined (ACE_HAS_WCHAR)
77 /// Creates an ACE_UNIX_Addr from a string.
78 ACE_UNIX_Addr (const wchar_t rendezvous_point
[]);
80 /// Creates an ACE_UNIX_Addr from a string.
81 int set (const wchar_t rendezvous_point
[]);
82 #endif /* ACE_HAS_WCHAR */
84 /// Compare two addresses for equality.
85 bool operator == (const ACE_UNIX_Addr
&SAP
) const;
87 /// Compare two addresses for inequality.
88 bool operator != (const ACE_UNIX_Addr
&SAP
) const;
90 /// Return the path name of the underlying rendezvous point.
91 const char *get_path_name () const;
93 /// Computes and returns hash value.
94 virtual u_long
hash () const;
96 /// Dump the state of an object.
99 /// Declare the dynamic allocation hooks.
100 ACE_ALLOC_HOOK_DECLARE
;
103 /// Underlying socket address.
104 sockaddr_un unix_addr_
;
107 ACE_END_VERSIONED_NAMESPACE_DECL
109 #if defined (__ACE_INLINE__)
110 #include "ace/UNIX_Addr.inl"
111 #endif /* __ACE_INLINE__ */
113 #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
115 #include /**/ "ace/post.h"
117 #endif /* ACE_UNIX_ADDR_H */