SNode.C
Loading...
Searching...
No Matches
EchoSocketContext.h
Go to the documentation of this file.
1
/*
2
* SNode.C - a slim toolkit for network communication
3
* Copyright (C) Volker Christian <me@vchrist.at>
4
* 2020, 2021, 2022, 2023, 2024, 2025
5
*
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published
8
* by the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#
ifndef
APPS_ECHO_MODEL_ECHOSOCKETCONTEXT_H
21
#
define
APPS_ECHO_MODEL_ECHOSOCKETCONTEXT_H
22
23
#
include
"core/socket/stream/SocketContext.h"
24
#
include
"core/socket/stream/SocketContextFactory.h"
25
26
namespace
core::socket::
stream
{
27
class
SocketConnection
;
28
}
29
30
#
ifndef
DOXYGEN_SHOULD_SKIP_THIS
31
32
#
include
<
cstddef
>
33
34
#
endif
/* DOXYGEN_SHOULD_SKIP_THIS */
35
36
namespace
apps::echo::model {
37
38
class
EchoSocketContext :
public
core::socket::
stream
::SocketContext {
39
public
:
40
enum
class
Role { SERVER, CLIENT };
41
42
explicit
EchoSocketContext(core::socket::
stream
::
SocketConnection
* socketConnection, Role role);
43
44
private
:
45
void
onConnected()
override
;
46
void
onDisconnected()
override
;
47
48
bool
onSignal(
int
signum)
override
;
49
50
std::size_t onReceivedFromPeer()
override
;
51
52
Role role;
53
};
54
55
class
EchoServerSocketContextFactory :
public
core::socket::
stream
::SocketContextFactory {
56
private
:
57
core::socket::
stream
::SocketContext* create(core::socket::
stream
::
SocketConnection
* socketConnection)
override
;
58
};
59
60
class
EchoClientSocketContextFactory :
public
core::socket::
stream
::SocketContextFactory {
61
private
:
62
core::socket::
stream
::SocketContext* create(core::socket::
stream
::
SocketConnection
* socketConnection)
override
;
63
};
64
65
}
// namespace apps::echo::model
66
67
#
endif
// APPS_ECHO_MODEL_ECHOSOCKETCONTEXT_H
core::socket::stream::SocketClient
Definition
SocketClient.h:48
core::socket::stream::SocketConnection
Definition
SocketConnection.h:53
main
int main(int argc, char *argv[])
Definition
configtest.cpp:26
QUOTE_INCLUDE
#define QUOTE_INCLUDE(a)
Definition
clients.h:25
STR
#define STR(a)
Definition
clients.h:26
apps::echo::model::legacy::getClient
EchoSocketClient getClient()
Definition
clients.h:54
apps
Definition
clients.h:50
apps
echo
model
EchoSocketContext.h
Generated on Mon Feb 10 2025 20:20:30 for SNode.C by
1.11.0