FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
stream_session.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 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 #ifndef SRC_VNET_SESSION_STREAM_SESSION_H_
17 #define SRC_VNET_SESSION_STREAM_SESSION_H_
18 
19 #include <vnet/vnet.h>
20 #include <svm/svm_fifo.h>
21 #include <vnet/session/transport.h>
22 
24 
25 /*
26  * Application session state
27  */
28 typedef enum
29 {
38 
39 typedef struct _stream_session_t
40 {
41  /** fifo pointers. Once allocated, these do not move */
42  svm_fifo_t *server_rx_fifo;
43  svm_fifo_t *server_tx_fifo;
44 
45  /** Type */
46  session_type_t session_type;
47 
48  /** State */
49  volatile u8 session_state;
50 
51  u8 thread_index;
52 
53  /** To avoid n**2 "one event per frame" check */
54  u8 enqueue_epoch;
55 
56  /** svm segment index where fifos were allocated */
57  u32 svm_segment_index;
58 
59  /** Session index in per_thread pool */
60  u32 session_index;
61 
62  /** Transport specific */
63  u32 connection_index;
64 
65  /** stream server pool index */
66  u32 app_index;
67 
68  /** Parent listener session if the result of an accept */
69  u32 listener_index;
70 
73 
74 typedef struct _session_endpoint
75 {
76  /*
77  * Network specific
78  */
79 #define _(type, name) type name;
81 #undef _
82  /*
83  * Session specific
84  */
85  u8 transport_proto; /**< transport protocol for session */
87 
88 #define SESSION_IP46_ZERO \
89 { \
90  .ip6 = { \
91  { 0, 0, }, \
92  }, \
93 }
94 #define SESSION_ENDPOINT_NULL \
95 { \
96  .sw_if_index = ENDPOINT_INVALID_INDEX, \
97  .ip = SESSION_IP46_ZERO, \
98  .fib_index = ENDPOINT_INVALID_INDEX, \
99  .is_ip4 = 0, \
100  .port = 0, \
101  .transport_proto = 0, \
102 }
103 
104 #define session_endpoint_to_transport(_sep) ((transport_endpoint_t *)_sep)
105 
108 {
109  return sep->is_ip4 ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6;
110 }
111 
112 #endif /* SRC_VNET_SESSION_STREAM_SESSION_H_ */
113 
114 /*
115  * fd.io coding-style-patch-verification: ON
116  *
117  * Local Variables:
118  * eval: (c-set-style "gnu")
119  * End:
120  */
u8 pad[3]
log2 (size of the packing page block)
Definition: bihash_doc.h:61
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
Definition: cache.h:68
struct _svm_fifo svm_fifo_t
stream_session_state_t
#define always_inline
Definition: clib.h:92
struct _stream_session_t stream_session_t
struct _session_endpoint session_endpoint_t
unsigned int u32
Definition: types.h:88
u8 session_type_t
static u8 session_endpoint_fib_proto(session_endpoint_t *sep)
static int app_index
#define foreach_transport_connection_fields
port in net order
Definition: transport.h:80
unsigned char u8
Definition: types.h:56