34 #include <psp_gateway.pb.h>
35 #include <psp_gateway.grpc.pb.h>
40 struct doca_flow_crypto_psp_spi_key_bulk;
80 const ::psp_gateway::MultiTunnelRequest *request,
81 ::psp_gateway::MultiTunnelResponse *response)
override;
92 const ::psp_gateway::KeyRotationRequest *request,
93 ::psp_gateway::KeyRotationResponse *response)
override;
120 size_t try_connect(std::vector<psp_gw_peer> &peers);
130 static uint32_t psp_version_to_key_length_bits(uint32_t psp_proto_ver)
132 return (psp_proto_ver == 0 || psp_proto_ver == 2) ? 128 : 256;
154 bool supply_reverse_params,
155 bool suppress_failure_msg,
164 ::psp_gateway::PSP_Gateway::Stub *get_stub(
const std::string &peer_ip);
182 int select_psp_version(const ::psp_gateway::MultiTunnelRequest *request)
const;
190 bool is_psp_ver_supported(uint32_t psp_ver)
const
203 void fill_tunnel_params(
int psp_ver, uint32_t *key, uint32_t spi, psp_gateway::TunnelParameters *params);
214 doca_error_t generate_keys_spis(uint32_t key_len_bits, uint32_t nr_keys_spis, uint32_t *keys, uint32_t *spis);
223 doca_error_t add_encrypt_entries(std::vector<psp_session_and_key_t> &new_sessions_keys,
224 std::string peer_svc_addr);
236 const psp_gateway::TunnelParameters ¶ms,
237 std::vector<psp_session_and_key_t> &sessions_keys_prepared);
246 void debug_key(
const char *msg_prefix,
const void *key,
size_t key_size_bytes)
const;
254 uint32_t next_crypto_id(
void);
265 uint64_t next_request_id{};
268 const bool DEBUG_KEYS{
false};
271 std::map<std::string, std::unique_ptr<::psp_gateway::PSP_Gateway::Stub>> stubs;
274 std::map<session_key, psp_session_t> sessions;
277 uint32_t next_crypto_id_ = 1;
The entity which owns all the doca flow shared resources and flow pipes (but not sessions).
Implementation of the PSP_Gateway service.
doca_error_t handle_miss_packet(struct rte_mbuf *packet)
Handles any "miss" packets received by RSS which indicate a new tunnel connection is needed.
::grpc::Status RequestKeyRotation(::grpc::ServerContext *context, const ::psp_gateway::KeyRotationRequest *request, ::psp_gateway::KeyRotationResponse *response) override
Requests that the recipient rotate the PSP master key.
PSP_GatewayImpl(psp_gw_app_config *config, PSP_GatewayFlows *psp_flows)
Constructs the object. This operation cannot fail.
::grpc::Status RequestMultipleTunnelParams(::grpc::ServerContext *context, const ::psp_gateway::MultiTunnelRequest *request, ::psp_gateway::MultiTunnelResponse *response) override
Requests that the recipient allocate multiple SPIs and encryption keys so that the initiator can begi...
doca_error_t show_flow_counts(void)
Displays the counters of all tunnel sessions that have changed since the previous invocation.
static constexpr uint16_t DEFAULT_HTTP_PORT_NUM
size_t try_connect(std::vector< psp_gw_peer > &peers)
Attempt to establish tunnels to each of the passed peers. On success, a given peer is removed from th...
enum doca_error doca_error_t
DOCA API return codes.
const std::set< uint32_t > SUPPORTED_PSP_VERSIONS
std::pair< psp_session_t *, void * > psp_session_and_key_t
describes the configuration of the PSP networking service on the local host.
Describes a peer which is capable of exchanging traffic flows over a PSP tunnel.
Maintains the state of the host PF.