Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    ACE.h
00006  *
00007  *  $Id: ACE.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_ACE_H
00014 #define ACE_ACE_H
00015 #include "ace/pre.h"
00016 
00017 #include "ace/OS.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #include "ace/Flag_Manip.h"
00024 #include "ace/Handle_Ops.h"
00025 #include "ace/Lib_Find.h"
00026 #include "ace/Init_ACE.h"
00027 #include "ace/Sock_Connect.h"
00028 
00029 // Forward declarations.
00030 class ACE_Time_Value;
00031 class ACE_Message_Block;
00032 class ACE_Handle_Set;
00033 
00034 // When log2 is defined as macro redefine it as acelog2
00035 #if defined (log2)
00036 # define acelog2 log2
00037 # undef log2
00038 #endif /* log2 */
00039 
00040 /**
00041  * @class ACE
00042  *
00043  * @brief Contains value added ACE methods that extend the behavior
00044  * of the UNIX and Win32 OS calls.
00045  *
00046  * This class consolidates all these ACE static methods in a
00047  * single place in order to manage the namespace better.  These
00048  * methods are put here rather than in ACE_OS in order to
00049  * separate concerns.
00050  */
00051 class ACE_Export ACE : public ACE_Flag_Manip, public ACE_Handle_Ops,
00052                        public ACE_Lib_Find, public ACE_Init_ACE,
00053                        public ACE_Sock_Connect
00054 {
00055 
00056   ACE_CLASS_IS_NAMESPACE (ACE);
00057 public:
00058 
00059   // = ACE version information.
00060   /// e.g., the "5" in ACE 5.1.12.
00061   static u_int major_version (void);
00062 
00063   /// e.g., the "1" in ACE 5.1.12.
00064   static u_int minor_version (void);
00065 
00066   /// e.g., the "12" in ACE 5.1.12.
00067   /// Returns 0 for "stable" (non-beta) releases.
00068   static u_int beta_version (void);
00069 
00070   // = C++ compiler version information.
00071   /// E.g., the "SunPro C++" in SunPro C++ 4.32.0
00072   static const ACE_TCHAR * compiler_name (void);
00073 
00074   /// E.g., the "4" in SunPro C++ 4.32.0
00075   static u_int compiler_major_version (void);
00076 
00077   /// E.g., the "32" in SunPro C++ 4.32.0
00078   static u_int compiler_minor_version (void);
00079 
00080   /// E.g., the "0" in SunPro C++ 4.32.0
00081   static u_int compiler_beta_version (void);
00082 
00083   /// Check if error indicates the process being out of handles (file
00084   /// descriptors).
00085   static int out_of_handles (int error);
00086 
00087   /**
00088    * @name I/O operations
00089    *
00090    * Notes on common parameters:
00091    *
00092    * <handle> is the connected endpoint that will be used for I/O.
00093    *
00094    * <buf> is the buffer to write from or receive into.
00095    *
00096    * <len> is the number of bytes to transfer.
00097    *
00098    * The <timeout> parameter in the following methods indicates how
00099    * long to blocking trying to transfer data.  If <timeout> == 0,
00100    * then the call behaves as a normal send/recv call, i.e., for
00101    * blocking sockets, the call will block until action is possible;
00102    * for non-blocking sockets, EWOULDBLOCK will be returned if no
00103    * action is immediately possible.
00104    *
00105    * If <timeout> != 0, the call will wait until the relative time
00106    * specified in *<timeout> elapses.
00107    *
00108    * The "_n()" I/O methods keep looping until all the data has been
00109    * transferred.  These methods also work for sockets in non-blocking
00110    * mode i.e., they keep looping on EWOULDBLOCK.  <timeout> is used
00111    * to make sure we keep making progress, i.e., the same timeout
00112    * value is used for every I/O operation in the loop and the timeout
00113    * is not counted down.
00114    *
00115    * The return values for the "*_n()" methods match the return values
00116    * from the non "_n()" methods and are specified as follows:
00117    *
00118    * - On complete transfer, the number of bytes transferred is returned.
00119    * - On timeout, -1 is returned, errno == ETIME.
00120    * - On error, -1 is returned, errno is set to appropriate error.
00121    * - On EOF, 0 is returned, errno is irrelevant.
00122    *
00123    * On partial transfers, i.e., if any data is transferred before
00124    * timeout/error/EOF, <bytes_transferred> will contain the number of
00125    * bytes transferred.
00126    *
00127    * Methods with <iovec> parameter are I/O vector variants of the I/O
00128    * operations.
00129    *
00130    * Methods with the extra <flags> argument will always result in
00131    * <send> getting called. Methods without the extra <flags> argument
00132    * will result in <send> getting called on Win32 platforms, and
00133    * <write> getting called on non-Win32 platforms.
00134    */
00135   //@{
00136   static ssize_t recv (ACE_HANDLE handle,
00137                        void *buf,
00138                        size_t len,
00139                        int flags,
00140                        const ACE_Time_Value *timeout = 0);
00141 
00142 #if defined (ACE_HAS_TLI)
00143 
00144   static ssize_t t_rcv (ACE_HANDLE handle,
00145                         void *buf,
00146                         size_t len,
00147                         int *flags,
00148                         const ACE_Time_Value *timeout = 0);
00149 
00150 #endif /* ACE_HAS_TLI */
00151 
00152   static ssize_t recv (ACE_HANDLE handle,
00153                        void *buf,
00154                        size_t len,
00155                        const ACE_Time_Value *timeout = 0);
00156 
00157   static ssize_t recvmsg (ACE_HANDLE handle,
00158                           struct msghdr *msg,
00159                           int flags,
00160                           const ACE_Time_Value *timeout = 0);
00161 
00162   static ssize_t recvfrom (ACE_HANDLE handle,
00163                            char *buf,
00164                            int len,
00165                            int flags,
00166                            struct sockaddr *addr,
00167                            int *addrlen,
00168                            const ACE_Time_Value *timeout = 0);
00169 
00170   static ssize_t recv_n (ACE_HANDLE handle,
00171                          void *buf,
00172                          size_t len,
00173                          int flags,
00174                          const ACE_Time_Value *timeout = 0,
00175                          size_t *bytes_transferred = 0);
00176 
00177 #if defined (ACE_HAS_TLI)
00178 
00179   static ssize_t t_rcv_n (ACE_HANDLE handle,
00180                           void *buf,
00181                           size_t len,
00182                           int *flags,
00183                           const ACE_Time_Value *timeout = 0,
00184                           size_t *bytes_transferred = 0);
00185 
00186 #endif /* ACE_HAS_TLI */
00187 
00188   static ssize_t recv_n (ACE_HANDLE handle,
00189                          void *buf,
00190                          size_t len,
00191                          const ACE_Time_Value *timeout = 0,
00192                          size_t *bytes_transferred = 0);
00193 
00194   /// Receive into a variable number of pieces.
00195   /**
00196    * Accepts a variable, caller-specified, number of pointer/length
00197    * pairs. Arguments following @a n are char *, size_t pairs.
00198    *
00199    * @param handle The I/O handle to receive on
00200    * @param n      The total number of char *, size_t pairs following @a n.
00201    *
00202    * @return -1 on error, else total number of bytes received.
00203    */
00204   static ssize_t recv (ACE_HANDLE handle, size_t n, ...);
00205 
00206   static ssize_t recvv (ACE_HANDLE handle,
00207                         iovec *iov,
00208                         int iovcnt,
00209                         const ACE_Time_Value *timeout = 0);
00210 
00211   static ssize_t recvv_n (ACE_HANDLE handle,
00212                           iovec *iov,
00213                           int iovcnt,
00214                           const ACE_Time_Value *timeout = 0,
00215                           size_t *bytes_transferred = 0);
00216 
00217   static ssize_t recv_n (ACE_HANDLE handle,
00218                          ACE_Message_Block *message_block,
00219                          const ACE_Time_Value *timeout = 0,
00220                          size_t *bytes_transferred = 0);
00221 
00222   static ssize_t send (ACE_HANDLE handle,
00223                        const void *buf,
00224                        size_t len,
00225                        int flags,
00226                        const ACE_Time_Value *timeout = 0);
00227 
00228 #if defined (ACE_HAS_TLI)
00229 
00230   static ssize_t t_snd (ACE_HANDLE handle,
00231                         const void *buf,
00232                         size_t len,
00233                         int flags,
00234                         const ACE_Time_Value *timeout = 0);
00235 
00236 #endif /* ACE_HAS_TLI */
00237 
00238   static ssize_t send (ACE_HANDLE handle,
00239                        const void *buf,
00240                        size_t len,
00241                        const ACE_Time_Value *timeout = 0);
00242 
00243   static ssize_t sendmsg (ACE_HANDLE handle,
00244                           const struct msghdr *msg,
00245                           int flags,
00246                           const ACE_Time_Value *timeout = 0);
00247 
00248   static ssize_t sendto (ACE_HANDLE handle,
00249                          const char *buf,
00250                          int len,
00251                          int flags,
00252                          const struct sockaddr *addr,
00253                          int addrlen,
00254                          const ACE_Time_Value *timeout = 0);
00255 
00256   static ssize_t send_n (ACE_HANDLE handle,
00257                          const void *buf,
00258                          size_t len,
00259                          int flags,
00260                          const ACE_Time_Value *timeout = 0,
00261                          size_t *bytes_transferred = 0);
00262 
00263 #if defined (ACE_HAS_TLI)
00264 
00265   static ssize_t t_snd_n (ACE_HANDLE handle,
00266                           const void *buf,
00267                           size_t len,
00268                           int flags,
00269                           const ACE_Time_Value *timeout = 0,
00270                           size_t *bytes_transferred = 0);
00271 
00272 #endif /* ACE_HAS_TLI */
00273 
00274   static ssize_t send_n (ACE_HANDLE handle,
00275                          const void *buf,
00276                          size_t len,
00277                          const ACE_Time_Value *timeout = 0,
00278                          size_t *bytes_transferred = 0);
00279 
00280   /// Varargs variant.
00281   static ssize_t send (ACE_HANDLE handle, size_t n, ...);
00282 
00283   static ssize_t sendv (ACE_HANDLE handle,
00284                         const iovec *iov,
00285                         int iovcnt,
00286                         const ACE_Time_Value *timeout = 0);
00287 
00288   static ssize_t sendv_n (ACE_HANDLE handle,
00289                           const iovec *iov,
00290                           int iovcnt,
00291                           const ACE_Time_Value *timeout = 0,
00292                           size_t *bytes_transferred = 0);
00293 
00294   /// Send all the <message_block>s chained through their <next> and
00295   /// <cont> pointers.  This call uses the underlying OS gather-write
00296   /// operation to reduce the domain-crossing penalty.
00297   static ssize_t send_n (ACE_HANDLE handle,
00298                          const ACE_Message_Block *message_block,
00299                          const ACE_Time_Value *timeout = 0,
00300                          size_t *bytes_transferred = 0);
00301 
00302   // = File system I/O functions (these don't support timeouts).
00303 
00304   static ssize_t read_n (ACE_HANDLE handle,
00305                          void *buf,
00306                          size_t len,
00307                          size_t *bytes_transferred = 0);
00308 
00309   static ssize_t write_n (ACE_HANDLE handle,
00310                           const void *buf,
00311                           size_t len,
00312                           size_t *bytes_transferred = 0);
00313 
00314   /// Write all the <message_block>s chained through their <next> and
00315   /// <cont> pointers.  This call uses the underlying OS gather-write
00316   /// operation to reduce the domain-crossing penalty.
00317   static ssize_t write_n (ACE_HANDLE handle,
00318                           const ACE_Message_Block *message_block,
00319                           size_t *bytes_transferred = 0);
00320 
00321   static ssize_t readv_n (ACE_HANDLE handle,
00322                           iovec *iov,
00323                           int iovcnt,
00324                           size_t *bytes_transferred = 0);
00325 
00326   static ssize_t writev_n (ACE_HANDLE handle,
00327                            const iovec *iov,
00328                            int iovcnt,
00329                            size_t *bytes_transferred = 0);
00330   //@}
00331 
00332   /**
00333    * Wait up to <timeout> amount of time to passively establish a
00334    * connection.  This method doesn't perform the <accept>, it just
00335    * does the timed wait...
00336    */
00337   static int handle_timed_accept (ACE_HANDLE listener,
00338                                   ACE_Time_Value *timeout,
00339                                   int restart);
00340 
00341   /**
00342    * Wait up to <timeout> amount of time to complete an actively
00343    * established non-blocking connection.  If <is_tli> is non-0 then
00344    * we are being called by a TLI wrapper (which behaves slightly
00345    * differently from a socket wrapper).
00346    */
00347   static ACE_HANDLE handle_timed_complete (ACE_HANDLE listener,
00348                                            const ACE_Time_Value *timeout,
00349                                            int is_tli = 0);
00350 
00351   /**
00352    * Reset the limit on the number of open handles.  If <new_limit> ==
00353    * -1 set the limit to the maximum allowable.  Otherwise, set it to
00354    * be the value of <new_limit>.
00355    */
00356   static int set_handle_limit (int new_limit = -1);
00357 
00358   /**
00359    * Returns the maximum number of open handles currently permitted in
00360    * this process.  This maximum may be extended using
00361    * <ACE::set_handle_limit>.
00362    */
00363   static int max_handles (void);
00364 
00365   // = String functions
00366 #if !defined (ACE_HAS_WINCE)
00367   /**
00368    * Return a dynamically allocated duplicate of <str>, substituting
00369    * the environment variable if <str[0] == '$'>.  Note that the
00370    * pointer is allocated with <ACE_OS::malloc> and must be freed by
00371    * <ACE_OS::free>.
00372    */
00373   static ACE_TCHAR *strenvdup (const ACE_TCHAR *str);
00374 #endif /* ACE_HAS_WINCE */
00375 
00376   /// Returns a pointer to the "end" of the string, i.e., the character
00377   /// past the '\0'.
00378   static const char *strend (const char *s);
00379 
00380   /// This method is just like <strdup>, except that it uses <operator
00381   /// new> rather than <malloc>.  If <s> is NULL returns NULL rather than
00382   /// segfaulting...
00383   static char *strnew (const char *s);
00384 
00385   /// Delete the memory allocated by <strnew>.
00386   static void strdelete (char *s);
00387 
00388   /// Create a fresh new copy of <str>, up to <n> chars long.  Uses
00389   /// <ACE_OS::malloc> to allocate the new string.
00390   static char *strndup (const char *str, size_t n);
00391 
00392   /// Create a fresh new copy of <str>, up to <n> chars long.  Uses
00393   /// <ACE_OS::malloc> to allocate the new string.
00394   static char *strnnew (const char *str, size_t n);
00395 
00396 #if defined (ACE_HAS_WCHAR)
00397   static const wchar_t *strend (const wchar_t *s);
00398 
00399   static wchar_t *strnew (const wchar_t *s);
00400 
00401   static void strdelete (wchar_t *s);
00402 
00403   static wchar_t *strndup (const wchar_t *str, size_t n);
00404 
00405   static wchar_t *strnnew (const wchar_t *str, size_t n);
00406 
00407 #endif /* ACE_HAS_WCHAR */
00408 
00409   /**
00410    * On Win32 returns <pathname> if it already ends in ".exe,"
00411    * otherwise returns a dynamically allocated buffer containing
00412    * "<pathname>.exe".  Always returns <pathname> on UNIX.
00413    */
00414   static const ACE_TCHAR *execname (const ACE_TCHAR *pathname);
00415 
00416   /**
00417    * Returns the "basename" of a <pathname> separated by <delim>.  For
00418    * instance, the basename of "/tmp/foo.cpp" is "foo.cpp" when
00419    * <delim> is '/'.
00420    */
00421   static const ACE_TCHAR *basename (const ACE_TCHAR *pathname,
00422                                     ACE_TCHAR delim =
00423                                       ACE_DIRECTORY_SEPARATOR_CHAR);
00424 
00425   /**
00426    * Returns the "dirname" of a <pathname>.  For instance, the dirname
00427    * of "/tmp/foo.cpp" is "/tmp" when <delim> is '/'.  If <pathname>
00428    * has no <delim> ".\0" is returned.  This method does not modify
00429    * <pathname> and is not reentrant.
00430    */
00431   static const ACE_TCHAR *dirname (const ACE_TCHAR *pathname,
00432                                    ACE_TCHAR delim = ACE_DIRECTORY_SEPARATOR_CHAR);
00433 
00434   /**
00435    * Returns the current timestamp in the form
00436    * "hour:minute:second:microsecond."  The month, day, and year are
00437    * also stored in the beginning of the <date_and_time> array, which
00438    * is a user-supplied array of size <time_len> <ACE_TCHAR>s.  Returns
00439    * 0 if unsuccessful, else returns pointer to beginning of the
00440    * "time" portion of <date_and_time>.  If
00441    * <return_pointer_to_first_digit> is 0 then return a pointer to the
00442    * space before the time, else return a pointer to the beginning of
00443    * the time portion.
00444    */
00445   static ACE_TCHAR *timestamp (ACE_TCHAR date_and_time[],
00446                                int time_len,
00447                                int return_pointer_to_first_digit = 0);
00448 
00449   /**
00450    * if <avoid_zombies> == 0 call <ACE_OS::fork> directly, else create
00451    * an orphan process that's inherited by the init process; init
00452    * cleans up when the orphan process terminates so we don't create
00453    * zombies.
00454    */
00455   static pid_t fork (const ACE_TCHAR *program_name = ACE_LIB_TEXT ("<unknown>"),
00456                      int avoid_zombies = 0);
00457 
00458   /**
00459    * Become a daemon process using the algorithm in Richard Stevens
00460    * "Advanced Programming in the UNIX Environment."  If
00461    * <close_all_handles> is non-zero then all open file handles are
00462    * closed.
00463    */
00464   static int daemonize (const ACE_TCHAR pathname[] = ACE_LIB_TEXT ("/"),
00465                         int close_all_handles = ACE_DEFAULT_CLOSE_ALL_HANDLES,
00466                         const ACE_TCHAR program_name[] = ACE_LIB_TEXT ("<unknown>"));
00467 
00468   // = Miscelleous functions.
00469   /// Rounds the request to a multiple of the page size.
00470   static size_t round_to_pagesize (off_t length);
00471 
00472   /// Rounds the request to a multiple of the allocation granularity.
00473   static size_t round_to_allocation_granularity (off_t len);
00474 
00475   // @@ UNICODE what about buffer?
00476   /// Format buffer into printable format.  This is useful for
00477   /// debugging.
00478   static size_t format_hexdump (const char *buffer, size_t size,
00479                                 ACE_TCHAR *obuf, size_t obuf_sz);
00480 
00481   /// Computes the hash value of <str> using the "Hash PJW" routine.
00482   static u_long hash_pjw (const char *str);
00483 
00484   /// Computes the hash value of <str> using the "Hash PJW" routine.
00485   static u_long hash_pjw (const char *str, size_t len);
00486 
00487 #if defined (ACE_HAS_WCHAR)
00488   /// Computes the hash value of <str> using the "Hash PJW" routine.
00489   static u_long hash_pjw (const wchar_t *str);
00490 
00491   /// Computes the hash value of <str> using the "Hash PJW" routine.
00492   static u_long hash_pjw (const wchar_t *str, size_t len);
00493 #endif /* ACE_HAS_WCHAR */
00494 
00495   /// Computes the ISO 8802-3 standard 32 bits CRC for the string
00496   /// (not for a file).
00497   static u_long crc32 (const char *str);
00498 
00499   /// Computes the ISO 8802-3 standard 32 bits CRC for the given
00500   /// buffer (the length is included in the CRC).
00501   static u_long crc32 (const char *buf, ACE_UINT32 len);
00502 
00503   /// Computes the ISO 8802-3 standard 32 bits CRC for the
00504   /// @ len iovec buffers.
00505   static u_long crc32 (iovec *iov, int len);
00506 
00507   /// Euclid's greatest common divisor algorithm.
00508   static u_long gcd (u_long x, u_long y);
00509 
00510   /// Calculates the minimum enclosing frame size for the given values.
00511   static u_long minimum_frame_size (u_long period1, u_long period2);
00512 
00513   /**
00514    * Function that can burn up noticeable CPU time:  brute-force
00515    * determination of whether number "n" is prime.  Returns 0 if
00516    * it is prime, or the smallest factor if it is not prime.  min_factor
00517    * and max_factor can be used to partition the work among threads.
00518    * For just one thread, typical values are 2 and n/2.
00519    */
00520   static u_long is_prime (const u_long n,
00521                           const u_long min_factor,
00522                           const u_long max_factor);
00523 
00524   /// Map troublesome win32 errno values to values that standard C
00525   /// strerr function understands.  Thank you Microsoft.
00526   static int map_errno (int error);
00527 
00528   /// Returns a string containing the error message corresponding to a
00529   /// WinSock error.  This works around an omission in the Win32 API...
00530   static const ACE_TCHAR *sock_error (int error);
00531 
00532   /**
00533    * Checks if process with <pid> is still alive.  Returns 1 if it is
00534    * still alive, 0 if it isn't alive, and -1 if something weird
00535    * happened.
00536    */
00537   static int process_active (pid_t pid);
00538 
00539   /**
00540    * Terminate the process abruptly with id <pid>.  On Win32 platforms
00541    * this uses <TerminateProcess> and on POSIX platforms is uses
00542    * <kill> with the -9 (SIGKILL) signal, which cannot be caught or
00543    * ignored.  Note that this call is potentially dangerous to use
00544    * since the process being terminated may not have a chance to
00545    * cleanup before it shuts down.
00546    */
00547   static int terminate_process (pid_t pid);
00548 
00549   /**
00550    * This method uses process id and object pointer to come up with a
00551    * machine wide unique name.  The process ID will provide uniqueness
00552    * between processes on the same machine. The "this" pointer of the
00553    * <object> will provide uniqueness between other "live" objects in
00554    * the same process. The uniqueness of this name is therefore only
00555    * valid for the life of <object>.
00556    */
00557   static void unique_name (const void *object,
00558                            ACE_TCHAR *name,
00559                            size_t length);
00560 
00561   /// Computes the base 2 logarithm of <num>.
00562   static u_long log2 (u_long num);
00563 
00564   /// Hex conversion utility.
00565   static ACE_TCHAR nibble2hex (u_int n);
00566 
00567   /// Convert a hex character to its byte representation.
00568   static u_char hex2byte (ACE_TCHAR c);
00569 
00570   // = Set/get the debug level.
00571   static char debug (void);
00572   static void debug (char d);
00573 
00574   /// Wrapper facade for <select> that uses <ACE_Handle_Set>s.
00575   static int select (int width,
00576                      ACE_Handle_Set *readfds,
00577                      ACE_Handle_Set *writefds = 0,
00578                      ACE_Handle_Set *exceptfds = 0,
00579                      const ACE_Time_Value *timeout = 0);
00580 
00581   /// Wrapper facade for the most common use of <select> that uses
00582   /// <ACE_Handle_Set>s.
00583   static int select (int width,
00584                      ACE_Handle_Set &readfds,
00585                      const ACE_Time_Value *timeout = 0);
00586 
00587   /// Timed wait for handle to get read ready.
00588   static int handle_read_ready (ACE_HANDLE handle,
00589                                 const ACE_Time_Value *timeout);
00590 
00591   /// Timed wait for handle to get write ready.
00592   static int handle_write_ready (ACE_HANDLE handle,
00593                                  const ACE_Time_Value *timeout);
00594 
00595   /// Timed wait for handle to get exception ready.
00596   static int handle_exception_ready (ACE_HANDLE handle,
00597                                      const ACE_Time_Value *timeout);
00598 
00599   /// Timed wait for handle to get read, write, or exception ready.
00600   static int handle_ready (ACE_HANDLE handle,
00601                            const ACE_Time_Value *timeout,
00602                            int read_ready,
00603                            int write_ready,
00604                            int exception_ready);
00605 
00606   /// Wait for <timeout> before proceeding to a <recv> operation.
00607   /// <val> keeps track of whether we're in non-blocking mode or not.
00608   static int enter_recv_timedwait (ACE_HANDLE handle,
00609                                    const ACE_Time_Value *timeout,
00610                                    int &val);
00611 
00612   /// Wait for <timeout> before proceeding to a <send> operation.
00613   /// <val> keeps track of whether we're in non-blocking mode or not.
00614   static int enter_send_timedwait (ACE_HANDLE handle,
00615                                    const ACE_Time_Value* timeout,
00616                                    int &val);
00617 
00618   /// This makes sure that <handle> is set into non-blocking mode.
00619   /// <val> keeps track of whether were in non-blocking mode or not.
00620   static void record_and_set_non_blocking_mode (ACE_HANDLE handle,
00621                                                 int &val);
00622 
00623   /// Cleanup after a timed operation, restore the appropriate
00624   /// non-blocking status of <handle>.
00625   static void restore_non_blocking_mode (ACE_HANDLE handle,
00626                                          int val);
00627 
00628 private:
00629 
00630   //
00631   // = Recv_n helpers
00632   //
00633 
00634   static ssize_t recv_i (ACE_HANDLE handle,
00635                          void *buf,
00636                          size_t len);
00637 
00638   static ssize_t recv_n_i (ACE_HANDLE handle,
00639                            void *buf,
00640                            size_t len,
00641                            int flags,
00642                            size_t *bytes_transferred);
00643 
00644   static ssize_t recv_n_i (ACE_HANDLE handle,
00645                            void *buf,
00646                            size_t len,
00647                            int flags,
00648                            const ACE_Time_Value *timeout,
00649                            size_t *bytes_transferred);
00650 
00651 #if defined (ACE_HAS_TLI)
00652 
00653   static ssize_t t_rcv_n_i (ACE_HANDLE handle,
00654                             void *buf,
00655                             size_t len,
00656                             int *flags,
00657                             size_t *bytes_transferred);
00658 
00659   static ssize_t t_rcv_n_i (ACE_HANDLE handle,
00660                             void *buf,
00661                             size_t len,
00662                             int *flags,
00663                             const ACE_Time_Value *timeout,
00664                             size_t *bytes_transferred);
00665 
00666 #endif /* ACE_HAS_TLI */
00667 
00668   static ssize_t recv_n_i (ACE_HANDLE handle,
00669                            void *buf,
00670                            size_t len,
00671                            size_t *bytes_transferred);
00672 
00673   static ssize_t recv_n_i (ACE_HANDLE handle,
00674                            void *buf,
00675                            size_t len,
00676                            const ACE_Time_Value *timeout,
00677                            size_t *bytes_transferred);
00678 
00679   static ssize_t recvv_n_i (ACE_HANDLE handle,
00680                             iovec *iov,
00681                             int iovcnt,
00682                             size_t *bytes_transferred);
00683 
00684   static ssize_t recvv_n_i (ACE_HANDLE handle,
00685                             iovec *iov,
00686                             int iovcnt,
00687                             const ACE_Time_Value *timeout,
00688                             size_t *bytes_transferred);
00689 
00690   //
00691   // = Send_n helpers
00692   //
00693 
00694   static ssize_t send_i (ACE_HANDLE handle,
00695                          const void *buf,
00696                          size_t len);
00697 
00698   static ssize_t send_n_i (ACE_HANDLE handle,
00699                            const void *buf,
00700                            size_t len,
00701                            int flags,
00702                            size_t *bytes_transferred);
00703 
00704   static ssize_t send_n_i (ACE_HANDLE handle,
00705                            const void *buf,
00706                            size_t len,
00707                            int flags,
00708                            const ACE_Time_Value *timeout,
00709                            size_t *bytes_transferred);
00710 
00711 #if defined (ACE_HAS_TLI)
00712 
00713   static ssize_t t_snd_n_i (ACE_HANDLE handle,
00714                             const void *buf,
00715                             size_t len,
00716                             int flags,
00717                             size_t *bytes_transferred);
00718 
00719   static ssize_t t_snd_n_i (ACE_HANDLE handle,
00720                             const void *buf,
00721                             size_t len,
00722                             int flags,
00723                             const ACE_Time_Value *timeout,
00724                             size_t *bytes_transferred);
00725 
00726 #endif /* ACE_HAS_TLI */
00727 
00728   static ssize_t send_n_i (ACE_HANDLE handle,
00729                            const void *buf,
00730                            size_t len,
00731                            size_t *bytes_transferred);
00732 
00733   static ssize_t send_n_i (ACE_HANDLE handle,
00734                            const void *buf,
00735                            size_t len,
00736                            const ACE_Time_Value *timeout,
00737                            size_t *bytes_transferred);
00738 
00739   static ssize_t sendv_n_i (ACE_HANDLE handle,
00740                             const iovec *iov,
00741                             int iovcnt,
00742                             size_t *bytes_transferred);
00743 
00744   static ssize_t sendv_n_i (ACE_HANDLE handle,
00745                             const iovec *iov,
00746                             int iovcnt,
00747                             const ACE_Time_Value *timeout,
00748                             size_t *bytes_transferred);
00749 
00750   /// Size of a VM page.
00751   static size_t pagesize_;
00752 
00753   /// Size of allocation granularity.
00754   static size_t allocation_granularity_;
00755 
00756   /// CRC table.
00757   static u_long crc_table_[];
00758 
00759   /// Hex characters.
00760   static const ACE_TCHAR hex_chars_[];
00761 
00762   /// Are we debugging ACE?
00763   static char debug_;
00764 };
00765 
00766 #if !defined (ACE_LACKS_INLINE_FUNCTIONS)
00767 #include "ace/ACE.i"
00768 #endif /* ACE_LACKS_INLINE_FUNCTIONS */
00769 
00770 #if defined (acelog2)
00771 # define log2 acelog2
00772 #endif /* acelog2 */
00773 
00774 #include "ace/post.h"
00775 #endif  /* ACE_ACE_H */

Generated on Mon Jun 16 11:19:02 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002