Sock_Connect.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //==========================================================================
00004 /**
00005  *  @file   Sock_Connect.h
00006  *
00007  *  Sock_Connect.h,v 1.12 2005/10/28 16:14:55 ossama 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/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   /**
00057    * Return count and array of all configured IP interfaces on this
00058    * host, rc = 0 on success (count == number of interfaces else -1).
00059    * Caller is responsible for calling delete [] on @a addr_array.
00060    */
00061   extern ACE_Export int get_ip_interfaces (size_t &count,
00062                                            ACE_INET_Addr *&addr_array);
00063 
00064   /**
00065    * Helper routine for get_ip_interfaces, differs by UNIX platform so
00066    * put into own subroutine.  perform some ioctls to retrieve ifconf
00067    * list of ifreq structs.
00068    */
00069   extern ACE_Export int count_interfaces (ACE_HANDLE handle,
00070                                size_t &how_many);
00071 
00072   /// Routine to return a handle from which @c ioctl requests can be
00073   /// made.  Caller must close the handle.
00074   extern ACE_Export ACE_HANDLE get_handle (void);
00075 
00076   /**
00077    * Returns 1 if IPv6 is enabled on the current host; 0 if not.
00078    * This is an execution-time check. If ACE has not been compiled
00079    * with ACE_HAS_IPV6, it always returns 0. If ACE_HAS_IPV6 is
00080    * enabled, this function tries to create a PF_INET6 socket,
00081    * returning 1 if it succeeds, and 0 if it fails. Caches the result
00082    * so it only gets checked once.
00083    */
00084   extern ACE_Export int ipv6_enabled (void);
00085 }
00086 
00087 ACE_END_VERSIONED_NAMESPACE_DECL
00088 
00089 #include /**/ "ace/post.h"
00090 
00091 #endif  /* ACE_SOCK_CONNECT_H */

Generated on Thu Nov 9 09:42:04 2006 for ACE by doxygen 1.3.6