1//
2// local/seq_packet_protocol.hpp
3// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4//
5// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6//
7// Distributed under the Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9//
10
11#ifndef BOOST_ASIO_LOCAL_SEQ_PACKET_PROTOCOL_HPP
12#define BOOST_ASIO_LOCAL_SEQ_PACKET_PROTOCOL_HPP
13
14#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15# pragma once
16#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18#include <boost/asio/detail/config.hpp>
19
20#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) \
21 || defined(GENERATING_DOCUMENTATION)
22
23#include <boost/asio/basic_socket_acceptor.hpp>
24#include <boost/asio/basic_seq_packet_socket.hpp>
25#include <boost/asio/detail/socket_types.hpp>
26#include <boost/asio/local/basic_endpoint.hpp>
27
28#include <boost/asio/detail/push_options.hpp>
29
30namespace boost {
31namespace asio {
32namespace local {
33
34/// Encapsulates the flags needed for seq_packet UNIX sockets.
35/**
36 * The boost::asio::local::seq_packet_protocol class contains flags necessary
37 * for sequenced packet UNIX domain sockets.
38 *
39 * @par Thread Safety
40 * @e Distinct @e objects: Safe.@n
41 * @e Shared @e objects: Safe.
42 *
43 * @par Concepts:
44 * Protocol.
45 */
46class seq_packet_protocol
47{
48public:
49 /// Obtain an identifier for the type of the protocol.
50 int type() const noexcept
51 {
52 return SOCK_SEQPACKET;
53 }
54
55 /// Obtain an identifier for the protocol.
56 int protocol() const noexcept
57 {
58 return 0;
59 }
60
61 /// Obtain an identifier for the protocol family.
62 int family() const noexcept
63 {
64 return AF_UNIX;
65 }
66
67 /// The type of a UNIX domain endpoint.
68 typedef basic_endpoint<seq_packet_protocol> endpoint;
69
70 /// The UNIX domain socket type.
71 typedef basic_seq_packet_socket<seq_packet_protocol> socket;
72
73 /// The UNIX domain acceptor type.
74 typedef basic_socket_acceptor<seq_packet_protocol> acceptor;
75};
76
77} // namespace local
78} // namespace asio
79} // namespace boost
80
81#include <boost/asio/detail/pop_options.hpp>
82
83#endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
84 // || defined(GENERATING_DOCUMENTATION)
85
86#endif // BOOST_ASIO_LOCAL_SEQ_PACKET_PROTOCOL_HPP
87

source code of boost/libs/asio/include/boost/asio/local/seq_packet_protocol.hpp