/**
* Relational pipes
* Copyright © 2022 František Kučera (Frantovo.cz, GlobalCode.info)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <string>
#include <cstring>
#include <unistd.h>
#include <stdexcept>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
namespace relpipe {
namespace out {
namespace socket {
class Socket {
public:
virtual ~Socket() = default;
// virtual void setOption(const std::string& uri, const std::string& value) = 0;
virtual void send(const std::string& message) = 0;
virtual const std::string receive() = 0;
};
class SocketFactory {
public:
virtual ~SocketFactory() = default;
virtual bool canHandle(const std::string& connectionString) = 0;
// virtual void setOption(const std::string& uri, const std::string& value) = 0;
virtual Socket* open(const std::string& connectionString) = 0;
static std::shared_ptr<SocketFactory> find(const std::string& connectionString);
};
}
}
}