ICMP_Socket.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    ICMP_Socket.h
00006  *
00007  *  ICMP_Socket.h,v 1.5 2005/10/28 16:14:52 ossama Exp
00008  *
00009  *  @author Robert S. Iakobashvili <coroberti@gmail.com> <coroberti@walla.co.il>
00010  *  @author Gonzalo A. Diethelm <gonzalo.diethelm@aditiva.com>
00011  */
00012 //=============================================================================
00013 
00014 #ifndef ACE_ICMP_SOCKET_H
00015 #define ACE_ICMP_SOCKET_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 #if defined (ACE_HAS_ICMP_SUPPORT) && (ACE_HAS_ICMP_SUPPORT == 1)
00026 
00027 #include "ace/SOCK.h"
00028 #include "ace/Time_Value.h"
00029 #include "ace/os_include/netinet/os_in.h"
00030 
00031 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00032 
00033 /**
00034  * @class ACE_ICMP_Socket
00035  *
00036  * @brief An abstract class that forms the basis for usage of the ICMP
00037  * protocol (that is, support for things such as ping).
00038  */
00039 class ACE_Export ACE_ICMP_Socket : public ACE_SOCK
00040 {
00041 public:
00042   // = Initialization methods.
00043 
00044   /**
00045    * @name Data transfer routines.
00046    *
00047    * Data transfer routines.
00048    */
00049   //@{
00050 
00051   /// Send an @a n byte @a buf to the datagram socket (uses
00052   /// @c sendto(3) ).
00053   ssize_t send (void const * buf,
00054                 size_t n,
00055                 ACE_Addr const & addr,
00056                 int flags = 0) const;
00057 
00058   /// Receive an @a n byte @a buf from the datagram socket
00059   /// (uses @c recvfrom(3) ).
00060   ssize_t recv (void * buf,
00061                 size_t n,
00062                 ACE_Addr & addr,
00063                 int flags = 0) const;
00064 
00065   /// TODO: comment
00066   ssize_t recv (void * buf,
00067                 size_t n,
00068                 int flags,
00069                 ACE_Time_Value const * timeout) const;
00070 
00071   //@}
00072 
00073   /// Wrapper around the BSD-style @c socket system call (no QoS).
00074   int open (ACE_Addr const & local = ACE_Addr::sap_any,
00075             int protocol = IPPROTO_ICMP,
00076             int reuse_addr = 0);
00077 
00078   /// Dump the state of object.
00079   void dump (void) const;
00080 
00081   /// Declare the dynamic allocation hooks.
00082   ACE_ALLOC_HOOK_DECLARE;
00083 
00084 protected:
00085 
00086   // Protected constructors, so the class can only be derived from.
00087 
00088   /// Default constructor.
00089   ACE_ICMP_Socket (void);
00090 
00091   /// Constructor that takes a local listening address.
00092   ACE_ICMP_Socket (ACE_Addr const & local,
00093                    int protocol = IPPROTO_ICMP,
00094                    int reuse_addr = 0);
00095 
00096   /// Wrapper around BSD-style @c bind system call.
00097   int shared_open (ACE_Addr const & local);
00098 
00099   /// Calculates check-sum.
00100   unsigned short calculate_checksum (unsigned short* paddress,
00101                                      int len);
00102 };
00103 
00104 ACE_END_VERSIONED_NAMESPACE_DECL
00105 
00106 #endif  /* ACE_HAS_ICMP_SUPPORT == 1 */
00107 
00108 #include /**/ "ace/post.h"
00109 
00110 #endif /* ACE_ICMP_SOCKET_H */

Generated on Thu Nov 9 09:41:52 2006 for ACE by doxygen 1.3.6