Initial Patch of Auction House bot rev. 135
[auctionmangos.git] / dep / ACE_wrappers / ace / SOCK.h
blobd2f3df97dc76897923e8cf1c5128362be503615f
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file SOCK.h
7 * $Id: SOCK.h 81014 2008-03-19 11:41:31Z johnnyw $
9 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
11 //=============================================================================
13 #ifndef ACE_SOCK_H
14 #define ACE_SOCK_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/ACE_export.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "ace/Addr.h"
24 #include "ace/IPC_SAP.h"
25 #include "ace/OS_NS_stropts.h"
27 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
29 /**
30 * @class ACE_SOCK
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
43 public:
45 /// Wrapper around the @c setsockopt system call.
46 int set_option (int level,
47 int option,
48 void *optval,
49 int optlen) const;
51 /// Wrapper around the @c getsockopt system call.
52 int get_option (int level,
53 int option,
54 void *optval,
55 int *optlen) const;
57 /**
58 * Close the socket.
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.
64 int close (void);
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;
70 /**
71 * Return the address of the remotely connected peer (if there is
72 * one), in the referenced ACE_Addr. Returns 0 if successful, else
73 * -1.
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).
84 int open (int type,
85 int protocol_family,
86 int protocol,
87 int reuse_addr);
89 /// Wrapper around the QoS-enabled @c WSASocket function.
90 int open (int type,
91 int protocol_family,
92 int protocol,
93 ACE_Protocol_Info *protocolinfo,
94 ACE_SOCK_GROUP g,
95 u_long flags,
96 int reuse_addr);
98 protected:
100 /// Constructor with arguments to call the BSD-style @c socket system
101 /// call (no QoS).
102 ACE_SOCK (int type,
103 int protocol_family,
104 int protocol = 0,
105 int reuse_addr = 0);
107 /// Constructor with arguments to call the QoS-enabled @c WSASocket
108 /// function.
109 ACE_SOCK (int type,
110 int protocol_family,
111 int protocol,
112 ACE_Protocol_Info *protocolinfo,
113 ACE_SOCK_GROUP g,
114 u_long flags,
115 int reuse_addr);
117 /// Default constructor is protected to prevent instances of this class
118 /// from being defined.
119 ACE_SOCK (void);
121 /// Protected destructor.
123 * Not a virtual destructor. Protected destructor to prevent
124 * operator delete() from being called through a base class ACE_SOCK
125 * pointer/reference.
127 ~ACE_SOCK (void);
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 */