GitHub Actions: Try MSVC builds with /std:c++17 and 20
[ACE_TAO.git] / ACE / ace / ICMP_Socket.h
blobab3f549cf17f1f62611de09456a15e46320bbb13
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file ICMP_Socket.h
7 * @author Robert S. Iakobashvili <coroberti@gmail.com> <coroberti@walla.co.il>
8 * @author Gonzalo A. Diethelm <gonzalo.diethelm@aditiva.com>
9 */
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)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #if defined (ACE_HAS_ICMP_SUPPORT) && (ACE_HAS_ICMP_SUPPORT == 1)
25 #include "ace/SOCK.h"
26 #include "ace/Time_Value.h"
27 #include "ace/os_include/netinet/os_in.h"
29 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
31 /**
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
39 public:
40 /**
41 * @name Data transfer routines.
43 * Data transfer routines.
45 //@{
47 /// Send an @a n byte @a buf to the datagram socket (uses
48 /// @c sendto(3) ).
49 ssize_t send (void const * buf,
50 size_t n,
51 ACE_Addr const & addr,
52 int flags = 0) const;
54 /// Receive an @a n byte @a buf from the datagram socket
55 /// (uses @c recvfrom(3) ).
56 ssize_t recv (void * buf,
57 size_t n,
58 ACE_Addr & addr,
59 int flags = 0) const;
61 /// TODO: comment
62 ssize_t recv (void * buf,
63 size_t n,
64 int flags,
65 ACE_Time_Value const * timeout) const;
67 //@}
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,
72 int reuse_addr = 0);
74 /// Dump the state of object.
75 void dump (void) const;
77 /// Declare the dynamic allocation hooks.
78 ACE_ALLOC_HOOK_DECLARE;
80 protected:
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,
90 int reuse_addr = 0);
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,
97 int len);
100 ACE_END_VERSIONED_NAMESPACE_DECL
102 #endif /* ACE_HAS_ICMP_SUPPORT == 1 */
104 #include /**/ "ace/post.h"
106 #endif /* ACE_ICMP_SOCKET_H */