3 //=============================================================================
7 * @author Robert S. Iakobashvili <coroberti@gmail.com> <coroberti@walla.co.il>
8 * @author Gonzalo A. Diethelm <gonzalo.diethelm@aditiva.com>
10 //=============================================================================
12 #ifndef ACE_ICMP_SOCKET_H
13 #define ACE_ICMP_SOCKET_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/ACE_export.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #if defined (ACE_HAS_ICMP_SUPPORT) && (ACE_HAS_ICMP_SUPPORT == 1)
26 #include "ace/Time_Value.h"
27 #include "ace/os_include/netinet/os_in.h"
29 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
32 * @class ACE_ICMP_Socket
34 * @brief An abstract class that forms the basis for usage of the ICMP
35 * protocol (that is, support for things such as ping).
37 class ACE_Export ACE_ICMP_Socket
: public ACE_SOCK
41 * @name Data transfer routines.
43 * Data transfer routines.
46 /// Send an @a n byte @a buf to the datagram socket (uses
48 ssize_t
send (void const * buf
,
50 ACE_Addr
const & addr
,
53 /// Receive an @a n byte @a buf from the datagram socket
54 /// (uses @c recvfrom(3) ).
55 ssize_t
recv (void * buf
,
61 ssize_t
recv (void * buf
,
64 ACE_Time_Value
const * timeout
) const;
68 /// Wrapper around the BSD-style @c socket system call (no QoS).
69 int open (ACE_Addr
const & local
= ACE_Addr::sap_any
,
70 int protocol
= IPPROTO_ICMP
,
73 /// Dump the state of object.
76 /// Declare the dynamic allocation hooks.
77 ACE_ALLOC_HOOK_DECLARE
;
80 // Protected constructors, so the class can only be derived from.
81 /// Default constructor.
84 /// Constructor that takes a local listening address.
85 ACE_ICMP_Socket (ACE_Addr
const & local
,
86 int protocol
= IPPROTO_ICMP
,
89 /// Wrapper around BSD-style @c bind system call.
90 int shared_open (ACE_Addr
const & local
);
92 /// Calculates check-sum.
93 unsigned short calculate_checksum (unsigned short* paddress
,
97 ACE_END_VERSIONED_NAMESPACE_DECL
99 #endif /* ACE_HAS_ICMP_SUPPORT == 1 */
101 #include /**/ "ace/post.h"
103 #endif /* ACE_ICMP_SOCKET_H */