• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2 / Copyright (c) 2003-2021 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
10A type `X` meets the `Endpoint` requirements if it satisfies the requirements
11of `Destructible` (C++Std [destructible]), `DefaultConstructible` (C++Std
12[defaultconstructible]), `CopyConstructible` (C++Std [copyconstructible]),
13and `CopyAssignable` (C++Std [copyassignable]), as well as the additional
14requirements listed below.
15
16The default constructor and move operations of the type `X` shall not exit via
17an exception.
18
19In the table below, `a` denotes a (possibly const) value of type `X`, and `u`
20denotes an identifier.
21
22[table Endpoint requirements
23  [[expression] [type] [assertion/note[br]pre/post-conditions]]
24  [
25    [`X::protocol_type`]
26    [type meeting [link boost_asio.reference.Protocol `Protocol`] requirements]
27    []
28  ]
29  [
30    [`a.protocol()`]
31    [`protocol_type`]
32    []
33  ]
34]
35
36In the table below, `a` denotes a (possibly const) value of type `X`, `b`
37denotes a value of type `X`, and `s` denotes a (possibly const) value of a type
38that is convertible to `size_t` and denotes a size in bytes.
39
40[table Endpoint requirements for extensible implementations
41  [[expression] [type] [assertion/note[br]pre/post-conditions]]
42  [
43    [`a.data()`]
44    [`const void*`]
45    [
46      Returns a pointer suitable for passing as the /address/ argument to
47      functions such as __POSIX__ __connect__, or as the /dest_addr/ argument
48      to functions such as  __POSIX__ __sendto__. The implementation shall
49      perform a `static_cast` on the pointer to convert it to `const
50      sockaddr*`.
51    ]
52  ]
53  [
54    [`b.data()`]
55    [`void*`]
56    [
57      Returns a pointer suitable for passing as the /address/ argument to
58      functions such as __POSIX__ __accept__, __getpeername__, __getsockname__
59      and __recvfrom__. The implementation shall perform a `static_cast` on the
60      pointer to convert it to `sockaddr*`.
61    ]
62  ]
63  [
64    [`a.size()`]
65    [`size_t`]
66    [
67      Returns a value suitable for passing as the /address_len/ argument
68      to functions such as __POSIX__ __connect__, or as the /dest_len/ argument
69      to functions such as __POSIX__ __sendto__, after appropriate integer
70      conversion has been performed.
71    ]
72  ]
73  [
74    [`b.resize(s)`]
75    []
76    [
77      pre: `s >= 0`[br]
78      post: `a.size() == s`[br]
79      Passed the value contained in the /address_len/ argument to functions
80      such as __POSIX__ __accept__, __getpeername__, __getsockname__ and
81      __recvfrom__, after successful completion of the function. Permitted to
82      throw an exception if the protocol associated with the endpoint object
83      `a` does not support the specified size.
84    ]
85  ]
86  [
87    [`a.capacity()`]
88    [`size_t`]
89    [
90      Returns a value suitable for passing as the /address_len/ argument to
91      functions such as __POSIX__ __accept__, __getpeername__, __getsockname__
92      and __recvfrom__, after appropriate integer conversion has been performed.
93    ]
94  ]
95]
96
97[endsect]
98