You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
3.9 KiB
146 lines
3.9 KiB
/*
|
|
* Copyright (c) 2016, Intel Corporation
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
* are permitted provided that the following conditions are met:
|
|
*
|
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
* list of conditions and the following disclaimer.
|
|
*
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
* this list of conditions and the following disclaimer in the documentation and/or
|
|
* other materials provided with the distribution.
|
|
*
|
|
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
* may be used to endorse or promote products derived from this software without
|
|
* specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
#pragma once
|
|
|
|
/** @file
|
|
*
|
|
* Stubs ASIO interfaces called by libremote-processor. This is used when
|
|
* the user asks for networking support to be compiled out.
|
|
*/
|
|
|
|
#include <system_error>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#define ASIO_OS_DEF(x) (x)
|
|
|
|
namespace asio
|
|
{
|
|
struct dummy_base
|
|
{
|
|
template <class... Args>
|
|
dummy_base(Args &&...)
|
|
{
|
|
}
|
|
void set_option(const dummy_base &) const {};
|
|
int protocol() const { return 0; }
|
|
};
|
|
struct endpoint_base : dummy_base
|
|
{
|
|
using dummy_base::dummy_base;
|
|
|
|
dummy_base protocol() const { return {}; };
|
|
};
|
|
|
|
template <typename T>
|
|
struct basic_socket_acceptor : dummy_base
|
|
{
|
|
using dummy_base::dummy_base;
|
|
|
|
using reuse_address = dummy_base;
|
|
void open(const dummy_base &) const {};
|
|
void bind(const dummy_base &) const {};
|
|
void listen() const {};
|
|
void async_accept(const dummy_base &, const dummy_base &) const {};
|
|
};
|
|
|
|
inline bool write(const dummy_base &, const dummy_base &, const dummy_base &)
|
|
{
|
|
return true;
|
|
}
|
|
inline bool read(const dummy_base &, const dummy_base &, const dummy_base &)
|
|
{
|
|
return true;
|
|
}
|
|
using buffer = dummy_base;
|
|
struct io_service : dummy_base
|
|
{
|
|
template <class... Args>
|
|
io_service(Args &&...)
|
|
{
|
|
throw std::runtime_error("Stub constructor called. Did you forget to set the "
|
|
"'TuningAllowed' attribute to 'false' in the Parameter "
|
|
"Framework's toplevel configuration file?");
|
|
}
|
|
|
|
void run(const dummy_base &) const {};
|
|
void stop() const {};
|
|
};
|
|
struct socket_base : dummy_base
|
|
{
|
|
using dummy_base::dummy_base;
|
|
|
|
using linger = dummy_base;
|
|
using enable_connection_aborted = dummy_base;
|
|
void close() const {};
|
|
|
|
const endpoint_base &local_endpoint() const { return base; }
|
|
|
|
endpoint_base base;
|
|
};
|
|
|
|
bool write(const dummy_base &, const dummy_base &, const dummy_base &);
|
|
bool read(const dummy_base &, const dummy_base &, const dummy_base &);
|
|
|
|
struct error_code : dummy_base, std::error_code
|
|
{
|
|
};
|
|
namespace error
|
|
{
|
|
static const error_code eof{};
|
|
}
|
|
|
|
namespace ip
|
|
{
|
|
namespace tcp
|
|
{
|
|
using v6 = dummy_base;
|
|
using no_delay = dummy_base;
|
|
using endpoint = endpoint_base;
|
|
using socket = socket_base;
|
|
using acceptor = basic_socket_acceptor<void>;
|
|
}
|
|
}
|
|
|
|
namespace generic
|
|
{
|
|
struct stream_protocol
|
|
{
|
|
using endpoint = endpoint_base;
|
|
using socket = socket_base;
|
|
};
|
|
};
|
|
|
|
namespace local
|
|
{
|
|
using stream_protocol = generic::stream_protocol;
|
|
}
|
|
}
|