Skip to content

Commit 9151fd2

Browse files
committed
doc: clarify protocol-tag family/type/protocol return values
The family()/type()/protocol() members on the protocol tags returned bare platform constants documented as "the protocol (0)", which read as one entry in an unlisted corosio enumeration (#255). Explain at the class level that these three members produce the (family, type, protocol) triple passed to the OS socket() call and that the values are platform-defined constants, and expand local_stream/local_datagram protocol() to state that 0 selects the default (and only) protocol rather than indexing a list. Clarify the socket/acceptor type aliases across all four tags. Documentation only; no API or behavior change.
1 parent 069ba7e commit 9151fd2

4 files changed

Lines changed: 42 additions & 26 deletions

File tree

include/boost/corosio/local_datagram.hpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ class local_datagram_socket;
2424
Identifies the local datagram protocol for parameterizing
2525
socket open() calls with a self-documenting type.
2626
27-
The family(), type(), and protocol() members are implemented
28-
in the compiled library to avoid exposing platform socket
29-
headers.
27+
The family(), type(), and protocol() members return the
28+
three integers passed to the operating system's socket()
29+
call. Their values are platform-defined constants taken from
30+
the system socket headers.
3031
3132
@note Not available on Windows. Windows does not support
3233
AF_UNIX datagram sockets (SOCK_DGRAM).
@@ -36,16 +37,22 @@ class local_datagram_socket;
3637
class BOOST_COROSIO_DECL local_datagram
3738
{
3839
public:
39-
/// Return the address family (AF_UNIX).
40+
/// Return the address family, the platform's `AF_UNIX` constant.
4041
static int family() noexcept;
4142

42-
/// Return the socket type (SOCK_DGRAM).
43+
/// Return the socket type, the platform's `SOCK_DGRAM` constant.
4344
static int type() noexcept;
4445

45-
/// Return the protocol (0).
46+
/** Return the protocol number, always `0`.
47+
48+
A value of `0` directs the operating system to select the
49+
default protocol for an `AF_UNIX` `SOCK_DGRAM` socket. It
50+
is not an index into a list of protocols: Unix domain
51+
datagram sockets have only one, so `0` is the sole valid value.
52+
*/
4653
static int protocol() noexcept;
4754

48-
/// The associated socket type.
55+
/// The socket type to use with this protocol, @ref local_datagram_socket.
4956
using socket = local_datagram_socket;
5057
};
5158

include/boost/corosio/local_stream.hpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ class local_stream_acceptor;
2323
socket and acceptor open() calls with a self-documenting
2424
type.
2525
26-
The family(), type(), and protocol() members are implemented
27-
in the compiled library to avoid exposing platform socket
28-
headers.
26+
The family(), type(), and protocol() members return the
27+
three integers passed to the operating system's socket()
28+
call. Their values are platform-defined constants taken from
29+
the system socket headers.
2930
3031
@par Example
3132
@code
@@ -38,19 +39,25 @@ class local_stream_acceptor;
3839
class BOOST_COROSIO_DECL local_stream
3940
{
4041
public:
41-
/// Return the address family (AF_UNIX).
42+
/// Return the address family, the platform's `AF_UNIX` constant.
4243
static int family() noexcept;
4344

44-
/// Return the socket type (SOCK_STREAM).
45+
/// Return the socket type, the platform's `SOCK_STREAM` constant.
4546
static int type() noexcept;
4647

47-
/// Return the protocol (0).
48+
/** Return the protocol number, always `0`.
49+
50+
A value of `0` directs the operating system to select the
51+
default protocol for an `AF_UNIX` `SOCK_STREAM` socket. It
52+
is not an index into a list of protocols: Unix domain
53+
stream sockets have only one, so `0` is the sole valid value.
54+
*/
4855
static int protocol() noexcept;
4956

50-
/// The associated socket type.
57+
/// The socket type to use with this protocol, @ref local_stream_socket.
5158
using socket = local_stream_socket;
5259

53-
/// The associated acceptor type.
60+
/// The acceptor type to use with this protocol, @ref local_stream_acceptor.
5461
using acceptor = local_stream_acceptor;
5562
};
5663

include/boost/corosio/tcp.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ class tcp_acceptor;
2323
(IPv4 or IPv6). It is used to parameterize socket and acceptor
2424
`open()` calls with a self-documenting type.
2525
26-
The `family()`, `type()`, and `protocol()` members are
27-
implemented in the compiled library to avoid exposing
28-
platform socket headers. For an inline variant that includes
29-
platform headers, use @ref native_tcp.
26+
The `family()`, `type()`, and `protocol()` members return the
27+
three integers passed to the operating system's `socket()`
28+
call. Their values are platform-defined constants taken from
29+
the system socket headers. For an inline variant that includes
30+
those headers, use @ref native_tcp.
3031
3132
@par Example
3233
@code
@@ -72,10 +73,10 @@ class BOOST_COROSIO_DECL tcp
7273
/// Return the IP protocol (IPPROTO_TCP).
7374
static int protocol() noexcept;
7475

75-
/// The associated socket type.
76+
/// The socket type to use with this protocol, @ref tcp_socket.
7677
using socket = tcp_socket;
7778

78-
/// The associated acceptor type.
79+
/// The acceptor type to use with this protocol, @ref tcp_acceptor.
7980
using acceptor = tcp_acceptor;
8081

8182
/// Test for equality.

include/boost/corosio/udp.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ class udp_socket;
2222
(IPv4 or IPv6). It is used to parameterize `udp_socket::open()`
2323
calls with a self-documenting type.
2424
25-
The `family()`, `type()`, and `protocol()` members are
26-
implemented in the compiled library to avoid exposing
27-
platform socket headers. For an inline variant that includes
28-
platform headers, use @ref native_udp.
25+
The `family()`, `type()`, and `protocol()` members return the
26+
three integers passed to the operating system's `socket()`
27+
call. Their values are platform-defined constants taken from
28+
the system socket headers. For an inline variant that includes
29+
those headers, use @ref native_udp.
2930
3031
@par Example
3132
@code
@@ -69,7 +70,7 @@ class BOOST_COROSIO_DECL udp
6970
/// Return the IP protocol (IPPROTO_UDP).
7071
static int protocol() noexcept;
7172

72-
/// The associated socket type.
73+
/// The socket type to use with this protocol, @ref udp_socket.
7374
using socket = udp_socket;
7475

7576
/// Test for equality.

0 commit comments

Comments
 (0)