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.
47 /// Send an @a n byte @a buf to the datagram socket (uses
49 ssize_t
send (void const * buf
,
51 ACE_Addr
const & addr
,
54 /// Receive an @a n byte @a buf from the datagram socket
55 /// (uses @c recvfrom(3) ).
56 ssize_t
recv (void * buf
,
62 ssize_t
recv (void * buf
,
65 ACE_Time_Value
const * timeout
) const;
69 /// Wrapper around the BSD-style @c socket system call (no QoS).
70 int open (ACE_Addr
const & local
= ACE_Addr::sap_any
,
71 int protocol
= IPPROTO_ICMP
,
74 /// Dump the state of object.
75 void dump (void) const;
77 /// Declare the dynamic allocation hooks.
78 ACE_ALLOC_HOOK_DECLARE
;
82 // Protected constructors, so the class can only be derived from.
84 /// Default constructor.
85 ACE_ICMP_Socket (void);
87 /// Constructor that takes a local listening address.
88 ACE_ICMP_Socket (ACE_Addr
const & local
,
89 int protocol
= IPPROTO_ICMP
,
92 /// Wrapper around BSD-style @c bind system call.
93 int shared_open (ACE_Addr
const & local
);
95 /// Calculates check-sum.
96 unsigned short calculate_checksum (unsigned short* paddress
,
100 ACE_END_VERSIONED_NAMESPACE_DECL
102 #endif /* ACE_HAS_ICMP_SUPPORT == 1 */
104 #include /**/ "ace/post.h"
106 #endif /* ACE_ICMP_SOCKET_H */