3 //=============================================================================
7 * $Id: SOCK.h 81014 2008-03-19 11:41:31Z johnnyw $
9 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
11 //=============================================================================
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/ACE_export.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "ace/IPC_SAP.h"
25 #include "ace/OS_NS_stropts.h"
27 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
32 * @brief An abstract class that forms the basis for more specific
33 * classes, such as ACE_SOCK_Acceptor and ACE_SOCK_Stream.
34 * Do not instantiate this class.
36 * This class provides functions that are common to all of the
37 * <ACE_SOCK_*> classes. ACE_SOCK provides the ability to get
38 * and set socket options, get the local and remote addresses,
39 * and open and close a socket handle.
41 class ACE_Export ACE_SOCK
: public ACE_IPC_SAP
45 /// Wrapper around the @c setsockopt system call.
46 int set_option (int level
,
51 /// Wrapper around the @c getsockopt system call.
52 int get_option (int level
,
59 * This method also sets the object's handle value to ACE_INVALID_HANDLE.
61 * @return The result of closing the socket; 0 if the handle value
62 * was already ACE_INVALID_HANDLE.
66 /// Return the local endpoint address in the referenced <ACE_Addr>.
67 /// Returns 0 if successful, else -1.
68 int get_local_addr (ACE_Addr
&) const;
71 * Return the address of the remotely connected peer (if there is
72 * one), in the referenced ACE_Addr. Returns 0 if successful, else
75 int get_remote_addr (ACE_Addr
&) const;
77 /// Dump the state of an object.
78 void dump (void) const;
80 /// Declare the dynamic allocation hooks.
81 ACE_ALLOC_HOOK_DECLARE
;
83 /// Wrapper around the BSD-style @c socket system call (no QoS).
89 /// Wrapper around the QoS-enabled @c WSASocket function.
93 ACE_Protocol_Info
*protocolinfo
,
100 /// Constructor with arguments to call the BSD-style @c socket system
107 /// Constructor with arguments to call the QoS-enabled @c WSASocket
112 ACE_Protocol_Info
*protocolinfo
,
117 /// Default constructor is protected to prevent instances of this class
118 /// from being defined.
121 /// Protected destructor.
123 * Not a virtual destructor. Protected destructor to prevent
124 * operator delete() from being called through a base class ACE_SOCK
131 ACE_END_VERSIONED_NAMESPACE_DECL
133 #if defined (__ACE_INLINE__)
134 #include "ace/SOCK.inl"
135 #endif /* __ACE_INLINE__ */
137 #include /**/ "ace/post.h"
138 #endif /* ACE_SOCK_H */