| Home | Libraries | People | FAQ | More

### Endpoint requirements

An endpoint must meet the requirements of `CopyConstructible` types (C++ Std, 20.1.3), and the requirements of `Assignable` types (C++ Std, 23.1).

In the table below, `X` denotes an endpoint class, `a` denotes a value of type `X`, `s` denotes a size in bytes, and `u` denotes an identifier.

Table 10. Endpoint requirements

expression | type | assertion/note pre/post-conditions
--- | --- | ---
`X::protocol_type` | type meeting protocol requirements |
`X u;` |  |
`X();` |  |
`a.protocol();` | `protocol_type` |
`a.data();` | a pointer | Returns a pointer suitable for passing as the address argument to POSIX functions such as `accept()`, `getpeername()`, `getsockname()` and `recvfrom()`. The implementation shall perform a `reinterpret_cast` on the pointer to convert it to `sockaddr*`.
`const X& u = a; u.data();` | a pointer | Returns a pointer suitable for passing as the address argument to POSIX functions such as `connect()`, or as the dest_addr argument to POSIX functions such as `sendto()`. The implementation shall perform a `reinterpret_cast` on the pointer to convert it to `const sockaddr*`.
`a.size();` | `size_t` | Returns a value suitable for passing as the address_len argument to POSIX functions such as `connect()`, or as the dest_len argument to POSIX functions such as `sendto()`, after appropriate integer conversion has been performed.
`a.resize(s);` |  | post: `a.size() == s` Passed the value contained in the address_len argument to POSIX functions such as `accept()`, `getpeername()`, `getsockname()` and `recvfrom()`, after successful completion of the function. Permitted to throw an exception if the protocol associated with the endpoint object `a` does not support the specified size.
`a.capacity();` | `size_t` | Returns a value suitable for passing as the address_len argument to POSIX functions such as `accept()`, `getpeername()`, `getsockname()` and `recvfrom()`, after appropriate integer conversion has been performed.