author | František Kučera <franta-hg@frantovo.cz> |
Thu, 28 Jul 2022 02:03:11 +0200 | |
branch | v_0 |
changeset 2 | fb399fd4f053 |
parent 1 | e3265afd1111 |
child 3 | e701e06ff561 |
permissions | -rw-r--r-- |
0 | 1 |
/** |
2 |
* Relational pipes |
|
3 |
* Copyright © 2022 František Kučera (Frantovo.cz, GlobalCode.info) |
|
4 |
* |
|
5 |
* This program is free software: you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation, version 3 of the License. |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
*/ |
|
17 |
#pragma once |
|
18 |
||
19 |
#include <string> |
|
1
e3265afd1111
first version: TCP-only + fixed parameters
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
20 |
#include <cstring> |
e3265afd1111
first version: TCP-only + fixed parameters
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
21 |
#include <unistd.h> |
0 | 22 |
#include <stdexcept> |
1
e3265afd1111
first version: TCP-only + fixed parameters
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
23 |
#include <arpa/inet.h> |
e3265afd1111
first version: TCP-only + fixed parameters
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
24 |
#include <sys/types.h> |
e3265afd1111
first version: TCP-only + fixed parameters
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
25 |
#include <sys/socket.h> |
e3265afd1111
first version: TCP-only + fixed parameters
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
26 |
#include <netinet/in.h> |
0 | 27 |
|
28 |
namespace relpipe { |
|
29 |
namespace out { |
|
30 |
namespace socket { |
|
31 |
||
32 |
class Socket { |
|
33 |
public: |
|
2 | 34 |
virtual ~Socket() = default; |
35 |
// virtual void setOption(const std::string& uri, const std::string& value) = 0; |
|
36 |
virtual void send(const std::string& message) = 0; |
|
37 |
virtual const std::string receive() = 0; |
|
38 |
}; |
|
1
e3265afd1111
first version: TCP-only + fixed parameters
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
39 |
|
2 | 40 |
class SocketFactory { |
41 |
public: |
|
42 |
virtual ~SocketFactory() = default; |
|
43 |
virtual bool canHandle(const std::string& connectionString) = 0; |
|
44 |
// virtual void setOption(const std::string& uri, const std::string& value) = 0; |
|
45 |
virtual Socket* open(const std::string& connectionString) = 0; |
|
46 |
static SocketFactory* find(const std::string& connectionString); |
|
47 |
}; |
|
0 | 48 |
|
49 |
||
50 |
} |
|
51 |
} |
|
52 |
} |