3 //=============================================================================
7 * $Id: UNIX_Addr.h 80826 2008-03-04 14:51:23Z wotte $
11 //=============================================================================
14 #ifndef ACE_UNIX_ADDR_H
15 #define ACE_UNIX_ADDR_H
17 #include /**/ "ace/pre.h"
19 #include /**/ "ace/ACE_export.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
28 #include "ace/Log_Msg.h"
30 #include "ace/os_include/sys/os_un.h"
32 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
35 * @class ACE_UNIX_Addr
37 * @brief Defines the ``UNIX domain address family'' address format.
39 class ACE_Export ACE_UNIX_Addr
: public ACE_Addr
42 // = Initialization methods.
43 /// Default constructor.
47 ACE_UNIX_Addr (const ACE_UNIX_Addr
&sa
);
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 (void) const;
67 /// Set a pointer to the underlying network address.
68 virtual void set_addr (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 (void) const;
93 /// Computes and returns hash value.
94 virtual u_long
hash (void) const;
96 /// Dump the state of an object.
97 void dump (void) const;
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 */