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

SOCK.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    SOCK.h
00006  *
00007  *  $Id: SOCK.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_SOCK_H
00014 #define ACE_SOCK_H
00015 #include "ace/pre.h"
00016 
00017 #include "ace/ACE_export.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #include "ace/Addr.h"
00024 #include "ace/IPC_SAP.h"
00025 #include "ace/OS.h"
00026 
00027 /**
00028  * @class ACE_SOCK
00029  *
00030  * @brief An abstract class that forms the basis for more specific
00031  * classes, such as <ACE_SOCK_Acceptor> and <ACE_SOCK_Stream>.
00032  * Do not instantiate this class.
00033  *
00034  * This class provides functions that are common to all of the
00035  * <ACE_SOCK_*> classes. <ACE_SOCK> provides the ability to get
00036  * and set socket options, get the local and remote addresses,
00037  * and open and close a socket handle.
00038  */
00039 class ACE_Export ACE_SOCK : public ACE_IPC_SAP
00040 {
00041 public:
00042   /// Default ctor/dtor.
00043   ~ACE_SOCK (void);
00044 
00045   /// Wrapper around the <setsockopt> system call.
00046   int set_option (int level,
00047                   int option,
00048                   void *optval,
00049                   int optlen) const;
00050 
00051   /// Wrapper around the <getsockopt> system call.
00052   int get_option (int level,
00053                   int option,
00054                   void *optval,
00055                   int *optlen) const;
00056 
00057   /// Close down the socket handle.
00058   int close (void);
00059 
00060   /// Return the local endpoint address in the referenced <ACE_Addr>.
00061   /// Returns 0 if successful, else -1.
00062   int get_local_addr (ACE_Addr &) const;
00063 
00064   /**
00065    * Return the address of the remotely connected peer (if there is
00066    * one), in the referenced <ACE_Addr>. Returns 0 if successful, else
00067    * -1.
00068    */
00069   int get_remote_addr (ACE_Addr &) const;
00070 
00071   /// Dump the state of an object.
00072   void dump (void) const;
00073 
00074   /// Declare the dynamic allocation hooks.
00075   ACE_ALLOC_HOOK_DECLARE;
00076 
00077   /// Wrapper around the BSD-style <socket> system call (no QoS).
00078   int open (int type,
00079             int protocol_family,
00080             int protocol,
00081             int reuse_addr);
00082 
00083   /// Wrapper around the QoS-enabled <WSASocket> function.
00084   int open (int type,
00085             int protocol_family,
00086             int protocol,
00087             ACE_Protocol_Info *protocolinfo,
00088             ACE_SOCK_GROUP g,
00089             u_long flags,
00090             int reuse_addr);
00091 
00092 protected:
00093   /// Constructor with arguments to call the BSD-style <socket> system
00094   /// call (no QoS).
00095   ACE_SOCK (int type,
00096             int protocol_family,
00097             int protocol = 0,
00098             int reuse_addr = 0);
00099 
00100   /// Constructor with arguments to call the QoS-enabled <WSASocket>
00101   /// function.
00102   ACE_SOCK (int type,
00103             int protocol_family,
00104             int protocol,
00105             ACE_Protocol_Info *protocolinfo,
00106             ACE_SOCK_GROUP g,
00107              u_long flags,
00108             int reuse_addr);
00109 
00110   /// Default constructor is protected to prevent instances of this class
00111   /// from being defined.
00112   ACE_SOCK (void);
00113 
00114 };
00115 
00116 #if !defined (ACE_LACKS_INLINE_FUNCTIONS)
00117 #include "ace/SOCK.i"
00118 #endif /* ACE_LACKS_INLINE_FUNCTIONS */
00119 
00120 #include "ace/post.h"
00121 #endif /* ACE_SOCK_H */

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