Restore build on FreeBSD.
[getmangos.git] / dep / ACE_wrappers / ace / SPIPE_Connector.h
blob419414adc2ce730112c87a3af3793173361b75d8
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file SPIPE_Connector.h
7 * $Id: SPIPE_Connector.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Doug Schmidt <schmidt@cs.wustl.edu>
10 * @author Prashant Jain <pjain@cs.wustl.edu>
12 //=============================================================================
14 #ifndef ACE_SPIPE_CONNECTOR_H
15 #define ACE_SPIPE_CONNECTOR_H
16 #include /**/ "ace/pre.h"
18 #include "ace/SPIPE_Stream.h"
19 #include "ace/os_include/os_fcntl.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
27 /**
28 * @class ACE_SPIPE_Connector
30 * @brief Defines an active connection factory for ACE_SPIPE_Stream.
31 * On Windows this is mapped to Named Pipes, whereas on UNIX it is
32 * mapped to STREAM pipes.
34 class ACE_Export ACE_SPIPE_Connector
36 public:
37 // = Initialization method.
38 /// Default constructor.
39 ACE_SPIPE_Connector (void);
41 /**
42 * Actively connect and produce a <new_stream> if things go well.
43 * The @a remote_sap is the address that we are trying to connect
44 * with. The @a timeout is the amount of time to wait to connect.
45 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then
46 * the connection is done using non-blocking mode. In this case, if
47 * the connection can't be made immediately the value of -1 is
48 * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then
49 * this is the maximum amount of time to wait before timing out. If the
50 * time expires before the connection is made @c errno == ETIME. The
51 * @a local_sap is the value of local address to bind to. If it's
52 * the default value of ACE_Addr::sap_any then the user is letting
53 * the OS do the binding. If @a reuse_addr == 1 then the
54 * <local_addr> is reused, even if it hasn't been cleanedup yet.
55 * The @a flags and @a perms arguments are passed down to the <open>
56 * method. The @a pipe_mode argument is only used in NT and is used to
57 * establish the NT pipe mode.
59 ACE_SPIPE_Connector (ACE_SPIPE_Stream &new_io,
60 const ACE_SPIPE_Addr &remote_sap,
61 ACE_Time_Value *timeout = 0,
62 const ACE_Addr &local_sap = ACE_Addr::sap_any,
63 int reuse_addr = 0,
64 int flags = O_RDWR,
65 int perms = 0,
66 LPSECURITY_ATTRIBUTES sa = 0,
67 int pipe_mode = PIPE_READMODE_MESSAGE | PIPE_WAIT);
69 /**
70 * Actively connect and produce a <new_stream> if things go well.
71 * The @a remote_sap is the address that we are trying to connect
72 * with. The @a timeout is the amount of time to wait to connect.
73 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then
74 * the connection is done using non-blocking mode. In this case, if
75 * the connection can't be made immediately the value of -1 is
76 * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then
77 * this is the maximum amount of time to wait before timing out. If the
78 * time expires before the connection is made @c errno == ETIME. The
79 * @a local_sap is the value of local address to bind to. If it's
80 * the default value of ACE_Addr::sap_any then the user is letting
81 * the OS do the binding. If @a reuse_addr == 1 then the
82 * <local_addr> is reused, even if it hasn't been cleanedup yet.
83 * The @a flags and @a perms arguments are passed down to the <open>
84 * method. The @a pipe_mode argument is only used in NT and is used to
85 * establish the NT pipe mode.
87 int connect (ACE_SPIPE_Stream &new_io,
88 const ACE_SPIPE_Addr &remote_sap,
89 ACE_Time_Value *timeout = 0,
90 const ACE_Addr &local_sap = ACE_Addr::sap_any,
91 int reuse_addr = 0,
92 int flags = O_RDWR,
93 int perms = 0,
94 LPSECURITY_ATTRIBUTES sa = 0,
95 int pipe_mode = PIPE_READMODE_MESSAGE | PIPE_WAIT);
97 /// Resets any event associations on this handle
98 int reset_new_handle (ACE_HANDLE handle);
100 // = Meta-type info
101 typedef ACE_SPIPE_Addr PEER_ADDR;
102 typedef ACE_SPIPE_Stream PEER_STREAM;
104 /// Dump the state of an object.
105 void dump (void) const;
107 /// Declare the dynamic allocation hooks.
108 ACE_ALLOC_HOOK_DECLARE;
111 ACE_END_VERSIONED_NAMESPACE_DECL
113 #if defined (__ACE_INLINE__)
114 #include "ace/SPIPE_Connector.inl"
115 #endif /* __ACE_INLINE__ */
117 #include /**/ "ace/post.h"
118 #endif /* ACE_SPIPE_CONNECTOR_H */