Realistic 3D camera system
3D camera system components
udp.hpp
Go to the documentation of this file.
1 //
2 // ip/udp.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_UDP_HPP
12 #define ASIO_IP_UDP_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"
25 
27 
28 namespace asio {
29 namespace ip {
30 
32 
42 class udp
43 {
44 public:
47 
49  static udp v4()
50  {
51  return udp(ASIO_OS_DEF(AF_INET));
52  }
53 
55  static udp v6()
56  {
57  return udp(ASIO_OS_DEF(AF_INET6));
58  }
59 
61  int type() const
62  {
63  return ASIO_OS_DEF(SOCK_DGRAM);
64  }
65 
67  int protocol() const
68  {
69  return ASIO_OS_DEF(IPPROTO_UDP);
70  }
71 
73  int family() const
74  {
75  return family_;
76  }
77 
80 
83 
85  friend bool operator==(const udp& p1, const udp& p2)
86  {
87  return p1.family_ == p2.family_;
88  }
89 
91  friend bool operator!=(const udp& p1, const udp& p2)
92  {
93  return p1.family_ != p2.family_;
94  }
95 
96 private:
97  // Construct with a specific family.
98  explicit udp(int protocol_family)
99  : family_(protocol_family)
100  {
101  }
102 
103  int family_;
104 };
105 
106 } // namespace ip
107 } // namespace asio
108 
110 
111 #endif // ASIO_IP_UDP_HPP
Describes an endpoint for a version-independent IP socket.
#define ASIO_OS_DEF(c)
static udp v6()
Construct to represent the IPv6 UDP protocol.
Definition: udp.hpp:55
int type() const
Obtain an identifier for the type of the protocol.
Definition: udp.hpp:61
Provides datagram-oriented socket functionality.
int protocol() const
Obtain an identifier for the protocol.
Definition: udp.hpp:67
basic_endpoint< udp > endpoint
The type of a UDP endpoint.
Definition: udp.hpp:46
Encapsulates the flags needed for UDP.
Definition: udp.hpp:42
int family() const
Obtain an identifier for the protocol family.
Definition: udp.hpp:73
static udp v4()
Construct to represent the IPv4 UDP protocol.
Definition: udp.hpp:49
basic_datagram_socket< udp > socket
The UDP socket type.
Definition: udp.hpp:79
basic_resolver< udp > resolver
The UDP resolver type.
Definition: udp.hpp:82
Provides endpoint resolution functionality.
friend bool operator!=(const udp &p1, const udp &p2)
Compare two protocols for inequality.
Definition: udp.hpp:91
friend bool operator==(const udp &p1, const udp &p2)
Compare two protocols for equality.
Definition: udp.hpp:85