udp.hpp
Go to the documentation of this file.
00001 //
00002 // udp.hpp
00003 // ~~~~~~~
00004 //
00005 // Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
00006 //
00007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
00008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00009 //
00010 
00011 #ifndef ASIO_IP_UDP_HPP
00012 #define ASIO_IP_UDP_HPP
00013 
00014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
00015 # pragma once
00016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
00017 
00018 #include "asio/detail/push_options.hpp"
00019 
00020 #include "asio/basic_datagram_socket.hpp"
00021 #include "asio/ip/basic_endpoint.hpp"
00022 #include "asio/ip/basic_resolver.hpp"
00023 #include "asio/ip/basic_resolver_iterator.hpp"
00024 #include "asio/ip/basic_resolver_query.hpp"
00025 #include "asio/detail/socket_types.hpp"
00026 
00027 namespace asio {
00028 namespace ip {
00029 
00031 
00041 class udp
00042 {
00043 public:
00045   typedef basic_endpoint<udp> endpoint;
00046 
00048   typedef basic_resolver_query<udp> resolver_query;
00049 
00051   typedef basic_resolver_iterator<udp> resolver_iterator;
00052 
00054   static udp v4()
00055   {
00056     return udp(PF_INET);
00057   }
00058 
00060   static udp v6()
00061   {
00062     return udp(PF_INET6);
00063   }
00064 
00066   int type() const
00067   {
00068     return SOCK_DGRAM;
00069   }
00070 
00072   int protocol() const
00073   {
00074     return IPPROTO_UDP;
00075   }
00076 
00078   int family() const
00079   {
00080     return family_;
00081   }
00082 
00084   typedef basic_datagram_socket<udp> socket;
00085 
00087   typedef basic_resolver<udp> resolver;
00088 
00090   friend bool operator==(const udp& p1, const udp& p2)
00091   {
00092     return p1.family_ == p2.family_;
00093   }
00094 
00096   friend bool operator!=(const udp& p1, const udp& p2)
00097   {
00098     return p1.family_ != p2.family_;
00099   }
00100 
00101 private:
00102   // Construct with a specific family.
00103   explicit udp(int family)
00104     : family_(family)
00105   {
00106   }
00107 
00108   int family_;
00109 };
00110 
00111 } // namespace ip
00112 } // namespace asio
00113 
00114 #include "asio/detail/pop_options.hpp"
00115 
00116 #endif // ASIO_IP_UDP_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Castor
Author(s): Carpe Noctem
autogenerated on Fri Nov 8 2013 11:05:39