Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / asio / doc / requirements / Endpoint.qbk
1 [/
2  / Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
3  /
4  / Distributed under the Boost Software License, Version 1.0. (See accompanying
5  / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6  /]
7
8 [section:Endpoint Endpoint requirements]
9
10 An endpoint must meet the requirements of `CopyConstructible` types (C++ Std,
11 20.1.3), and the requirements of `Assignable` types (C++ Std, 23.1).
12
13 In the table below, `X` denotes an endpoint class, `a` denotes a value of type
14 `X`, `s` denotes a size in bytes, and `u` denotes an identifier.
15
16 [table Endpoint requirements
17   [[expression] [type] [assertion/note\npre/post-conditions]]
18   [
19     [`X::protocol_type`]
20     [type meeting [link boost_asio.reference.Protocol protocol] requirements]
21     []
22   ]
23   [
24     [`X u;`]
25     []
26     []
27   ]
28   [
29     [`X();`]
30     []
31     []
32   ]
33   [
34     [`a.protocol();`]
35     [`protocol_type`]
36     []
37   ]
38   [
39     [`a.data();`]
40     [a pointer]
41     [
42       Returns a pointer suitable for passing as the /address/ argument to
43       __POSIX__ functions such as __accept__, __getpeername__, __getsockname__
44       and __recvfrom__. The implementation shall perform a
45       `reinterpret_cast` on the pointer to convert it to `sockaddr*`.
46     ]
47   ]
48   [
49     [`const X& u = a;
50       u.data();`]
51     [a pointer]
52     [
53       Returns a pointer suitable for passing as the /address/ argument to
54       __POSIX__ functions such as __connect__, or as the /dest_addr/ argument
55       to __POSIX__ functions such as  __sendto__. The implementation shall
56       perform a `reinterpret_cast` on the pointer to convert it to `const
57       sockaddr*`.
58     ]
59   ]
60   [
61     [`a.size();`]
62     [`size_t`]
63     [
64       Returns a value suitable for passing as the /address_len/ argument
65       to __POSIX__ functions such as __connect__, or as the /dest_len/ argument
66       to __POSIX__ functions such as __sendto__, after appropriate integer
67       conversion has been performed.
68     ]
69   ]
70   [
71     [`a.resize(s);`]
72     []
73     [
74       post: `a.size() == s`\n
75       Passed the value contained in the /address_len/ argument to __POSIX__
76       functions such as __accept__, __getpeername__, __getsockname__ and
77       __recvfrom__, after successful completion of the function. Permitted to
78       throw an exception if the protocol associated with the endpoint object `a`
79       does not support the specified size.
80     ]
81   ]
82   [
83     [`a.capacity();`]
84     [`size_t`]
85     [
86       Returns a value suitable for passing as the /address_len/ argument to
87       __POSIX__ functions such as __accept__, __getpeername__, __getsockname__
88       and __recvfrom__, after appropriate integer conversion has been performed.
89     ]
90   ]
91 ]
92
93 [endsect]