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

Sock_Connect.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //==========================================================================
00004 /**
00005  *  @file   Sock_Connect.h
00006  *
00007  *  $Id: Sock_Connect.h,v 1.1.1.2 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Priyanka Gontla <pgontla@ece.uci.edu>
00010  *  @author Based on code that existed formerly in ACE.h.
00011  */
00012 //==========================================================================
00013 
00014 #ifndef ACE_SOCK_CONNECT_H
00015 #define ACE_SOCK_CONNECT_H
00016 
00017 #include "ace/pre.h"
00018 
00019 #include "ace/ACE_export.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #include "ace/OS.h"
00026 
00027 // Forward Declarations
00028 class ACE_INET_Addr;
00029 
00030 class ACE_Export ACE_Sock_Connect
00031 {
00032  public:
00033 
00034   // = Socket connection establishment calls.
00035 
00036   /// Bind a new unused port to <handle>.
00037   static int bind_port (ACE_HANDLE handle,
00038                         ACE_UINT32 ip_addr = INADDR_ANY);
00039 
00040   /**
00041    * Get our broadcast address based on our <host_addr>.  If
00042    * <hostname> is non-0 we'll use it to determine our IP address.  If
00043    * <handle> is not <ACE_INVALID_HANDLE> then we'll use this to
00044    * determine our broadcast address, otherwise we'll have to create a
00045    * socket internally (and free it).  Returns -1 on failure and 0 on
00046    * success.
00047    */
00048   static int get_bcast_addr (ACE_UINT32 &bcast_addr,
00049                              const ACE_TCHAR *hostname = 0,
00050                              ACE_UINT32 host_addr = 0,
00051                              ACE_HANDLE handle = ACE_INVALID_HANDLE);
00052 
00053   /**
00054    * Return count and array of all configured IP interfaces on this
00055    * host, rc = 0 on success (count == number of interfaces else -1).
00056    * Caller is responsible for calling delete [] on <addr_array>.
00057    */
00058   static int get_ip_interfaces (size_t &count,
00059                                 ACE_INET_Addr *&addr_array);
00060 
00061   /**
00062    * Helper routine for get_ip_interfaces, differs by UNIX platform so
00063    * put into own subroutine.  perform some ioctls to retrieve ifconf
00064    * list of ifreq structs.
00065    */
00066   static int count_interfaces (ACE_HANDLE handle,
00067                                size_t &how_many);
00068 
00069   /// Routine to return a handle from which <ioctl> requests can be
00070   /// made.  Caller must <close> the handle.
00071   static ACE_HANDLE get_handle (void);
00072 
00073   /**
00074    * Returns 1 if IPv6 is enabled on the current host; 0 if not.
00075    * This is an execution-time check. If ACE has not been compiled
00076    * with ACE_HAS_IPV6, it always returns 0. If ACE_HAS_IPV6 is
00077    * enabled, this function tries to create a PF_INET6 socket,
00078    * returning 1 if it succeeds, and 0 if it fails. Caches the result
00079    * so it only gets checked once.
00080    */
00081   static int ipv6_enabled (void);
00082 
00083 #if defined (ACE_HAS_IPV6)
00084 private:
00085   /// Does this box have ipv6 turned on?
00086   static int ipv6_enabled_;
00087 #endif /* ACE_HAS_IPV6 */
00088 };
00089 
00090 #if !defined (ACE_LACKS_INLINE_FUNCTIONS)
00091 #include "ace/Sock_Connect.i"
00092 #endif /* ACE_LACKS_INLINE_FUNCTIONS */
00093 
00094 #include "ace/post.h"
00095 
00096 #endif  /* ACE_SOCK_CONNECT_H */

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