/**
  * This constructor is typically used to perform name resolution for
  * communication with remote hosts.
  *
  * @param host A string identifying a location. May be a descriptive name or
  * a numeric address string. If an empty string and the passive flag has been
  * specified, the resolved endpoints are suitable for local service binding.
  * If an empty string and passive is not specified, the resolved endpoints
  * will use the loopback address.
  *
  * @param service A string identifying the requested service. This may be a
  * descriptive name or a numeric string corresponding to a port number. May
  * be an empty string, in which case all resolved endpoints will have a port
  * number of 0.
  *
  * @param resolve_flags A set of flags that determine how name resolution
  * should be performed. The default flags are suitable for communication with
  * remote hosts.
  *
  * @note On POSIX systems, host names may be locally defined in the file
  * <tt>/etc/hosts</tt>. On Windows, host names may be defined in the file
  * <tt>c:\\windows\\system32\\drivers\\etc\\hosts</tt>. Remote host name
  * resolution is performed using DNS. Operating systems may use additional
  * locations when resolving host names (such as NETBIOS names on Windows).
  *
  * On POSIX systems, service names are typically defined in the file
  * <tt>/etc/services</tt>. On Windows, service names may be found in the file
  * <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems
  * may use additional locations when resolving service names.
  */
 basic_resolver_query(const std::string& host, const std::string& service,
     resolver_query_base::flags resolve_flags = address_configured)
   : hints_(),
     host_name_(host),
     service_name_(service)
 {
   typename InternetProtocol::endpoint endpoint;
   hints_.ai_flags = static_cast<int>(resolve_flags);
   hints_.ai_family = BOOST_ASIO_OS_DEF(AF_UNSPEC);
   hints_.ai_socktype = endpoint.protocol().type();
   hints_.ai_protocol = endpoint.protocol().protocol();
   hints_.ai_addrlen = 0;
   hints_.ai_canonname = 0;
   hints_.ai_addr = 0;
   hints_.ai_next = 0;
 }
Exemple #2
0
 /// Obtain an identifier for the type of the protocol.
 int type() const
 {
   return BOOST_ASIO_OS_DEF(SOCK_STREAM);
 }
 /// Obtain an identifier for the protocol.
 int protocol() const
 {
   return BOOST_ASIO_OS_DEF(IPPROTO_UDP);
 }
 /// Construct to represent the IPv6 UDP protocol.
 static udp v6()
 {
   return udp(BOOST_ASIO_OS_DEF(AF_INET6));
 }
Exemple #5
0
 /// Obtain an identifier for the type of the protocol.
 int type() const
 {
   return BOOST_ASIO_OS_DEF(SOCK_RAW);
 }
Exemple #6
0
 /// Construct to represent the IPv6 ICMP protocol.
 static icmp v6()
 {
   return icmp(BOOST_ASIO_OS_DEF(IPPROTO_ICMPV6),
       BOOST_ASIO_OS_DEF(AF_INET6));
 }
Exemple #7
0
 /// Construct to represent the IPv4 ICMP protocol.
 static icmp v4()
 {
   return icmp(BOOST_ASIO_OS_DEF(IPPROTO_ICMP),
       BOOST_ASIO_OS_DEF(AF_INET));
 }
 // Get the name of the IO control command.
 int name() const
 {
   return static_cast<int>(BOOST_ASIO_OS_DEF(FIONREAD));
 }
Exemple #9
0
 /// Construct to represent the IPv6 TCP protocol.
 static tcp v6()
 {
   return tcp(BOOST_ASIO_OS_DEF(AF_INET6));
 }
Exemple #10
0
 // Determine whether the endpoint is IPv4.
 bool is_v4() const
 {
   return data_.base.sa_family == BOOST_ASIO_OS_DEF(AF_INET);
 }
Exemple #11
0
 /// Construct to represent the version 1 Fiber protocol.
 static datagram_fiber v1()
 {
   return datagram_fiber(BOOST_ASIO_OS_DEF(AF_INET));
 }
Exemple #12
0
 /// Construct to represent the version 1 Fiber protocol.
 static stream_fiber v1()
 {
   return stream_fiber(BOOST_ASIO_OS_DEF(AF_INET));
 }
 /// Obtain an identifier for the type of the protocol.
 int type() const
 {
   return BOOST_ASIO_OS_DEF(SOCK_SEQPACKET);
 }