00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 #ifndef ACE_SOCK_ACCEPTOR_H
00014 #define ACE_SOCK_ACCEPTOR_H
00015 #include  "ace/pre.h"
00016 
00017 #include "ace/SOCK_Stream.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif 
00022 
00023 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00024 
00025 class ACE_Time_Value;
00026 class ACE_Accept_QoS_Params;
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 class ACE_Export ACE_SOCK_Acceptor : public ACE_SOCK
00040 {
00041 public:
00042   
00043 
00044   ACE_SOCK_Acceptor (void);
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052   ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
00053                      int reuse_addr = 0,
00054                      int protocol_family = PF_UNSPEC,
00055                      int backlog = ACE_DEFAULT_BACKLOG,
00056                      int protocol = 0);
00057 
00058 
00059 
00060   ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
00061                      ACE_Protocol_Info *protocolinfo,
00062                      ACE_SOCK_GROUP g,
00063                      u_long flags,
00064                      int reuse_addr,
00065                      int protocol_family = PF_UNSPEC,
00066                      int backlog = ACE_DEFAULT_BACKLOG,
00067                      int protocol = 0);
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076   int open (const ACE_Addr &local_sap,
00077             int reuse_addr = 0,
00078             int protocol_family = PF_UNSPEC,
00079             int backlog = ACE_DEFAULT_BACKLOG,
00080             int protocol = 0);
00081 
00082 
00083 
00084   int open (const ACE_Addr &local_sap,
00085             ACE_Protocol_Info *protocolinfo,
00086             ACE_SOCK_GROUP g,
00087             u_long flags,
00088             int reuse_addr,
00089             int protocol_family = PF_UNSPEC,
00090             int backlog = ACE_DEFAULT_BACKLOG,
00091             int protocol = 0);
00092 
00093 
00094   int close (void);
00095 
00096 
00097   ~ACE_SOCK_Acceptor (void);
00098 
00099   
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109   int accept (ACE_SOCK_Stream &new_stream,
00110               ACE_Addr *remote_addr = 0,
00111               ACE_Time_Value *timeout = 0,
00112               int restart = 1,
00113               int reset_new_handle = 0) const;
00114 
00115 #if !defined (ACE_HAS_WINCE)
00116 
00117 
00118 
00119 
00120 
00121 
00122 
00123 
00124 
00125 
00126   int accept (ACE_SOCK_Stream &new_stream,
00127               ACE_Accept_QoS_Params qos_params,
00128               ACE_Addr *remote_addr = 0,
00129               ACE_Time_Value *timeout = 0,
00130               int restart = 1,
00131               int reset_new_handle = 0) const;
00132 #endif  // ACE_HAS_WINCE
00133 
00134   
00135   typedef ACE_INET_Addr PEER_ADDR;
00136   typedef ACE_SOCK_Stream PEER_STREAM;
00137 
00138 
00139   void dump (void) const;
00140 
00141 
00142   ACE_ALLOC_HOOK_DECLARE;
00143 
00144 protected:
00145 
00146 
00147   int shared_accept_start (ACE_Time_Value *timeout,
00148                            int restart,
00149                            int &in_blocking_mode) const;
00150 
00151 
00152 
00153   int shared_accept_finish (ACE_SOCK_Stream new_stream,
00154                             int in_blocking_mode,
00155                             int reset_new_handle) const;
00156 
00157 
00158 
00159 
00160 
00161 
00162   int shared_open (const ACE_Addr &local_sap,
00163                    int protocol_family,
00164                    int backlog);
00165 
00166 private:
00167 
00168   int get_remote_addr (ACE_Addr &) const;
00169 };
00170 
00171 ACE_END_VERSIONED_NAMESPACE_DECL
00172 
00173 #if defined (__ACE_INLINE__)
00174 #include "ace/SOCK_Acceptor.inl"
00175 #endif 
00176 
00177 #include  "ace/post.h"
00178 #endif