| Kea 3.0.2-git

io_socket.h
Go to the documentation of this file.
1// Copyright (C) 2010-2025 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef IO_SOCKET_H
8#define IO_SOCKET_H 1
9
10// IMPORTANT NOTE: only very few ASIO headers files can be included in
11// this file. In particular, asio.hpp should never be included here.
12// See the description of the namespace below.
13#include <unistd.h> // for some network system calls
14
15#include <functional>
16#include <string>
17#include <boost/asio/socket_base.hpp>
18
19#include <exceptions/exceptions.h>
20
21 namespace isc {
22 namespace asiolink {
23
38 class IOSocket {
39 public:
40
42
43
45 typedef boost::asio::socket_base::reuse_address ReuseAddress;
46
48
54
55 private:
56 IOSocket(const IOSocket& source);
57 IOSocket& operator=(const IOSocket& source);
58 protected:
63 IOSocket() {}
64 public:
66 virtual ~IOSocket() {}
68
89 virtual int getNative() const = 0;
90
100 virtual int getProtocol() const = 0;
101
115 static IOSocket& getDummyUDPSocket();
116
123 static IOSocket& getDummyTCPSocket();
124};
125
126} // namespace asiolink
127} // namespace isc
128
129#endif // IO_SOCKET_H
isc::asiolink::IOSocket::getDummyTCPSocket
static IOSocket & getDummyTCPSocket()
Return a non-usable "dummy" TCP socket for testing.
Definition io_socket.cc:51
isc::asiolink::IOSocket::~IOSocket
virtual ~IOSocket()
The destructor.
Definition io_socket.h:66
isc::asiolink::IOSocket::getDummyUDPSocket
static IOSocket & getDummyUDPSocket()
Return a non-usable "dummy" UDP socket for testing.
Definition io_socket.cc:45
isc::asiolink::IOSocket::IOSocket
IOSocket()
The default constructor.
Definition io_socket.h:63
isc::asiolink::IOSocket::ReuseAddress
boost::asio::socket_base::reuse_address ReuseAddress
Represents SO_REUSEADDR socket option.
Definition io_socket.h:45
isc::asiolink::IOSocket::getProtocol
virtual int getProtocol() const =0
Return the transport protocol of the socket.
isc::asiolink::IOSocket::getNative
virtual int getNative() const =0
Return the "native" representation of the socket.
exceptions.h
isc::asiolink
Definition addr_utilities.cc:170
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148