session: refactor local/cut-through listens
[vpp.git] / src / vnet / session / application_local.h
1 /*
2  * Copyright (c) 2019 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16
17 #ifndef SRC_VNET_SESSION_APPLICATION_LOCAL_H_
18 #define SRC_VNET_SESSION_APPLICATION_LOCAL_H_
19
20 #include <vnet/session/application.h>
21
22 local_session_t *application_local_listen_session_alloc (application_t * app);
23 void application_local_listener_session_endpoint (session_t * ll,
24                                                   session_endpoint_t * sep);
25
26 local_session_t *app_worker_local_session_alloc (app_worker_t * app_wrk);
27 void app_worker_local_session_free (app_worker_t * app_wrk,
28                                     local_session_t * s);
29 local_session_t *app_worker_get_local_session (app_worker_t * app_wrk,
30                                                u32 session_index);
31 local_session_t *app_worker_get_local_session_from_handle (session_handle_t
32                                                            handle);
33
34 void app_worker_local_sessions_free (app_worker_t * app_wrk);
35 int app_worker_local_session_cleanup (app_worker_t * client_wrk,
36                                       app_worker_t * server_wrk,
37                                       local_session_t * ls);
38
39 int app_worker_local_session_connect_notify (local_session_t * ls);
40 int app_worker_local_session_connect (app_worker_t * client,
41                                       app_worker_t * server,
42                                       session_t * ls, u32 opaque);
43 int app_worker_local_session_disconnect (u32 app_or_wrk,
44                                          local_session_t * ls);
45 int app_worker_local_session_disconnect_w_index (u32 app_or_wrk,
46                                                  u32 ls_index);
47
48 void app_worker_format_local_sessions (app_worker_t * app_wrk, int verbose);
49 void app_worker_format_local_connects (app_worker_t * app, int verbose);
50
51 void mq_send_local_session_disconnected_cb (u32 app_or_wrk,
52                                             local_session_t * ls);
53
54 always_inline u8
55 application_local_session_listener_has_transport (local_session_t * ls)
56 {
57   transport_proto_t tp;
58   tp = session_type_transport_proto (ls->listener_session_type);
59   return (tp != TRANSPORT_PROTO_NONE);
60 }
61
62 #endif /* SRC_VNET_SESSION_APPLICATION_LOCAL_H_ */
63
64 /*
65  * fd.io coding-style-patch-verification: ON
66  *
67  * Local Variables:
68  * eval: (c-set-style "gnu")
69  * End:
70  */