libiqxmlrpc  0.12.4
 All Classes Namespaces Files Functions Typedefs Enumerations
inet_addr.h
1 // Libiqxmlrpc - an object-oriented XML-RPC solution.
2 // Copyright (C) 2011 Anton Dedov
3 
4 #ifndef _libiqnet_inet_addr_h_
5 #define _libiqnet_inet_addr_h_
6 
7 #if _MSC_VER >= 1700
8 #include <winsock2.h>
9 #endif
10 
11 #include "api_export.h"
12 #include <string>
13 
15 namespace iqnet
16 {
17 
19 std::string LIBIQXMLRPC_API get_host_name();
20 
21 #ifdef _MSC_VER
22 #pragma warning(push)
23 #pragma warning(disable: 4251)
24 #endif
25 
26 
27 class LIBIQXMLRPC_API Inet_addr {
28  struct sockaddr_in sa;
29  std::string host;
30  int port;
31 
32 public:
34  Inet_addr() {}
35 
36  Inet_addr( const struct sockaddr_in& );
37  Inet_addr( const std::string& host, int port = 0 );
38  Inet_addr( int port );
39 
40  virtual ~Inet_addr() {}
41 
42  const struct sockaddr_in* get_sockaddr() const { return &sa; }
43  const std::string& get_host_name() const { return host; }
44  int get_port() const { return port; }
45 };
46 
47 } // namespace iqnet
48 
49 #endif