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 80826 2008-03-04 14:51:23Z wotte $
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/Basic_Types.h"
00026 #include "ace/os_include/netinet/os_in.h"
00027 
00028 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00029 
00030 // Forward Declarations
00031 class ACE_INET_Addr;
00032 
00033 namespace ACE
00034 {
00035   // = Socket connection establishment calls.
00036 
00037   /// Bind a new unused port to @a handle.
00038   extern ACE_Export int bind_port (ACE_HANDLE handle,
00039                                    ACE_UINT32 ip_addr = INADDR_ANY,
00040                                    int address_family = AF_UNSPEC);
00041 
00042   /**
00043    * Get our broadcast address based on our @a host_addr.  If
00044    * @a hostname is non-0 we'll use it to determine our IP address.  If
00045    * @a handle is not ACE_INVALID_HANDLE then we'll use this to
00046    * determine our broadcast address, otherwise we'll have to create a
00047    * socket internally (and free it).  Returns -1 on failure and 0 on
00048    * success.
00049    */
00050   extern ACE_Export int get_bcast_addr (
00051     ACE_UINT32 &bcast_addr,
00052     const ACE_TCHAR *hostname = 0,
00053     ACE_UINT32 host_addr = 0,
00054     ACE_HANDLE handle = ACE_INVALID_HANDLE);
00055 
00056   /// Get fully qualified host/domain name.
00057   extern ACE_Export int get_fqdn (ACE_INET_Addr const & addr,
00058                                   char hostname[],
00059                                   size_t len);
00060 
00061   /**
00062    * Return count and array of all configured IP interfaces on this
00063    * host, rc = 0 on success (count == number of interfaces else -1).
00064    * Caller is responsible for calling delete [] on @a addr_array.
00065    */
00066   extern ACE_Export int get_ip_interfaces (size_t &count,
00067                                            ACE_INET_Addr *&addr_array);
00068 
00069   /**
00070    * Helper routine for get_ip_interfaces, differs by UNIX platform so
00071    * put into own subroutine.  perform some ioctls to retrieve ifconf
00072    * list of ifreq structs.
00073    */
00074   extern ACE_Export int count_interfaces (ACE_HANDLE handle,
00075                                           size_t &how_many);
00076 
00077   /// Routine to return a handle from which @c ioctl requests can be
00078   /// made.  Caller must close the handle.
00079   extern ACE_Export ACE_HANDLE get_handle (void);
00080 
00081   /// Returns @c true if IPv4 is enabled on the current host; @c false
00082   /// if not.
00083   /**
00084    * This is an execution-time check. If ACE has not been compiled
00085    * with @c ACE_HAS_IPV6, it always returns @c true. This function
00086    * tries to create a @c PF_INET socket, returning @c true if it
00087    * succeeds, and @c false if it fails. Caches the result so it only
00088      gets checked once.
00089    */
00090   extern ACE_Export bool ipv4_enabled (void);
00091 
00092   /**
00093    * Returns 1 if IPv6 is enabled on the current host; 0 if not.
00094    * This is an execution-time check. If ACE has not been compiled
00095    * with ACE_HAS_IPV6, it always returns 0. If ACE_HAS_IPV6 is
00096    * enabled, this function tries to create a PF_INET6 socket,
00097    * returning 1 if it succeeds, and 0 if it fails. Caches the result
00098    * so it only gets checked once.
00099    */
00100   extern ACE_Export int ipv6_enabled (void);
00101 }
00102 
00103 ACE_END_VERSIONED_NAMESPACE_DECL
00104 
00105 #include /**/ "ace/post.h"
00106 
00107 #endif  /* ACE_SOCK_CONNECT_H */

Generated on Tue Feb 2 17:18:42 2010 for ACE by  doxygen 1.4.7