Flow-IPC 1.0.2
Flow-IPC project: Full implementation reference.
server_session_dtl.hpp
Go to the documentation of this file.
1/* Flow-IPC: Sessions
2 * Copyright 2023 Akamai Technologies, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the
5 * "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in
12 * writing, software distributed under the License is
13 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14 * CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing
16 * permissions and limitations under the License. */
17
18/// @file
19#pragma once
20
22
23namespace ipc::session
24{
25
26// Types.
27
28/**
29 * This is the data-less sub-class of Server_session or any more-advanced (e.g., SHM-capable) variant thereof
30 * that exposes `protected` APIs hidden from public user by providing public access to them; this is used internally
31 * by Session_server. The background is briefly explained in the impl section of Server_session doc header.
32 *
33 * @tparam Server_session_t
34 * The object whose `protected` stuff to expose.
35 */
36template<typename Server_session_t>
38 public Server_session_t
39{
40public:
41 // Types.
42
43 /// Short-hand for base class.
45
46 /// See `protected` counterpart.
47 using Session_base_obj = typename Base::Session_base_obj;
48
49 // Constructors/destructor.
50
51 /**
52 * See `protected` counterpart.
53 *
54 * @param logger_ptr
55 * See `protected` counterpart.
56 * @param srv_app_ref
57 * See `protected` counterpart.
58 * @param master_channel_sock_stm
59 * See `protected` counterpart.
60 */
61 explicit Server_session_dtl(flow::log::Logger* logger_ptr, const Server_app& srv_app_ref,
62 transport::sync_io::Native_socket_stream&& master_channel_sock_stm);
63
64 // Methods.
65
66 /**
67 * See `protected` counterpart.
68 *
69 * @param srv
70 * See `protected` counterpart.
71 * @param init_channels_by_srv_req
72 * See `protected` counterpart.
73 * @param mdt_from_cli_or_null
74 * See `protected` counterpart.
75 * @param init_channels_by_cli_req
76 * See `protected` counterpart.
77 * @param cli_app_lookup_func
78 * See `protected` counterpart.
79 * @param cli_namespace_func
80 * See `protected` counterpart.
81 * @param pre_rsp_setup_func
82 * See `protected` counterpart.
83 * @param n_init_channels_by_srv_req_func
84 * See `protected` counterpart.
85 * @param mdt_load_func
86 * See `protected` counterpart.
87 * @param on_done_func
88 * See `protected` counterpart.
89 */
90 template<typename Session_server_impl_t,
91 typename Task_err, typename Cli_app_lookup_func, typename Cli_namespace_func, typename Pre_rsp_setup_func,
92 typename N_init_channels_by_srv_req_func, typename Mdt_load_func>
93 void async_accept_log_in(Session_server_impl_t* srv,
94 typename Base::Channels* init_channels_by_srv_req,
95 typename Base::Mdt_reader_ptr* mdt_from_cli_or_null,
96 typename Base::Channels* init_channels_by_cli_req,
97 Cli_app_lookup_func&& cli_app_lookup_func, Cli_namespace_func&& cli_namespace_func,
98 Pre_rsp_setup_func&& pre_rsp_setup_func,
99 N_init_channels_by_srv_req_func&& n_init_channels_by_srv_req_func,
100 Mdt_load_func&& mdt_load_func,
101 Task_err&& on_done_func);
102
103 /**
104 * Provides `const` access to Session_base super-object.
105 * @return See above.
106 */
107 const Session_base_obj& base() const;
108}; // class Server_session_dtl
109
110// Template implementations.
111
112/// Internally used macro; public API users should disregard (same deal as in struc/channel.hpp).
113#define TEMPLATE_SRV_SESSION_DTL \
114 template<typename Server_session_t>
115/// Internally used macro; public API users should disregard (same deal as in struc/channel.hpp).
116#define CLASS_SRV_SESSION_DTL \
117 Server_session_dtl<Server_session_t>
118
120CLASS_SRV_SESSION_DTL::Server_session_dtl(flow::log::Logger* logger_ptr, const Server_app& srv_app_ref,
121 transport::sync_io::Native_socket_stream&& master_channel_sock_stm) :
122 Base(logger_ptr, srv_app_ref, std::move(master_channel_sock_stm))
123{
124 // Yep.
125}
126
128template<typename Session_server_impl_t,
129 typename Task_err, typename Cli_app_lookup_func, typename Cli_namespace_func, typename Pre_rsp_setup_func,
130 typename N_init_channels_by_srv_req_func, typename Mdt_load_func>
131void CLASS_SRV_SESSION_DTL::async_accept_log_in
132 (Session_server_impl_t* srv,
133 typename Base::Channels* init_channels_by_srv_req,
134 typename Base::Mdt_reader_ptr* mdt_from_cli_or_null,
135 typename Base::Channels* init_channels_by_cli_req,
136 Cli_app_lookup_func&& cli_app_lookup_func,
137 Cli_namespace_func&& cli_namespace_func,
138 Pre_rsp_setup_func&& pre_rsp_setup_func,
139 N_init_channels_by_srv_req_func&& n_init_channels_by_srv_req_func,
140 Mdt_load_func&& mdt_load_func,
141 Task_err&& on_done_func)
142{
143 Base::async_accept_log_in(srv, init_channels_by_srv_req, mdt_from_cli_or_null, init_channels_by_cli_req,
144 std::move(cli_app_lookup_func), std::move(cli_namespace_func),
145 std::move(pre_rsp_setup_func),
146 std::move(n_init_channels_by_srv_req_func), std::move(mdt_load_func),
147 std::move(on_done_func));
148}
149
151const typename CLASS_SRV_SESSION_DTL::Session_base_obj& CLASS_SRV_SESSION_DTL::base() const
152{
153 return Base::base();
154}
155
156#undef CLASS_SRV_SESSION_DTL
157#undef TEMPLATE_SRV_SESSION_DTL
158
159} // namespace ipc::session
This is the data-less sub-class of Server_session or any more-advanced (e.g., SHM-capable) variant th...
void async_accept_log_in(Session_server_impl_t *srv, typename Base::Channels *init_channels_by_srv_req, typename Base::Mdt_reader_ptr *mdt_from_cli_or_null, typename Base::Channels *init_channels_by_cli_req, Cli_app_lookup_func &&cli_app_lookup_func, Cli_namespace_func &&cli_namespace_func, Pre_rsp_setup_func &&pre_rsp_setup_func, N_init_channels_by_srv_req_func &&n_init_channels_by_srv_req_func, Mdt_load_func &&mdt_load_func, Task_err &&on_done_func)
See protected counterpart.
typename Base::Session_base_obj Session_base_obj
See protected counterpart.
const Session_base_obj & base() const
Provides const access to Session_base super-object.
Server_session_dtl(flow::log::Logger *logger_ptr, const Server_app &srv_app_ref, transport::sync_io::Native_socket_stream &&master_channel_sock_stm)
See protected counterpart.
Implements both sync_io::Native_handle_sender and sync_io::Native_handle_receiver concepts by using a...
Flow-IPC module providing the broad lifecycle and shared-resource organization – via the session conc...
Definition: app.cpp:27
#define TEMPLATE_SRV_SESSION_DTL
Internally used macro; public API users should disregard (same deal as in struc/channel....
An App that is used as a server in at least one client-server IPC split.
Definition: app.hpp:206