...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
A socket service must meet the requirements for an I/O object service with support for movability, as well as the additional requirements listed below.
In the table below, X
denotes
a socket service class for protocol Protocol
, a
and ao
denote values of type
X
, b
and c
denote values of type
X::implementation_type
, p
denotes a value of type Protocol
,
n
denotes a value of type
X::native_handle_type
, e
denotes a value of type Protocol::endpoint
,
ec
denotes a value of type
error_code
, s
denotes a value meeting SettableSocketOption
requirements,
g
denotes a value meeting
GettableSocketOption
requirements, i
denotes a
value meeting IoControlCommand
requirements,
h
denotes a value of type
socket_base::shutdown_type
, ch
denotes a value meeting ConnectHandler
requirements, and
u
and v
denote identifiers.
Table 30. SocketService requirements
expression |
return type |
assertion/note |
---|---|---|
|
The implementation-defined native representation of a socket. Must
satisfy the requirements of |
|
|
From IoObjectService
requirements. |
|
|
From IoObjectService
requirements. Implicitly cancels asynchronous operations, as if
by calling |
|
a.move_construct(b, c);
|
From IoObjectService
requirements. The underlying native representation is moved from
|
|
a.move_assign(b, ao, c);
|
From IoObjectService
requirements. Implicitly cancels asynchronous operations associated
with |
|
a.open(b, p, ec);
|
|
pre: |
a.assign(b, p, n, ec);
|
|
pre: |
a.is_open(b);
|
|
|
const X& u = a; const X::implementation_type& v = b; u.is_open(v);
|
|
|
a.close(b, ec);
|
|
If |
a.native_handle(b);
|
|
|
a.cancel(b, ec);
|
|
pre: |
a.set_option(b, s, ec);
|
|
pre: |
a.get_option(b, g, ec);
|
|
pre: |
const X& u = a; const X::implementation_type& v = b; u.get_option(v, g, ec);
|
|
pre: |
a.io_control(b, i, ec);
|
|
pre: |
a.at_mark(b, ec);
|
|
pre: |
const X& u = a; const X::implementation_type& v = b; u.at_mark(v, ec);
|
|
pre: |
a.available(b, ec);
|
|
pre: |
const X& u = a; const X::implementation_type& v = b; u.available(v, ec);
|
|
pre: |
const typename Protocol::endpoint& u = e; a.bind(b, u, ec);
|
|
pre: |
a.shutdown(b, h, ec);
|
|
pre: |
a.local_endpoint(b, ec);
|
|
pre: |
const X& u = a; const X::implementation_type& v = b; u.local_endpoint(v, ec);
|
|
pre: |
a.remote_endpoint(b, ec);
|
|
pre: |
const X& u = a; const X::implementation_type& v = b; u.remote_endpoint(v, ec);
|
|
pre: |
const typename Protocol::endpoint& u = e; a.connect(b, u, ec);
|
|
pre: |
const typename Protocol::endpoint& u = e; a.async_connect(b, u, ch);
|
pre: |