[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / Ping_Socket.h
blob213f37fbd477c2002edd3534716153d8dd400730
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Ping_Socket.h
7 * $Id: Ping_Socket.h 81737 2008-05-20 09:46:39Z johnnyw $
9 * @author Robert S. Iakobashvili <coroberti@gmail.com> <coroberti@walla.co.il>
10 * @author Gonzalo A. Diethelm <gonzalo.diethelm@aditiva.com>
12 //=============================================================================
14 #ifndef ACE_PING_SOCKET_H
15 #define ACE_PING_SOCKET_H
17 #include /**/ "ace/pre.h"
19 #include /**/ "ace/ACE_export.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #if defined (ACE_HAS_ICMP_SUPPORT) && (ACE_HAS_ICMP_SUPPORT == 1)
27 #include "ace/ICMP_Socket.h"
29 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
31 class ACE_INET_Addr;
33 /**
34 * @class ACE_Ping_Socket
36 * @brief This class is useful to perform ICMP echo checks (pinging)
37 * on the party of your interest. It may be used as well to check
38 * LAN-adapters against 3rd parties.
40 class ACE_Export ACE_Ping_Socket : public ACE_ICMP_Socket
42 typedef ACE_ICMP_Socket inherited;
44 public:
46 // = Initialization and termination methods.
48 /// Default constructor.
49 ACE_Ping_Socket (void);
51 ACE_Ping_Socket (ACE_Addr const & local,
52 int protocol = IPPROTO_ICMP,
53 int reuse_addr = 0);
55 /// Destructor.
56 ~ACE_Ping_Socket (void);
58 /// Wrapper around the BSD-style @c socket system call (no QoS).
59 int open (ACE_Addr const & local = ACE_Addr::sap_any,
60 int protocol = IPPROTO_ICMP,
61 int reuse_addr = 0);
63 /// @a toConnect = 1 - makes connect to remote address
64 int send_echo_check (ACE_INET_Addr & remote_addr,
65 bool to_connect = false);
67 /// To receive @c ICMP_ECHOREPLY. To be called after successfully
68 /// sending @c ICMP_ECHO.
69 int process_incoming_dgram (char * ptr, ssize_t len);
71 /// @a toConnect = 1 - makes connect to remote address
72 int make_echo_check (ACE_INET_Addr & remote_addr,
73 bool to_connect = false,
74 ACE_Time_Value const * timeout = &time_default_);
76 char * icmp_recv_buff (void);
78 /// Dump the state of an object.
79 void dump (void) const;
81 /// Declare the dynamic allocation hooks.
82 ACE_ALLOC_HOOK_DECLARE;
84 public:
86 enum
88 PING_BUFFER_SIZE = (1024 * 2)
91 static ACE_Time_Value const time_default_;
93 private:
95 int receive_echo_reply (ACE_Time_Value const * timeout);
97 /// Do not allow this function to percolate up to this interface.
98 int get_remote_addr (ACE_INET_Addr &addr) const;
100 char icmp_send_buff_[PING_BUFFER_SIZE];
101 char icmp_recv_buff_[PING_BUFFER_SIZE];
103 ACE_UINT16 sequence_number_;
105 bool connected_socket_;
108 ACE_END_VERSIONED_NAMESPACE_DECL
110 #if defined (__ACE_INLINE__)
111 # include "ace/Ping_Socket.inl"
112 #endif /* __ACE_INLINE__ */
114 #endif /* ACE_HAS_ICMP_SUPPORT == 1 */
116 #include /**/ "ace/post.h"
118 #endif /* ACE_PING_SOCKET_H */