0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00
construct/include/ircd/net/asio.h
2019-10-08 19:30:48 -07:00

59 lines
2.1 KiB
C++

// Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#pragma once
#define HAVE_IRCD_NET_ASIO_H
// This file is not included with the IRCd standard include stack because
// it requires symbols we can't forward declare without boost headers. It
// is part of the <ircd/asio.h> stack which can be included in your
// definition file if you need low level access to this socket API. The
// <ircd/net/net.h> still offers higher level access to sockets without
// requiring boost headers; please check that for satisfaction before
// including this.
namespace ircd::net
{
namespace ip = asio::ip;
using asio::deadline_timer;
using asio::steady_timer;
using ircd::string;
string_view string(const mutable_buffer &, const ip::address_v6 &);
string_view string(const mutable_buffer &, const ip::address_v4 &);
string_view string(const mutable_buffer &, const ip::address &);
std::string string(const ip::address_v6 &);
std::string string(const ip::address_v4 &);
std::string string(const ip::address &);
uint16_t port(const ip::tcp::endpoint &);
ip::address addr(const ip::tcp::endpoint &);
std::string host(const ip::tcp::endpoint &);
string_view string(const mutable_buffer &, const ip::tcp::endpoint &);
std::string string(const ip::tcp::endpoint &);
ipport make_ipport(const boost::asio::ip::tcp::endpoint &);
ipport make_ipport(const boost::asio::ip::udp::endpoint &);
ip::tcp::endpoint make_endpoint(const ipport &);
ip::udp::endpoint make_endpoint_udp(const ipport &);
}
#include <ircd/net/socket.h>
#include <ircd/net/acceptor.h>
#include <ircd/net/acceptor_udp.h>
#include <ircd/net/dns_resolver.h>
namespace ircd
{
using net::string;
using net::addr;
using net::host;
using net::port;
}