Realistic 3D camera system
3D camera system components
basic_resolver_query.hpp
Go to the documentation of this file.
1 //
2 // ip/basic_resolver_query.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef ASIO_IP_BASIC_RESOLVER_QUERY_HPP
12 #define ASIO_IP_BASIC_RESOLVER_QUERY_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 #include <string>
22 
24 
25 namespace asio {
26 namespace ip {
27 
29 
37 template <typename InternetProtocol>
39  : public resolver_query_base
40 {
41 public:
43  typedef InternetProtocol protocol_type;
44 
46 
62  basic_resolver_query(const std::string& service,
64  : hints_(),
65  host_name_(),
66  service_name_(service)
67  {
68  typename InternetProtocol::endpoint endpoint;
69  hints_.ai_flags = static_cast<int>(resolve_flags);
70  hints_.ai_family = PF_UNSPEC;
71  hints_.ai_socktype = endpoint.protocol().type();
72  hints_.ai_protocol = endpoint.protocol().protocol();
73  hints_.ai_addrlen = 0;
74  hints_.ai_canonname = 0;
75  hints_.ai_addr = 0;
76  hints_.ai_next = 0;
77  }
78 
80 
99  basic_resolver_query(const protocol_type& protocol,
100  const std::string& service,
102  : hints_(),
103  host_name_(),
104  service_name_(service)
105  {
106  hints_.ai_flags = static_cast<int>(resolve_flags);
107  hints_.ai_family = protocol.family();
108  hints_.ai_socktype = protocol.type();
109  hints_.ai_protocol = protocol.protocol();
110  hints_.ai_addrlen = 0;
111  hints_.ai_canonname = 0;
112  hints_.ai_addr = 0;
113  hints_.ai_next = 0;
114  }
115 
117 
147  basic_resolver_query(const std::string& host, const std::string& service,
149  : hints_(),
150  host_name_(host),
151  service_name_(service)
152  {
153  typename InternetProtocol::endpoint endpoint;
154  hints_.ai_flags = static_cast<int>(resolve_flags);
155  hints_.ai_family = ASIO_OS_DEF(AF_UNSPEC);
156  hints_.ai_socktype = endpoint.protocol().type();
157  hints_.ai_protocol = endpoint.protocol().protocol();
158  hints_.ai_addrlen = 0;
159  hints_.ai_canonname = 0;
160  hints_.ai_addr = 0;
161  hints_.ai_next = 0;
162  }
163 
165 
198  basic_resolver_query(const protocol_type& protocol,
199  const std::string& host, const std::string& service,
201  : hints_(),
202  host_name_(host),
203  service_name_(service)
204  {
205  hints_.ai_flags = static_cast<int>(resolve_flags);
206  hints_.ai_family = protocol.family();
207  hints_.ai_socktype = protocol.type();
208  hints_.ai_protocol = protocol.protocol();
209  hints_.ai_addrlen = 0;
210  hints_.ai_canonname = 0;
211  hints_.ai_addr = 0;
212  hints_.ai_next = 0;
213  }
214 
217  {
218  return hints_;
219  }
220 
222  std::string host_name() const
223  {
224  return host_name_;
225  }
226 
228  std::string service_name() const
229  {
230  return service_name_;
231  }
232 
233 private:
235  std::string host_name_;
236  std::string service_name_;
237 };
238 
239 } // namespace ip
240 } // namespace asio
241 
243 
244 #endif // ASIO_IP_BASIC_RESOLVER_QUERY_HPP
const asio::detail::addrinfo_type & hints() const
Get the hints associated with the query.
An query to be passed to a resolver.
#define ASIO_OS_DEF(c)
basic_resolver_query(const std::string &host, const std::string &service, resolver_query_base::flags resolve_flags=address_configured)
Construct with specified host name and service name for any protocol.
addrinfo addrinfo_type
basic_resolver_query(const std::string &service, resolver_query_base::flags resolve_flags=passive|address_configured)
Construct with specified service name for any protocol.
std::string host_name() const
Get the host name associated with the query.
basic_resolver_query(const protocol_type &protocol, const std::string &service, resolver_query_base::flags resolve_flags=passive|address_configured)
Construct with specified service name for a given protocol.
std::string service_name() const
Get the service name associated with the query.
basic_resolver_query(const protocol_type &protocol, const std::string &host, const std::string &service, resolver_query_base::flags resolve_flags=address_configured)
Construct with specified host name and service name for a given protocol.
InternetProtocol protocol_type
The protocol type associated with the endpoint query.