| 1 | /************************************************************************************ |
| 2 | * |
| 3 | * D++, A Lightweight C++ library for Discord |
| 4 | * |
| 5 | * SPDX-License-Identifier: Apache-2.0 |
| 6 | * Copyright 2021 Craig Edwards and D++ contributors |
| 7 | * (https://github.com/brainboxdotcc/DPP/graphs/contributors) |
| 8 | * |
| 9 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | * you may not use this file except in compliance with the License. |
| 11 | * You may obtain a copy of the License at |
| 12 | * |
| 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | * |
| 15 | * Unless required by applicable law or agreed to in writing, software |
| 16 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | * See the License for the specific language governing permissions and |
| 19 | * limitations under the License. |
| 20 | * |
| 21 | ************************************************************************************/ |
| 22 | #pragma once |
| 23 | #include <dpp/export.h>cxx . . $ `<file>/include/dpp/export.h`/ |
| 24 | #include <string> |
| 25 | #include <cstdint> |
| 26 | |
| 27 | namespace dppcxx . . $ dpp/::detailcxx . . $ dpp/detail/ { |
| 28 | |
| 29 | struct wrapped_ssl_ctxcxx . . $ dpp/detail/wrapped_ssl_ctx#; |
| 30 | |
| 31 | /** |
| 32 | * @brief Generate a new wrapped SSL context. |
| 33 | * If an SSL context already exists for the given port number, it will be returned, else a new one will be |
| 34 | * generated and cached. Contexts with port = 0 will be considered client contexts. There can only be one |
| 35 | * client context at a time and it covers all SSL client connections. There can be many SSL server contexts, |
| 36 | * individual ones can be cached per-port, each with their own loaded SSL private and public key PEM certificate. |
| 37 | * |
| 38 | * @param port Port number. Pass zero to create or get the client context. |
| 39 | * @param private_key Private key PEM pathname for server contexts |
| 40 | * @param public_key Public key PEM pathname for server contexts |
| 41 | * @return wrapped SSL context |
| 42 | */ |
| 43 | DPP_EXPORTcxx . . $ `include/dpp/export.h:55:12`! wrapped_ssl_ctxcxx . . $ dpp/detail/wrapped_ssl_ctx#* generate_ssl_contextcxx . . $ dpp/detail/generate_ssl_context(52fcd11ca3290fcf).(uint16_tcxx . . $ uint16_t# port = 0, const stdcxx . . $ std/::stringcxx . . $ std/string# &private_key = ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., const stdcxx . . $ std/::stringcxx . . $ std/string# &public_key = ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 44 | |
| 45 | /** |
| 46 | * @brief Release an SSL context |
| 47 | * @warning Only do this if you are certain no SSL connections remain that use this context. |
| 48 | * As OpenSSL is a C library it is impossible for us to track this on its behalf. Be careful! |
| 49 | * @param port port number to release |
| 50 | */ |
| 51 | DPP_EXPORTcxx . . $ `include/dpp/export.h:55:12`! void release_ssl_contextcxx . . $ dpp/detail/release_ssl_context(ed53e3bbd3fa2f69).(uint16_tcxx . . $ uint16_t# port = 0); |
| 52 | |
| 53 | }; |