Compare commits
71 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ffb86d5a0 | |||
|
|
ebb3931272 | ||
| 6e67d285c2 | |||
|
|
ceb4368daf | ||
|
|
4dcf45fb61 | ||
|
|
21175d735b | ||
|
|
ae025b25ce | ||
|
|
3e29dc5ec9 | ||
|
|
0da2395974 | ||
|
|
1fc736c3ab | ||
|
|
09131638d7 | ||
|
|
90c922bd87 | ||
|
|
06c684c090 | ||
|
|
f599d4b31d | ||
|
|
632f977c5f | ||
|
|
80c72ef098 | ||
|
|
a0832676d2 | ||
|
|
229d9b3c43 | ||
|
|
4c57fac547 | ||
|
|
92cfabb27d | ||
|
|
9e9512d76a | ||
|
|
b23674d2d4 | ||
|
|
c563cc788e | ||
|
|
f43ab8ea6c | ||
|
|
dac44f83d0 | ||
|
|
90639f939f | ||
|
|
75171c7f8a | ||
|
|
64d7c74aa5 | ||
|
|
d8d5db4ff0 | ||
|
|
0e13205fce | ||
|
|
026c8fb666 | ||
|
|
472433e7fc | ||
|
|
2e0192b23b | ||
|
|
a8e551a8fe | ||
|
|
b4ae8501ca | ||
|
|
bff04aa088 | ||
|
|
ec511463f3 | ||
|
|
287243d2ba | ||
|
|
71328824f5 | ||
|
|
b45daa62c9 | ||
|
|
7def98db4a | ||
|
|
d2b9463ad7 | ||
| e90972a1b0 | |||
| 6848e56fb6 | |||
|
|
29afc289bb | ||
| b6689cd478 | |||
| 0288fc8adc | |||
|
|
ec4df79c9e | ||
| d5818c3299 | |||
|
|
5b606b54f9 | ||
|
|
24ba0a637d | ||
|
|
c8f75fd8ba | ||
|
|
282fbd9a99 | ||
|
|
4542dc5679 | ||
|
|
f7f630a181 | ||
|
|
a7208adaa0 | ||
|
|
78679f7a46 | ||
|
|
b20ac2a4a8 | ||
|
|
a3c4b6bfaf | ||
|
|
42cca8c2c2 | ||
|
|
14de0ad733 | ||
|
|
1d7299786c | ||
|
|
bf28a43fbe | ||
|
|
1e77fccc5f | ||
|
|
ae075c552e | ||
|
|
4db10b83d9 | ||
|
|
be33289503 | ||
|
|
6d7bf78649 | ||
|
|
a8c942e652 | ||
|
|
f44caeedb7 | ||
|
|
e0f70152ff |
106
3rdparty/mysql/jdbc/cppconn/build_config.h
vendored
106
3rdparty/mysql/jdbc/cppconn/build_config.h
vendored
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_BUILD_CONFIG_H_
|
||||
#define _SQL_BUILD_CONFIG_H_
|
||||
|
||||
#ifdef STATIC_CONCPP
|
||||
#define CPPCONN_PUBLIC_FUNC
|
||||
#endif
|
||||
|
||||
|
||||
#if defined _MSC_VER
|
||||
|
||||
#define DLL_EXPORT __declspec(dllexport)
|
||||
#define DLL_IMPORT __declspec(dllimport)
|
||||
#define DLL_LOCAL
|
||||
|
||||
#elif __GNUC__ >= 4
|
||||
|
||||
#define DLL_EXPORT __attribute__ ((visibility ("default")))
|
||||
#define DLL_IMPORT
|
||||
#define DLL_LOCAL __attribute__ ((visibility ("hidden")))
|
||||
|
||||
#elif defined __SUNPRO_CC || defined __SUNPRO_C
|
||||
|
||||
#define DLL_EXPORT __global
|
||||
#define DLL_IMPORT __global
|
||||
#define DLL_LOCAL __hidden
|
||||
|
||||
#else
|
||||
|
||||
#define DLL_EXPORT
|
||||
#define DLL_IMPORT
|
||||
#define DLL_LOCAL
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef CPPCONN_PUBLIC_FUNC
|
||||
|
||||
#ifdef connector_jdbc_EXPORTS
|
||||
#define CPPCONN_PUBLIC_FUNC DLL_EXPORT
|
||||
#else
|
||||
// this is for static build
|
||||
#ifdef CPPCONN_LIB_BUILD
|
||||
#define CPPCONN_PUBLIC_FUNC
|
||||
#else
|
||||
// this is for clients using dynamic lib
|
||||
#define CPPCONN_PUBLIC_FUNC DLL_IMPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
/*
|
||||
Warning 4251 is about non dll-interface classes being used by ones exported
|
||||
from our DLL (for example std lib classes or Boost ones). Following
|
||||
the crowd, we ignore this issue for now.
|
||||
*/
|
||||
|
||||
__pragma(warning (disable:4251))
|
||||
|
||||
#elif defined __SUNPRO_CC || defined __SUNPRO_C
|
||||
#else
|
||||
|
||||
/*
|
||||
These are triggered by, e.g., std::auto_ptr<> which is used by Boost.
|
||||
*/
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#endif
|
||||
|
||||
#endif //#ifndef _SQL_BUILD_CONFIG_H_
|
||||
195
3rdparty/mysql/jdbc/cppconn/callback.h
vendored
195
3rdparty/mysql/jdbc/cppconn/callback.h
vendored
@@ -1,195 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_CALLBACK_H_
|
||||
#define _SQL_CALLBACK_H_
|
||||
|
||||
#include "sqlstring.h"
|
||||
#include <functional>
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
||||
namespace mysql
|
||||
{
|
||||
class MySQL_Connection;
|
||||
class MySQL_Driver;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
A callback to be used with `Driver::setCallback()` to define reaction
|
||||
to the user action request during WebAuthn authentication handshake.
|
||||
|
||||
The client library defines default reaction which prints message on stderr.
|
||||
This callback can be used to change it.
|
||||
|
||||
Example usage:
|
||||
|
||||
// Use lambda
|
||||
|
||||
driver->setCallback(WebAuthn_Callback{[](SQLString msg){
|
||||
cerr << "User action request: " << msg << endl;
|
||||
}});
|
||||
|
||||
// Disable default behavior (and do nothing upon action request)
|
||||
|
||||
driver->setCallback(WebAuthn_Callback{});
|
||||
|
||||
// Return to default behavior
|
||||
|
||||
driver->setCallbacak(WebAuthn_Callback{nullptr});
|
||||
|
||||
// User defined callback
|
||||
|
||||
struct My_Callback : WebAuthn_Callback
|
||||
{
|
||||
void ActionRequested(SQLString) override;
|
||||
}
|
||||
cb;
|
||||
|
||||
driver->setCallback(cb);
|
||||
*/
|
||||
|
||||
class WebAuthn_Callback
|
||||
{
|
||||
std::function<void(SQLString)> callback_func;
|
||||
|
||||
public:
|
||||
|
||||
/*
|
||||
Create a callback that will call given lambda upon user action request.
|
||||
*/
|
||||
|
||||
WebAuthn_Callback(std::function<void(SQLString)>&& cb)
|
||||
: callback_func{std::move(cb)}
|
||||
{}
|
||||
|
||||
/*
|
||||
Create an empty callback that will do nothing upon user action request.
|
||||
This disables the default callback defined by the client library.
|
||||
*/
|
||||
|
||||
WebAuthn_Callback()
|
||||
: callback_func{[](SQLString){}}
|
||||
{}
|
||||
|
||||
/*
|
||||
Create a null callback. Setting such callback has the effect of using
|
||||
the default callback defined by the client library.
|
||||
*/
|
||||
|
||||
WebAuthn_Callback(std::nullptr_t)
|
||||
{}
|
||||
|
||||
/*
|
||||
Derived class can override this method to react to user action request.
|
||||
*/
|
||||
|
||||
virtual void ActionRequested(sql::SQLString msg)
|
||||
{
|
||||
if (callback_func)
|
||||
callback_func(msg);
|
||||
}
|
||||
|
||||
// Returns true if this callback is not null.
|
||||
|
||||
operator bool() const
|
||||
{
|
||||
return (bool)callback_func;
|
||||
}
|
||||
|
||||
void operator()(sql::SQLString msg)
|
||||
{
|
||||
ActionRequested(msg);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Class that provides functionality allowing user code to set the
|
||||
* callback functions through inheriting, passing the callback as
|
||||
* constructor parameters or using lambdas.
|
||||
*/
|
||||
|
||||
class Fido_Callback
|
||||
{
|
||||
std::function<void(SQLString)> callback_func = nullptr;
|
||||
bool is_null = false;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor to set the callback as function or as lambda
|
||||
*/
|
||||
Fido_Callback(std::function<void(SQLString)> cb) : callback_func(cb)
|
||||
{}
|
||||
|
||||
Fido_Callback()
|
||||
{}
|
||||
|
||||
/**
|
||||
* Constructor to reset the callback to default
|
||||
*/
|
||||
Fido_Callback(std::nullptr_t) : is_null(true)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Override this message to receive Fido Action Requests
|
||||
*/
|
||||
virtual void FidoActionRequested(sql::SQLString msg)
|
||||
{
|
||||
if (callback_func)
|
||||
callback_func(msg);
|
||||
}
|
||||
|
||||
operator bool() const
|
||||
{
|
||||
return !is_null;
|
||||
}
|
||||
|
||||
void operator()(sql::SQLString msg)
|
||||
{
|
||||
if (is_null)
|
||||
return;
|
||||
FidoActionRequested(msg);
|
||||
}
|
||||
|
||||
friend class mysql::MySQL_Connection;
|
||||
friend class mysql::MySQL_Driver;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
#endif // _SQL_CONNECTION_H_
|
||||
117
3rdparty/mysql/jdbc/cppconn/config.h
vendored
117
3rdparty/mysql/jdbc/cppconn/config.h
vendored
@@ -1,117 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// libmysql defines HAVE_STRTOUL (on win), so we have to follow different pattern in definitions names
|
||||
// to avoid annoying warnings.
|
||||
|
||||
#define HAVE_FUNCTION_STRTOLD 1
|
||||
#define HAVE_FUNCTION_STRTOLL 1
|
||||
#define HAVE_FUNCTION_STRTOL 1
|
||||
#define HAVE_FUNCTION_STRTOULL 1
|
||||
|
||||
#define HAVE_FUNCTION_STRTOUL 1
|
||||
|
||||
#define HAVE_FUNCTION_STRTOIMAX 1
|
||||
#define HAVE_FUNCTION_STRTOUMAX 1
|
||||
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
#define HAVE_INT8_T 1
|
||||
#define HAVE_UINT8_T 1
|
||||
#define HAVE_INT16_T 1
|
||||
#define HAVE_UINT16_T 1
|
||||
#define HAVE_INT32_T 1
|
||||
#define HAVE_UINT32_T 1
|
||||
#define HAVE_INT32_T 1
|
||||
#define HAVE_UINT32_T 1
|
||||
#define HAVE_INT64_T 1
|
||||
#define HAVE_UINT64_T 1
|
||||
#define HAVE_MS_INT8 1
|
||||
#define HAVE_MS_UINT8 1
|
||||
#define HAVE_MS_INT16 1
|
||||
#define HAVE_MS_UINT16 1
|
||||
#define HAVE_MS_INT32 1
|
||||
#define HAVE_MS_UINT32 1
|
||||
#define HAVE_MS_INT64 1
|
||||
#define HAVE_MS_UINT64 1
|
||||
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_INTTYPES_H) && !defined(_WIN32)
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifndef CPPCONN_DONT_TYPEDEF_MS_TYPES_TO_C99_TYPES
|
||||
|
||||
#if _MSC_VER >= 1600
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#else
|
||||
|
||||
#if !defined(HAVE_INT8_T) && defined(HAVE_MS_INT8)
|
||||
typedef __int8 int8_t;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MS_UINT8
|
||||
typedef unsigned __int8 uint8_t;
|
||||
#endif
|
||||
#ifdef HAVE_MS_INT16
|
||||
typedef __int16 int16_t;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MS_UINT16
|
||||
typedef unsigned __int16 uint16_t;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MS_INT32
|
||||
typedef __int32 int32_t;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MS_UINT32
|
||||
typedef unsigned __int32 uint32_t;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MS_INT64
|
||||
typedef __int64 int64_t;
|
||||
#endif
|
||||
#ifdef HAVE_MS_UINT64
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#endif
|
||||
|
||||
#endif // _MSC_VER >= 1600
|
||||
#endif // CPPCONN_DONT_TYPEDEF_MS_TYPES_TO_C99_TYPES
|
||||
#endif // _WIN32
|
||||
285
3rdparty/mysql/jdbc/cppconn/connection.h
vendored
285
3rdparty/mysql/jdbc/cppconn/connection.h
vendored
@@ -1,285 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2020, Oracle and/or its affiliates.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_CONNECTION_H_
|
||||
#define _SQL_CONNECTION_H_
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "build_config.h"
|
||||
#include "warning.h"
|
||||
#include "sqlstring.h"
|
||||
#include "variant.h"
|
||||
|
||||
/*
|
||||
Options used on ConnectOptionsMap
|
||||
*/
|
||||
|
||||
/*
|
||||
Connect related
|
||||
*/
|
||||
#define OPT_HOSTNAME "hostName"
|
||||
#define OPT_USERNAME "userName"
|
||||
#define OPT_PASSWORD "password"
|
||||
#define OPT_PASSWORD1 "password1"
|
||||
#define OPT_PASSWORD2 "password2"
|
||||
#define OPT_PASSWORD3 "password3"
|
||||
#define OPT_PORT "port"
|
||||
#define OPT_SOCKET "socket"
|
||||
#define OPT_PIPE "pipe"
|
||||
#define OPT_SCHEMA "schema"
|
||||
#define OPT_MULTI_HOST "OPT_MULTI_HOST"
|
||||
#define OPT_DNS_SRV "OPT_DNS_SRV"
|
||||
#define OPT_NAMED_PIPE "OPT_NAMED_PIPE"
|
||||
#define OPT_INIT_COMMAND "preInit"
|
||||
#define OPT_POST_INIT_COMMAND "postInit"
|
||||
#define OPT_LOCAL_INFILE "OPT_LOCAL_INFILE"
|
||||
#define OPT_LOAD_DATA_LOCAL_DIR "OPT_LOAD_DATA_LOCAL_DIR"
|
||||
|
||||
/*
|
||||
SSL related
|
||||
*/
|
||||
#define OPT_SSL_MODE "ssl-mode"
|
||||
#define OPT_SSL_KEY "ssl-key"
|
||||
#define OPT_SSL_CERT "ssl-cert"
|
||||
#define OPT_SSL_CA "ssl-ca"
|
||||
#define OPT_SSL_CAPATH "ssl-capath"
|
||||
#define OPT_SSL_CIPHER "ssl-cipher"
|
||||
#define OPT_SSL_CRL "ssl-crl"
|
||||
#define OPT_SSL_CRLPATH "ssl-crlpath"
|
||||
#define OPT_SERVER_PUBLIC_KEY "rsaKey"
|
||||
#define OPT_TLS_VERSION "tls-version"
|
||||
|
||||
/*
|
||||
Connection related
|
||||
*/
|
||||
#define OPT_RECONNECT "OPT_RECONNECT"
|
||||
#define OPT_RETRY_COUNT "OPT_RETRY_COUNT"
|
||||
#define OPT_CONNECT_TIMEOUT "OPT_CONNECT_TIMEOUT"
|
||||
#define OPT_READ_TIMEOUT "OPT_READ_TIMEOUT"
|
||||
#define OPT_WRITE_TIMEOUT "OPT_WRITE_TIMEOUT"
|
||||
#define OPT_MAX_ALLOWED_PACKET "OPT_MAX_ALLOWED_PACKET"
|
||||
#define OPT_NET_BUFFER_LENGTH "OPT_NET_BUFFER_LENGTH"
|
||||
|
||||
/*
|
||||
Connection Attributes
|
||||
*/
|
||||
#define OPT_CONNECT_ATTR_ADD "OPT_CONNECT_ATTR_ADD"
|
||||
#define OPT_CONNECT_ATTR_DELETE "OPT_CONNECT_ATTR_DELETE"
|
||||
#define OPT_CONNECT_ATTR_RESET "OPT_CONNECT_ATTR_RESET"
|
||||
|
||||
/*
|
||||
Authentication
|
||||
*/
|
||||
#define OPT_ENABLE_CLEARTEXT_PLUGIN "OPT_ENABLE_CLEARTEXT_PLUGIN"
|
||||
#define OPT_CAN_HANDLE_EXPIRED_PASSWORDS "OPT_CAN_HANDLE_EXPIRED_PASSWORDS"
|
||||
#define OPT_GET_SERVER_PUBLIC_KEY "OPT_GET_SERVER_PUBLIC_KEY"
|
||||
#define OPT_LEGACY_AUTH "useLegacyAuth"
|
||||
#define OPT_DEFAULT_AUTH "defaultAuth"
|
||||
|
||||
/*
|
||||
Charracter set results and Metadata
|
||||
*/
|
||||
#define OPT_CHARACTER_SET_RESULTS "characterSetResults"
|
||||
#define OPT_OPTIONAL_RESULTSET_METADATA "OPT_OPTIONAL_RESULTSET_METADATA"
|
||||
#define OPT_REPORT_DATA_TRUNCATION "OPT_REPORT_DATA_TRUNCATION"
|
||||
#define OPT_CHARSET_NAME "OPT_CHARSET_NAME"
|
||||
#define OPT_DEFAULT_STMT_RESULT_TYPE "defaultStatementResultType"
|
||||
|
||||
/*
|
||||
Client side options
|
||||
*/
|
||||
#define OPT_CLIENT_COMPRESS "CLIENT_COMPRESS"
|
||||
#define OPT_CLIENT_FOUND_ROWS "CLIENT_FOUND_ROWS"
|
||||
#define OPT_CLIENT_IGNORE_SIGPIPE "CLIENT_IGNORE_SIGPIPE"
|
||||
#define OPT_CLIENT_IGNORE_SPACE "CLIENT_IGNORE_SPACE"
|
||||
#define OPT_CLIENT_INTERACTIVE "CLIENT_INTERACTIVE"
|
||||
#define OPT_CLIENT_LOCAL_FILES "CLIENT_LOCAL_FILES"
|
||||
#define OPT_CLIENT_MULTI_STATEMENTS "CLIENT_MULTI_STATEMENTS"
|
||||
#define OPT_CLIENT_NO_SCHEMA "CLIENT_NO_SCHEMA"
|
||||
#define OPT_SET_CHARSET_DIR "charsetDir"
|
||||
#define OPT_PLUGIN_DIR "pluginDir"
|
||||
#define OPT_READ_DEFAULT_GROUP "readDefaultGroup"
|
||||
#define OPT_READ_DEFAULT_FILE "readDefaultFile"
|
||||
|
||||
/*
|
||||
Auth plugin options
|
||||
*/
|
||||
#define OPT_OCI_CONFIG_FILE "OPT_OCI_CONFIG_FILE"
|
||||
#define OPT_AUTHENTICATION_KERBEROS_CLIENT_MODE \
|
||||
"OPT_AUTHENTICATION_KERBEROS_CLIENT_MODE"
|
||||
#define OPT_OCI_CLIENT_CONFIG_PROFILE "OPT_OCI_CLIENT_CONFIG_PROFILE"
|
||||
|
||||
/*
|
||||
Telemetry options
|
||||
*/
|
||||
#define OPT_OPENTELEMETRY "OPT_OPENTELEMETRY"
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
||||
typedef sql::Variant ConnectPropertyVal;
|
||||
|
||||
typedef std::map< sql::SQLString, ConnectPropertyVal > ConnectOptionsMap;
|
||||
|
||||
class DatabaseMetaData;
|
||||
class PreparedStatement;
|
||||
class Statement;
|
||||
class Driver;
|
||||
|
||||
typedef enum transaction_isolation
|
||||
{
|
||||
TRANSACTION_NONE= 0,
|
||||
TRANSACTION_READ_COMMITTED,
|
||||
TRANSACTION_READ_UNCOMMITTED,
|
||||
TRANSACTION_REPEATABLE_READ,
|
||||
TRANSACTION_SERIALIZABLE
|
||||
} enum_transaction_isolation;
|
||||
|
||||
enum ssl_mode
|
||||
{
|
||||
SSL_MODE_DISABLED= 1, SSL_MODE_PREFERRED, SSL_MODE_REQUIRED,
|
||||
SSL_MODE_VERIFY_CA, SSL_MODE_VERIFY_IDENTITY
|
||||
};
|
||||
|
||||
typedef enum opentelemetry_mode
|
||||
{
|
||||
OTEL_DISABLED = 1, OTEL_PREFERRED, OTEL_REQUIRED
|
||||
} enum_opentelemetry_mode;
|
||||
|
||||
class CPPCONN_PUBLIC_FUNC Savepoint
|
||||
{
|
||||
/* Prevent use of these */
|
||||
Savepoint(const Savepoint &);
|
||||
void operator=(Savepoint &);
|
||||
public:
|
||||
Savepoint() {};
|
||||
virtual ~Savepoint() {};
|
||||
virtual int getSavepointId() = 0;
|
||||
|
||||
virtual sql::SQLString getSavepointName() = 0;
|
||||
};
|
||||
|
||||
|
||||
class CPPCONN_PUBLIC_FUNC Connection
|
||||
{
|
||||
/* Prevent use of these */
|
||||
Connection(const Connection &);
|
||||
void operator=(Connection &);
|
||||
public:
|
||||
|
||||
Connection() {};
|
||||
|
||||
virtual ~Connection() {};
|
||||
|
||||
virtual void clearWarnings() = 0;
|
||||
|
||||
virtual Statement *createStatement() = 0;
|
||||
|
||||
virtual void close() = 0;
|
||||
|
||||
virtual void commit() = 0;
|
||||
|
||||
virtual bool getAutoCommit() = 0;
|
||||
|
||||
virtual sql::SQLString getCatalog() = 0;
|
||||
|
||||
virtual Driver *getDriver() = 0;
|
||||
|
||||
virtual sql::SQLString getSchema() = 0;
|
||||
|
||||
virtual sql::SQLString getClientInfo() = 0;
|
||||
|
||||
virtual void getClientOption(const sql::SQLString & optionName, void * optionValue) = 0;
|
||||
|
||||
virtual sql::SQLString getClientOption(const sql::SQLString & optionName) = 0;
|
||||
|
||||
virtual DatabaseMetaData * getMetaData() = 0;
|
||||
|
||||
virtual enum_transaction_isolation getTransactionIsolation() = 0;
|
||||
|
||||
virtual const SQLWarning * getWarnings() = 0;
|
||||
|
||||
virtual bool isClosed() = 0;
|
||||
|
||||
virtual bool isReadOnly() = 0;
|
||||
|
||||
virtual bool isValid() = 0;
|
||||
|
||||
virtual bool reconnect() = 0;
|
||||
|
||||
virtual sql::SQLString nativeSQL(const sql::SQLString& sql) = 0;
|
||||
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql) = 0;
|
||||
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int autoGeneratedKeys) = 0;
|
||||
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int* columnIndexes) = 0;
|
||||
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency) = 0;
|
||||
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) = 0;
|
||||
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, sql::SQLString columnNames[]) = 0;
|
||||
|
||||
virtual void releaseSavepoint(Savepoint * savepoint) = 0;
|
||||
|
||||
virtual void rollback() = 0;
|
||||
|
||||
virtual void rollback(Savepoint * savepoint) = 0;
|
||||
|
||||
virtual void setAutoCommit(bool autoCommit) = 0;
|
||||
|
||||
virtual void setCatalog(const sql::SQLString& catalog) = 0;
|
||||
|
||||
virtual void setSchema(const sql::SQLString& catalog) = 0;
|
||||
|
||||
virtual sql::Connection * setClientOption(const sql::SQLString & optionName, const void * optionValue) = 0;
|
||||
|
||||
virtual sql::Connection * setClientOption(const sql::SQLString & optionName, const sql::SQLString & optionValue) = 0;
|
||||
|
||||
virtual void setHoldability(int holdability) = 0;
|
||||
|
||||
virtual void setReadOnly(bool readOnly) = 0;
|
||||
|
||||
virtual Savepoint * setSavepoint() = 0;
|
||||
|
||||
virtual Savepoint * setSavepoint(const sql::SQLString& name) = 0;
|
||||
|
||||
virtual void setTransactionIsolation(enum_transaction_isolation level) = 0;
|
||||
|
||||
/* virtual void setTypeMap(Map map) = 0; */
|
||||
};
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
#endif // _SQL_CONNECTION_H_
|
||||
75
3rdparty/mysql/jdbc/cppconn/datatype.h
vendored
75
3rdparty/mysql/jdbc/cppconn/datatype.h
vendored
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_DATATYPE_H_
|
||||
#define _SQL_DATATYPE_H_
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
||||
class DataType
|
||||
{
|
||||
DataType();
|
||||
public:
|
||||
enum {
|
||||
UNKNOWN = 0,
|
||||
BIT,
|
||||
TINYINT,
|
||||
SMALLINT,
|
||||
MEDIUMINT,
|
||||
INTEGER,
|
||||
BIGINT,
|
||||
REAL,
|
||||
DOUBLE,
|
||||
DECIMAL,
|
||||
NUMERIC,
|
||||
CHAR,
|
||||
BINARY,
|
||||
VARCHAR,
|
||||
VARBINARY,
|
||||
LONGVARCHAR,
|
||||
LONGVARBINARY,
|
||||
TIMESTAMP,
|
||||
DATE,
|
||||
TIME,
|
||||
YEAR,
|
||||
GEOMETRY,
|
||||
ENUM,
|
||||
SET,
|
||||
SQLNULL,
|
||||
JSON
|
||||
};
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
||||
#endif /* _SQL_DATATYPE_H_ */
|
||||
106
3rdparty/mysql/jdbc/cppconn/driver.h
vendored
106
3rdparty/mysql/jdbc/cppconn/driver.h
vendored
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_DRIVER_H_
|
||||
#define _SQL_DRIVER_H_
|
||||
|
||||
#include "connection.h"
|
||||
#include "build_config.h"
|
||||
#include "callback.h"
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
||||
class CPPCONN_PUBLIC_FUNC Driver
|
||||
{
|
||||
protected:
|
||||
virtual ~Driver() {}
|
||||
public:
|
||||
// Attempts to make a database connection to the given URL.
|
||||
|
||||
virtual Connection * connect(const sql::SQLString& hostName, const sql::SQLString& userName, const sql::SQLString& password) = 0;
|
||||
|
||||
virtual Connection * connect(ConnectOptionsMap & options) = 0;
|
||||
|
||||
virtual int getMajorVersion() = 0;
|
||||
|
||||
virtual int getMinorVersion() = 0;
|
||||
|
||||
virtual int getPatchVersion() = 0;
|
||||
|
||||
virtual const sql::SQLString & getName() = 0;
|
||||
|
||||
virtual void setCallBack(sql::Fido_Callback &cb) = 0;
|
||||
virtual void setCallBack(sql::Fido_Callback &&cb) = 0;
|
||||
|
||||
virtual void threadInit() = 0;
|
||||
|
||||
virtual void threadEnd() = 0;
|
||||
|
||||
virtual void setCallBack(sql::WebAuthn_Callback &cb) = 0;
|
||||
virtual void setCallBack(sql::WebAuthn_Callback &&cb) = 0;
|
||||
};
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
|
||||
CPPCONN_PUBLIC_FUNC void check(const std::string &);
|
||||
CPPCONN_PUBLIC_FUNC void check(const std::map<std::string,std::string> &);
|
||||
|
||||
/*
|
||||
Checks if user standard lib is compatible with connector one
|
||||
*/
|
||||
inline static void check_lib()
|
||||
{
|
||||
check(std::string{});
|
||||
check(std::map<std::string,std::string>{});
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
CPPCONN_PUBLIC_FUNC sql::Driver * _get_driver_instance_by_name(const char * const clientlib);
|
||||
|
||||
/* If dynamic loading is disabled in a driver then this function works just like get_driver_instance() */
|
||||
inline static sql::Driver * get_driver_instance_by_name(const char * const clientlib)
|
||||
{
|
||||
check_lib();
|
||||
return _get_driver_instance_by_name(clientlib);
|
||||
}
|
||||
|
||||
inline static sql::Driver * get_driver_instance()
|
||||
{
|
||||
return get_driver_instance_by_name("");
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _SQL_DRIVER_H_ */
|
||||
147
3rdparty/mysql/jdbc/cppconn/exception.h
vendored
147
3rdparty/mysql/jdbc/cppconn/exception.h
vendored
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2020, Oracle and/or its affiliates.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_EXCEPTION_H_
|
||||
#define _SQL_EXCEPTION_H_
|
||||
|
||||
#include "build_config.h"
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
||||
#define MEMORY_ALLOC_OPERATORS(Class) \
|
||||
void* operator new(size_t size){ return ::operator new(size); } \
|
||||
void* operator new(size_t, void*) noexcept; \
|
||||
void* operator new(size_t, const std::nothrow_t&) noexcept; \
|
||||
void* operator new[](size_t); \
|
||||
void* operator new[](size_t, void*) noexcept; \
|
||||
void* operator new[](size_t, const std::nothrow_t&) noexcept; \
|
||||
void* operator new(size_t N, std::allocator<Class>&);
|
||||
|
||||
|
||||
class SQLException : public std::runtime_error
|
||||
{
|
||||
protected:
|
||||
const std::string sql_state;
|
||||
const int errNo;
|
||||
|
||||
public:
|
||||
SQLException(const SQLException& e) : std::runtime_error(e.what()), sql_state(e.sql_state), errNo(e.errNo) {}
|
||||
|
||||
SQLException(const std::string& reason, const std::string& SQLState, int vendorCode) :
|
||||
std::runtime_error (reason ),
|
||||
sql_state (SQLState ),
|
||||
errNo (vendorCode)
|
||||
{}
|
||||
|
||||
SQLException(const std::string& reason, const std::string& SQLState) : std::runtime_error(reason), sql_state(SQLState), errNo(0) {}
|
||||
|
||||
SQLException(const std::string& reason) : std::runtime_error(reason), sql_state("HY000"), errNo(0) {}
|
||||
|
||||
SQLException() : std::runtime_error(""), sql_state("HY000"), errNo(0) {}
|
||||
|
||||
const std::string & getSQLState() const
|
||||
{
|
||||
return sql_state;
|
||||
}
|
||||
|
||||
const char * getSQLStateCStr() const
|
||||
{
|
||||
return sql_state.c_str();
|
||||
}
|
||||
|
||||
|
||||
int getErrorCode() const
|
||||
{
|
||||
return errNo;
|
||||
}
|
||||
|
||||
virtual ~SQLException() noexcept {};
|
||||
|
||||
protected:
|
||||
MEMORY_ALLOC_OPERATORS(SQLException)
|
||||
};
|
||||
|
||||
struct MethodNotImplementedException : public SQLException
|
||||
{
|
||||
MethodNotImplementedException(const MethodNotImplementedException& e) : SQLException(e.what(), e.sql_state, e.errNo) { }
|
||||
MethodNotImplementedException(const std::string& reason) : SQLException(reason, "", 0) {}
|
||||
};
|
||||
|
||||
struct InvalidArgumentException : public SQLException
|
||||
{
|
||||
InvalidArgumentException(const InvalidArgumentException& e) : SQLException(e.what(), e.sql_state, e.errNo) { }
|
||||
InvalidArgumentException(const std::string& reason) : SQLException(reason, "", 0) {}
|
||||
};
|
||||
|
||||
struct InvalidInstanceException : public SQLException
|
||||
{
|
||||
InvalidInstanceException(const InvalidInstanceException& e) : SQLException(e.what(), e.sql_state, e.errNo) { }
|
||||
InvalidInstanceException(const std::string& reason) : SQLException(reason, "", 0) {}
|
||||
};
|
||||
|
||||
|
||||
struct NonScrollableException : public SQLException
|
||||
{
|
||||
NonScrollableException(const NonScrollableException& e) : SQLException(e.what(), e.sql_state, e.errNo) { }
|
||||
NonScrollableException(const std::string& reason) : SQLException(reason, "", 0) {}
|
||||
};
|
||||
|
||||
struct SQLUnsupportedOptionException : public SQLException
|
||||
{
|
||||
SQLUnsupportedOptionException(const SQLUnsupportedOptionException& e, const std::string conn_option) :
|
||||
SQLException(e.what(), e.sql_state, e.errNo),
|
||||
option(conn_option )
|
||||
{}
|
||||
|
||||
SQLUnsupportedOptionException(const std::string& reason, const std::string conn_option) :
|
||||
SQLException(reason, "", 0),
|
||||
option(conn_option )
|
||||
{}
|
||||
|
||||
const char *getConnectionOption() const
|
||||
{
|
||||
return option.c_str();
|
||||
}
|
||||
|
||||
~SQLUnsupportedOptionException() noexcept {};
|
||||
protected:
|
||||
const std::string option;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
#endif /* _SQL_EXCEPTION_H_ */
|
||||
494
3rdparty/mysql/jdbc/cppconn/metadata.h
vendored
494
3rdparty/mysql/jdbc/cppconn/metadata.h
vendored
@@ -1,494 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_METADATA_H_
|
||||
#define _SQL_METADATA_H_
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include "datatype.h"
|
||||
#include "sqlstring.h"
|
||||
|
||||
namespace sql
|
||||
{
|
||||
class ResultSet;
|
||||
class Connection;
|
||||
|
||||
class DatabaseMetaData
|
||||
{
|
||||
protected:
|
||||
virtual ~DatabaseMetaData() {}
|
||||
|
||||
public:
|
||||
enum
|
||||
{
|
||||
attributeNoNulls = 0,
|
||||
attributeNullable,
|
||||
attributeNullableUnknown
|
||||
};
|
||||
enum
|
||||
{
|
||||
bestRowTemporary = 0,
|
||||
bestRowTransaction,
|
||||
bestRowSession
|
||||
};
|
||||
enum
|
||||
{
|
||||
bestRowUnknown = 0,
|
||||
bestRowNotPseudo,
|
||||
bestRowPseudo
|
||||
};
|
||||
enum
|
||||
{
|
||||
columnNoNulls = 0,
|
||||
columnNullable,
|
||||
columnNullableUnknown
|
||||
};
|
||||
enum
|
||||
{
|
||||
importedKeyCascade = 0,
|
||||
importedKeyInitiallyDeferred,
|
||||
importedKeyInitiallyImmediate,
|
||||
importedKeyNoAction,
|
||||
importedKeyNotDeferrable,
|
||||
importedKeyRestrict,
|
||||
importedKeySetDefault,
|
||||
importedKeySetNull
|
||||
};
|
||||
enum
|
||||
{
|
||||
procedureColumnIn = 0,
|
||||
procedureColumnInOut,
|
||||
procedureColumnOut,
|
||||
procedureColumnResult,
|
||||
procedureColumnReturn,
|
||||
procedureColumnUnknown,
|
||||
procedureNoNulls,
|
||||
procedureNoResult,
|
||||
procedureNullable,
|
||||
procedureNullableUnknown,
|
||||
procedureResultUnknown,
|
||||
procedureReturnsResult
|
||||
};
|
||||
enum
|
||||
{
|
||||
sqlStateSQL99 = 0,
|
||||
sqlStateXOpen
|
||||
};
|
||||
enum
|
||||
{
|
||||
tableIndexClustered = 0,
|
||||
tableIndexHashed,
|
||||
tableIndexOther,
|
||||
tableIndexStatistic
|
||||
};
|
||||
enum
|
||||
{
|
||||
versionColumnUnknown = 0,
|
||||
versionColumnNotPseudo = 1,
|
||||
versionColumnPseudo = 2
|
||||
};
|
||||
enum
|
||||
{
|
||||
typeNoNulls = 0,
|
||||
typeNullable = 1,
|
||||
typeNullableUnknown = 2
|
||||
};
|
||||
enum
|
||||
{
|
||||
typePredNone = 0,
|
||||
typePredChar = 1,
|
||||
typePredBasic= 2,
|
||||
typeSearchable = 3
|
||||
};
|
||||
|
||||
|
||||
virtual bool allProceduresAreCallable() = 0;
|
||||
|
||||
virtual bool allTablesAreSelectable() = 0;
|
||||
|
||||
virtual bool dataDefinitionCausesTransactionCommit() = 0;
|
||||
|
||||
virtual bool dataDefinitionIgnoredInTransactions() = 0;
|
||||
|
||||
virtual bool deletesAreDetected(int type) = 0;
|
||||
|
||||
virtual bool doesMaxRowSizeIncludeBlobs() = 0;
|
||||
|
||||
virtual ResultSet * getAttributes(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& typeNamePattern, const sql::SQLString& attributeNamePattern) = 0;
|
||||
|
||||
virtual ResultSet * getBestRowIdentifier(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table, int scope, bool nullable) = 0;
|
||||
|
||||
virtual ResultSet * getCatalogs() = 0;
|
||||
|
||||
virtual const sql::SQLString& getCatalogSeparator() = 0;
|
||||
|
||||
virtual const sql::SQLString& getCatalogTerm() = 0;
|
||||
|
||||
virtual ResultSet * getColumnPrivileges(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table, const sql::SQLString& columnNamePattern) = 0;
|
||||
|
||||
virtual ResultSet * getColumns(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern, const sql::SQLString& columnNamePattern) = 0;
|
||||
|
||||
virtual Connection * getConnection() = 0;
|
||||
|
||||
virtual ResultSet * getCrossReference(const sql::SQLString& primaryCatalog, const sql::SQLString& primarySchema, const sql::SQLString& primaryTable, const sql::SQLString& foreignCatalog, const sql::SQLString& foreignSchema, const sql::SQLString& foreignTable) = 0;
|
||||
|
||||
virtual unsigned int getDatabaseMajorVersion() = 0;
|
||||
|
||||
virtual unsigned int getDatabaseMinorVersion() = 0;
|
||||
|
||||
virtual unsigned int getDatabasePatchVersion() = 0;
|
||||
|
||||
virtual const sql::SQLString& getDatabaseProductName() = 0;
|
||||
|
||||
virtual SQLString getDatabaseProductVersion() = 0;
|
||||
|
||||
virtual int getDefaultTransactionIsolation() = 0;
|
||||
|
||||
virtual unsigned int getDriverMajorVersion() = 0;
|
||||
|
||||
virtual unsigned int getDriverMinorVersion() = 0;
|
||||
|
||||
virtual unsigned int getDriverPatchVersion() = 0;
|
||||
|
||||
virtual const sql::SQLString& getDriverName() = 0;
|
||||
|
||||
virtual const sql::SQLString& getDriverVersion() = 0;
|
||||
|
||||
virtual ResultSet * getExportedKeys(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0;
|
||||
|
||||
virtual const sql::SQLString& getExtraNameCharacters() = 0;
|
||||
|
||||
virtual const sql::SQLString& getIdentifierQuoteString() = 0;
|
||||
|
||||
virtual ResultSet * getImportedKeys(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0;
|
||||
|
||||
virtual ResultSet * getIndexInfo(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table, bool unique, bool approximate) = 0;
|
||||
|
||||
virtual unsigned int getCDBCMajorVersion() = 0;
|
||||
|
||||
virtual unsigned int getCDBCMinorVersion() = 0;
|
||||
|
||||
virtual unsigned int getMaxBinaryLiteralLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxCatalogNameLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxCharLiteralLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxColumnNameLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxColumnsInGroupBy() = 0;
|
||||
|
||||
virtual unsigned int getMaxColumnsInIndex() = 0;
|
||||
|
||||
virtual unsigned int getMaxColumnsInOrderBy() = 0;
|
||||
|
||||
virtual unsigned int getMaxColumnsInSelect() = 0;
|
||||
|
||||
virtual unsigned int getMaxColumnsInTable() = 0;
|
||||
|
||||
virtual unsigned int getMaxConnections() = 0;
|
||||
|
||||
virtual unsigned int getMaxCursorNameLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxIndexLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxProcedureNameLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxRowSize() = 0;
|
||||
|
||||
virtual unsigned int getMaxSchemaNameLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxStatementLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxStatements() = 0;
|
||||
|
||||
virtual unsigned int getMaxTableNameLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxTablesInSelect() = 0;
|
||||
|
||||
virtual unsigned int getMaxUserNameLength() = 0;
|
||||
|
||||
virtual const sql::SQLString& getNumericFunctions() = 0;
|
||||
|
||||
virtual ResultSet * getPrimaryKeys(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0;
|
||||
|
||||
virtual ResultSet * getProcedureColumns(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& procedureNamePattern, const sql::SQLString& columnNamePattern) = 0;
|
||||
|
||||
virtual ResultSet * getProcedures(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& procedureNamePattern) = 0;
|
||||
|
||||
virtual const sql::SQLString& getProcedureTerm() = 0;
|
||||
|
||||
virtual int getResultSetHoldability() = 0;
|
||||
|
||||
virtual ResultSet * getSchemas() = 0;
|
||||
|
||||
virtual const sql::SQLString& getSchemaTerm() = 0;
|
||||
|
||||
virtual ResultSet * getSchemaCollation(const sql::SQLString& catalog, const sql::SQLString& schemaPattern) = 0;
|
||||
|
||||
virtual ResultSet * getSchemaCharset(const sql::SQLString& catalog, const sql::SQLString& schemaPattern) = 0;
|
||||
|
||||
virtual const sql::SQLString& getSearchStringEscape() = 0;
|
||||
|
||||
virtual const sql::SQLString& getSQLKeywords() = 0;
|
||||
|
||||
virtual int getSQLStateType() = 0;
|
||||
|
||||
virtual const sql::SQLString& getStringFunctions() = 0;
|
||||
|
||||
virtual ResultSet * getSuperTables(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern) = 0;
|
||||
|
||||
virtual ResultSet * getSuperTypes(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& typeNamePattern) = 0;
|
||||
|
||||
virtual const sql::SQLString& getSystemFunctions() = 0;
|
||||
|
||||
virtual ResultSet * getTablePrivileges(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern) = 0;
|
||||
|
||||
virtual ResultSet * getTables(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern, std::list<sql::SQLString> &types) = 0;
|
||||
|
||||
virtual ResultSet * getTableTypes() = 0;
|
||||
|
||||
virtual ResultSet * getTableCollation(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern) = 0;
|
||||
|
||||
virtual ResultSet * getTableCharset(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern) = 0;
|
||||
|
||||
virtual const sql::SQLString& getTimeDateFunctions() = 0;
|
||||
|
||||
virtual ResultSet * getTypeInfo() = 0;
|
||||
|
||||
virtual ResultSet * getUDTs(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& typeNamePattern, std::list<int> &types) = 0;
|
||||
|
||||
virtual SQLString getURL() = 0;
|
||||
|
||||
virtual SQLString getUserName() = 0;
|
||||
|
||||
virtual ResultSet * getVersionColumns(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0;
|
||||
|
||||
virtual bool insertsAreDetected(int type) = 0;
|
||||
|
||||
virtual bool isCatalogAtStart() = 0;
|
||||
|
||||
virtual bool isReadOnly() = 0;
|
||||
|
||||
virtual bool locatorsUpdateCopy() = 0;
|
||||
|
||||
virtual bool nullPlusNonNullIsNull() = 0;
|
||||
|
||||
virtual bool nullsAreSortedAtEnd() = 0;
|
||||
|
||||
virtual bool nullsAreSortedAtStart() = 0;
|
||||
|
||||
virtual bool nullsAreSortedHigh() = 0;
|
||||
|
||||
virtual bool nullsAreSortedLow() = 0;
|
||||
|
||||
virtual bool othersDeletesAreVisible(int type) = 0;
|
||||
|
||||
virtual bool othersInsertsAreVisible(int type) = 0;
|
||||
|
||||
virtual bool othersUpdatesAreVisible(int type) = 0;
|
||||
|
||||
virtual bool ownDeletesAreVisible(int type) = 0;
|
||||
|
||||
virtual bool ownInsertsAreVisible(int type) = 0;
|
||||
|
||||
virtual bool ownUpdatesAreVisible(int type) = 0;
|
||||
|
||||
virtual bool storesLowerCaseIdentifiers() = 0;
|
||||
|
||||
virtual bool storesLowerCaseQuotedIdentifiers() = 0;
|
||||
|
||||
virtual bool storesMixedCaseIdentifiers() = 0;
|
||||
|
||||
virtual bool storesMixedCaseQuotedIdentifiers() = 0;
|
||||
|
||||
virtual bool storesUpperCaseIdentifiers() = 0;
|
||||
|
||||
virtual bool storesUpperCaseQuotedIdentifiers() = 0;
|
||||
|
||||
virtual bool supportsAlterTableWithAddColumn() = 0;
|
||||
|
||||
virtual bool supportsAlterTableWithDropColumn() = 0;
|
||||
|
||||
virtual bool supportsANSI92EntryLevelSQL() = 0;
|
||||
|
||||
virtual bool supportsANSI92FullSQL() = 0;
|
||||
|
||||
virtual bool supportsANSI92IntermediateSQL() = 0;
|
||||
|
||||
virtual bool supportsBatchUpdates() = 0;
|
||||
|
||||
virtual bool supportsCatalogsInDataManipulation() = 0;
|
||||
|
||||
virtual bool supportsCatalogsInIndexDefinitions() = 0;
|
||||
|
||||
virtual bool supportsCatalogsInPrivilegeDefinitions() = 0;
|
||||
|
||||
virtual bool supportsCatalogsInProcedureCalls() = 0;
|
||||
|
||||
virtual bool supportsCatalogsInTableDefinitions() = 0;
|
||||
|
||||
virtual bool supportsColumnAliasing() = 0;
|
||||
|
||||
virtual bool supportsConvert() = 0;
|
||||
|
||||
virtual bool supportsConvert(int fromType, int toType) = 0;
|
||||
|
||||
virtual bool supportsCoreSQLGrammar() = 0;
|
||||
|
||||
virtual bool supportsCorrelatedSubqueries() = 0;
|
||||
|
||||
virtual bool supportsDataDefinitionAndDataManipulationTransactions() = 0;
|
||||
|
||||
virtual bool supportsDataManipulationTransactionsOnly() = 0;
|
||||
|
||||
virtual bool supportsDifferentTableCorrelationNames() = 0;
|
||||
|
||||
virtual bool supportsExpressionsInOrderBy() = 0;
|
||||
|
||||
virtual bool supportsExtendedSQLGrammar() = 0;
|
||||
|
||||
virtual bool supportsFullOuterJoins() = 0;
|
||||
|
||||
virtual bool supportsGetGeneratedKeys() = 0;
|
||||
|
||||
virtual bool supportsGroupBy() = 0;
|
||||
|
||||
virtual bool supportsGroupByBeyondSelect() = 0;
|
||||
|
||||
virtual bool supportsGroupByUnrelated() = 0;
|
||||
|
||||
virtual bool supportsIntegrityEnhancementFacility() = 0;
|
||||
|
||||
virtual bool supportsLikeEscapeClause() = 0;
|
||||
|
||||
virtual bool supportsLimitedOuterJoins() = 0;
|
||||
|
||||
virtual bool supportsMinimumSQLGrammar() = 0;
|
||||
|
||||
virtual bool supportsMixedCaseIdentifiers() = 0;
|
||||
|
||||
virtual bool supportsMixedCaseQuotedIdentifiers() = 0;
|
||||
|
||||
virtual bool supportsMultipleOpenResults() = 0;
|
||||
|
||||
virtual bool supportsMultipleResultSets() = 0;
|
||||
|
||||
virtual bool supportsMultipleTransactions() = 0;
|
||||
|
||||
virtual bool supportsNamedParameters() = 0;
|
||||
|
||||
virtual bool supportsNonNullableColumns() = 0;
|
||||
|
||||
virtual bool supportsOpenCursorsAcrossCommit() = 0;
|
||||
|
||||
virtual bool supportsOpenCursorsAcrossRollback() = 0;
|
||||
|
||||
virtual bool supportsOpenStatementsAcrossCommit() = 0;
|
||||
|
||||
virtual bool supportsOpenStatementsAcrossRollback() = 0;
|
||||
|
||||
virtual bool supportsOrderByUnrelated() = 0;
|
||||
|
||||
virtual bool supportsOuterJoins() = 0;
|
||||
|
||||
virtual bool supportsPositionedDelete() = 0;
|
||||
|
||||
virtual bool supportsPositionedUpdate() = 0;
|
||||
|
||||
virtual bool supportsResultSetConcurrency(int type, int concurrency) = 0;
|
||||
|
||||
virtual bool supportsResultSetHoldability(int holdability) = 0;
|
||||
|
||||
virtual bool supportsResultSetType(int type) = 0;
|
||||
|
||||
virtual bool supportsSavepoints() = 0;
|
||||
|
||||
virtual bool supportsSchemasInDataManipulation() = 0;
|
||||
|
||||
virtual bool supportsSchemasInIndexDefinitions() = 0;
|
||||
|
||||
virtual bool supportsSchemasInPrivilegeDefinitions() = 0;
|
||||
|
||||
virtual bool supportsSchemasInProcedureCalls() = 0;
|
||||
|
||||
virtual bool supportsSchemasInTableDefinitions() = 0;
|
||||
|
||||
virtual bool supportsSelectForUpdate() = 0;
|
||||
|
||||
virtual bool supportsStatementPooling() = 0;
|
||||
|
||||
virtual bool supportsStoredProcedures() = 0;
|
||||
|
||||
virtual bool supportsSubqueriesInComparisons() = 0;
|
||||
|
||||
virtual bool supportsSubqueriesInExists() = 0;
|
||||
|
||||
virtual bool supportsSubqueriesInIns() = 0;
|
||||
|
||||
virtual bool supportsSubqueriesInQuantifieds() = 0;
|
||||
|
||||
virtual bool supportsTableCorrelationNames() = 0;
|
||||
|
||||
virtual bool supportsTransactionIsolationLevel(int level) = 0;
|
||||
|
||||
virtual bool supportsTransactions() = 0;
|
||||
|
||||
virtual bool supportsTypeConversion() = 0; /* SDBC */
|
||||
|
||||
virtual bool supportsUnion() = 0;
|
||||
|
||||
virtual bool supportsUnionAll() = 0;
|
||||
|
||||
virtual bool updatesAreDetected(int type) = 0;
|
||||
|
||||
virtual bool usesLocalFilePerTable() = 0;
|
||||
|
||||
virtual bool usesLocalFiles() = 0;
|
||||
|
||||
virtual ResultSet *getSchemata(const sql::SQLString& catalogName = "") = 0;
|
||||
|
||||
virtual ResultSet *getSchemaObjects(const sql::SQLString& catalogName = "",
|
||||
const sql::SQLString& schemaName = "",
|
||||
const sql::SQLString& objectType = "",
|
||||
bool includingDdl = true,
|
||||
const sql::SQLString& objectName = "",
|
||||
const sql::SQLString& contextTableName = "") = 0;
|
||||
|
||||
virtual ResultSet *getSchemaObjectTypes() = 0;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
#endif /* _SQL_METADATA_H_ */
|
||||
84
3rdparty/mysql/jdbc/cppconn/parameter_metadata.h
vendored
84
3rdparty/mysql/jdbc/cppconn/parameter_metadata.h
vendored
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_PARAMETER_METADATA_H_
|
||||
#define _SQL_PARAMETER_METADATA_H_
|
||||
|
||||
#include "sqlstring.h"
|
||||
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
||||
class ParameterMetaData
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
parameterModeIn,
|
||||
parameterModeInOut,
|
||||
parameterModeOut,
|
||||
parameterModeUnknown
|
||||
};
|
||||
enum
|
||||
{
|
||||
parameterNoNulls,
|
||||
parameterNullable,
|
||||
parameterNullableUnknown
|
||||
};
|
||||
|
||||
virtual sql::SQLString getParameterClassName(unsigned int param) = 0;
|
||||
|
||||
virtual int getParameterCount() = 0;
|
||||
|
||||
virtual int getParameterMode(unsigned int param) = 0;
|
||||
|
||||
virtual int getParameterType(unsigned int param) = 0;
|
||||
|
||||
virtual sql::SQLString getParameterTypeName(unsigned int param) = 0;
|
||||
|
||||
virtual int getPrecision(unsigned int param) = 0;
|
||||
|
||||
virtual int getScale(unsigned int param) = 0;
|
||||
|
||||
virtual int isNullable(unsigned int param) = 0;
|
||||
|
||||
virtual bool isSigned(unsigned int param) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~ParameterMetaData() {}
|
||||
};
|
||||
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
#endif /* _SQL_PARAMETER_METADATA_H_ */
|
||||
99
3rdparty/mysql/jdbc/cppconn/prepared_statement.h
vendored
99
3rdparty/mysql/jdbc/cppconn/prepared_statement.h
vendored
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_PREPARED_STATEMENT_H_
|
||||
#define _SQL_PREPARED_STATEMENT_H_
|
||||
|
||||
#include <iostream>
|
||||
#include "statement.h"
|
||||
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
||||
class Connection;
|
||||
class ResultSet;
|
||||
class ResultSetMetaData;
|
||||
class ParameterMetaData;
|
||||
|
||||
class PreparedStatement : public Statement
|
||||
{
|
||||
public:
|
||||
virtual ~PreparedStatement() {}
|
||||
|
||||
virtual void clearParameters() = 0;
|
||||
|
||||
virtual bool execute(const sql::SQLString& sql) = 0;
|
||||
virtual bool execute() = 0;
|
||||
|
||||
virtual ResultSet *executeQuery(const sql::SQLString& sql) = 0;
|
||||
virtual ResultSet *executeQuery() = 0;
|
||||
|
||||
virtual int executeUpdate(const sql::SQLString& sql) = 0;
|
||||
virtual int executeUpdate() = 0;
|
||||
|
||||
virtual ResultSetMetaData * getMetaData() = 0;
|
||||
|
||||
virtual ParameterMetaData * getParameterMetaData() = 0;
|
||||
|
||||
virtual bool getMoreResults() = 0;
|
||||
|
||||
virtual void setBigInt(unsigned int parameterIndex, const sql::SQLString& value) = 0;
|
||||
|
||||
virtual void setBlob(unsigned int parameterIndex, std::istream * blob) = 0;
|
||||
|
||||
virtual void setBoolean(unsigned int parameterIndex, bool value) = 0;
|
||||
|
||||
virtual void setDateTime(unsigned int parameterIndex, const sql::SQLString& value) = 0;
|
||||
|
||||
virtual void setDouble(unsigned int parameterIndex, double value) = 0;
|
||||
|
||||
virtual void setInt(unsigned int parameterIndex, int32_t value) = 0;
|
||||
|
||||
virtual void setUInt(unsigned int parameterIndex, uint32_t value) = 0;
|
||||
|
||||
virtual void setInt64(unsigned int parameterIndex, int64_t value) = 0;
|
||||
|
||||
virtual void setUInt64(unsigned int parameterIndex, uint64_t value) = 0;
|
||||
|
||||
virtual void setNull(unsigned int parameterIndex, int sqlType) = 0;
|
||||
|
||||
virtual void setString(unsigned int parameterIndex, const sql::SQLString& value) = 0;
|
||||
|
||||
virtual PreparedStatement * setResultSetType(sql::ResultSet::enum_type type) = 0;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
#endif /* _SQL_PREPARED_STATEMENT_H_ */
|
||||
188
3rdparty/mysql/jdbc/cppconn/resultset.h
vendored
188
3rdparty/mysql/jdbc/cppconn/resultset.h
vendored
@@ -1,188 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_RESULTSET_H_
|
||||
#define _SQL_RESULTSET_H_
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include "sqlstring.h"
|
||||
#include "resultset_metadata.h"
|
||||
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
||||
class Statement;
|
||||
|
||||
class RowID
|
||||
{
|
||||
public:
|
||||
virtual ~RowID() {}
|
||||
};
|
||||
|
||||
class ResultSet
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
CLOSE_CURSORS_AT_COMMIT,
|
||||
HOLD_CURSORS_OVER_COMMIT
|
||||
};
|
||||
enum
|
||||
{
|
||||
CONCUR_READ_ONLY,
|
||||
CONCUR_UPDATABLE
|
||||
};
|
||||
enum
|
||||
{
|
||||
FETCH_FORWARD,
|
||||
FETCH_REVERSE,
|
||||
FETCH_UNKNOWN
|
||||
};
|
||||
typedef enum
|
||||
{
|
||||
TYPE_FORWARD_ONLY,
|
||||
TYPE_SCROLL_INSENSITIVE,
|
||||
TYPE_SCROLL_SENSITIVE
|
||||
} enum_type;
|
||||
|
||||
virtual ~ResultSet() {}
|
||||
|
||||
virtual bool absolute(int row) = 0;
|
||||
|
||||
virtual void afterLast() = 0;
|
||||
|
||||
virtual void beforeFirst() = 0;
|
||||
|
||||
virtual void cancelRowUpdates() = 0;
|
||||
|
||||
virtual void clearWarnings() = 0;
|
||||
|
||||
virtual void close() = 0;
|
||||
|
||||
virtual uint32_t findColumn(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual bool first() = 0;
|
||||
|
||||
virtual std::istream * getBlob(uint32_t columnIndex) const = 0;
|
||||
virtual std::istream * getBlob(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual bool getBoolean(uint32_t columnIndex) const = 0;
|
||||
virtual bool getBoolean(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual int getConcurrency() = 0;
|
||||
virtual SQLString getCursorName() = 0;
|
||||
|
||||
virtual long double getDouble(uint32_t columnIndex) const = 0;
|
||||
virtual long double getDouble(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual int getFetchDirection() = 0;
|
||||
virtual size_t getFetchSize() = 0;
|
||||
virtual int getHoldability() = 0;
|
||||
|
||||
virtual int32_t getInt(uint32_t columnIndex) const = 0;
|
||||
virtual int32_t getInt(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual uint32_t getUInt(uint32_t columnIndex) const = 0;
|
||||
virtual uint32_t getUInt(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual int64_t getInt64(uint32_t columnIndex) const = 0;
|
||||
virtual int64_t getInt64(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual uint64_t getUInt64(uint32_t columnIndex) const = 0;
|
||||
virtual uint64_t getUInt64(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual ResultSetMetaData * getMetaData() const = 0;
|
||||
|
||||
virtual size_t getRow() const = 0;
|
||||
|
||||
virtual RowID * getRowId(uint32_t columnIndex) = 0;
|
||||
virtual RowID * getRowId(const sql::SQLString & columnLabel) = 0;
|
||||
|
||||
virtual const Statement * getStatement() const = 0;
|
||||
|
||||
virtual SQLString getString(uint32_t columnIndex) const = 0;
|
||||
virtual SQLString getString(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual enum_type getType() const = 0;
|
||||
|
||||
virtual void getWarnings() = 0;
|
||||
|
||||
virtual void insertRow() = 0;
|
||||
|
||||
virtual bool isAfterLast() const = 0;
|
||||
|
||||
virtual bool isBeforeFirst() const = 0;
|
||||
|
||||
virtual bool isClosed() const = 0;
|
||||
|
||||
virtual bool isFirst() const = 0;
|
||||
|
||||
virtual bool isLast() const = 0;
|
||||
|
||||
virtual bool isNull(uint32_t columnIndex) const = 0;
|
||||
virtual bool isNull(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual bool last() = 0;
|
||||
|
||||
virtual bool next() = 0;
|
||||
|
||||
virtual void moveToCurrentRow() = 0;
|
||||
|
||||
virtual void moveToInsertRow() = 0;
|
||||
|
||||
virtual bool previous() = 0;
|
||||
|
||||
virtual void refreshRow() = 0;
|
||||
|
||||
virtual bool relative(int rows) = 0;
|
||||
|
||||
virtual bool rowDeleted() = 0;
|
||||
|
||||
virtual bool rowInserted() = 0;
|
||||
|
||||
virtual bool rowUpdated() = 0;
|
||||
|
||||
virtual void setFetchSize(size_t rows) = 0;
|
||||
|
||||
virtual size_t rowsCount() const = 0;
|
||||
|
||||
virtual bool wasNull() const = 0;
|
||||
};
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
#endif /* _SQL_RESULTSET_H_ */
|
||||
107
3rdparty/mysql/jdbc/cppconn/resultset_metadata.h
vendored
107
3rdparty/mysql/jdbc/cppconn/resultset_metadata.h
vendored
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_RESULTSET_METADATA_H_
|
||||
#define _SQL_RESULTSET_METADATA_H_
|
||||
|
||||
#include "sqlstring.h"
|
||||
#include "datatype.h"
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
||||
class ResultSetMetaData
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
columnNoNulls,
|
||||
columnNullable,
|
||||
columnNullableUnknown
|
||||
};
|
||||
|
||||
virtual SQLString getCatalogName(unsigned int column) = 0;
|
||||
|
||||
virtual unsigned int getColumnCount() = 0;
|
||||
|
||||
virtual unsigned int getColumnDisplaySize(unsigned int column) = 0;
|
||||
|
||||
virtual SQLString getColumnLabel(unsigned int column) = 0;
|
||||
|
||||
virtual SQLString getColumnName(unsigned int column) = 0;
|
||||
|
||||
virtual int getColumnType(unsigned int column) = 0;
|
||||
|
||||
virtual SQLString getColumnTypeName(unsigned int column) = 0;
|
||||
|
||||
virtual SQLString getColumnCharset(unsigned int columnIndex) = 0;
|
||||
|
||||
virtual SQLString getColumnCollation(unsigned int columnIndex) = 0;
|
||||
|
||||
virtual unsigned int getPrecision(unsigned int column) = 0;
|
||||
|
||||
virtual unsigned int getScale(unsigned int column) = 0;
|
||||
|
||||
virtual SQLString getSchemaName(unsigned int column) = 0;
|
||||
|
||||
virtual SQLString getTableName(unsigned int column) = 0;
|
||||
|
||||
virtual bool isAutoIncrement(unsigned int column) = 0;
|
||||
|
||||
virtual bool isCaseSensitive(unsigned int column) = 0;
|
||||
|
||||
virtual bool isCurrency(unsigned int column) = 0;
|
||||
|
||||
virtual bool isDefinitelyWritable(unsigned int column) = 0;
|
||||
|
||||
virtual int isNullable(unsigned int column) = 0;
|
||||
|
||||
virtual bool isNumeric(unsigned int column) = 0;
|
||||
|
||||
virtual bool isReadOnly(unsigned int column) = 0;
|
||||
|
||||
virtual bool isSearchable(unsigned int column) = 0;
|
||||
|
||||
virtual bool isSigned(unsigned int column) = 0;
|
||||
|
||||
virtual bool isWritable(unsigned int column) = 0;
|
||||
|
||||
virtual bool isZerofill(unsigned int column) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~ResultSetMetaData() {}
|
||||
};
|
||||
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
#endif /* _SQL_RESULTSET_METADATA_H_ */
|
||||
251
3rdparty/mysql/jdbc/cppconn/sqlstring.h
vendored
251
3rdparty/mysql/jdbc/cppconn/sqlstring.h
vendored
@@ -1,251 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_STRING_H_
|
||||
#define _SQL_STRING_H_
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include "build_config.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace sql
|
||||
{
|
||||
class SQLString
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4251)
|
||||
#endif
|
||||
std::string realStr;
|
||||
#ifdef _WIN32
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
public:
|
||||
#ifdef _WIN32
|
||||
//TODO something less dirty-hackish.
|
||||
static const size_t npos = static_cast<std::string::size_type>(-1);
|
||||
#else
|
||||
static const size_t npos = std::string::npos;
|
||||
#endif
|
||||
|
||||
~SQLString() {}
|
||||
|
||||
SQLString() {}
|
||||
|
||||
SQLString(const SQLString & other) : realStr(other.realStr) {}
|
||||
|
||||
SQLString(const std::string & other) : realStr(other) {}
|
||||
|
||||
SQLString(const char other[]) : realStr(other) {}
|
||||
|
||||
SQLString(const char * s, size_t n) : realStr(s, n) {}
|
||||
|
||||
// Needed for stuff like SQLString str= "char * string constant"
|
||||
const SQLString & operator=(const char * s)
|
||||
{
|
||||
realStr = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const SQLString & operator=(const std::string & rhs)
|
||||
{
|
||||
realStr = rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const SQLString & operator=(const SQLString & rhs)
|
||||
{
|
||||
realStr = rhs.realStr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Conversion to st::string. Comes in play for stuff like std::string str= SQLString_var;
|
||||
operator const std::string &() const
|
||||
{
|
||||
return realStr;
|
||||
}
|
||||
|
||||
/** For access std::string methods. Not sure we need it. Makes it look like some smart ptr.
|
||||
possibly operator* - will look even more like smart ptr */
|
||||
std::string * operator ->()
|
||||
{
|
||||
return & realStr;
|
||||
}
|
||||
|
||||
int compare(const SQLString& str) const
|
||||
{
|
||||
return realStr.compare(str.realStr);
|
||||
}
|
||||
|
||||
int compare(const char * s) const
|
||||
{
|
||||
return realStr.compare(s);
|
||||
}
|
||||
|
||||
int compare(size_t pos1, size_t n1, const char * s) const
|
||||
{
|
||||
return realStr.compare(pos1, n1, s);
|
||||
}
|
||||
|
||||
int caseCompare(const SQLString &s) const
|
||||
{
|
||||
std::string tmp(realStr), str(s);
|
||||
std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
|
||||
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
|
||||
return tmp.compare(str);
|
||||
}
|
||||
|
||||
int caseCompare(const char * s) const
|
||||
{
|
||||
std::string tmp(realStr), str(s);
|
||||
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
|
||||
std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
|
||||
return tmp.compare(str);
|
||||
}
|
||||
|
||||
int caseCompare(size_t pos1, size_t n1, const char * s) const
|
||||
{
|
||||
std::string tmp(realStr.c_str() + pos1, n1), str(s);
|
||||
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
|
||||
std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
|
||||
return tmp.compare(str);
|
||||
}
|
||||
|
||||
const std::string & asStdString() const
|
||||
{
|
||||
return realStr;
|
||||
}
|
||||
|
||||
const char * c_str() const
|
||||
{
|
||||
return realStr.c_str();
|
||||
}
|
||||
|
||||
size_t length() const
|
||||
{
|
||||
return realStr.length();
|
||||
}
|
||||
|
||||
SQLString & append(const std::string & str)
|
||||
{
|
||||
realStr.append(str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SQLString & append(const char * s)
|
||||
{
|
||||
realStr.append(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
const char& operator[](size_t pos) const
|
||||
{
|
||||
return realStr[pos];
|
||||
}
|
||||
|
||||
size_t find(char c, size_t pos = 0) const
|
||||
{
|
||||
return realStr.find(c, pos);
|
||||
}
|
||||
|
||||
size_t find(const SQLString & s, size_t pos = 0) const
|
||||
{
|
||||
return realStr.find(s.realStr, pos);
|
||||
}
|
||||
|
||||
SQLString substr(size_t pos = 0, size_t n = npos) const
|
||||
{
|
||||
return realStr.substr(pos, n);
|
||||
}
|
||||
|
||||
const SQLString& replace(size_t pos1, size_t n1, const SQLString & s)
|
||||
{
|
||||
realStr.replace(pos1, n1, s.realStr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
size_t find_first_of(char c, size_t pos = 0) const
|
||||
{
|
||||
return realStr.find_first_of(c, pos);
|
||||
}
|
||||
|
||||
size_t find_last_of(char c, size_t pos = npos) const
|
||||
{
|
||||
return realStr.find_last_of(c, pos);
|
||||
}
|
||||
|
||||
const SQLString & operator+=(const SQLString & op2)
|
||||
{
|
||||
realStr += op2.realStr;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Operators that can and have to be not a member.
|
||||
*/
|
||||
inline const SQLString operator+(const SQLString & op1, const SQLString & op2)
|
||||
{
|
||||
return sql::SQLString(op1.asStdString() + op2.asStdString());
|
||||
}
|
||||
|
||||
inline bool operator ==(const SQLString & op1, const SQLString & op2)
|
||||
{
|
||||
return (op1.asStdString() == op2.asStdString());
|
||||
}
|
||||
|
||||
inline bool operator !=(const SQLString & op1, const SQLString & op2)
|
||||
{
|
||||
return (op1.asStdString() != op2.asStdString());
|
||||
}
|
||||
|
||||
inline bool operator <(const SQLString & op1, const SQLString & op2)
|
||||
{
|
||||
return op1.asStdString() < op2.asStdString();
|
||||
}
|
||||
|
||||
|
||||
}// namespace sql
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
// operator << for SQLString output
|
||||
inline ostream & operator << (ostream & os, const sql::SQLString & str )
|
||||
{
|
||||
return os << str.asStdString();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
117
3rdparty/mysql/jdbc/cppconn/statement.h
vendored
117
3rdparty/mysql/jdbc/cppconn/statement.h
vendored
@@ -1,117 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_STATEMENT_H_
|
||||
#define _SQL_STATEMENT_H_
|
||||
|
||||
#include "config.h"
|
||||
#include "resultset.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
||||
class ResultSet;
|
||||
class Connection;
|
||||
class SQLWarning;
|
||||
|
||||
|
||||
class Statement
|
||||
{
|
||||
public:
|
||||
virtual ~Statement() {};
|
||||
|
||||
virtual Connection * getConnection() = 0;
|
||||
|
||||
virtual void cancel() = 0;
|
||||
|
||||
virtual void clearWarnings() = 0;
|
||||
|
||||
virtual void close() = 0;
|
||||
|
||||
virtual bool execute(const sql::SQLString& sql) = 0;
|
||||
|
||||
virtual ResultSet * executeQuery(const sql::SQLString& sql) = 0;
|
||||
|
||||
virtual int executeUpdate(const sql::SQLString& sql) = 0;
|
||||
|
||||
virtual size_t getFetchSize() = 0;
|
||||
|
||||
virtual unsigned int getMaxFieldSize() = 0;
|
||||
|
||||
virtual uint64_t getMaxRows() = 0;
|
||||
|
||||
virtual bool getMoreResults() = 0;
|
||||
|
||||
virtual unsigned int getQueryTimeout() = 0;
|
||||
|
||||
virtual ResultSet * getResultSet() = 0;
|
||||
|
||||
virtual sql::ResultSet::enum_type getResultSetType() = 0;
|
||||
|
||||
virtual uint64_t getUpdateCount() = 0;
|
||||
|
||||
virtual const SQLWarning * getWarnings() = 0;
|
||||
|
||||
virtual void setCursorName(const sql::SQLString & name) = 0;
|
||||
|
||||
virtual void setEscapeProcessing(bool enable) = 0;
|
||||
|
||||
virtual void setFetchSize(size_t rows) = 0;
|
||||
|
||||
virtual void setMaxFieldSize(unsigned int max) = 0;
|
||||
|
||||
virtual void setMaxRows(unsigned int max) = 0;
|
||||
|
||||
virtual void setQueryTimeout(unsigned int seconds) = 0;
|
||||
|
||||
virtual Statement * setResultSetType(sql::ResultSet::enum_type type) = 0;
|
||||
|
||||
virtual int setQueryAttrBigInt(const sql::SQLString &name, const sql::SQLString& value) = 0;
|
||||
virtual int setQueryAttrBoolean(const sql::SQLString &name, bool value) = 0;
|
||||
virtual int setQueryAttrDateTime(const sql::SQLString &name, const sql::SQLString& value) = 0;
|
||||
virtual int setQueryAttrDouble(const sql::SQLString &name, double value) = 0;
|
||||
virtual int setQueryAttrInt(const sql::SQLString &name, int32_t value) = 0;
|
||||
virtual int setQueryAttrUInt(const sql::SQLString &name, uint32_t value) = 0;
|
||||
virtual int setQueryAttrInt64(const sql::SQLString &name, int64_t value) = 0;
|
||||
virtual int setQueryAttrUInt64(const sql::SQLString &name, uint64_t value) = 0;
|
||||
virtual int setQueryAttrNull(const sql::SQLString &name) = 0;
|
||||
virtual int setQueryAttrString(const sql::SQLString &name, const sql::SQLString& value) = 0;
|
||||
|
||||
virtual void clearAttributes() = 0;
|
||||
|
||||
};
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
#endif /* _SQL_STATEMENT_H_ */
|
||||
324
3rdparty/mysql/jdbc/cppconn/variant.h
vendored
324
3rdparty/mysql/jdbc/cppconn/variant.h
vendored
@@ -1,324 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_VARIANT_H_
|
||||
#define _SQL_VARIANT_H_
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <algorithm>
|
||||
#include <typeinfo>
|
||||
|
||||
#include "build_config.h"
|
||||
#include "sqlstring.h"
|
||||
#include "exception.h"
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
||||
class BaseVariantImpl
|
||||
{
|
||||
public:
|
||||
BaseVariantImpl (void *ptr, sql::SQLString vtype) :
|
||||
cvptr(ptr),
|
||||
vTypeName(vtype)
|
||||
{}
|
||||
|
||||
virtual ~BaseVariantImpl() {
|
||||
cvptr=NULL;
|
||||
}
|
||||
|
||||
virtual BaseVariantImpl* Clone()=0;
|
||||
|
||||
template<class T>
|
||||
T* get() const {
|
||||
if (typeid(T).name() == typeid(void).name()) {
|
||||
return static_cast< T * > (cvptr);
|
||||
}
|
||||
|
||||
if ((vTypeName == typeid(std::string).name() &&
|
||||
typeid(T).name() == typeid(sql::SQLString).name()) ||
|
||||
(vTypeName == typeid(sql::SQLString).name() &&
|
||||
typeid(T).name() == typeid(std::string).name()) ||
|
||||
(vTypeName == typeid(std::map< std::string, std::string >).name() &&
|
||||
typeid(T).name() ==
|
||||
typeid(std::map< sql::SQLString, sql::SQLString >).name()) ||
|
||||
(vTypeName ==
|
||||
typeid(std::map< sql::SQLString, sql::SQLString >).name() &&
|
||||
typeid(T).name() ==
|
||||
typeid(std::map< std::string, std::string >).name()) ||
|
||||
(vTypeName == typeid(std::list< std::string >).name() &&
|
||||
typeid(T).name() ==
|
||||
typeid(std::list< sql::SQLString >).name()) ||
|
||||
(vTypeName ==
|
||||
typeid(std::list< sql::SQLString >).name() &&
|
||||
typeid(T).name() ==
|
||||
typeid(std::list< std::string >).name()))
|
||||
{
|
||||
return static_cast< T * > (cvptr);
|
||||
}
|
||||
|
||||
if (typeid(T).name() != vTypeName) {
|
||||
throw sql::InvalidArgumentException("Variant type doesn't match.");
|
||||
}
|
||||
|
||||
return static_cast< T * > (cvptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
void *cvptr;
|
||||
sql::SQLString vTypeName;
|
||||
};
|
||||
|
||||
|
||||
template<class T>
|
||||
class VariantImpl : public BaseVariantImpl
|
||||
{
|
||||
public:
|
||||
VariantImpl(T i) : BaseVariantImpl(new T(i), typeid(i).name()) {}
|
||||
|
||||
~VariantImpl() {
|
||||
destroy_content();
|
||||
}
|
||||
|
||||
VariantImpl(VariantImpl& that) : BaseVariantImpl(that) {
|
||||
copy_content(that);
|
||||
}
|
||||
|
||||
VariantImpl& operator=(VariantImpl& that) {
|
||||
if (this != &that) {
|
||||
destroy_content();
|
||||
if (cvptr == NULL) {
|
||||
copy_content(that);
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual VariantImpl* Clone() {
|
||||
return new VariantImpl(*this);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void destroy_content() {
|
||||
T *tmp=static_cast< T * >(cvptr);
|
||||
if (tmp) {
|
||||
delete tmp;
|
||||
cvptr=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void copy_content(BaseVariantImpl& that) {
|
||||
cvptr=new T (*(static_cast< T * > (that.get< void >())));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<class T>
|
||||
class VariantMap : public BaseVariantImpl
|
||||
{
|
||||
public:
|
||||
VariantMap(T i) : BaseVariantImpl(new T(i), typeid(i).name()) {}
|
||||
|
||||
~VariantMap() {
|
||||
destroy_content();
|
||||
}
|
||||
|
||||
VariantMap(VariantMap& that) : BaseVariantImpl(that) {
|
||||
if (this != &that) {
|
||||
copy_content(that);
|
||||
}
|
||||
}
|
||||
|
||||
VariantMap& operator=(VariantMap& that) {
|
||||
if (this != &that) {
|
||||
destroy_content();
|
||||
copy_content(that);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual VariantMap* Clone() {
|
||||
return new VariantMap(*this);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void destroy_content() {
|
||||
T *tmp=static_cast< T *> (cvptr);
|
||||
if (tmp) {
|
||||
tmp->clear();
|
||||
delete tmp;
|
||||
cvptr=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void copy_content(VariantMap& var) {
|
||||
T *tmp=static_cast< T *> (var.cvptr);
|
||||
if (tmp) {
|
||||
cvptr=new T();
|
||||
typename T::const_iterator cit=tmp->begin();
|
||||
while(cit != tmp->end()) {
|
||||
(static_cast< T * >(cvptr))->insert(
|
||||
std::make_pair(sql::SQLString(cit->first),
|
||||
sql::SQLString(cit->second)));
|
||||
++cit;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<class T>
|
||||
class VariantList : public BaseVariantImpl
|
||||
{
|
||||
public:
|
||||
VariantList(T i) : BaseVariantImpl(new T(i), typeid(i).name()) {}
|
||||
|
||||
~VariantList() {
|
||||
destroy_content();
|
||||
}
|
||||
|
||||
VariantList(VariantList& that) : BaseVariantImpl(that) {
|
||||
if (this != &that) {
|
||||
copy_content(that);
|
||||
}
|
||||
}
|
||||
|
||||
VariantList& operator=(VariantList& that) {
|
||||
if (this != &that) {
|
||||
destroy_content();
|
||||
copy_content(that);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual VariantList* Clone() {
|
||||
return new VariantList(*this);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void destroy_content()
|
||||
{
|
||||
T *tmp=static_cast< T *> (cvptr);
|
||||
if (tmp) {
|
||||
tmp->clear();
|
||||
delete tmp;
|
||||
cvptr=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void copy_content(VariantList& var)
|
||||
{
|
||||
T *tmp=static_cast< T *> (var.cvptr);
|
||||
if (tmp) {
|
||||
cvptr=new T();
|
||||
typename T::const_iterator cit=tmp->begin();
|
||||
while(cit != tmp->end()) {
|
||||
(static_cast< T * >(cvptr))->push_back(sql::SQLString(*cit));
|
||||
++cit;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CPPCONN_PUBLIC_FUNC Variant
|
||||
{
|
||||
public:
|
||||
Variant(const int &i=0) :
|
||||
variant(new VariantImpl< int >(i)) {}
|
||||
|
||||
Variant(const double &i) :
|
||||
variant(new VariantImpl< double >(i)) {}
|
||||
|
||||
Variant(const bool &i) :
|
||||
variant(new VariantImpl< bool >(i)) {}
|
||||
|
||||
Variant(const char* i) :
|
||||
variant(new VariantImpl< sql::SQLString >(i)) {}
|
||||
|
||||
Variant(const std::string &i) :
|
||||
variant(new VariantImpl< sql::SQLString >(i)) {}
|
||||
|
||||
Variant(const sql::SQLString &i) :
|
||||
variant(new VariantImpl< sql::SQLString >(i)) {}
|
||||
|
||||
Variant(const std::list< std::string > &i) :
|
||||
variant(new VariantList< std::list < std::string > >(i)) {}
|
||||
|
||||
Variant(const std::list< sql::SQLString > &i) :
|
||||
variant(new VariantList< std::list < sql::SQLString > >(i)) {}
|
||||
|
||||
Variant(const std::map< std::string, std::string > &i) :
|
||||
variant(new VariantMap< std::map< std::string, std::string > >(i)) {}
|
||||
|
||||
Variant(const std::map< sql::SQLString, sql::SQLString > &i) :
|
||||
variant(new VariantMap< std::map< sql::SQLString, sql::SQLString > >(i)) {}
|
||||
|
||||
~Variant() {
|
||||
if (variant) {
|
||||
delete variant;
|
||||
variant=0;
|
||||
}
|
||||
}
|
||||
|
||||
Variant(const Variant& that) {
|
||||
if (this != &that) {
|
||||
variant=that.variant->Clone();
|
||||
}
|
||||
}
|
||||
|
||||
Variant& operator=(const Variant& that) {
|
||||
if (this != &that) {
|
||||
delete variant;
|
||||
variant=that.variant->Clone();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T* get() const {
|
||||
return variant->get<T>();
|
||||
}
|
||||
|
||||
private:
|
||||
BaseVariantImpl *variant;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
#endif /* _SQL_VARIANT_H_ */
|
||||
53
3rdparty/mysql/jdbc/cppconn/version_info.h
vendored
53
3rdparty/mysql/jdbc/cppconn/version_info.h
vendored
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* */
|
||||
|
||||
#define MYCPPCONN_DM_MAJOR_VERSION 8
|
||||
#define MYCPPCONN_DM_MINOR_VERSION 2
|
||||
#define MYCPPCONN_DM_PATCH_VERSION 0
|
||||
|
||||
#define MYCPPCONN_DM_VERSION "8.2.0"
|
||||
#define MYCPPCONN_DM_VERSION_ID 8020000
|
||||
#define MYSQL_CONCPP_LICENSE "GPL-2.0"
|
||||
|
||||
#define MYSQL_CONCPP_VERSION_MAJOR 8
|
||||
#define MYSQL_CONCPP_VERSION_MINOR 2
|
||||
#define MYSQL_CONCPP_VERSION_MICRO 0
|
||||
|
||||
#define MYSQL_CONCPP_VERSION_NUMBER 8020000
|
||||
|
||||
|
||||
/* Driver version info */
|
||||
|
||||
#define MYCPPCONN_STATIC_MYSQL_VERSION "8.2.0"
|
||||
#define MYCPPCONN_STATIC_MYSQL_VERSION_ID 80200
|
||||
|
||||
#define MYCPPCONN_BOOST_VERSION
|
||||
80
3rdparty/mysql/jdbc/cppconn/warning.h
vendored
80
3rdparty/mysql/jdbc/cppconn/warning.h
vendored
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SQL_WARNING_H_
|
||||
#define _SQL_WARNING_H_
|
||||
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include "sqlstring.h"
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma warning (disable : 4290)
|
||||
//warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
|
||||
class SQLWarning
|
||||
{
|
||||
public:
|
||||
|
||||
SQLWarning(){}
|
||||
|
||||
virtual const sql::SQLString & getMessage() const = 0;
|
||||
|
||||
virtual const sql::SQLString & getSQLState() const = 0;
|
||||
|
||||
virtual int getErrorCode() const = 0;
|
||||
|
||||
virtual const SQLWarning * getNextWarning() const = 0;
|
||||
|
||||
virtual void setNextWarning(const SQLWarning * _next) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~SQLWarning(){};
|
||||
|
||||
SQLWarning(const SQLWarning&){};
|
||||
|
||||
private:
|
||||
const SQLWarning & operator = (const SQLWarning & rhs);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
#endif /* _SQL_WARNING_H_ */
|
||||
233
3rdparty/mysql/jdbc/mysql_connection.h
vendored
233
3rdparty/mysql/jdbc/mysql_connection.h
vendored
@@ -1,233 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _MYSQL_CONNECTION_H_
|
||||
#define _MYSQL_CONNECTION_H_
|
||||
|
||||
#include "cppconn/connection.h"
|
||||
#include <memory>
|
||||
|
||||
#if(_WIN32 && CONCPP_BUILD_SHARED)
|
||||
extern std::string driver_dll_path;
|
||||
#endif
|
||||
|
||||
namespace sql
|
||||
{
|
||||
namespace mysql
|
||||
{
|
||||
|
||||
class CPPCONN_PUBLIC_FUNC MySQL_Savepoint : public sql::Savepoint
|
||||
{
|
||||
sql::SQLString name;
|
||||
|
||||
public:
|
||||
MySQL_Savepoint(const sql::SQLString &savepoint);
|
||||
virtual ~MySQL_Savepoint() {}
|
||||
|
||||
int getSavepointId();
|
||||
|
||||
sql::SQLString getSavepointName();
|
||||
|
||||
private:
|
||||
/* Prevent use of these */
|
||||
MySQL_Savepoint(const MySQL_Savepoint &);
|
||||
void operator=(MySQL_Savepoint &);
|
||||
};
|
||||
|
||||
|
||||
class MySQL_DebugLogger;
|
||||
struct MySQL_ConnectionData; /* PIMPL */
|
||||
class MySQL_Statement;
|
||||
class MySQL_Prepared_Statement;
|
||||
|
||||
namespace NativeAPI
|
||||
{
|
||||
class NativeConnectionWrapper;
|
||||
}
|
||||
|
||||
class CPPCONN_PUBLIC_FUNC MySQL_Connection : public sql::Connection
|
||||
{
|
||||
friend MySQL_Statement;
|
||||
friend MySQL_Prepared_Statement;
|
||||
|
||||
MySQL_Statement * createServiceStmt();
|
||||
|
||||
public:
|
||||
MySQL_Connection(Driver * _driver,
|
||||
::sql::mysql::NativeAPI::NativeConnectionWrapper & _proxy,
|
||||
const sql::SQLString& hostName,
|
||||
const sql::SQLString& userName,
|
||||
const sql::SQLString& password);
|
||||
|
||||
MySQL_Connection(Driver * _driver, ::sql::mysql::NativeAPI::NativeConnectionWrapper & _proxy,
|
||||
std::map< sql::SQLString, sql::ConnectPropertyVal > & options);
|
||||
|
||||
virtual ~MySQL_Connection();
|
||||
|
||||
void clearWarnings();
|
||||
|
||||
void close();
|
||||
|
||||
void commit();
|
||||
|
||||
sql::Statement * createStatement();
|
||||
|
||||
sql::SQLString escapeString(const sql::SQLString &);
|
||||
|
||||
bool getAutoCommit();
|
||||
|
||||
sql::SQLString getCatalog();
|
||||
|
||||
Driver *getDriver();
|
||||
|
||||
sql::SQLString getSchema();
|
||||
|
||||
sql::SQLString getClientInfo();
|
||||
|
||||
void getClientOption(const sql::SQLString & optionName, void * optionValue);
|
||||
|
||||
sql::SQLString getClientOption(const sql::SQLString & optionName);
|
||||
|
||||
sql::DatabaseMetaData * getMetaData();
|
||||
|
||||
enum_transaction_isolation getTransactionIsolation();
|
||||
|
||||
const SQLWarning * getWarnings();
|
||||
|
||||
bool isClosed();
|
||||
|
||||
bool isReadOnly();
|
||||
|
||||
bool isValid();
|
||||
|
||||
bool reconnect();
|
||||
|
||||
sql::SQLString nativeSQL(const sql::SQLString& sql);
|
||||
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql);
|
||||
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int autoGeneratedKeys);
|
||||
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int columnIndexes[]);
|
||||
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency);
|
||||
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability);
|
||||
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, sql::SQLString columnNames[]);
|
||||
|
||||
void releaseSavepoint(Savepoint * savepoint) ;
|
||||
|
||||
void rollback();
|
||||
|
||||
void rollback(Savepoint * savepoint);
|
||||
|
||||
void setAutoCommit(bool autoCommit);
|
||||
|
||||
void setCatalog(const sql::SQLString& catalog);
|
||||
|
||||
void setSchema(const sql::SQLString& catalog);
|
||||
|
||||
sql::Connection * setClientOption(const sql::SQLString & optionName, const void * optionValue);
|
||||
|
||||
sql::Connection * setClientOption(const sql::SQLString & optionName, const sql::SQLString & optionValue);
|
||||
|
||||
void setHoldability(int holdability);
|
||||
|
||||
void setReadOnly(bool readOnly);
|
||||
|
||||
sql::Savepoint * setSavepoint();
|
||||
|
||||
sql::Savepoint * setSavepoint(const sql::SQLString& name);
|
||||
|
||||
void setTransactionIsolation(enum_transaction_isolation level);
|
||||
|
||||
virtual sql::SQLString getSessionVariable(const sql::SQLString & varname);
|
||||
|
||||
virtual void setSessionVariable(const sql::SQLString & varname, const sql::SQLString & value);
|
||||
|
||||
virtual void setSessionVariable(const sql::SQLString & varname, unsigned int value);
|
||||
|
||||
virtual sql::SQLString getLastStatementInfo();
|
||||
|
||||
sql::SQLString getCurrentUser();
|
||||
|
||||
private:
|
||||
/* We do not really think this class has to be subclassed*/
|
||||
void checkClosed();
|
||||
void init(std::map< sql::SQLString, sql::ConnectPropertyVal > & properties);
|
||||
|
||||
Driver * driver;
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4251)
|
||||
#endif
|
||||
std::shared_ptr< NativeAPI::NativeConnectionWrapper > proxy;
|
||||
#ifdef _WIN32
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
/* statement handle to execute queries initiated by driver. Perhaps it is
|
||||
a good idea to move it to a separate helper class */
|
||||
#ifdef _WIN32
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4251)
|
||||
#endif
|
||||
std::unique_ptr< ::sql::mysql::MySQL_Statement > service;
|
||||
|
||||
std::unique_ptr< ::sql::mysql::MySQL_ConnectionData > intern; /* pimpl */
|
||||
#ifdef _WIN32
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
/* We need to store the user name for telemetry */
|
||||
SQLString currentUser;
|
||||
|
||||
/* Prevent use of these */
|
||||
MySQL_Connection(const MySQL_Connection &);
|
||||
void operator=(MySQL_Connection &);
|
||||
};
|
||||
|
||||
} /* namespace mysql */
|
||||
} /* namespace sql */
|
||||
|
||||
#endif // _MYSQL_CONNECTION_H_
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
162
3rdparty/mysql/jdbc/mysql_driver.h
vendored
162
3rdparty/mysql/jdbc/mysql_driver.h
vendored
@@ -1,162 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2020, Oracle and/or its affiliates.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _MYSQL_DRIVER_H_
|
||||
#define _MYSQL_DRIVER_H_
|
||||
|
||||
|
||||
#include "cppconn/driver.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
CPPCONN_PUBLIC_FUNC void * sql_mysql_get_driver_instance();
|
||||
}
|
||||
|
||||
namespace sql
|
||||
{
|
||||
namespace mysql
|
||||
{
|
||||
namespace NativeAPI
|
||||
{
|
||||
class NativeDriverWrapper;
|
||||
}
|
||||
|
||||
//class sql::mysql::NativeAPI::NativeDriverWrapper;
|
||||
|
||||
class CPPCONN_PUBLIC_FUNC MySQL_Driver : public sql::Driver
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4251)
|
||||
#endif
|
||||
std::unique_ptr< ::sql::mysql::NativeAPI::NativeDriverWrapper > proxy;
|
||||
#ifdef _WIN32
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Note: With current implementation `fido_callback` and `fido_callback_store`
|
||||
are not really used and should be removed after deprecation of Fido
|
||||
authentication plugin and when ABI can be changed.
|
||||
*/
|
||||
|
||||
::sql::Fido_Callback* fido_callback = nullptr;
|
||||
::sql::Fido_Callback fido_callback_store;
|
||||
|
||||
/*
|
||||
Callback function to be called by WebAuthn authentication plugin to notify
|
||||
the user.
|
||||
|
||||
Note: Currently the same callback can be used wih deprecated Fido
|
||||
authentication plugin.
|
||||
|
||||
Note: The `fido_callback` pointer is re-used as a flag to indicate if
|
||||
the callback was set by a user and its type (WebAuthn vs. Fido).
|
||||
*/
|
||||
|
||||
std::function<void(SQLString)> webauthn_callback;
|
||||
|
||||
public:
|
||||
MySQL_Driver();
|
||||
MySQL_Driver(const ::sql::SQLString & clientLib);
|
||||
|
||||
virtual ~MySQL_Driver();
|
||||
|
||||
sql::Connection * connect(const sql::SQLString& hostName, const sql::SQLString& userName, const sql::SQLString& password) override;
|
||||
|
||||
sql::Connection * connect(sql::ConnectOptionsMap & options) override;
|
||||
|
||||
int getMajorVersion() override;
|
||||
|
||||
int getMinorVersion() override;
|
||||
|
||||
int getPatchVersion() override;
|
||||
|
||||
const sql::SQLString & getName() override;
|
||||
|
||||
void setCallBack(sql::Fido_Callback &cb) override;
|
||||
void setCallBack(sql::Fido_Callback &&cb) override;
|
||||
|
||||
void setCallBack(sql::WebAuthn_Callback &cb) override;
|
||||
void setCallBack(sql::WebAuthn_Callback &&cb) override;
|
||||
|
||||
void threadInit() override;
|
||||
|
||||
void threadEnd() override;
|
||||
|
||||
private:
|
||||
/* Prevent use of these */
|
||||
MySQL_Driver(const MySQL_Driver &);
|
||||
void operator=(MySQL_Driver &);
|
||||
|
||||
struct WebAuthn_Callback_Setter;
|
||||
|
||||
friend WebAuthn_Callback_Setter;
|
||||
friend MySQL_Connection;
|
||||
|
||||
};
|
||||
|
||||
/** We do not hide the function if MYSQLCLIENT_STATIC_BINDING(or anything else) not defined
|
||||
because the counterpart C function is declared in the cppconn and is always visible.
|
||||
If dynamic loading is not enabled then its result is just like of get_driver_instance()
|
||||
*/
|
||||
|
||||
CPPCONN_PUBLIC_FUNC MySQL_Driver * _get_driver_instance_by_name(const char * const clientlib);
|
||||
|
||||
inline static MySQL_Driver * get_driver_instance_by_name(const char * const clientlib)
|
||||
{
|
||||
check_lib();
|
||||
return sql::mysql::_get_driver_instance_by_name(clientlib);
|
||||
}
|
||||
|
||||
inline static MySQL_Driver * get_driver_instance()
|
||||
{
|
||||
return sql::mysql::get_driver_instance_by_name("");
|
||||
}
|
||||
|
||||
inline static MySQL_Driver *get_mysql_driver_instance() { return get_driver_instance(); }
|
||||
|
||||
} /* namespace mysql */
|
||||
} /* namespace sql */
|
||||
|
||||
#endif // _MYSQL_DRIVER_H_
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
58
3rdparty/mysql/jdbc/mysql_error.h
vendored
58
3rdparty/mysql/jdbc/mysql_error.h
vendored
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _MYSQL_ERROR_H_
|
||||
#define _MYSQL_ERROR_H_
|
||||
|
||||
namespace sql
|
||||
{
|
||||
namespace mysql
|
||||
{
|
||||
/* Driver specific errors */
|
||||
enum DRIVER_ERROR {
|
||||
/* Underlying client library(cl) can't deal with expired password.
|
||||
Raised when password actually expires */
|
||||
deCL_CANT_HANDLE_EXP_PWD= 820
|
||||
};
|
||||
} /* namespace mysql */
|
||||
} /* namespace sql */
|
||||
|
||||
#endif /* _MYSQL_ERROR_H_ */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
50
3rdparty/mysql/mysql/jdbc.h
vendored
50
3rdparty/mysql/mysql/jdbc.h
vendored
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../jdbc/mysql_connection.h"
|
||||
#include "../jdbc/mysql_driver.h"
|
||||
#include "../jdbc/mysql_error.h"
|
||||
#include "../jdbc/cppconn/build_config.h"
|
||||
#include "../jdbc/cppconn/callback.h"
|
||||
#include "../jdbc/cppconn/config.h"
|
||||
#include "../jdbc/cppconn/connection.h"
|
||||
#include "../jdbc/cppconn/datatype.h"
|
||||
#include "../jdbc/cppconn/driver.h"
|
||||
#include "../jdbc/cppconn/exception.h"
|
||||
#include "../jdbc/cppconn/metadata.h"
|
||||
#include "../jdbc/cppconn/parameter_metadata.h"
|
||||
#include "../jdbc/cppconn/prepared_statement.h"
|
||||
#include "../jdbc/cppconn/resultset.h"
|
||||
#include "../jdbc/cppconn/resultset_metadata.h"
|
||||
#include "../jdbc/cppconn/statement.h"
|
||||
#include "../jdbc/cppconn/sqlstring.h"
|
||||
#include "../jdbc/cppconn/warning.h"
|
||||
#include "../jdbc/cppconn/version_info.h"
|
||||
#include "../jdbc/cppconn/variant.h"
|
||||
68
3rdparty/mysql/mysqlx/common.h
vendored
68
3rdparty/mysql/mysqlx/common.h
vendored
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQL_COMMON_H
|
||||
#define MYSQL_COMMON_H
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
//disable c++17 iterator warnings
|
||||
#define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING
|
||||
|
||||
/*
|
||||
Common definitions and declarations that are needed by public headers.
|
||||
|
||||
Note: Any common stuff that is needed only by the implementation, should be
|
||||
kept in the common/ folder, either as headers or source files.
|
||||
*/
|
||||
|
||||
#include "common_constants.h"
|
||||
#include "common/api.h"
|
||||
#include "common/error.h"
|
||||
#include "common/util.h"
|
||||
#include "common/value.h"
|
||||
#include "common/settings.h"
|
||||
|
||||
PUSH_SYS_WARNINGS
|
||||
#include <cassert>
|
||||
POP_SYS_WARNINGS
|
||||
|
||||
/*
|
||||
On Windows, dependency on the sockets library can be handled using
|
||||
#pragma comment directive.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma comment(lib,"ws2_32")
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
181
3rdparty/mysql/mysqlx/common/api.h
vendored
181
3rdparty/mysql/mysqlx/common/api.h
vendored
@@ -1,181 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_COMMON_API_H
|
||||
#define MYSQLX_COMMON_API_H
|
||||
|
||||
|
||||
/*
|
||||
X DevAPI ABI version and revision
|
||||
=================================
|
||||
|
||||
All public symbols inside mysqlx namespace should be defined inside
|
||||
MYSQLX_ABI_BEGIN(X,Y) ... MYSQLX_ABI_END(X,Y) block, where X.Y is the
|
||||
ABI version of the symbol. This puts the symbol inside mysqlx::abiX::rY
|
||||
namespace.
|
||||
|
||||
The current ABI version is determined by MYSQLX_ABI_X_Y macros below. Using
|
||||
inline namespace ensures that symbol reference mysqlx::foo resolves
|
||||
to mysqlx::abiX::rY::foo, where X.Y is the current ABI version.
|
||||
|
||||
Declarations below ensure, that each ABI revision namespace includes all
|
||||
symbols from previous revisions (via using namespace declaration).
|
||||
|
||||
If the same symbol is defined for several revisions of the ABI, the latest
|
||||
one will shadow other definitions but earlier revisions will be also present
|
||||
to be used by old code. This way backward ABI compatibility can be maintained.
|
||||
*/
|
||||
|
||||
/*
|
||||
When new ABI version or revision is added, the corresponding
|
||||
MYSQLX_ABI_MAJOR/MINOR_X macro needs to be added below. The macros for the
|
||||
latest ABI version and revision should expand to "inline", other MSQLX_ABI_*
|
||||
macros should have empty expansion. For example,
|
||||
after adding revision ABI 2.1 these macros should look as follows:
|
||||
|
||||
#define MYSQLX_ABI_MAJOR_2 inline // current ABI version
|
||||
#define MYSQLX_ABI_MINOR_0
|
||||
#define MYSQLX_ABI_MINOR_1 inline // current ABI revision
|
||||
|
||||
TODO: Auto-generate this based on information in version.cmake
|
||||
*/
|
||||
|
||||
#define MYSQLX_ABI_MAJOR_2 inline // current ABI version
|
||||
#define MYSQLX_ABI_MINOR_0 inline // current ABI revision
|
||||
|
||||
|
||||
#define MYSQLX_ABI_BEGIN(X,Y) \
|
||||
MYSQLX_ABI_MAJOR_ ## X namespace abi ## X { \
|
||||
MYSQLX_ABI_MINOR_ ## Y namespace r ## Y {
|
||||
|
||||
#define MYSQLX_ABI_END(X,Y) }}
|
||||
|
||||
#define MYSQLX_ABI(X,Y) mysqlx::abi##X::r##Y
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mysqlx {
|
||||
|
||||
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
namespace internal {
|
||||
}
|
||||
|
||||
namespace common {
|
||||
}
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
|
||||
/*
|
||||
When new revision 1 of the current ABI 2 is added, the following declarations
|
||||
should be added. They import all revision 0 symbols into revision 1. Symbols
|
||||
that have changed should be defined inside
|
||||
MYSQLX_ABI_BEGIN(2,1) ... MYSQLX_ABI_END(2,1) and they will
|
||||
shadow the corresponding revision 0 symbol.
|
||||
|
||||
MYSQLX_ABI_BEGIN(2,1)
|
||||
|
||||
using namespace r0;
|
||||
|
||||
namespace internal {
|
||||
using namespace r0::internal;
|
||||
}
|
||||
|
||||
namespace common {
|
||||
using namespace r0::common;
|
||||
}
|
||||
|
||||
MYSQLX_ABI_END(2,1)
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
/*
|
||||
Macros for declaring public API
|
||||
===============================
|
||||
|
||||
API function declarations should be decorated with PUBLIC_API prefix. API
|
||||
classes should have PUBLIC_API marker between the "class" keyword and
|
||||
the class name.
|
||||
|
||||
See: https://gcc.gnu.org/wiki/Visibility
|
||||
|
||||
TODO: Use better name than PUBLIC_API - not all public API classes should
|
||||
be decorated with these declarations but only these whose implementation
|
||||
is inside the library (so, not the ones which are implemented in headers).
|
||||
*/
|
||||
|
||||
#if defined _MSC_VER
|
||||
|
||||
#define DLL_EXPORT __declspec(dllexport)
|
||||
#define DLL_IMPORT __declspec(dllimport)
|
||||
#define DLL_LOCAL
|
||||
|
||||
#elif __GNUC__ >= 4
|
||||
|
||||
#define DLL_EXPORT __attribute__ ((visibility ("default")))
|
||||
#define DLL_IMPORT
|
||||
#define DLL_LOCAL __attribute__ ((visibility ("hidden")))
|
||||
|
||||
#elif defined __SUNPRO_CC || defined __SUNPRO_C
|
||||
|
||||
#define DLL_EXPORT __global
|
||||
#define DLL_IMPORT __global
|
||||
#define DLL_LOCAL __hidden
|
||||
|
||||
#else
|
||||
|
||||
#define DLL_EXPORT
|
||||
#define DLL_IMPORT
|
||||
#define DLL_LOCAL
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined CONCPP_BUILD_SHARED
|
||||
#define PUBLIC_API DLL_EXPORT
|
||||
#define INTERNAL DLL_LOCAL
|
||||
#elif defined CONCPP_BUILD_STATIC
|
||||
#define PUBLIC_API
|
||||
#define INTERNAL
|
||||
#elif !defined STATIC_CONCPP
|
||||
#define PUBLIC_API DLL_IMPORT
|
||||
#define INTERNAL
|
||||
#else
|
||||
#define PUBLIC_API
|
||||
#define INTERNAL
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
99
3rdparty/mysql/mysqlx/common/error.h
vendored
99
3rdparty/mysql/mysqlx/common/error.h
vendored
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_COMMON_ERROR_H
|
||||
#define MYSQLX_COMMON_ERROR_H
|
||||
|
||||
/*
|
||||
TODO: Error handling infrastructure for XDevAPI and X DevAPI for C still
|
||||
needs to be done. Current code is just a temporary hack.
|
||||
*/
|
||||
|
||||
#include "api.h"
|
||||
#include "util.h"
|
||||
|
||||
PUSH_SYS_WARNINGS
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <ostream>
|
||||
#include <memory>
|
||||
#include <forward_list>
|
||||
#include <string.h> // for memcpy
|
||||
#include <utility> // std::move etc
|
||||
POP_SYS_WARNINGS
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
namespace common {
|
||||
|
||||
/**
|
||||
Base class for connector errors.
|
||||
|
||||
@internal
|
||||
TODO: Derive from std::system_error and introduce proper
|
||||
error codes.
|
||||
@endinternal
|
||||
|
||||
@ingroup devapi
|
||||
*/
|
||||
|
||||
class Error : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
|
||||
Error(const char *msg)
|
||||
: std::runtime_error(msg)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
std::ostream& operator<<(std::ostream &out, const Error &e)
|
||||
{
|
||||
out << e.what();
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void throw_error(const char *msg)
|
||||
{
|
||||
throw Error(msg);
|
||||
}
|
||||
|
||||
} // common
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
|
||||
#endif
|
||||
346
3rdparty/mysql/mysqlx/common/op_if.h
vendored
346
3rdparty/mysql/mysqlx/common/op_if.h
vendored
@@ -1,346 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_COMMON_OP_IF_H
|
||||
#define MYSQLX_COMMON_OP_IF_H
|
||||
|
||||
/*
|
||||
This file defines a hierarchy of abstract interfaces for objects that
|
||||
represent database operations. The base interface is the Executable_if for
|
||||
any operation that can be executed. Other interfaces in the hierarchy allow
|
||||
specifying more details of the operation.
|
||||
|
||||
Note: Header op_impl.h defines implementations of these interfaces used
|
||||
in the connector.
|
||||
*/
|
||||
|
||||
#include "api.h"
|
||||
#include "../common_constants.h"
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
namespace common {
|
||||
|
||||
class Result_init;
|
||||
class Value;
|
||||
|
||||
#define LOCK_MODE(X,N) X = N,
|
||||
enum Lock_mode
|
||||
{
|
||||
LOCK_MODE_LIST(LOCK_MODE)
|
||||
};
|
||||
|
||||
#define LOCK_CONTENTION(X,N) X = N,
|
||||
enum class Lock_contention
|
||||
{
|
||||
LOCK_CONTENTION_LIST(LOCK_CONTENTION)
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Abstract interface for internal implementations of an executable object.
|
||||
|
||||
The execute() method returns a Result_init object which can be
|
||||
used to construct a result instance.
|
||||
|
||||
Implementation of an executable object holds a description of the operation
|
||||
that should be executed. Executable objects can be copied (for example
|
||||
by copy assignment operation) and in this case a new copy of the current
|
||||
description of the operation should be created by clone() method. After
|
||||
cloning, the 2 executable implementations can be modified and executed
|
||||
independently.
|
||||
|
||||
See various Op_xxx classes defined for example in operation.h to see examples
|
||||
of executable object implementations. Note that these Op_xxx classes do
|
||||
not directly inherit from Executable_if. Instead they use a whole hierarchy
|
||||
of implementation classes based on Executable_if. But in the end, each
|
||||
implementation of an executable object defines the execute() method that
|
||||
executes given operation using all the information collected using other
|
||||
methods of the implementation class.
|
||||
*/
|
||||
|
||||
struct Executable_if
|
||||
{
|
||||
/*
|
||||
Execute the operation and return reference to object which implements
|
||||
Result_init interface. Such object is then used to construct a result
|
||||
instance.
|
||||
*/
|
||||
|
||||
virtual Result_init& execute() = 0;
|
||||
|
||||
virtual Executable_if *clone() const = 0;
|
||||
|
||||
virtual ~Executable_if() {}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
The XXX_if classes defined below form a hierarchy of interfaces, based
|
||||
on Executable_if, for internal implementations of various crud operations.
|
||||
The concrete implementations, like Op_collection_find defined in
|
||||
operation.h, implements one of the top interfaces in this hierarchy but
|
||||
the hierarchy allows casting the implementation down to the layer
|
||||
implementing particular aspect of the operation. For example
|
||||
Limit_if interface allows setting limit and offset for returned/affected
|
||||
rows/documents, which is common for different CRUD operations.
|
||||
*/
|
||||
|
||||
|
||||
struct Bind_if : public Executable_if
|
||||
{
|
||||
using string = std::string;
|
||||
|
||||
// Add value for named parameter
|
||||
|
||||
virtual void add_param(const string&, const Value&) = 0;
|
||||
|
||||
// Add value for positional parameter
|
||||
|
||||
virtual void add_param(Value) = 0;
|
||||
|
||||
virtual void clear_params() = 0;
|
||||
};
|
||||
|
||||
|
||||
struct Limit_if : public Bind_if
|
||||
{
|
||||
virtual void set_offset(unsigned) = 0;
|
||||
virtual void clear_offset() = 0;
|
||||
|
||||
virtual void set_limit(unsigned) = 0;
|
||||
virtual void clear_limit() = 0;
|
||||
};
|
||||
|
||||
|
||||
struct Sort_if : public Limit_if
|
||||
{
|
||||
using string = std::string;
|
||||
enum direction_t { ASC, DESC };
|
||||
|
||||
virtual void add_sort(const string &expr, direction_t dir) = 0;
|
||||
virtual void add_sort(const string&) = 0;
|
||||
virtual void clear_sort() = 0;
|
||||
};
|
||||
|
||||
|
||||
struct Having_if : public Sort_if
|
||||
{
|
||||
using string = std::string;
|
||||
|
||||
virtual void set_having(const string&) = 0;
|
||||
virtual void clear_having() = 0;
|
||||
};
|
||||
|
||||
|
||||
struct Group_by_if : public Having_if
|
||||
{
|
||||
using string = std::string;
|
||||
|
||||
virtual void add_group_by(const string&) = 0;
|
||||
virtual void clear_group_by() = 0;
|
||||
};
|
||||
|
||||
|
||||
struct Proj_if : public Group_by_if
|
||||
{
|
||||
using string = std::string;
|
||||
|
||||
/*
|
||||
Add projection specification for a table query. It is an expression with
|
||||
optional "AS <alias>" suffix.
|
||||
*/
|
||||
|
||||
virtual void add_proj(const string&) = 0;
|
||||
|
||||
/*
|
||||
Set projection for a document query. It is a JSON-like string but document
|
||||
field values are interpreted as expressions.
|
||||
*/
|
||||
|
||||
virtual void set_proj(const string&) = 0;
|
||||
|
||||
virtual void clear_proj() = 0;
|
||||
};
|
||||
|
||||
|
||||
template <class Base>
|
||||
struct Select_if : public Base
|
||||
{
|
||||
using string = std::string;
|
||||
|
||||
// Set expression to select rows/documents.
|
||||
|
||||
virtual void set_where(const string&) = 0;
|
||||
|
||||
// Define lock mode for rows/documents returned by the query.
|
||||
|
||||
virtual void set_lock_mode(Lock_mode, Lock_contention) = 0;
|
||||
virtual void clear_lock_mode() = 0;
|
||||
};
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
||||
struct Collection_find_if : public Select_if<Proj_if>
|
||||
{};
|
||||
|
||||
|
||||
/*
|
||||
Interface to internal implementations of CRUD add operation.
|
||||
*/
|
||||
|
||||
struct Collection_add_if : public Executable_if
|
||||
{
|
||||
/*
|
||||
Note: Current implementation only supports sending
|
||||
documents in form of UTF8 JSON strings.
|
||||
*/
|
||||
|
||||
virtual void add_json(const std::string&) = 0;
|
||||
virtual void clear_docs() = 0;
|
||||
};
|
||||
|
||||
|
||||
struct Collection_remove_if : public Select_if<Sort_if>
|
||||
{};
|
||||
|
||||
|
||||
/*
|
||||
Interface to internal implementations of CRUD modify operation.
|
||||
|
||||
Methods `add_operation` are used to pass to the implementation object
|
||||
the modifications requested by the user.
|
||||
*/
|
||||
|
||||
struct Collection_modify_if : public Select_if<Sort_if>
|
||||
{
|
||||
using string = std::string;
|
||||
|
||||
enum Operation
|
||||
{
|
||||
SET,
|
||||
UNSET,
|
||||
ARRAY_INSERT,
|
||||
ARRAY_APPEND,
|
||||
ARRAY_DELETE,
|
||||
MERGE_PATCH
|
||||
};
|
||||
|
||||
virtual void add_operation(Operation, const string&, const Value&) = 0;
|
||||
virtual void add_operation(Operation, const string&) = 0;
|
||||
virtual void clear_modifications() = 0;
|
||||
};
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
||||
/*
|
||||
Interface to be implemented by internal implementations of
|
||||
table insert operation.
|
||||
*/
|
||||
|
||||
template <class Row_impl>
|
||||
struct Table_insert_if : public Executable_if
|
||||
{
|
||||
using string = std::string;
|
||||
|
||||
/*
|
||||
Pass to the implementation names of columns specified by
|
||||
the user. Columns are passed one-by-one in the order in
|
||||
which they were specified.
|
||||
*/
|
||||
|
||||
virtual void add_column(const string&) = 0;
|
||||
virtual void clear_columns() = 0;
|
||||
|
||||
/*
|
||||
Pass to the implementation a row that should be inserted
|
||||
into the table. Several rows can be passed.
|
||||
|
||||
TODO: use move semantics instead
|
||||
*/
|
||||
|
||||
virtual void add_row(const Row_impl&) = 0;
|
||||
virtual void clear_rows() = 0;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Interface to be implemented by internal implementations
|
||||
of table CRUD select operation.
|
||||
|
||||
Method `add_where` is used to report selection criteria
|
||||
to the implementation.
|
||||
*/
|
||||
|
||||
struct Table_select_if : public Select_if<Proj_if>
|
||||
{};
|
||||
|
||||
|
||||
/*
|
||||
Interface to be implemented by internal implementations
|
||||
of table CRUD remove operation.
|
||||
|
||||
Selection criteria which selects rows to be removed is
|
||||
passed to the implementation using `set_where` method.
|
||||
|
||||
Note: setting where condition to empty string removes it.
|
||||
*/
|
||||
|
||||
struct Table_remove_if : public Select_if<Sort_if>
|
||||
{};
|
||||
|
||||
|
||||
/*
|
||||
Interface to be implemented by internal implementations of
|
||||
table CRUD update operation. Such update operation sets values
|
||||
of fields in a row. Name of the column that should be set and
|
||||
expression defining new value are reported to the implementation
|
||||
using method `add_set`.
|
||||
*/
|
||||
|
||||
struct Table_update_if : public Table_remove_if
|
||||
{
|
||||
using string = std::string;
|
||||
|
||||
virtual void add_set(const string&, const Value&) = 0;
|
||||
virtual void clear_modifications() = 0;
|
||||
};
|
||||
|
||||
} // internal
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif
|
||||
427
3rdparty/mysql/mysqlx/common/settings.h
vendored
427
3rdparty/mysql/mysqlx/common/settings.h
vendored
@@ -1,427 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_COMMON_SETTINGS_H
|
||||
#define MYSQLX_COMMON_SETTINGS_H
|
||||
|
||||
/*
|
||||
Classes and code handling session settings. They are used to process session
|
||||
creation options, check their consistency and present the settings in the
|
||||
form expected by CDK.
|
||||
|
||||
Known session options and their values are defined
|
||||
in mysql_common_constants.h header as SESSION_OPTION_LIST() and accompanying
|
||||
macros.
|
||||
*/
|
||||
|
||||
#include "../common_constants.h"
|
||||
#include "value.h"
|
||||
|
||||
PUSH_SYS_WARNINGS
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <bitset>
|
||||
#include <sstream>
|
||||
POP_SYS_WARNINGS
|
||||
|
||||
|
||||
namespace cdk {
|
||||
namespace ds {
|
||||
|
||||
class Multi_source;
|
||||
struct Attr_processor;
|
||||
|
||||
}}
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
namespace common {
|
||||
|
||||
|
||||
/*
|
||||
Class for storing session configuration settings.
|
||||
*/
|
||||
|
||||
class PUBLIC_API Settings_impl
|
||||
{
|
||||
public:
|
||||
|
||||
/*
|
||||
Enumerations with available session options and their values.
|
||||
*/
|
||||
|
||||
#define SETTINGS_OPT_ENUM_str(X,N) X = N,
|
||||
#define SETTINGS_OPT_ENUM_num(X,N) X = N,
|
||||
#define SETTINGS_OPT_ENUM_any(X,N) X = N,
|
||||
#define SETTINGS_OPT_ENUM_bool(X,N) X = N,
|
||||
|
||||
enum Session_option_impl{
|
||||
SESSION_OPTION_LIST(SETTINGS_OPT_ENUM)
|
||||
LAST
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Enumerations with available client options and their values.
|
||||
*/
|
||||
|
||||
#define CLIENT_OPT_IMPL_ENUM_str(X,N) X = -N,
|
||||
#define CLIENT_OPT_IMPL_ENUM_bool(X,N) X = -N,
|
||||
#define CLIENT_OPT_IMPL_ENUM_num(X,N) X = -N,
|
||||
#define CLIENT_OPT_IMPL_ENUM_any(X,N) X = -N,
|
||||
|
||||
enum Client_option_impl {
|
||||
CLIENT_OPTION_LIST(CLIENT_OPT_IMPL_ENUM)
|
||||
};
|
||||
|
||||
|
||||
|
||||
static const char* option_name(int opt);
|
||||
|
||||
|
||||
#define SETTINGS_VAL_ENUM(X,N) X = N,
|
||||
|
||||
enum class SSL_mode {
|
||||
SSL_MODE_LIST(SETTINGS_VAL_ENUM)
|
||||
LAST
|
||||
};
|
||||
|
||||
static const char* ssl_mode_name(SSL_mode mode);
|
||||
|
||||
|
||||
enum class Auth_method {
|
||||
AUTH_METHOD_LIST(SETTINGS_VAL_ENUM)
|
||||
LAST
|
||||
};
|
||||
|
||||
static const char* auth_method_name(Auth_method method);
|
||||
|
||||
enum class Compression_mode {
|
||||
COMPRESSION_MODE_LIST(SETTINGS_VAL_ENUM)
|
||||
LAST
|
||||
};
|
||||
|
||||
static const char* compression_mode_name(Compression_mode mode);
|
||||
|
||||
protected:
|
||||
|
||||
using Value = common::Value;
|
||||
using opt_val_t = std::pair<int, Value>;
|
||||
// TODO: use multimap instead?
|
||||
using option_list_t = std::vector<opt_val_t>;
|
||||
using connection_attr = std::map<std::string,std::string>;
|
||||
using iterator = option_list_t::const_iterator;
|
||||
|
||||
public:
|
||||
|
||||
/*
|
||||
Examine settings stored in this object.
|
||||
*/
|
||||
|
||||
bool has_option(int) const;
|
||||
const Value& get(int) const;
|
||||
|
||||
|
||||
// Iterating over options stored in this object.
|
||||
|
||||
iterator begin() const
|
||||
{
|
||||
return m_data.m_options.cbegin();
|
||||
}
|
||||
|
||||
iterator end() const
|
||||
{
|
||||
return m_data.m_options.cend();
|
||||
}
|
||||
|
||||
/*
|
||||
Clear individual or all settings.
|
||||
*/
|
||||
|
||||
void clear();
|
||||
void erase(int);
|
||||
|
||||
/*
|
||||
Session options include connection options that specify data source
|
||||
(one or many) for which given session is created. This method initializes
|
||||
CDK Multi_source object to describe the data source(s) based on the
|
||||
connection options.
|
||||
*/
|
||||
|
||||
void get_data_source(cdk::ds::Multi_source&);
|
||||
|
||||
void get_attributes(cdk::ds::Attr_processor&);
|
||||
|
||||
// Set options based on URI
|
||||
|
||||
void set_from_uri(const std::string &);
|
||||
|
||||
// Set Client options based on JSON object
|
||||
|
||||
void set_client_opts(const std::string &);
|
||||
|
||||
// Set Client options from othe Settings object
|
||||
|
||||
void set_client_opts(const Settings_impl &);
|
||||
|
||||
/*
|
||||
Public API has no methods to directly set individual options. Instead,
|
||||
to change session settings implementation should create a Setter object
|
||||
and use its methods to do the changes. A Settings_impl::Setter object
|
||||
provides "transactional" semantics for changing session options -- only
|
||||
consistent option changes modify the original Settings_impl object.
|
||||
|
||||
Note: This Setter class is defined in "implementation" header
|
||||
common/settings.h. The public API leaves it undefined.
|
||||
*/
|
||||
|
||||
class Setter;
|
||||
|
||||
protected:
|
||||
|
||||
struct PUBLIC_API Data
|
||||
{
|
||||
Data()
|
||||
{
|
||||
init_connection_attr();
|
||||
}
|
||||
DLL_WARNINGS_PUSH
|
||||
option_list_t m_options;
|
||||
connection_attr m_connection_attr;
|
||||
DLL_WARNINGS_POP
|
||||
unsigned m_host_cnt = 0;
|
||||
bool m_user_priorities = false;
|
||||
bool m_ssl_ca = false;
|
||||
SSL_mode m_ssl_mode = SSL_mode::LAST;
|
||||
bool m_tcpip = false; // set to true if TCPIP connection was specified
|
||||
bool m_sock = false; // set to true if socket connection was specified
|
||||
bool m_tls_vers = false;
|
||||
bool m_tls_ciphers = false;
|
||||
bool m_compression_algorithms = false;
|
||||
|
||||
void erase(int);
|
||||
void init_connection_attr();
|
||||
void clear_connection_attr();
|
||||
|
||||
};
|
||||
|
||||
Data m_data;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#define SETTINGS_OPT_NAME_str(X,N) case N: return #X;
|
||||
#define SETTINGS_OPT_NAME_bool(X,N) case N: return #X;
|
||||
#define SETTINGS_OPT_NAME_num(X,N) case N: return #X;
|
||||
#define SETTINGS_OPT_NAME_any(X,N) case N: return #X;
|
||||
#define SETTINGS_OPT_NAME_bool(X,N) case N: return #X;
|
||||
|
||||
|
||||
#define CLIENT_OPT_NAME_str(X,N) case -N: return #X;
|
||||
#define CLIENT_OPT_NAME_bool(X,N) case -N: return #X;
|
||||
#define CLIENT_OPT_NAME_num(X,N) case -N: return #X;
|
||||
#define CLIENT_OPT_NAME_any(X,N) case -N: return #X;
|
||||
|
||||
|
||||
inline
|
||||
const char* Settings_impl::option_name(int opt)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
SESSION_OPTION_LIST(SETTINGS_OPT_NAME)
|
||||
CLIENT_OPTION_LIST(CLIENT_OPT_NAME)
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define SETTINGS_VAL_NAME(X,N) case N: return #X;
|
||||
|
||||
inline
|
||||
const char* Settings_impl::ssl_mode_name(SSL_mode mode)
|
||||
{
|
||||
switch (unsigned(mode))
|
||||
{
|
||||
SSL_MODE_LIST(SETTINGS_VAL_NAME)
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
const char* Settings_impl::auth_method_name(Auth_method method)
|
||||
{
|
||||
switch (unsigned(method))
|
||||
{
|
||||
AUTH_METHOD_LIST(SETTINGS_VAL_NAME)
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
const char* Settings_impl::compression_mode_name(Compression_mode mode)
|
||||
{
|
||||
switch (unsigned(mode))
|
||||
{
|
||||
COMPRESSION_MODE_LIST(SETTINGS_VAL_NAME)
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Note: For options that can repeat, returns the last value.
|
||||
*/
|
||||
|
||||
inline
|
||||
const common::Value& Settings_impl::get(int opt) const
|
||||
{
|
||||
using std::find_if;
|
||||
|
||||
auto it = find_if(m_data.m_options.crbegin(), m_data.m_options.crend(),
|
||||
[opt](opt_val_t el) -> bool { return el.first == opt; }
|
||||
);
|
||||
|
||||
static Value null_value;
|
||||
|
||||
if (it == m_data.m_options.crend())
|
||||
return null_value;
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
bool Settings_impl::has_option(int opt) const
|
||||
{
|
||||
// For options whose value is a list, we return true if we know the option
|
||||
// was set even if no actual values are stored in m_options, which is the
|
||||
// case when option value is an empty list.
|
||||
|
||||
switch (opt)
|
||||
{
|
||||
case Session_option_impl::TLS_VERSIONS:
|
||||
if (m_data.m_tls_vers)
|
||||
return true;
|
||||
break;
|
||||
|
||||
case Session_option_impl::TLS_CIPHERSUITES:
|
||||
if (m_data.m_tls_ciphers)
|
||||
return true;
|
||||
break;
|
||||
|
||||
case Session_option_impl::COMPRESSION_ALGORITHMS:
|
||||
if (m_data.m_compression_algorithms)
|
||||
return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return m_data.m_options.cend() !=
|
||||
find_if(m_data.m_options.cbegin(), m_data.m_options.cend(),
|
||||
[opt](opt_val_t el) -> bool { return el.first == opt; }
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void Settings_impl::erase(int opt)
|
||||
{
|
||||
m_data.erase(opt);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Note: Removes all occurrences of the given option. Also updates the context
|
||||
used for checking option consistency.
|
||||
*/
|
||||
|
||||
inline
|
||||
void Settings_impl::Data::erase(int opt)
|
||||
{
|
||||
remove_from(m_options,
|
||||
[opt](opt_val_t el) -> bool
|
||||
{
|
||||
return el.first == opt;
|
||||
}
|
||||
);
|
||||
|
||||
/*
|
||||
TODO: removing HOST from multi-host settings can leave "orphaned"
|
||||
PORT/PRIORITY settings. Do we correctly detect that?
|
||||
*/
|
||||
|
||||
switch (opt)
|
||||
{
|
||||
case Session_option_impl::HOST:
|
||||
m_host_cnt = 0;
|
||||
FALLTHROUGH;
|
||||
case Session_option_impl::PORT:
|
||||
if (0 == m_host_cnt)
|
||||
m_tcpip = false;
|
||||
break;
|
||||
case Session_option_impl::SOCKET:
|
||||
m_sock = false;
|
||||
break;
|
||||
case Session_option_impl::PRIORITY:
|
||||
m_user_priorities = false;
|
||||
break;
|
||||
case Session_option_impl::SSL_CA:
|
||||
m_ssl_ca = false;
|
||||
break;
|
||||
case Session_option_impl::SSL_MODE:
|
||||
m_ssl_mode = SSL_mode::LAST;
|
||||
break;
|
||||
case Session_option_impl::CONNECTION_ATTRIBUTES:
|
||||
clear_connection_attr();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // common namespace
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
|
||||
} // mysqlx namespace
|
||||
|
||||
#endif
|
||||
|
||||
414
3rdparty/mysql/mysqlx/common/util.h
vendored
414
3rdparty/mysql/mysqlx/common/util.h
vendored
@@ -1,414 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_COMMON_UTIL_H
|
||||
#define MYSQLX_COMMON_UTIL_H
|
||||
|
||||
#include "api.h"
|
||||
#include <limits>
|
||||
|
||||
/*
|
||||
Macros used to disable warnings for fragments of code.
|
||||
*/
|
||||
|
||||
#if defined _MSC_VER
|
||||
|
||||
|
||||
#define PRAGMA(X) __pragma(X)
|
||||
#define DISABLE_WARNING(W) PRAGMA(warning (disable:W))
|
||||
|
||||
#define DIAGNOSTIC_PUSH PRAGMA(warning (push))
|
||||
#define DIAGNOSTIC_POP PRAGMA(warning (pop))
|
||||
|
||||
#elif defined __GNUC__ || defined __clang__
|
||||
|
||||
#define PRAGMA(X) _Pragma(#X)
|
||||
#define DISABLE_WARNING(W) PRAGMA(GCC diagnostic ignored #W)
|
||||
|
||||
#if defined __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
|
||||
#define DIAGNOSTIC_PUSH PRAGMA(GCC diagnostic push)
|
||||
#define DIAGNOSTIC_POP PRAGMA(GCC diagnostic pop)
|
||||
#else
|
||||
#define DIAGNOSTIC_PUSH
|
||||
#define DIAGNOSTIC_POP
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define PRAGMA(X)
|
||||
#define DISABLE_WARNING(W)
|
||||
|
||||
#define DIAGNOSTIC_PUSH
|
||||
#define DIAGNOSTIC_POP
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Macros to disable compile warnings in system headers. Put
|
||||
PUSH_SYS_WARNINGS/POP_SYS_WARNINGS around sytem header includes.
|
||||
*/
|
||||
|
||||
#if defined _MSC_VER
|
||||
|
||||
/*
|
||||
Warning 4350 is triggered by std::shared_ptr<> implementation
|
||||
- see https://msdn.microsoft.com/en-us/library/0eestyah.aspx
|
||||
|
||||
Warning 4365 conversion from 'type_1' to 'type_2', signed/unsigned mismatch
|
||||
- see https://msdn.microsoft.com/en-us/library/ms173683.aspx
|
||||
|
||||
Warning 4774 format string expected in argument <position> is not a
|
||||
string literal
|
||||
*/
|
||||
|
||||
#define PUSH_SYS_WARNINGS \
|
||||
PRAGMA(warning (push,2)) \
|
||||
DISABLE_WARNING(4350) \
|
||||
DISABLE_WARNING(4738) \
|
||||
DISABLE_WARNING(4548) \
|
||||
DISABLE_WARNING(4365) \
|
||||
DISABLE_WARNING(4774) \
|
||||
DISABLE_WARNING(4244)
|
||||
|
||||
#else
|
||||
|
||||
#define PUSH_SYS_WARNINGS DIAGNOSTIC_PUSH
|
||||
|
||||
#endif
|
||||
|
||||
#define POP_SYS_WARNINGS DIAGNOSTIC_POP
|
||||
|
||||
PUSH_SYS_WARNINGS
|
||||
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <ostream>
|
||||
#include <memory>
|
||||
#include <forward_list>
|
||||
#include <string.h> // for memcpy
|
||||
#include <utility> // std::move etc
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
|
||||
POP_SYS_WARNINGS
|
||||
|
||||
/*
|
||||
Macro to be used to disable "implicit fallthrough" gcc warning
|
||||
<https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html>
|
||||
*/
|
||||
|
||||
#ifndef FALLTHROUGH
|
||||
# ifdef __GNUC__
|
||||
# if __GNUC__ < 7
|
||||
# define FALLTHROUGH // fallthrough
|
||||
# else
|
||||
# if __cplusplus >= 201703L
|
||||
# define FALLTHROUGH [[fallthrough]] // C++17
|
||||
# elif __cplusplus >= 201103L
|
||||
# define FALLTHROUGH [[gnu::fallthrough]] // C++11 and C++14
|
||||
# else
|
||||
# define FALLTHROUGH __attribute__((fallthrough))
|
||||
# endif
|
||||
# endif
|
||||
# else
|
||||
# define FALLTHROUGH // fallthrough
|
||||
# endif
|
||||
#endif //FALLTHROUGH
|
||||
|
||||
/*
|
||||
Note: we add throw statement to the definition of THROW() so that compiler won't
|
||||
complain if it is used in contexts where, e.g., a value should be returned from
|
||||
a function.
|
||||
*/
|
||||
|
||||
#undef THROW
|
||||
|
||||
#ifdef THROW_AS_ASSERT
|
||||
|
||||
#define THROW(MSG) do { assert(false && (MSG)); throw (MSG); } while(false)
|
||||
|
||||
#else
|
||||
|
||||
#define THROW(MSG) do { throw_error(MSG); throw (MSG); } while(false)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Macros used to disable warnings for fragments of code.
|
||||
*/
|
||||
|
||||
#undef PRAGMA
|
||||
#undef DISABLE_WARNING
|
||||
#undef DIAGNOSTIC_PUSH
|
||||
#undef DIAGNOSTIC_POP
|
||||
|
||||
#if defined _MSC_VER
|
||||
|
||||
#define PRAGMA(X) __pragma(X)
|
||||
#define DISABLE_WARNING(W) PRAGMA(warning(disable : W))
|
||||
|
||||
#define DIAGNOSTIC_PUSH PRAGMA(warning(push))
|
||||
#define DIAGNOSTIC_POP PRAGMA(warning(pop))
|
||||
|
||||
#elif defined __GNUC__ || defined __clang__
|
||||
|
||||
#define PRAGMA(X) _Pragma(#X)
|
||||
#define DISABLE_WARNING(W) PRAGMA(GCC diagnostic ignored #W)
|
||||
|
||||
#if defined __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
|
||||
#define DIAGNOSTIC_PUSH PRAGMA(GCC diagnostic push)
|
||||
#define DIAGNOSTIC_POP PRAGMA(GCC diagnostic pop)
|
||||
#else
|
||||
#define DIAGNOSTIC_PUSH
|
||||
#define DIAGNOSTIC_POP
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define PRAGMA(X)
|
||||
#define DISABLE_WARNING(W)
|
||||
|
||||
#define DIAGNOSTIC_PUSH
|
||||
#define DIAGNOSTIC_POP
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
On Windows, MSVC issues warnings if public API class definition uses
|
||||
another class which is not exported as public API (either as a base class
|
||||
or type of member). This is indeed dangerous because client code might get
|
||||
the class definition wrong if the non-exported component is not available or
|
||||
(worse) is defined in a different way than the same component during connector
|
||||
build time.
|
||||
|
||||
We can not completely avoid these warnings because for some API classes we
|
||||
use standard C++ library classes as components. For example, we use
|
||||
std::shared_ptr<> a lot. We can not modify standard library headers to export
|
||||
these classes. As is the common practice, we ignore this issue assuming that
|
||||
the code that uses our connector is built with the same C++ runtime
|
||||
implementation as the one used to build the connector. To silence the warnings,
|
||||
uses of standard library classes in our public API classes should be surrounded
|
||||
with DLL_WARNINGS_PUSH/POP macros.
|
||||
*/
|
||||
|
||||
#if defined _MSC_VER
|
||||
|
||||
#define DLL_WARNINGS_PUSH DIAGNOSTIC_PUSH \
|
||||
DISABLE_WARNING(4251) \
|
||||
DISABLE_WARNING(4275)
|
||||
#define DLL_WARNINGS_POP DIAGNOSTIC_POP
|
||||
|
||||
#else
|
||||
|
||||
#define DLL_WARNINGS_PUSH
|
||||
#define DLL_WARNINGS_POP
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
A dirty trick to help Doxygen to process 'enum class' declarations, which
|
||||
are not fully supported. Thus we replace them by plain 'enum' when processing
|
||||
sources by Doxygen.
|
||||
*/
|
||||
|
||||
#ifdef DOXYGEN
|
||||
#define enum_class enum
|
||||
#else
|
||||
#define enum_class enum class
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Macro to put at the end of other macros that define lists of items. This is
|
||||
another dirty trick for Doxygen to hide from it a documentation of the last
|
||||
item in the list. Otherwise, in a situation like this:
|
||||
|
||||
#define ITEM_LIST(X) \
|
||||
X(item1) \
|
||||
...
|
||||
X(itemN) /##< Doc for last item #/
|
||||
|
||||
Doxegen treats the documentation of the last item as documentation for
|
||||
the whole ITEM_LIST() macro. This does not happen if END_LIST is added at
|
||||
the end:
|
||||
|
||||
#define ITEM_LIST(X) \
|
||||
X(item1) \
|
||||
...
|
||||
X(itemN) /##< Doc for last item #/ \
|
||||
END_LIST
|
||||
*/
|
||||
|
||||
#define END_LIST
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
namespace common {
|
||||
|
||||
/*
|
||||
Convenience for checking numeric limits (to be used when doing numeric
|
||||
casts).
|
||||
|
||||
TODO: Maybe more templates are needed for the case where T is a float/double
|
||||
type and U is an integer type or vice versa.
|
||||
*/
|
||||
|
||||
template <
|
||||
typename T, typename U,
|
||||
typename std::enable_if<std::is_unsigned<U>::value>::type* = nullptr
|
||||
>
|
||||
inline
|
||||
bool check_num_limits(U val)
|
||||
{
|
||||
using UT = typename std::make_unsigned<T>::type;
|
||||
return !(val > (UT)std::numeric_limits<T>::max());
|
||||
}
|
||||
|
||||
template <
|
||||
typename T, typename U,
|
||||
typename std::enable_if<std::is_unsigned<T>::value>::type* = nullptr,
|
||||
typename std::enable_if<!std::is_unsigned<U>::value>::type* = nullptr
|
||||
>
|
||||
inline
|
||||
bool check_num_limits(U val)
|
||||
{
|
||||
return !(val < 0) && !(val > std::numeric_limits<T>::max());
|
||||
}
|
||||
|
||||
template <
|
||||
typename T, typename U,
|
||||
typename std::enable_if<!std::is_unsigned<T>::value>::type* = nullptr,
|
||||
typename std::enable_if<!std::is_unsigned<U>::value>::type* = nullptr
|
||||
>
|
||||
inline
|
||||
bool check_num_limits(U val)
|
||||
{
|
||||
return
|
||||
!((val > std::numeric_limits<T>::max())
|
||||
|| (val < std::numeric_limits<T>::lowest()));
|
||||
}
|
||||
|
||||
#define ASSERT_NUM_LIMITS(T,V) assert(::mysqlx::common::check_num_limits<T>(V))
|
||||
|
||||
|
||||
|
||||
inline
|
||||
std::string to_upper(const std::string &val)
|
||||
{
|
||||
using std::transform;
|
||||
|
||||
std::string uc_val;
|
||||
uc_val.resize(val.size());
|
||||
transform(val.begin(), val.end(), uc_val.begin(), ::toupper);
|
||||
return uc_val;
|
||||
}
|
||||
|
||||
inline
|
||||
std::string to_lower(const std::string &val)
|
||||
{
|
||||
using std::transform;
|
||||
|
||||
std::string uc_val;
|
||||
uc_val.resize(val.size());
|
||||
transform(val.begin(), val.end(), uc_val.begin(), ::tolower);
|
||||
return uc_val;
|
||||
}
|
||||
|
||||
} // common
|
||||
|
||||
|
||||
namespace common {
|
||||
|
||||
#ifdef USE_NATIVE_BYTE
|
||||
using ::byte;
|
||||
#else
|
||||
typedef unsigned char byte;
|
||||
#endif
|
||||
|
||||
class nocopy
|
||||
{
|
||||
public:
|
||||
nocopy(const nocopy&) = delete;
|
||||
nocopy& operator=(const nocopy&) = delete;
|
||||
protected:
|
||||
nocopy() {}
|
||||
};
|
||||
|
||||
|
||||
class Printable
|
||||
{
|
||||
virtual void print(std::ostream&) const = 0;
|
||||
friend std::ostream& operator<<(std::ostream&, const Printable&);
|
||||
};
|
||||
|
||||
inline
|
||||
std::ostream& operator<<(std::ostream &out, const Printable &obj)
|
||||
{
|
||||
obj.print(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
} // common
|
||||
|
||||
|
||||
namespace common {
|
||||
|
||||
using std::find_if;
|
||||
|
||||
/*
|
||||
Remove from a container all elements that satisfy the given predicate.
|
||||
*/
|
||||
|
||||
template <class CONT, class PRED>
|
||||
void remove_from(CONT &cont, PRED pred)
|
||||
{
|
||||
using It = typename CONT::iterator;
|
||||
It end = std::remove_if(cont.begin(), cont.end(), pred);
|
||||
cont.erase(end, cont.end());
|
||||
}
|
||||
|
||||
|
||||
} // common
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
323
3rdparty/mysql/mysqlx/common/value.h
vendored
323
3rdparty/mysql/mysqlx/common/value.h
vendored
@@ -1,323 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_COMMON_VALUE_H
|
||||
#define MYSQLX_COMMON_VALUE_H
|
||||
|
||||
|
||||
#include "api.h"
|
||||
#include "error.h"
|
||||
#include "util.h"
|
||||
|
||||
PUSH_SYS_WARNINGS
|
||||
#include <string>
|
||||
POP_SYS_WARNINGS
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
namespace common {
|
||||
|
||||
class Value_conv;
|
||||
|
||||
/*
|
||||
Class representing a polymorphic value of one of the supported types.
|
||||
|
||||
TODO: Extend it with array and document types (currently these are implemented
|
||||
in derived mysqlx::Value class of DevAPI).
|
||||
|
||||
TODO: When storing raw bytes, currently they are copied inside the Value
|
||||
object. Consider if this can be avoided.
|
||||
*/
|
||||
|
||||
class PUBLIC_API Value
|
||||
: public virtual Printable
|
||||
{
|
||||
public:
|
||||
|
||||
enum Type
|
||||
{
|
||||
VNULL, ///< Null value
|
||||
UINT64, ///< Unsigned integer
|
||||
INT64, ///< Signed integer
|
||||
FLOAT, ///< Float number
|
||||
DOUBLE, ///< Double number
|
||||
BOOL, ///< Boolean
|
||||
STRING, ///< String (utf8)
|
||||
USTRING, ///< Wide string (utf16)
|
||||
RAW, ///< Raw bytes
|
||||
EXPR, ///< String to be interpreted as an expression
|
||||
JSON, ///< JSON string
|
||||
};
|
||||
|
||||
using string = std::string;
|
||||
|
||||
protected:
|
||||
|
||||
Type m_type;
|
||||
|
||||
// TODO: Use std::variant to save space
|
||||
|
||||
DLL_WARNINGS_PUSH
|
||||
|
||||
std::string m_str;
|
||||
std::u16string m_ustr;
|
||||
|
||||
DLL_WARNINGS_POP
|
||||
|
||||
union {
|
||||
double v_double = 0.0;
|
||||
float v_float;
|
||||
int64_t v_sint;
|
||||
uint64_t v_uint;
|
||||
bool v_bool;
|
||||
} m_val;
|
||||
|
||||
void print(std::ostream&) const override;
|
||||
|
||||
template <typename T>
|
||||
Value(Type type, T &&init)
|
||||
: Value(std::forward<T>(init))
|
||||
{
|
||||
m_type = type;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Construct a NULL item
|
||||
Value() : m_type(VNULL)
|
||||
{}
|
||||
|
||||
|
||||
// Construct an item from a string
|
||||
Value(const std::string& str) : m_type(STRING), m_str(str)
|
||||
{
|
||||
m_val.v_bool = false;
|
||||
}
|
||||
|
||||
Value(const std::u16string &str)
|
||||
: m_type(USTRING), m_ustr(str)
|
||||
{
|
||||
m_val.v_bool = false;
|
||||
}
|
||||
|
||||
|
||||
// Construct an item from a signed 64-bit integer
|
||||
Value(int64_t v) : m_type(INT64)
|
||||
{ m_val.v_sint = v; }
|
||||
|
||||
// Construct an item from an unsigned 64-bit integer
|
||||
Value(uint64_t v) : m_type(UINT64)
|
||||
{ m_val.v_uint = v; }
|
||||
|
||||
// Construct an item from a float
|
||||
Value(float v) : m_type(FLOAT)
|
||||
{ m_val.v_float = v; }
|
||||
|
||||
// Construct an item from a double
|
||||
Value(double v) : m_type(DOUBLE)
|
||||
{ m_val.v_double = v; }
|
||||
|
||||
|
||||
// Construct an item from a bool
|
||||
Value(bool v) : m_type(BOOL)
|
||||
{ m_val.v_bool = v; }
|
||||
|
||||
// Construct an item from bytes
|
||||
Value(const byte *ptr, size_t len) : m_type(RAW)
|
||||
{
|
||||
// Note: bytes are copied to m_str member.
|
||||
m_str.assign((const char*)ptr, len);
|
||||
}
|
||||
|
||||
// Other numeric conversions
|
||||
|
||||
template <
|
||||
typename T,
|
||||
typename std::enable_if<std::is_unsigned<T>::value>::type* = nullptr
|
||||
>
|
||||
Value(T val)
|
||||
: Value(uint64_t(val))
|
||||
{}
|
||||
|
||||
template <
|
||||
typename T,
|
||||
typename std::enable_if<!std::is_unsigned<T>::value>::type* = nullptr,
|
||||
typename std::enable_if<std::is_integral<T>::value>::type* = nullptr
|
||||
>
|
||||
Value(T val)
|
||||
: Value(int64_t(val))
|
||||
{}
|
||||
|
||||
|
||||
bool is_null() const
|
||||
{
|
||||
return VNULL == m_type;
|
||||
}
|
||||
|
||||
bool get_bool() const
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case BOOL: return m_val.v_bool;
|
||||
case UINT64: return 0 != m_val.v_uint;
|
||||
case INT64: return 0 != m_val.v_sint;
|
||||
default:
|
||||
throw Error("Can not convert to Boolean value");
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t get_uint() const
|
||||
{
|
||||
if (UINT64 != m_type && INT64 != m_type && BOOL != m_type)
|
||||
throw Error("Can not convert to integer value");
|
||||
|
||||
if (BOOL == m_type)
|
||||
return m_val.v_bool ? 1 : 0;
|
||||
|
||||
if (INT64 == m_type && 0 > m_val.v_sint)
|
||||
throw Error("Converting negative integer to unsigned value");
|
||||
|
||||
uint64_t val = (UINT64 == m_type ? m_val.v_uint : (uint64_t)m_val.v_sint);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
int64_t get_sint() const
|
||||
{
|
||||
if (INT64 == m_type)
|
||||
return m_val.v_sint;
|
||||
|
||||
uint64_t val = get_uint();
|
||||
|
||||
if (!check_num_limits<int64_t>(val))
|
||||
throw Error("Value cannot be converted to signed integer number");
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
float get_float() const
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case INT64: return 1.0F*m_val.v_sint;
|
||||
case UINT64: return 1.0F*m_val.v_uint;
|
||||
case FLOAT: return m_val.v_float;
|
||||
default:
|
||||
throw Error("Value cannot be converted to float number");
|
||||
}
|
||||
}
|
||||
|
||||
double get_double() const
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case INT64: return 1.0*m_val.v_sint;
|
||||
case UINT64: return 1.0*m_val.v_uint;
|
||||
case FLOAT: return m_val.v_float;
|
||||
case DOUBLE: return m_val.v_double;
|
||||
default:
|
||||
throw Error("Value can not be converted to double number");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Note: In general this method returns raw value representation as obtained
|
||||
from the server, which is stored in m_str member. If a non-string value was
|
||||
not obtained from the server, there is no raw representation for it and
|
||||
error is thrown. String values always have raw representation which is
|
||||
either utf8 or utf16 encoding. Strings obtained from the server use utf8 as
|
||||
raw representation. For strings created by user code this might be either
|
||||
utf8 or utf16, depending on how string was created.
|
||||
*/
|
||||
|
||||
const byte* get_bytes(size_t *size) const
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case USTRING:
|
||||
if (!m_ustr.empty())
|
||||
{
|
||||
if (size)
|
||||
*size = m_ustr.size() * sizeof(char16_t);
|
||||
return (const byte*)m_ustr.data();
|
||||
}
|
||||
FALLTHROUGH;
|
||||
|
||||
default:
|
||||
if (m_str.empty())
|
||||
throw Error("Value cannot be converted to raw bytes");
|
||||
FALLTHROUGH;
|
||||
|
||||
case RAW:
|
||||
case STRING:
|
||||
if (size)
|
||||
*size = m_str.length();
|
||||
return (const byte*)m_str.data();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Note: these methods perform utf8 conversions as necessary.
|
||||
|
||||
const std::string& get_string() const;
|
||||
const std::u16string& get_ustring() const;
|
||||
|
||||
Type get_type() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/*
|
||||
Note: Avoid implicit conversion from pointer types to bool.
|
||||
Without this declaration, Value(bool) constructor is invoked
|
||||
for pointer types. Here we declare and hide an explicit constructor
|
||||
for pointer types which prevents compiler to pick Value(bool).
|
||||
*/
|
||||
|
||||
template <typename T>
|
||||
Value(const T*);
|
||||
|
||||
public:
|
||||
|
||||
friend Value_conv;
|
||||
|
||||
struct Access;
|
||||
friend Access;
|
||||
};
|
||||
|
||||
} // common
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif
|
||||
345
3rdparty/mysql/mysqlx/common_constants.h
vendored
345
3rdparty/mysql/mysqlx/common_constants.h
vendored
@@ -1,345 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQL_COMMON_CONSTANTS_H
|
||||
#define MYSQL_COMMON_CONSTANTS_H
|
||||
|
||||
#include "version_info.h"
|
||||
|
||||
#define DEFAULT_MYSQL_PORT 3306
|
||||
#define DEFAULT_MYSQLX_PORT 33060
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
Common constants
|
||||
================
|
||||
|
||||
Warning: Values of these constants are part of the public API. Changing them
|
||||
is a non backward compatible API change.
|
||||
|
||||
Note: Value of 0 is reserved for special uses and thus constant values
|
||||
are always > 0.
|
||||
|
||||
Note: the empty END_LIST macro at the end of list macros helps Doxygen
|
||||
correctly interpret documentation for the list item.
|
||||
*/
|
||||
|
||||
#define OPT_STR(X,Y,N) X##_str(Y,N)
|
||||
#define OPT_BOOL(X,Y,N) X##_bool(Y,N)
|
||||
#define OPT_NUM(X,Y,N) X##_num(Y,N)
|
||||
#define OPT_ANY(X,Y,N) X##_any(Y,N)
|
||||
|
||||
|
||||
#undef END_LIST
|
||||
#define END_LIST
|
||||
|
||||
|
||||
#define CLIENT_OPTION_LIST(x) \
|
||||
OPT_BOOL(x,POOLING,1) /*!< disable/enable the pool. (Enabled by default)*/ \
|
||||
OPT_NUM(x,POOL_MAX_SIZE,2) /*!< size of the pool. (Defaults to 25)*/ \
|
||||
OPT_NUM(x,POOL_QUEUE_TIMEOUT,3) /*!< timeout for waiting for a connection in
|
||||
the pool (ms). (No timeout by default)*/ \
|
||||
OPT_NUM(x,POOL_MAX_IDLE_TIME,4)/*!< time for a connection to be in the pool
|
||||
without being used (ms).(Will not expire by default)*/ \
|
||||
END_LIST
|
||||
|
||||
|
||||
#define SESSION_OPTION_LIST(x) \
|
||||
OPT_STR(x,URI,1) /*!< connection URI or string */ \
|
||||
/*! DNS name of the host, IPv4 address or IPv6 address */ \
|
||||
OPT_STR(x,HOST,2) \
|
||||
OPT_NUM(x,PORT,3) /*!< X Plugin port to connect to */ \
|
||||
/*!
|
||||
Assign a priority (a number in range 1 to 100) to the last specified
|
||||
host; these priorities are used to determine the order in which multiple
|
||||
hosts are tried by the connection fail-over logic (see description
|
||||
of `Session` class)
|
||||
*/ \
|
||||
OPT_NUM(x,PRIORITY,4) \
|
||||
OPT_STR(x,USER,5) /*!< user name */ \
|
||||
OPT_STR(x,PWD,6) /*!< password */ \
|
||||
OPT_STR(x,DB,7) /*!< default database */ \
|
||||
/*!
|
||||
Specify \ref SSLMode option to be used. In plain C code the value
|
||||
should be a `#mysqlx_ssl_mode_t` enum constant.
|
||||
*/ \
|
||||
OPT_ANY(x,SSL_MODE,8) \
|
||||
/*! path to a PEM file specifying trusted root certificates*/ \
|
||||
OPT_STR(x,SSL_CA,9) \
|
||||
/*!
|
||||
Authentication method to use, see \ref AuthMethod. In plain C code the value
|
||||
should be a `#mysqlx_auth_method_t` enum constant.
|
||||
*/ \
|
||||
OPT_ANY(x,AUTH,10) \
|
||||
OPT_STR(x,SOCKET,11) /*!< unix socket path */ \
|
||||
/*!
|
||||
Sets connection timeout in milliseconds. In C++ code can be also set to
|
||||
a `std::chrono::duration` value.
|
||||
*/ \
|
||||
OPT_NUM(x,CONNECT_TIMEOUT,12) \
|
||||
/*!
|
||||
Specifies connection attributes (key-value pairs) to be sent when a session
|
||||
is created. The value is a JSON string (in C++ code can be also a `DbDoc`
|
||||
object) defining additional attributes to be sent on top of the default
|
||||
ones. Setting this option to `false` (in C++ code) or NULL (in plain C code)
|
||||
disables sending any connection attributes (including the default ones).
|
||||
Setting it to `true` (in C++ code) or empty string (in plain C code)
|
||||
requests sending only the default attributes which is also the default
|
||||
behavior when this option is not set.
|
||||
*/ \
|
||||
OPT_STR(x,CONNECTION_ATTRIBUTES,13) \
|
||||
/*!
|
||||
List of allowed TLS protocol versions, such as "TLSv1.2". The value is a
|
||||
string with comma separated versions. In C++ code it can also be an
|
||||
iterable container with versions.
|
||||
*/ \
|
||||
OPT_STR(x,TLS_VERSIONS, 14) \
|
||||
/*!
|
||||
List of allowed TLS cipher suites. The value is a string with
|
||||
comma separated IANA cipher suitenames (such as
|
||||
"TLS_RSA_WITH_3DES_EDE_CBC_SHA"). In C++ code it can also be an iterable
|
||||
container with names.
|
||||
Unknown cipher suites are silently ignored.
|
||||
*/ \
|
||||
OPT_STR(x,TLS_CIPHERSUITES, 15) \
|
||||
/*!
|
||||
If enabled (true) will check hostname for DNS SRV record and use its
|
||||
configuration (hostname, port, priority and weight) to connect.
|
||||
*/ \
|
||||
OPT_BOOL(x, DNS_SRV, 16) \
|
||||
OPT_ANY(x,COMPRESSION,17) /*!< enable or disable compression */ \
|
||||
/*!
|
||||
Specify compression algorithms in order of preference
|
||||
*/ \
|
||||
OPT_STR(x,COMPRESSION_ALGORITHMS,18) \
|
||||
/*!
|
||||
Path to a directory containing PEM files specifying trusted root
|
||||
certificates.
|
||||
*/ \
|
||||
OPT_STR(x,SSL_CAPATH,19) \
|
||||
/*! Path to a PEM file containing certificate revocation lists*/ \
|
||||
OPT_STR(x,SSL_CRL,20) \
|
||||
/*!
|
||||
Path to a directory containing PEM files with certificate revocation
|
||||
lists
|
||||
*/ \
|
||||
OPT_STR(x,SSL_CRLPATH,21) \
|
||||
END_LIST
|
||||
|
||||
|
||||
/*
|
||||
Names for options supported in the query part of a connection string and
|
||||
how they map to session options above.
|
||||
|
||||
Note: when adding new options to this list, also update doxygen docs
|
||||
for mysqlx::SessionSettings URL ctor (include\mysqlx\devapi\settings.h) and
|
||||
for mysqlx_get_session_from_url() (include\mysqlx\xapi.h).
|
||||
*/
|
||||
|
||||
#define URI_OPTION_LIST(X) \
|
||||
X("ssl-mode", SSL_MODE) \
|
||||
X("ssl-ca", SSL_CA) \
|
||||
X("ssl-capath", SSL_CAPATH) \
|
||||
X("ssl-crl", SSL_CRL) \
|
||||
X("ssl-crlpath", SSL_CRLPATH) \
|
||||
X("auth", AUTH) \
|
||||
X("connect-timeout", CONNECT_TIMEOUT) \
|
||||
X("connection-attributes",CONNECTION_ATTRIBUTES)\
|
||||
X("tls-version", TLS_VERSIONS) \
|
||||
X("tls-versions", TLS_VERSIONS) \
|
||||
X("tls-ciphersuites", TLS_CIPHERSUITES) \
|
||||
X("compression", COMPRESSION) \
|
||||
X("compression-algorithms", COMPRESSION_ALGORITHMS) \
|
||||
END_LIST
|
||||
|
||||
|
||||
#define SSL_MODE_LIST(x) \
|
||||
x(DISABLED,1) /*!< Establish an unencrypted connection. */ \
|
||||
x(REQUIRED,2) /*!< Establish a secure connection if the server supports
|
||||
secure connections. The connection attempt fails if a
|
||||
secure connection cannot be established. This is the
|
||||
default if `SSL_MODE` is not specified. */ \
|
||||
x(VERIFY_CA,3) /*!< Like `REQUIRED`, but additionally verify the server
|
||||
TLS certificate against the configured Certificate
|
||||
Authority (CA) certificates (defined by `SSL_CA`
|
||||
Option). The connection attempt fails if no valid
|
||||
matching CA certificates are found.*/ \
|
||||
x(VERIFY_IDENTITY,4) /*!< Like `VERIFY_CA`, but additionally verify that the
|
||||
server certificate matches the host to which the
|
||||
connection is attempted.*/\
|
||||
END_LIST
|
||||
|
||||
|
||||
#define AUTH_METHOD_LIST(x)\
|
||||
x(PLAIN,1) /*!< Plain text authentication method. The password is
|
||||
sent as a clear text. This method is used by
|
||||
default in encrypted connections. */ \
|
||||
x(MYSQL41,2) /*!< Authentication method supported by MySQL 4.1 and newer.
|
||||
The password is hashed before being sent to the server.
|
||||
This authentication method works over unencrypted
|
||||
connections */ \
|
||||
x(EXTERNAL,3) /*!< External authentication when the server establishes
|
||||
the user authenticity by other means such as SSL/x509
|
||||
certificates. Currently not supported by X Plugin */ \
|
||||
x(SHA256_MEMORY,4) /*!< Authentication using SHA256 password hashes stored in
|
||||
server-side cache. This authentication method works
|
||||
over unencrypted connections.
|
||||
*/ \
|
||||
END_LIST
|
||||
|
||||
/*
|
||||
Types that can be reported by MySQL server.
|
||||
*/
|
||||
|
||||
#define RESULT_TYPE_LIST(X) \
|
||||
X(BIT, 1) \
|
||||
X(TINYINT, 2) \
|
||||
X(SMALLINT, 3) \
|
||||
X(MEDIUMINT, 4) \
|
||||
X(INT, 5) \
|
||||
X(BIGINT, 6) \
|
||||
X(FLOAT, 7) \
|
||||
X(DECIMAL, 8) \
|
||||
X(DOUBLE, 9) \
|
||||
X(JSON, 10) \
|
||||
X(STRING, 11) \
|
||||
X(BYTES, 12) \
|
||||
X(TIME, 13) \
|
||||
X(DATE, 14) \
|
||||
X(DATETIME, 15) \
|
||||
X(TIMESTAMP, 16) \
|
||||
X(SET, 17) \
|
||||
X(ENUM, 18) \
|
||||
X(GEOMETRY, 19) \
|
||||
END_LIST
|
||||
|
||||
|
||||
/*
|
||||
Check options for an updatable view.
|
||||
@see https://dev.mysql.com/doc/refman/en/view-check-option.html
|
||||
*/
|
||||
|
||||
#define VIEW_CHECK_OPTION_LIST(x) \
|
||||
x(CASCADED,1) \
|
||||
x(LOCAL,2) \
|
||||
END_LIST
|
||||
|
||||
/*
|
||||
Algorithms used to process views.
|
||||
@see https://dev.mysql.com/doc/refman/en/view-algorithms.html
|
||||
*/
|
||||
|
||||
#define VIEW_ALGORITHM_LIST(x) \
|
||||
x(UNDEFINED,1) \
|
||||
x(MERGE,2) \
|
||||
x(TEMPTABLE,3) \
|
||||
END_LIST
|
||||
|
||||
/*
|
||||
View security settings.
|
||||
@see https://dev.mysql.com/doc/refman/en/stored-programs-security.html
|
||||
*/
|
||||
|
||||
#define VIEW_SECURITY_LIST(x) \
|
||||
x(DEFINER,1) \
|
||||
x(INVOKER,2) \
|
||||
END_LIST
|
||||
|
||||
|
||||
#define LOCK_MODE_LIST(X) \
|
||||
X(SHARED,1) /*!< Sets a shared mode lock on any rows that
|
||||
are read. Other sessions can read the rows,
|
||||
but cannot modify them until your transaction
|
||||
commits. If any of these rows were changed by
|
||||
another transaction that has not yet committed,
|
||||
your query waits until that transaction ends
|
||||
and then uses the latest values. */ \
|
||||
X(EXCLUSIVE,2) /*!< For index records the search encounters,
|
||||
locks the rows and any associated index entries, the same
|
||||
as if you issued an UPDATE statement for those rows. Other
|
||||
transactions are blocked from updating those rows,
|
||||
from doing locking in LOCK_SHARED, or from reading
|
||||
the data in certain transaction isolation levels. */ \
|
||||
END_LIST
|
||||
|
||||
#define LOCK_CONTENTION_LIST(X) \
|
||||
X(DEFAULT,0) /*!< Block query until existing row locks are released. */ \
|
||||
X(NOWAIT,1) /*!< Return error if lock could not be obtained immediately. */ \
|
||||
X(SKIP_LOCKED,2) /*!< Execute query immediately, excluding items that are
|
||||
locked from the query results. */ \
|
||||
END_LIST
|
||||
|
||||
#define COMPRESSION_MODE_LIST(x) \
|
||||
x(DISABLED,1) /*!< Disables the compression. */ \
|
||||
x(PREFERRED,2) /*!< Request compression, but not return error
|
||||
if compression is requested, but could not be
|
||||
used */ \
|
||||
x(REQUIRED,3) /*!< Request compression and return error if
|
||||
compression is not supported by the server */ \
|
||||
END_LIST
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#define COLLECTION_OPTIONS_OPTION(X)\
|
||||
X(REUSE,1) /*!< Use existing collection. Expects a boolean value. */ \
|
||||
X(VALIDATION,2) /*!< Collection validation options. Expects
|
||||
CollectionValidation or a json string.*/ \
|
||||
END_LIST
|
||||
|
||||
#define COLLECTION_VALIDATION_OPTION(X)\
|
||||
X(SCHEMA,1) /*!< Collection validation schema, as defined by
|
||||
https://dev.mysql.com/doc/refman/8.0/en/json-validation-functions.html#function_json-schema-valid
|
||||
*/ \
|
||||
X(LEVEL,2) /*!< Defines level of validation on the collection, see
|
||||
\ref CollectionValidation_Level "CollectionValidation::Level".
|
||||
In plain C code the value should be
|
||||
\ref opt_collection_validation_level "mysqlx_collection_validation_level_t".
|
||||
*/ \
|
||||
END_LIST
|
||||
|
||||
|
||||
// Schema Validation Level
|
||||
|
||||
//Windows defines STRICT as a macro... undefine it
|
||||
#ifdef STRICT
|
||||
#undef STRICT
|
||||
#endif
|
||||
|
||||
#define COLLECTION_VALIDATION_LEVEL(X)\
|
||||
X(OFF,1) /*!< No validation will be done on the collection. */ \
|
||||
X(STRICT,2) /*!< All collection documents have to comply to validation schema.
|
||||
*/ \
|
||||
END_LIST
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
208
3rdparty/mysql/mysqlx/devapi/collations.h
vendored
208
3rdparty/mysql/mysqlx/devapi/collations.h
vendored
@@ -1,208 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_COLLATIONS_H
|
||||
#define MYSQLX_COLLATIONS_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/*
|
||||
Import Lists of built-in character sets and collations supported by MySQL
|
||||
Server.
|
||||
*/
|
||||
|
||||
#include "mysql_charsets.h"
|
||||
#include "mysql_collations.h"
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
/*
|
||||
Enumeration of known character sets. For each character set CS listed
|
||||
in CDK_CS_LIST() macro, there is CharacterSet::CS constant in this
|
||||
enumeration.
|
||||
*/
|
||||
|
||||
|
||||
enum class CharacterSet : unsigned short
|
||||
{
|
||||
#undef CS
|
||||
#define CS_ENUM(CS) CS,
|
||||
CDK_CS_LIST(CS_ENUM)
|
||||
};
|
||||
|
||||
|
||||
#define CS_NAME_SWITCH(CS) case CharacterSet::CS: return #CS;
|
||||
|
||||
/**
|
||||
Returns name of a character set given by its id.
|
||||
|
||||
@ingroup devapi_res
|
||||
*/
|
||||
|
||||
inline
|
||||
const char* characterSetName(CharacterSet id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
CDK_CS_LIST(CS_NAME_SWITCH)
|
||||
default:
|
||||
THROW("Unknown character set id");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Structure that provides information about character set collation.
|
||||
|
||||
For each known collation COLL over character set CS, there is static object
|
||||
`Collation<CS>::%COLL` of type `CollationInfo` which describes
|
||||
collation COLL. For example `Collation<CharacterSet::latin1>::%swedish_ci` is
|
||||
an `CollationInfo` object which describes the `swedish_ci` collation over
|
||||
`latin1` character set.
|
||||
|
||||
@ingroup devapi_res
|
||||
*/
|
||||
|
||||
struct CollationInfo
|
||||
{
|
||||
/// Numeric collation id, as used by MySQL server.
|
||||
|
||||
unsigned id() const { return m_id; }
|
||||
|
||||
/// String name of a collation, such as "latin1_generic_ci".
|
||||
|
||||
const char *getName() const { return m_name; }
|
||||
|
||||
/// Id of the character set of this collation.
|
||||
|
||||
CharacterSet getCharacterSet() const { return m_cs; }
|
||||
|
||||
/**
|
||||
Returns true if given collation is case sensitive. Binary
|
||||
collations are assumed to be case sensitive.
|
||||
*/
|
||||
|
||||
bool isCaseSensitive() const { return m_case != case_ci; }
|
||||
|
||||
/// Returns true if this is binary collation.
|
||||
|
||||
bool isBinary() const { return m_case == case_bin; }
|
||||
|
||||
|
||||
bool operator==(const CollationInfo &other) const
|
||||
{
|
||||
return m_id == other.m_id;
|
||||
}
|
||||
|
||||
bool operator!=(const CollationInfo &other) const
|
||||
{
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
enum coll_case { case_bin, case_ci, case_cs };
|
||||
|
||||
CharacterSet m_cs;
|
||||
unsigned m_id;
|
||||
coll_case m_case;
|
||||
const char *m_name;
|
||||
|
||||
public:
|
||||
|
||||
struct Access;
|
||||
friend Access;
|
||||
};
|
||||
|
||||
|
||||
template <CharacterSet CS> struct Collation;
|
||||
|
||||
|
||||
/*
|
||||
The Collation<CS>::COLL constants are generated from information provided by
|
||||
COLLATION_XXX() macros.Each line X(CS, ID, COLL, CASE) in the expansion of
|
||||
a COLLATION_XXX() macro declares collation with name COLL for character set
|
||||
CS. ID is the MySQL id number for the collation. CASE is one of ci, cs or bin
|
||||
and indicates whether it is case insensitive, sensitive or binary collation,
|
||||
respectively.
|
||||
*/
|
||||
|
||||
/*
|
||||
Generate declarations of Collation<CS>::COLL constants using
|
||||
COLLATINS_XXX() macros. The list CS_LIST() is processed using
|
||||
COLL_DECL() macro, which for each character set CS declares
|
||||
specialization Collation<CS> of the Collation<> template and
|
||||
declares collation constants within this specialization.
|
||||
|
||||
The collation constant declarations are generated by processing
|
||||
COLLATIONS_CS() list with COLL_CONST() macro. The name of each
|
||||
constant is generated by COLL_CONST_NAME() macro. The convention
|
||||
used is that case insensitive and case sensitive collations get
|
||||
a _ci or _cs suffix, respectively, while binary collation constant
|
||||
have no suffix to the collation name.
|
||||
|
||||
Collation constants declared here are defined in file result.cc.
|
||||
*/
|
||||
|
||||
#define COLL_DECL(CS) \
|
||||
template<> struct Collation<CharacterSet::CS> \
|
||||
{ COLLATIONS_##CS(COLL_CONST) }; \
|
||||
|
||||
#define COLL_CONST(CS,ID,COLL,CASE) \
|
||||
static PUBLIC_API const CollationInfo COLL_CONST_NAME(COLL,CASE);
|
||||
|
||||
#define COLL_CONST_NAME(COLL,CASE) COLL_CONST_NAME_##CASE(COLL)
|
||||
|
||||
#define COLL_CONST_NAME_bin(COLL) COLL
|
||||
#define COLL_CONST_NAME_ci(COLL) COLL##_ci
|
||||
#define COLL_CONST_NAME_ai_ci(COLL) COLL##_ai_ci
|
||||
#define COLL_CONST_NAME_cs(COLL) COLL##_cs
|
||||
#define COLL_CONST_NAME_as_cs(COLL) COLL##_as_cs
|
||||
#define COLL_CONST_NAME_as_ci(COLL) COLL##_as_ci
|
||||
#define COLL_CONST_NAME_as_cs_ks(COLL) COLL##_as_cs_ks
|
||||
|
||||
// Add utf8mb4 alias for bin collation for compatibility
|
||||
|
||||
#undef COLLATIONS_utf8mb4_EXTRA
|
||||
#define COLLATIONS_utf8mb4_EXTRA \
|
||||
static PUBLIC_API const CollationInfo utf8mb4;
|
||||
|
||||
CDK_CS_LIST(COLL_DECL)
|
||||
|
||||
#undef COLLATIONS_utf8mb4_EXTRA
|
||||
#define COLLATIONS_utf8mb4_EXTRA
|
||||
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif
|
||||
606
3rdparty/mysql/mysqlx/devapi/collection_crud.h
vendored
606
3rdparty/mysql/mysqlx/devapi/collection_crud.h
vendored
@@ -1,606 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2023, Oracle and/or its affiliates.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_COLLECTION_CRUD_H
|
||||
#define MYSQLX_COLLECTION_CRUD_H
|
||||
|
||||
/**
|
||||
@file
|
||||
Declarations for CRUD operations on document collections.
|
||||
|
||||
Classes declared here represent CRUD operations on a document
|
||||
collection. An Object of a class such as CollectionAdd represents
|
||||
a "yet-to-be-executed" operation and stores all the parameters of the
|
||||
operation. The operation is sent to server for execution only when
|
||||
`execute()` method is called.
|
||||
|
||||
The following classes for collection CRUD operations are defined:
|
||||
- CollectionAdd
|
||||
- CollectionRemove
|
||||
- CollectionFind
|
||||
- CollectionModify
|
||||
|
||||
CRUD operation objects can be created directly, or assigned from
|
||||
result of DevAPI methods that create such operations:
|
||||
~~~~~~
|
||||
CollectionAdd add_op(coll);
|
||||
CollectionFind find_op = coll.find(...).sort(...);
|
||||
~~~~~~
|
||||
|
||||
CRUD operation objects have methods which can modify the operation
|
||||
before it gets executed. For example `CollectionAdd::add()`
|
||||
appends a document to the list of documents that should be added
|
||||
by the given CollectionAdd operation. These methods can be chained
|
||||
as allowed by the fluent API grammar.
|
||||
|
||||
@internal
|
||||
|
||||
The order of fluent API calls is expressed by base classes, such as
|
||||
Collection_find_base, which are composed from CRUD templates defined
|
||||
in crud.h. The order of templates determines the allowed order of fluent
|
||||
API calls.
|
||||
*/
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "result.h"
|
||||
#include "executable.h"
|
||||
#include "crud.h"
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
class Session;
|
||||
class Collection;
|
||||
class Table;
|
||||
|
||||
template<>
|
||||
PUBLIC_API common::Value Value::get<common::Value>() const;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
Adding documents to a collection
|
||||
================================
|
||||
*/
|
||||
|
||||
class CollectionAdd;
|
||||
|
||||
namespace internal {
|
||||
|
||||
/*
|
||||
Note: using empty class instead of alias/typedef to help Doxygen correctly
|
||||
expand templates.
|
||||
*/
|
||||
|
||||
struct Collection_add_base
|
||||
: public Executable<Result, CollectionAdd>
|
||||
{};
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
An operation which adds documents to a collection.
|
||||
|
||||
Documents to be added by this operation are specified with various variants
|
||||
of `add()` method.
|
||||
|
||||
Each document must have a unique identifier which is stored in `_id`
|
||||
field of the document. Document identifiers are character strings no longer
|
||||
than 32 characters. If added document does not have `_id` field, a unique
|
||||
identifier is generated for it. Document identifier generated by a given
|
||||
collection add operation can be examined using `Result::getDocumentIds()`
|
||||
method. Generated document identifiers are strings of 32 hexadecimal digits,
|
||||
like this one `0512020981044082E6119DFA0E4C0584`.
|
||||
|
||||
@note Generated document identifiers are based on UUIDs but they are not
|
||||
valid UUIDs (fields are reversed).
|
||||
|
||||
@ingroup devapi_op
|
||||
|
||||
@internal
|
||||
The various `add()` methods are implemented in terms of `do_add()` method
|
||||
defined by Collection_add_detail class. This method passes documents to
|
||||
the internal implementation object.
|
||||
*/
|
||||
|
||||
class CollectionAdd
|
||||
: public internal::Collection_add_base
|
||||
, internal::Collection_add_detail
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
Create an empty add operation for the given collection.
|
||||
*/
|
||||
|
||||
CollectionAdd(Collection &coll)
|
||||
{
|
||||
try {
|
||||
reset(internal::Crud_factory::mk_add(coll));
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
CollectionAdd(const internal::Collection_add_base &other)
|
||||
{
|
||||
internal::Collection_add_base::operator=(other);
|
||||
}
|
||||
|
||||
CollectionAdd(internal::Collection_add_base &&other)
|
||||
{
|
||||
internal::Collection_add_base::operator=(std::move(other));
|
||||
}
|
||||
|
||||
using internal::Collection_add_base::operator=;
|
||||
|
||||
|
||||
/**
|
||||
Add all documents from a range defined by two iterators.
|
||||
*/
|
||||
|
||||
template <typename It>
|
||||
CollectionAdd& add(const It &begin, const It &end)
|
||||
{
|
||||
try {
|
||||
do_add(get_impl(), begin, end);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Add all documents within given container.
|
||||
|
||||
Any container type for which `std::begin()`/`std::end()` are defined
|
||||
should work.
|
||||
*/
|
||||
|
||||
template <class Container>
|
||||
CollectionAdd& add(const Container &c)
|
||||
{
|
||||
try {
|
||||
do_add(get_impl(), c);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Add document(s) to a collection.
|
||||
|
||||
Documents can be described by JSON strings or DbDoc objects.
|
||||
*/
|
||||
|
||||
template <typename... Types>
|
||||
CollectionAdd& add(const Types&... docs)
|
||||
{
|
||||
try {
|
||||
do_add(get_impl(), docs...);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Collection_add_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(internal::Collection_add_base::get_impl());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
|
||||
/*
|
||||
Removing documents from a collection
|
||||
====================================
|
||||
*/
|
||||
|
||||
class CollectionRemove;
|
||||
|
||||
namespace internal {
|
||||
|
||||
struct Collection_remove_cmd
|
||||
: public Executable<Result, CollectionRemove>
|
||||
{};
|
||||
|
||||
struct Collection_remove_base
|
||||
: public Sort< Limit< Bind_parameters< Collection_remove_cmd > > >
|
||||
{};
|
||||
|
||||
} // internal namespace
|
||||
|
||||
|
||||
/**
|
||||
An operation which removes documents from a collection.
|
||||
|
||||
@ingroup devapi_op
|
||||
|
||||
@internal
|
||||
Note: All methods that modify remove operation are defined by the base
|
||||
class.
|
||||
*/
|
||||
|
||||
class CollectionRemove
|
||||
: public internal::Collection_remove_base
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Create an operation which removes selected documnets from the given
|
||||
collection.
|
||||
|
||||
Documents to be removed are specified by the given Boolean expression.
|
||||
*/
|
||||
|
||||
CollectionRemove(Collection &coll, const string &expr)
|
||||
{
|
||||
try {
|
||||
reset(internal::Crud_factory::mk_remove(coll, expr));
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
CollectionRemove(const internal::Collection_remove_cmd &other)
|
||||
{
|
||||
internal::Collection_remove_cmd::operator=(other);
|
||||
}
|
||||
|
||||
CollectionRemove(internal::Collection_remove_cmd &&other)
|
||||
{
|
||||
internal::Collection_remove_cmd::operator=(std::move(other));
|
||||
}
|
||||
|
||||
using internal::Collection_remove_cmd::operator=;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
Searching for documents in a collection
|
||||
=======================================
|
||||
*/
|
||||
|
||||
class CollectionFind;
|
||||
|
||||
namespace internal {
|
||||
|
||||
struct Collection_find_cmd
|
||||
: public Executable<DocResult, CollectionFind>
|
||||
{};
|
||||
|
||||
struct Collection_find_base
|
||||
: public Group_by< Having< Sort< Limit< Offset< Bind_parameters<
|
||||
Set_lock< Collection_find_cmd, common::Collection_find_if >
|
||||
> > > > > >
|
||||
{};
|
||||
|
||||
} // internal namespace
|
||||
|
||||
|
||||
/**
|
||||
An operation which returns all or selected documents from a collection.
|
||||
|
||||
@ingroup devapi_op
|
||||
*/
|
||||
|
||||
class CollectionFind
|
||||
: public internal::Collection_find_base
|
||||
, internal::Collection_find_detail
|
||||
{
|
||||
|
||||
using Operation = internal::Collection_find_base;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Create an operation which returns all documents from the given collection.
|
||||
*/
|
||||
|
||||
CollectionFind(Collection &coll)
|
||||
{
|
||||
try {
|
||||
reset(internal::Crud_factory::mk_find(coll));
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Create an operation which returns selected documents from the given
|
||||
collection.
|
||||
|
||||
Documents to be returned are specified by the given Boolean expression.
|
||||
*/
|
||||
|
||||
CollectionFind(Collection &coll, const string &expr)
|
||||
{
|
||||
try {
|
||||
reset(internal::Crud_factory::mk_find(coll, expr));
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
CollectionFind(const internal::Collection_find_cmd &other)
|
||||
{
|
||||
internal::Collection_find_cmd::operator=(other);
|
||||
}
|
||||
|
||||
CollectionFind(internal::Collection_find_cmd &&other)
|
||||
{
|
||||
internal::Collection_find_cmd::operator=(std::move(other));
|
||||
}
|
||||
|
||||
using internal::Collection_find_cmd::operator=;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Specify a projection for the documents returned by this operation.
|
||||
|
||||
Projection is either a single document expression given by `expr(<string>)`
|
||||
or a list (or collection) of strings of the form
|
||||
`"<expression> AS <path>"`. In the latter case each `<expression>`
|
||||
is evaluated and `<path>` specifies where to put the value of
|
||||
the expression in the resulting document (see `CollectionModify` for more
|
||||
information about document paths).
|
||||
*/
|
||||
|
||||
template <typename... Expr>
|
||||
Operation& fields(Expr... proj)
|
||||
{
|
||||
try {
|
||||
get_impl()->clear_proj();
|
||||
do_fields(get_impl(), proj...);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Collection_find_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(internal::Collection_find_base::get_impl());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
Modifying documents in a collection
|
||||
===================================
|
||||
*/
|
||||
|
||||
class CollectionModify;
|
||||
|
||||
|
||||
namespace internal {
|
||||
|
||||
class CollectionReplace;
|
||||
|
||||
struct Collection_modify_cmd
|
||||
: public Executable<Result, CollectionModify>
|
||||
{};
|
||||
|
||||
struct Collection_modify_base
|
||||
: public Sort< Limit< Bind_parameters< Collection_modify_cmd > > >
|
||||
{};
|
||||
|
||||
} // internal namespace
|
||||
|
||||
|
||||
/**
|
||||
An operation which modifies all or selected documents in a collection.
|
||||
|
||||
Note that in operations such as `set()`, `unset()`, `arrayInsert()` and
|
||||
`arrayAppend()` the field argument is specified as a document path. It can be
|
||||
a simple field name, but it can be a more complex expression like
|
||||
`$.foo.bar[3]`. One consequence of this is that document field names that
|
||||
contain spaces or other special characters need to be quoted, for example one
|
||||
needs to use this form
|
||||
```
|
||||
.unset("\"field name with spaces\"")
|
||||
```
|
||||
as `.unset("field name with spaces")` would be an invalid document path
|
||||
expression.
|
||||
|
||||
Note also that wildcard paths that use `*` or `**` are not valid for these
|
||||
operations that modify documents.
|
||||
|
||||
See [MySQL Reference Manual](https://dev.mysql.com/doc/refman/en/json.html#json-path-syntax)
|
||||
for more information on document path syntax supported by MySQL server.
|
||||
|
||||
@ingroup devapi_op
|
||||
*/
|
||||
|
||||
class CollectionModify
|
||||
: public internal::Collection_modify_base
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Create an operation which modifies selected documents in the given
|
||||
collection.
|
||||
|
||||
Documents to be modified are specified by the given Boolean expression.
|
||||
*/
|
||||
|
||||
CollectionModify(Collection &coll, const string &expr)
|
||||
{
|
||||
try {
|
||||
reset(internal::Crud_factory::mk_modify(coll, expr));
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
CollectionModify(const internal::Collection_modify_cmd &other)
|
||||
{
|
||||
internal::Collection_modify_cmd::operator=(other);
|
||||
}
|
||||
|
||||
CollectionModify(internal::Collection_modify_cmd &&other)
|
||||
{
|
||||
internal::Collection_modify_cmd::operator=(std::move(other));
|
||||
}
|
||||
|
||||
using internal::Collection_modify_cmd::operator=;
|
||||
|
||||
/**
|
||||
Set the given field in a document to the given value.
|
||||
|
||||
The field is given by a document path. The value can be either a direct
|
||||
literal, `DbDoc` instance or an expression given as `expr(<string>)`, to be
|
||||
evaluated on the server.
|
||||
*/
|
||||
|
||||
CollectionModify& set(const Field &field, const Value &val)
|
||||
{
|
||||
try {
|
||||
get_impl()->add_operation(Impl::SET, field,
|
||||
val.get<common::Value>());
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Remove the given field from a document.
|
||||
|
||||
The field is given by a document path.
|
||||
*/
|
||||
|
||||
CollectionModify& unset(const Field &field)
|
||||
{
|
||||
try {
|
||||
get_impl()->add_operation(Impl::UNSET, field);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Insert a value into an array field of a document.
|
||||
|
||||
The `field` parameter should be a document path pointing at a location
|
||||
inside an array field. The given value is inserted at this position.
|
||||
*/
|
||||
|
||||
CollectionModify& arrayInsert(const Field &field, const Value &val)
|
||||
{
|
||||
try {
|
||||
get_impl()->add_operation(Impl::ARRAY_INSERT, field,
|
||||
val.get<common::Value>());
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Append a value to an array field of a document.
|
||||
|
||||
The `field` parameter should be a document path pointing at an array
|
||||
field inside the document. The given value is appended at the end of the
|
||||
array.
|
||||
*/
|
||||
|
||||
CollectionModify& arrayAppend(const Field &field, const Value &val)
|
||||
{
|
||||
try {
|
||||
get_impl()->add_operation(Impl::ARRAY_APPEND, field,
|
||||
val.get<common::Value>());
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Apply JSON Patch to a target JSON document.
|
||||
|
||||
The JSON Patch format is defined by
|
||||
<a href=https://tools.ietf.org/html/rfc7386>RFC7386</a>.
|
||||
|
||||
A document patch is similar to a JSON object, with the key difference that
|
||||
document field values can be nested expressions in addition to literal
|
||||
values.
|
||||
|
||||
The patch contains instructions of how the source document is to be modified
|
||||
producing a derived document. By default, all fields from the source
|
||||
document are copied to the resulting document. If patch sets a field to NULL,
|
||||
the field of that name in the source is skipped from the result, identifiers
|
||||
and function calls are evaluated against the original source document.
|
||||
|
||||
*/
|
||||
|
||||
CollectionModify& patch(const string &val)
|
||||
{
|
||||
try {
|
||||
get_impl()->add_operation(
|
||||
Impl::MERGE_PATCH, "$", (const common::Value&)expr(val)
|
||||
);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Collection_modify_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(internal::Collection_modify_base::get_impl());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx namespace
|
||||
|
||||
#endif
|
||||
879
3rdparty/mysql/mysqlx/devapi/common.h
vendored
879
3rdparty/mysql/mysqlx/devapi/common.h
vendored
@@ -1,879 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_COMMON_H
|
||||
#define MYSQLX_COMMON_H
|
||||
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
PUSH_SYS_WARNINGS
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <ostream>
|
||||
#include <memory>
|
||||
#include <forward_list>
|
||||
#include <string.h> // for memcpy
|
||||
#include <utility> // std::move etc
|
||||
POP_SYS_WARNINGS
|
||||
|
||||
|
||||
#define CATCH_AND_WRAP \
|
||||
catch (const ::mysqlx::Error&) { throw; } \
|
||||
catch (const std::out_of_range&) { throw; } \
|
||||
catch (const std::exception &e) \
|
||||
{ throw ::mysqlx::Error(e.what()); } \
|
||||
catch (const char *e) \
|
||||
{ throw ::mysqlx::Error(e); } \
|
||||
catch (...) \
|
||||
{ throw ::mysqlx::Error("Unknown exception"); } \
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
using std::out_of_range;
|
||||
|
||||
using common::byte;
|
||||
class Value;
|
||||
|
||||
|
||||
/**
|
||||
Base class for connector errors.
|
||||
|
||||
@internal
|
||||
TODO: Derive from std::system_error and introduce proper
|
||||
error codes.
|
||||
@endinternal
|
||||
|
||||
@ingroup devapi
|
||||
*/
|
||||
|
||||
// TODO: Make it header-only class somehow...
|
||||
|
||||
DLL_WARNINGS_PUSH
|
||||
|
||||
class PUBLIC_API Error : public common::Error
|
||||
{
|
||||
|
||||
DLL_WARNINGS_POP
|
||||
|
||||
public:
|
||||
|
||||
Error(const char *msg)
|
||||
: common::Error(msg)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
void throw_error(const char *msg)
|
||||
{
|
||||
throw Error(msg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
A wrapper around std::wstring that can perform
|
||||
conversions from/to different character encodings
|
||||
used by MySQL.
|
||||
|
||||
Currently only utf-8 encoding is supported.
|
||||
|
||||
@ingroup devapi_aux
|
||||
*/
|
||||
|
||||
class string : public std::u16string
|
||||
{
|
||||
|
||||
struct Impl
|
||||
{
|
||||
PUBLIC_API static std::string to_utf8(const string&);
|
||||
PUBLIC_API static void from_utf8(string&, const std::string&);
|
||||
|
||||
PUBLIC_API static std::u32string to_ucs4(const string&);
|
||||
PUBLIC_API static void from_ucs4(string&, const std::u32string&);
|
||||
|
||||
PUBLIC_API static std::wstring to_wide(const string&);
|
||||
PUBLIC_API static void from_wide(string&, const std::wstring&);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct traits
|
||||
{};
|
||||
|
||||
|
||||
public:
|
||||
|
||||
string() {}
|
||||
string(const string&) = default;
|
||||
string(string&&) = default;
|
||||
|
||||
string& operator=(const string&) = default;
|
||||
string& operator=(string&&) = default;
|
||||
|
||||
using std::u16string::basic_string;
|
||||
|
||||
string(const std::u16string &other) : std::u16string(other) {}
|
||||
string(std::u16string &&other) : std::u16string(std::move(other)) {}
|
||||
|
||||
template <typename C>
|
||||
string(const C *other)
|
||||
{
|
||||
try {
|
||||
if (!other)
|
||||
return;
|
||||
std::basic_string<C> str(other);
|
||||
traits<C>::from_str(*this, str);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
template <typename C>
|
||||
string(const std::basic_string<C> &other)
|
||||
{
|
||||
try {
|
||||
traits<C>::from_str(*this, other);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
template <typename C>
|
||||
operator std::basic_string<C>() const
|
||||
{
|
||||
try {
|
||||
return traits<C>::to_str(*this);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
friend bool operator==(const string&lhs, const string&rhs)
|
||||
{
|
||||
return operator==((const std::u16string&)lhs, (const std::u16string&)rhs);
|
||||
}
|
||||
|
||||
friend bool operator!=(const string&lhs, const string&rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
// Note: These are needed to help overload resolution :/
|
||||
|
||||
friend bool operator==(const string &lhs, const char16_t *rhs)
|
||||
{
|
||||
return lhs == string(rhs);
|
||||
}
|
||||
|
||||
friend bool operator==(const char16_t *lhs, const string &rhs)
|
||||
{
|
||||
return string(lhs) == rhs;
|
||||
}
|
||||
|
||||
friend bool operator!=(const string &lhs, const char16_t *rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
friend bool operator!=(const char16_t *lhs, const string &rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
template<>
|
||||
struct string::traits<char>
|
||||
{
|
||||
using string = std::string;
|
||||
|
||||
static void from_str(mysqlx::string &to, const string &from)
|
||||
{
|
||||
Impl::from_utf8(to, from);
|
||||
}
|
||||
|
||||
static string to_str(const mysqlx::string &from)
|
||||
{
|
||||
return Impl::to_utf8(from);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct string::traits<wchar_t>
|
||||
{
|
||||
using string = std::wstring;
|
||||
|
||||
static void from_str(mysqlx::string &to, const string &from)
|
||||
{
|
||||
Impl::from_wide(to, from);
|
||||
}
|
||||
|
||||
static string to_str(const mysqlx::string &from)
|
||||
{
|
||||
return Impl::to_wide(from);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct string::traits<char32_t>
|
||||
{
|
||||
using string = std::u32string;
|
||||
|
||||
static void from_str(mysqlx::string &to, const string &from)
|
||||
{
|
||||
Impl::from_ucs4(to, from);
|
||||
}
|
||||
|
||||
static string to_str(const mysqlx::string &from)
|
||||
{
|
||||
return Impl::to_ucs4(from);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
std::ostream& operator<<(std::ostream &out, const string &str)
|
||||
{
|
||||
const std::string utf8(str);
|
||||
out << utf8;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
typedef unsigned long col_count_t;
|
||||
typedef unsigned long row_count_t;
|
||||
|
||||
|
||||
/**
|
||||
Class representing a region of memory holding raw bytes.
|
||||
|
||||
Method `begin()` returns pointer to the first byte in the
|
||||
region, `end()` to one past the last byte in the region.
|
||||
|
||||
@note An instance of `bytes` does not store the bytes -
|
||||
it merely describes a region of memory and is equivalent
|
||||
to a pair of pointers. It is very cheap to copy `bytes` and
|
||||
pass them by value.
|
||||
|
||||
@note This class extends std::pair<byte *, size_t> to make
|
||||
it consistent with how memory regions are described by
|
||||
std::get_temporary_buffer(). It is also possible to initialize
|
||||
a `bytes` instance by buffer returned from
|
||||
std::get_temporary_buffer(), as follows:
|
||||
|
||||
bytes buf = std::get_temporary_buffer<byte>(size);
|
||||
|
||||
@ingroup devapi_aux
|
||||
*/
|
||||
|
||||
class bytes : public std::pair<const byte*, size_t>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
bytes(const byte *beg_, const byte *end_)
|
||||
: pair(beg_, end_ - beg_)
|
||||
{}
|
||||
|
||||
bytes(const byte *beg, size_t len) : pair(beg, len)
|
||||
{}
|
||||
|
||||
bytes(const char *str) : pair((const byte*)str, 0)
|
||||
{
|
||||
if (nullptr != str)
|
||||
second = strlen(str);
|
||||
}
|
||||
|
||||
bytes(std::pair<const byte*, size_t> buf) : pair(buf)
|
||||
{}
|
||||
|
||||
bytes() : pair(nullptr, 0)
|
||||
{}
|
||||
|
||||
bytes(const bytes &) = default;
|
||||
|
||||
virtual const byte* begin() const { return first; }
|
||||
virtual const byte* end() const { return first + second; }
|
||||
|
||||
size_t length() const { return second; }
|
||||
size_t size() const { return length(); }
|
||||
|
||||
class Access;
|
||||
friend Access;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Infrastructure for type-agnostic handling of lists
|
||||
==================================================
|
||||
|
||||
Template internal::List_initializer<> defined below is used to return lists
|
||||
of values from public API method so that user can store this list in
|
||||
a container of his choice. The only requirement is that the container instance
|
||||
should be constructible from two iterators defining a range of elements
|
||||
(such constructors exists for standard STL containers, for example).
|
||||
|
||||
Thus, given a public API method foo() which returns a List_initializer<> for
|
||||
lists of elements of type X, user can do the following:
|
||||
|
||||
My_container cont = foo();
|
||||
|
||||
The container will be constructed as if this code was executed:
|
||||
|
||||
My_container cont = My_container(begin, end);
|
||||
|
||||
where begin and end are STL iterators defining a range of elements of type X.
|
||||
This is implemented by defining templated conversion operator.
|
||||
|
||||
Apart from initializing containers, values of List_initializer<> type can
|
||||
be iterated using a range loop:
|
||||
|
||||
for(X &el : foo()) { ... }
|
||||
|
||||
Otherwise, user should not be able to use List_initializer<> values directly.
|
||||
*/
|
||||
|
||||
namespace internal {
|
||||
|
||||
/*
|
||||
Iterator template.
|
||||
|
||||
It defines an STL input iterator which is implemented using an
|
||||
implementation object of some type Impl. It is assumed that Impl
|
||||
has the following methods:
|
||||
|
||||
void iterator_start() - puts iterator in "before begin" position;
|
||||
bool iterator_next() - moves iterator to next position, returns
|
||||
false if it was not possible;
|
||||
Value_type iterator_get() - gets current value.
|
||||
|
||||
An implementation object must be passed to iterator constructor. Iterator
|
||||
stores only a pointer to this implementation (so it must exist as long as
|
||||
iterator is used).
|
||||
*/
|
||||
|
||||
template<
|
||||
typename Impl,
|
||||
typename T = typename std::iterator_traits<Impl>::value_type,
|
||||
typename Distance = typename std::iterator_traits<T*>::difference_type,
|
||||
typename Pointer = typename std::iterator_traits<T*>::pointer,
|
||||
typename Reference = typename std::iterator_traits<T*>::reference
|
||||
>
|
||||
struct Iterator
|
||||
{
|
||||
public:
|
||||
using iterator_category = std::input_iterator_tag;
|
||||
using value_type = T;
|
||||
using difference_type = Distance;
|
||||
using pointer = Pointer;
|
||||
using reference = Reference;
|
||||
|
||||
protected:
|
||||
typename std::remove_reference<Impl>::type *m_impl = NULL;
|
||||
bool m_at_end = false;
|
||||
|
||||
public:
|
||||
Iterator(Impl &impl) : m_impl(&impl) {
|
||||
m_impl->iterator_start();
|
||||
m_at_end = !m_impl->iterator_next();
|
||||
}
|
||||
|
||||
Iterator()
|
||||
: m_at_end(true)
|
||||
{}
|
||||
|
||||
bool operator==(const Iterator &other) const
|
||||
{
|
||||
return (m_at_end && other.m_at_end);
|
||||
}
|
||||
|
||||
bool operator !=(const Iterator &other) const
|
||||
{
|
||||
/*
|
||||
Compares only if both iterators are at the end
|
||||
of the sequence.
|
||||
*/
|
||||
return !(m_at_end && other.m_at_end);
|
||||
}
|
||||
|
||||
Iterator& operator++()
|
||||
{
|
||||
try {
|
||||
if (m_impl && !m_at_end)
|
||||
m_at_end = !m_impl->iterator_next();
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
T operator*() const
|
||||
{
|
||||
if (!m_impl || m_at_end)
|
||||
THROW("Attempt to dereference null iterator");
|
||||
|
||||
try {
|
||||
return m_impl->iterator_get();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
friend Impl;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
List_initializer object can be used to initialize a container of
|
||||
arbitrary type U with list of items taken from a source object.
|
||||
|
||||
It is assumed that the source object type Source defines iterator
|
||||
type and that std::begin/end() return iterators to the beginning
|
||||
and end of the sequence. The container type U is assumed to have
|
||||
a constructor from begin/end iterator.
|
||||
|
||||
List_iterator defines begin/end() methods, so it is possible to
|
||||
iterate over the sequence without storing it in any container.
|
||||
*/
|
||||
|
||||
template <class Source>
|
||||
class List_initializer
|
||||
{
|
||||
protected:
|
||||
|
||||
Source m_src;
|
||||
|
||||
friend Source;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
/*
|
||||
Arguments given to the constructor are passed to the internal
|
||||
m_src object.
|
||||
*/
|
||||
|
||||
template <typename... Ty>
|
||||
List_initializer(Ty&&... args)
|
||||
: m_src(std::forward<Ty>(args)...)
|
||||
{}
|
||||
|
||||
/*
|
||||
Narrow the set of types for which this template is instantiated
|
||||
to avoid ambiguous conversion errors. It is important to disallow
|
||||
conversion to std::initializer_list<> because this conversion path
|
||||
is considered when assigning to STL containers.
|
||||
*/
|
||||
|
||||
template <
|
||||
typename U
|
||||
, typename std::enable_if<
|
||||
!std::is_same< U, std::initializer_list<typename U::value_type> >::value
|
||||
>::type* = nullptr
|
||||
>
|
||||
operator U()
|
||||
{
|
||||
try {
|
||||
return U(std::begin(m_src), std::end(m_src));
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
auto begin() -> decltype(std::begin(m_src))
|
||||
{
|
||||
try {
|
||||
return std::begin(m_src);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
auto end() const -> decltype(std::end(m_src))
|
||||
{
|
||||
try {
|
||||
return std::end(m_src);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct iterator_traits
|
||||
{
|
||||
using value_type = typename std::remove_reference<T>::type;
|
||||
using difference_type
|
||||
= typename std::iterator_traits<value_type*>::difference_type;
|
||||
using pointer
|
||||
= typename std::iterator_traits<value_type*>::pointer;
|
||||
using reference
|
||||
= typename std::iterator_traits<value_type*>::reference;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
This helper template adapts class Impl to be used as a source for
|
||||
List_initializer<> template.
|
||||
|
||||
Class Impl should be suitable for the Iterator<> template which is used to
|
||||
build iterators required by List_initializer<>. That is, Impl should
|
||||
implement iterator_start(), iteratore_next() etc (see Iterator<>).
|
||||
*/
|
||||
|
||||
template<
|
||||
typename Impl,
|
||||
typename Value_type = typename Impl::Value,
|
||||
typename Distance = typename iterator_traits<Value_type>::difference_type,
|
||||
typename Pointer = typename iterator_traits<Value_type>::pointer,
|
||||
typename Reference = typename iterator_traits<Value_type>::reference
|
||||
>
|
||||
class List_source
|
||||
{
|
||||
protected:
|
||||
|
||||
Impl m_impl;
|
||||
|
||||
public:
|
||||
|
||||
template <typename... Ty>
|
||||
List_source(Ty&&... args)
|
||||
: m_impl(std::forward<Ty>(args)...)
|
||||
{}
|
||||
|
||||
using iterator = Iterator<Impl, Value_type, Distance, Pointer, Reference>;
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return iterator(m_impl);
|
||||
}
|
||||
|
||||
iterator end() const
|
||||
{
|
||||
return iterator();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
A template used to adapt an object of class Impl that represents an array of
|
||||
values accessed via operator[] to be used as source for List_initializer<>
|
||||
template. This template uses instance of Impl to implement the iterator
|
||||
methods iterator_start(), so that it can be used with Iterator<> template.
|
||||
*/
|
||||
|
||||
template <typename Impl, typename Value_type = typename Impl::Value>
|
||||
class Array_src_impl
|
||||
{
|
||||
protected:
|
||||
|
||||
Impl m_impl;
|
||||
size_t m_pos = 0;
|
||||
bool m_at_begin = true;
|
||||
|
||||
public:
|
||||
|
||||
template <typename... Ty>
|
||||
Array_src_impl(Ty&&... args)
|
||||
: m_impl(std::forward<Ty>(args)...)
|
||||
{}
|
||||
|
||||
void iterator_start()
|
||||
{
|
||||
m_pos = 0;
|
||||
m_at_begin = true;
|
||||
}
|
||||
|
||||
bool iterator_next()
|
||||
{
|
||||
if (m_at_begin)
|
||||
m_at_begin = false;
|
||||
else
|
||||
m_pos++;
|
||||
return m_pos < size();
|
||||
}
|
||||
|
||||
Value_type iterator_get()
|
||||
{
|
||||
return operator[](m_pos);
|
||||
}
|
||||
|
||||
Value_type operator[](size_t pos)
|
||||
{
|
||||
return m_impl[pos];
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
return m_impl.size();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
This template adapts an object of type Impl holding an array of values as
|
||||
a source for List_initializer<> template. It combines List_source<> and
|
||||
Array_src_impl<> adapters.
|
||||
*/
|
||||
|
||||
template<
|
||||
typename Impl,
|
||||
typename Value_type = typename Impl::Value,
|
||||
typename Distance = typename iterator_traits<Value_type>::difference_type,
|
||||
typename Pointer = typename iterator_traits<Value_type>::pointer,
|
||||
typename Reference = typename iterator_traits<Value_type>::reference
|
||||
>
|
||||
class Array_source
|
||||
: public List_source<
|
||||
Array_src_impl<Impl, Value_type>,
|
||||
Value_type,
|
||||
Distance,
|
||||
Pointer,
|
||||
Reference
|
||||
>
|
||||
{
|
||||
using Base = List_source<
|
||||
Array_src_impl<Impl, Value_type>,
|
||||
Value_type,
|
||||
Distance,
|
||||
Pointer,
|
||||
Reference
|
||||
>;
|
||||
|
||||
using Base::m_impl;
|
||||
|
||||
public:
|
||||
|
||||
using
|
||||
List_source<
|
||||
Array_src_impl<Impl, Value_type>,
|
||||
Value_type,
|
||||
Distance,
|
||||
Pointer,
|
||||
Reference
|
||||
>::List_source;
|
||||
|
||||
Value_type operator[](size_t pos)
|
||||
{
|
||||
return m_impl[pos];
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
return m_impl.size();
|
||||
}
|
||||
};
|
||||
|
||||
} // internal
|
||||
|
||||
|
||||
/*
|
||||
Infrastructure for handling variable argument lists
|
||||
===================================================
|
||||
|
||||
See documentation of Args_processor<> template.
|
||||
*/
|
||||
|
||||
namespace internal {
|
||||
|
||||
/*
|
||||
Type trait which checks if std::begin()/end() work on objects of given
|
||||
class C, so that it can be used as a range to iterate over.
|
||||
|
||||
TODO: Make it work also with user-defined begin()/end() functions.
|
||||
TODO: Make it work with plain C arrays. For example:
|
||||
|
||||
int vals[] = { 1, 2, 3 }
|
||||
process_args(data, vals)
|
||||
*/
|
||||
|
||||
template <class C>
|
||||
class is_range
|
||||
{
|
||||
/*
|
||||
Note: This overload is taken into account only if std::begin(X) and
|
||||
std::end(X) expressions are valid.
|
||||
*/
|
||||
template <class X>
|
||||
static std::true_type
|
||||
test(
|
||||
decltype(std::begin(*((X*)nullptr)))*,
|
||||
decltype(std::end(*((X*)nullptr)))*
|
||||
);
|
||||
|
||||
template <class X>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
|
||||
static const bool value = std::is_same<
|
||||
std::true_type,
|
||||
decltype(test<C>(nullptr, nullptr))
|
||||
>::value;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Class template to be used for uniform processing of variable argument lists
|
||||
in public API methods. This template handles the cases where arguments
|
||||
are specified directly as a list:
|
||||
|
||||
method(arg1, arg2, ..., argN)
|
||||
|
||||
or they are taken from a container such as std::list:
|
||||
|
||||
method(container)
|
||||
|
||||
or they are taken from a range of items described by two iterators:
|
||||
|
||||
method(begin, end)
|
||||
|
||||
A class B that is using this template to define a varargs method 'foo'
|
||||
should define it as follows:
|
||||
|
||||
template <typename... T>
|
||||
X foo(T... args)
|
||||
{
|
||||
Args_processor<B>::process_args(m_impl, args...);
|
||||
return ...;
|
||||
}
|
||||
|
||||
Process_args() is a static method of Args_processor<> and therefore
|
||||
additional context data is passed to it as the first argument. By default
|
||||
this context is a pointer to internal implementation object, as defined
|
||||
by the base class B. The process_args() methods does all the necessary
|
||||
processing of the variable argument list, passing the resulting items
|
||||
one-by-one to B::process_one() method. Base class B must define this
|
||||
static method, which takes the context and one data item as arguments.
|
||||
B::process_one() method can have overloads that handle different types
|
||||
of data items.
|
||||
|
||||
See devapi/detail/crud.h for usage examples.
|
||||
*/
|
||||
|
||||
template <class Base, class D = typename Base::Impl*>
|
||||
class Args_processor
|
||||
{
|
||||
public:
|
||||
|
||||
/*
|
||||
Check if item of type T can be passed to Base::process_one()
|
||||
*/
|
||||
|
||||
template <typename T>
|
||||
class can_process
|
||||
{
|
||||
template <typename X>
|
||||
static std::true_type
|
||||
test(decltype(Base::process_one(*(D*)nullptr, *(X*)nullptr))*);
|
||||
|
||||
template <typename X>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
|
||||
static const bool value
|
||||
= std::is_same< std::true_type, decltype(test<T>(nullptr)) >::value;
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/*
|
||||
Process items from a container.
|
||||
*/
|
||||
|
||||
template <
|
||||
typename C,
|
||||
typename std::enable_if<is_range<C>::value>::type* = nullptr,
|
||||
typename std::enable_if<!can_process<C>::value>::type* = nullptr
|
||||
>
|
||||
static void process_args(D data, C container)
|
||||
{
|
||||
// TODO: use (const) reference to avoid copying instances?
|
||||
for (auto el : container)
|
||||
{
|
||||
Base::process_one(data, el);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
If process_args(data, a, b) is called and a,b are of the same type It
|
||||
which can not be passed to Base::process_one() then we assume that a and
|
||||
b are iterators that describe a range of elements to process.
|
||||
*/
|
||||
|
||||
template <
|
||||
typename It,
|
||||
typename std::enable_if<!can_process<It>::value>::type* = nullptr
|
||||
>
|
||||
static void process_args(D data, const It &begin, const It &end)
|
||||
{
|
||||
for (It it = begin; it != end; ++it)
|
||||
{
|
||||
Base::process_one(data, *it);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Process elements given as a varargs list.
|
||||
*/
|
||||
|
||||
template <
|
||||
typename T,
|
||||
typename... R,
|
||||
typename std::enable_if<can_process<T>::value>::type* = nullptr
|
||||
>
|
||||
static void process_args(D data, T first, R&&... rest)
|
||||
{
|
||||
process_args1(data, first, std::forward<R>(rest)...);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
template <
|
||||
typename T,
|
||||
typename... R,
|
||||
typename std::enable_if<can_process<T>::value>::type* = nullptr
|
||||
>
|
||||
static void process_args1(D data, T first, R&&... rest)
|
||||
{
|
||||
Base::process_one(data, first);
|
||||
process_args1(data, std::forward<R>(rest)...);
|
||||
}
|
||||
|
||||
static void process_args1(D)
|
||||
{}
|
||||
|
||||
};
|
||||
|
||||
} // internal namespace
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
|
||||
#endif
|
||||
508
3rdparty/mysql/mysqlx/devapi/crud.h
vendored
508
3rdparty/mysql/mysqlx/devapi/crud.h
vendored
@@ -1,508 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2023, Oracle and/or its affiliates.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_CRUD_H
|
||||
#define MYSQLX_CRUD_H
|
||||
|
||||
/**
|
||||
@file
|
||||
Common templates used to define CRUD operation classes.
|
||||
*/
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "detail/crud.h"
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
class Session;
|
||||
class Collection;
|
||||
class Table;
|
||||
|
||||
namespace internal {
|
||||
|
||||
/*
|
||||
Factory for constructing concrete implementations of various CRUD
|
||||
operations. All these implementations implement the base Executable_if
|
||||
interface.
|
||||
|
||||
Note: The caller of mk_xxx() method takes ownership of the returned
|
||||
implementation object.
|
||||
*/
|
||||
|
||||
struct PUBLIC_API Crud_factory
|
||||
{
|
||||
using Impl = common::Executable_if;
|
||||
|
||||
static Impl* mk_add(Collection &coll);
|
||||
static Impl* mk_remove(Collection &coll, const string &expr);
|
||||
static Impl* mk_find(Collection &coll);
|
||||
static Impl* mk_find(Collection &coll, const string &expr);
|
||||
static Impl* mk_modify(Collection &coll, const string &expr);
|
||||
|
||||
static Impl* mk_insert(Table &tbl);
|
||||
static Impl* mk_select(Table &tbl);
|
||||
static Impl* mk_update(Table &tbl);
|
||||
static Impl* mk_remove(Table &tbl);
|
||||
|
||||
static Impl* mk_sql(Session &sess, const string &sql);
|
||||
};
|
||||
|
||||
|
||||
} // internal
|
||||
|
||||
|
||||
/*
|
||||
Different CRUD operation classes derive from `Executable` which defines
|
||||
the `execute()` method that executes given operation. Derived classes
|
||||
define additional methods that can modify the operation before it gets
|
||||
executed.
|
||||
|
||||
The hierarchy of classes reflects the grammar that defines the order in which
|
||||
fluent API calls can be done. It is built using templates, such as Offset<>
|
||||
below, which add one API call on top of base class which defines remaining
|
||||
API calls that can be called later. For example, type
|
||||
|
||||
Limit< Offset< Executable<...> > >
|
||||
|
||||
represents an operation for which first .limit() can be called, followed by
|
||||
.offset() and then finally .execute(). See classes like
|
||||
Collection_find_base in collection_crud.h for more examples.
|
||||
|
||||
Each template assumes that its base class defines method 'get_impl()' which
|
||||
returns a pointer to the internal implementation object. It also assumes that
|
||||
this implementation is of appropriate type and can be casted to
|
||||
the appropriate interface type. For example Limit<> template assumes
|
||||
that the implementation type can be casted to Limit_if type.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
@brief The LockContention enum defines constants for defining
|
||||
the row locking contention for `Set_lock::lockExclusive()`
|
||||
and `Set_lock::lockShared()` methods.
|
||||
@see https://dev.mysql.com/doc/refman/8.0/en/innodb-locking-reads.html#innodb-locking-reads-nowait-skip-locked
|
||||
*/
|
||||
|
||||
enum_class LockContention
|
||||
{
|
||||
#define DEVAPI_LOCK_CONTENTION_ENUM(X,N) X = N,
|
||||
|
||||
LOCK_CONTENTION_LIST(DEVAPI_LOCK_CONTENTION_ENUM)
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
|
||||
/**
|
||||
Template for defining fluent api for CRUD operations.
|
||||
*/
|
||||
|
||||
template <class Base>
|
||||
class Offset
|
||||
: public Base
|
||||
{
|
||||
using Operation = Base;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Skip the given number of items (rows or documents) before starting
|
||||
to perform the operation.
|
||||
*/
|
||||
|
||||
Operation& offset(unsigned rows)
|
||||
{
|
||||
try {
|
||||
get_impl()->set_offset(rows);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Limit_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(Base::get_impl());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// @copydoc Offset
|
||||
|
||||
template <class Base>
|
||||
class Limit
|
||||
: public Base
|
||||
{
|
||||
using Operation = Base;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
%Limit the operation to the given number of items (rows or documents).
|
||||
*/
|
||||
|
||||
Operation& limit(unsigned items)
|
||||
{
|
||||
try {
|
||||
get_impl()->set_limit(items);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Limit_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(Base::get_impl());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// @copydoc Offset
|
||||
|
||||
template <class Base>
|
||||
class Sort
|
||||
: public Base
|
||||
, Sort_detail
|
||||
{
|
||||
using Operation = Base;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Specify ordering of documents in a query results.
|
||||
|
||||
Arguments are one or more strings of the form `"<expr> <dir>"` where
|
||||
`<expr>` gives the value to sort on and `<dir>` is a sorting direction
|
||||
`ASC` or `DESC`.
|
||||
*/
|
||||
|
||||
template <typename...Type>
|
||||
Operation& sort(Type... spec)
|
||||
{
|
||||
try {
|
||||
get_impl()->clear_sort();
|
||||
add_sort(get_impl(), spec...);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Sort_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(Base::get_impl());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// @copydoc Offset
|
||||
|
||||
template <class Base>
|
||||
class Order_by
|
||||
: public Base
|
||||
, Sort_detail
|
||||
{
|
||||
using Operation = Base;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Specify ordering of rows in a query results.
|
||||
|
||||
Arguments are one or more strings of the form `"<expr> <dir>"` where
|
||||
`<expr>` gives the value to sort on and `<dir>` is a sorting direction
|
||||
`ASC` or `DESC`.
|
||||
*/
|
||||
|
||||
template <typename...Type>
|
||||
Operation& orderBy(Type... spec)
|
||||
{
|
||||
try {
|
||||
get_impl()->clear_sort();
|
||||
add_sort(get_impl(), spec...);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Sort_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(Base::get_impl());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// @copydoc Offset
|
||||
|
||||
template <class Base>
|
||||
class Having
|
||||
: public Base
|
||||
{
|
||||
using Operation = Base;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Specify filter over grouped results of a query.
|
||||
|
||||
The argument is a Boolean expression which can use aggregation functions.
|
||||
*/
|
||||
|
||||
Operation& having(const string& having_spec)
|
||||
{
|
||||
try {
|
||||
get_impl()->set_having(having_spec);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Having_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(Base::get_impl());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// @copydoc Offset
|
||||
|
||||
template <class Base>
|
||||
class Group_by
|
||||
: public Base
|
||||
, Group_by_detail
|
||||
{
|
||||
using Operation = Base;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Specify grouping of items in a query result.
|
||||
|
||||
Arguments are a one or more expressions. Documents/rows for which
|
||||
expressions evaluate to the same value are grouped together.
|
||||
*/
|
||||
|
||||
template <typename... Expr>
|
||||
Operation& groupBy(Expr... group_by_spec)
|
||||
{
|
||||
try {
|
||||
get_impl()->clear_group_by();
|
||||
do_group_by(get_impl(), group_by_spec...);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Group_by_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(Base::get_impl());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// @copydoc Offset
|
||||
|
||||
template <class Base>
|
||||
class Bind_placeholders
|
||||
: public Base
|
||||
, Bind_detail
|
||||
{
|
||||
using BindOperation = Bind_placeholders;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Specify values for '?' placeholders in a query.
|
||||
|
||||
One or more values can be specified in a single call to bind(). A query
|
||||
can be executed only if values for all placeholders have been specified.
|
||||
*/
|
||||
|
||||
template <typename... Types>
|
||||
BindOperation& bind(Types&&... vals)
|
||||
{
|
||||
try {
|
||||
add_params(get_impl(), std::forward<Types>(vals)...);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Bind_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(Base::get_impl());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// @copydoc Offset
|
||||
|
||||
template <class Base>
|
||||
class Bind_parameters
|
||||
: public Base
|
||||
{
|
||||
using BindOperation = Bind_parameters;
|
||||
using Operation = Base;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Bind parameter with given name to the given value.
|
||||
|
||||
A statement or query can be executed only if all named parameters used by
|
||||
it are bound to values.
|
||||
*/
|
||||
|
||||
BindOperation& bind(const string ¶meter, const Value &val)
|
||||
{
|
||||
//TODO: Protocol supports Document and Array... but common::Values doesn't!
|
||||
if (Value::DOCUMENT == val.getType())
|
||||
throw_error("Can not bind a parameter to a document");
|
||||
|
||||
if (Value::ARRAY == val.getType())
|
||||
throw_error("Can not bind a parameter to an array");
|
||||
|
||||
try {
|
||||
get_impl()->add_param(parameter, (const common::Value&)val);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Bind parameters to values given by a map from parameter
|
||||
names to their values.
|
||||
*/
|
||||
|
||||
template <class Map>
|
||||
Operation& bind(const Map &args)
|
||||
{
|
||||
for (const auto &keyval : args)
|
||||
{
|
||||
bind(keyval.first, keyval.second);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Bind_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(Base::get_impl());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// @copydoc Offset
|
||||
|
||||
template <class Base, class IMPL>
|
||||
class Set_lock
|
||||
: public Base
|
||||
{
|
||||
using Operation = Base;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Set a shared mode lock on any rows/documents that are read.
|
||||
|
||||
Other sessions can read, but not modify locked rows/documents.
|
||||
*/
|
||||
|
||||
Operation&
|
||||
lockShared(LockContention contention= LockContention::DEFAULT)
|
||||
{
|
||||
get_impl()->set_lock_mode(common::Lock_mode::SHARED,
|
||||
common::Lock_contention((unsigned)contention));
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
Set an exclusive mode lock on any rows/documents that are read.
|
||||
|
||||
Other sessions are blocked from modifying, locking, or reading the data
|
||||
in certain transaction isolation levels. The lock is released
|
||||
when the transaction is committed or rolled back.
|
||||
*/
|
||||
|
||||
Operation&
|
||||
lockExclusive(LockContention contention = LockContention::DEFAULT)
|
||||
{
|
||||
get_impl()->set_lock_mode(common::Lock_mode::EXCLUSIVE,
|
||||
common::Lock_contention((unsigned)contention));
|
||||
return *this;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = IMPL;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(Base::get_impl());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // internal
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif
|
||||
280
3rdparty/mysql/mysqlx/devapi/detail/crud.h
vendored
280
3rdparty/mysql/mysqlx/devapi/detail/crud.h
vendored
@@ -1,280 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_DETAIL_CRUD_H
|
||||
#define MYSQLX_DETAIL_CRUD_H
|
||||
|
||||
/**
|
||||
@file
|
||||
Details for public API classes representing CRUD operations.
|
||||
*/
|
||||
|
||||
|
||||
#include "../common.h"
|
||||
#include "../executable.h"
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
namespace internal {
|
||||
|
||||
|
||||
struct PUBLIC_API Bind_detail
|
||||
{
|
||||
protected:
|
||||
|
||||
using Impl = common::Bind_if;
|
||||
using Args_prc = Args_processor<Bind_detail, Impl*>;
|
||||
|
||||
static void process_one(Impl *impl, const Value &val)
|
||||
{
|
||||
impl->add_param((const common::Value&)val);
|
||||
}
|
||||
|
||||
template <typename... T>
|
||||
static void add_params(Impl *impl, T&&... vals)
|
||||
{
|
||||
Args_prc::process_args(impl, std::forward<T>(vals)...);
|
||||
}
|
||||
|
||||
friend Args_prc;
|
||||
};
|
||||
|
||||
|
||||
struct PUBLIC_API Sort_detail
|
||||
{
|
||||
protected:
|
||||
|
||||
using Impl = common::Sort_if;
|
||||
using Args_prc = Args_processor<Sort_detail, Impl*>;
|
||||
|
||||
static void process_one(Impl *impl, const string &ord_spec)
|
||||
{
|
||||
impl->add_sort(ord_spec);
|
||||
}
|
||||
|
||||
template <typename... T>
|
||||
static void add_sort(Impl *impl, T... args)
|
||||
{
|
||||
Args_prc::process_args(impl, args...);
|
||||
}
|
||||
|
||||
friend Args_prc;
|
||||
};
|
||||
|
||||
|
||||
struct PUBLIC_API Group_by_detail
|
||||
{
|
||||
protected:
|
||||
|
||||
using Impl = common::Group_by_if;
|
||||
using Args_prc = Args_processor<Group_by_detail, Impl*>;
|
||||
|
||||
static void process_one(Impl *impl, const string &spec)
|
||||
{
|
||||
impl->add_group_by(spec);
|
||||
}
|
||||
|
||||
template <typename... T>
|
||||
static void do_group_by(Impl *impl, T... args)
|
||||
{
|
||||
Args_prc::process_args(impl, args...);
|
||||
}
|
||||
|
||||
friend Args_prc;
|
||||
};
|
||||
|
||||
|
||||
struct PUBLIC_API Proj_detail
|
||||
{
|
||||
protected:
|
||||
|
||||
using Impl = common::Proj_if;
|
||||
using Args_prc = Args_processor<Proj_detail, Impl*>;
|
||||
|
||||
static void process_one(Impl *impl, const string &spec)
|
||||
{
|
||||
impl->add_proj(spec);
|
||||
}
|
||||
|
||||
template <typename... T>
|
||||
static void add_proj(Impl *impl, T... proj_spec)
|
||||
{
|
||||
Args_prc::process_args(impl, proj_spec...);
|
||||
}
|
||||
|
||||
friend Args_prc;
|
||||
};
|
||||
|
||||
|
||||
struct PUBLIC_API Collection_add_detail
|
||||
{
|
||||
protected:
|
||||
|
||||
using Impl = common::Collection_add_if;
|
||||
using Args_prc = Args_processor<Collection_add_detail, Impl*>;
|
||||
|
||||
static void process_one(Impl *impl, const string &json)
|
||||
{
|
||||
impl->add_json(json);
|
||||
}
|
||||
|
||||
static void process_one(Impl *impl, const DbDoc &doc)
|
||||
{
|
||||
// TODO: Do it better when we support sending structured
|
||||
// document descriptions to the server.
|
||||
|
||||
std::ostringstream buf;
|
||||
buf << doc;
|
||||
// Note: utf8 conversion using mysqlx::string.
|
||||
impl->add_json(mysqlx::string(buf.str()));
|
||||
}
|
||||
|
||||
template <typename... T>
|
||||
static void do_add(Impl *impl, T... args)
|
||||
{
|
||||
Args_prc::process_args(impl, args...);
|
||||
}
|
||||
|
||||
friend Args_prc;
|
||||
};
|
||||
|
||||
|
||||
struct PUBLIC_API Collection_find_detail
|
||||
{
|
||||
protected:
|
||||
|
||||
using Impl = common::Proj_if;
|
||||
using Args_prc = Args_processor<Collection_find_detail, Impl*>;
|
||||
|
||||
static void process_one(Impl *impl, const string &proj)
|
||||
{
|
||||
impl->add_proj(proj);
|
||||
}
|
||||
|
||||
|
||||
static void do_fields(Impl *impl, const Expression &proj)
|
||||
{
|
||||
impl->set_proj(proj.get<string>());
|
||||
}
|
||||
|
||||
/*
|
||||
Note: If e is an expression (of type Expression) then only
|
||||
.fields(e) is valid - the multi-argument variant .fields(e,...)
|
||||
should be disabled.
|
||||
*/
|
||||
|
||||
template <
|
||||
typename T, typename... R,
|
||||
typename std::enable_if<!std::is_same<T, Expression>::value>::type* = nullptr
|
||||
>
|
||||
static void do_fields(Impl *impl, T first, R... rest)
|
||||
{
|
||||
Args_prc::process_args(impl, first, rest...);
|
||||
}
|
||||
|
||||
friend Args_prc;
|
||||
};
|
||||
|
||||
|
||||
struct PUBLIC_API Table_insert_detail
|
||||
{
|
||||
protected:
|
||||
|
||||
using Row_impl = internal::Row_detail::Impl;
|
||||
using Impl = common::Table_insert_if<Row_impl>;
|
||||
|
||||
/*
|
||||
Helper methods which pass column/row information to the
|
||||
internal implementation object.
|
||||
*/
|
||||
|
||||
struct Add_column
|
||||
{
|
||||
static void process_one(Impl *impl, const string &col)
|
||||
{
|
||||
impl->add_column(col);
|
||||
}
|
||||
};
|
||||
|
||||
struct Add_value
|
||||
{
|
||||
using Impl = std::pair<Row, unsigned>;
|
||||
|
||||
static void process_one(Impl *impl, const mysqlx::Value &val)
|
||||
{
|
||||
impl->first.set((impl->second)++, val);
|
||||
}
|
||||
};
|
||||
|
||||
struct Add_row
|
||||
{
|
||||
static void process_one(Impl *impl, const Row &row)
|
||||
{
|
||||
impl->add_row(*row.m_impl);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename... T>
|
||||
static void add_columns(Impl *impl, T... args)
|
||||
{
|
||||
Args_processor<Add_column, Impl*>::process_args(impl, args...);
|
||||
}
|
||||
|
||||
template <typename... T>
|
||||
static void add_rows(Impl *impl, T... args)
|
||||
{
|
||||
Args_processor<Add_row, Impl*>::process_args(impl, args...);
|
||||
}
|
||||
|
||||
template <typename... T>
|
||||
static void add_values(Impl *impl, T... args)
|
||||
{
|
||||
Add_value::Impl row{ {}, 0 };
|
||||
Args_processor<Add_value>::process_args(&row, args...);
|
||||
Add_row::process_one(impl, row.first);
|
||||
}
|
||||
|
||||
friend Args_processor<Add_column, Impl*>;
|
||||
friend Args_processor<Add_row, Impl*>;
|
||||
friend Args_processor<Add_value, Impl*>;
|
||||
|
||||
};
|
||||
|
||||
|
||||
using Table_select_detail = Proj_detail;
|
||||
|
||||
} // internal
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif
|
||||
77
3rdparty/mysql/mysqlx/devapi/detail/error.h
vendored
77
3rdparty/mysql/mysqlx/devapi/detail/error.h
vendored
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_DETAIL_ERROR_H
|
||||
#define MYSQLX_DETAIL_ERROR_H
|
||||
|
||||
/**
|
||||
@file
|
||||
Classes used to access query and command execution results.
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
//#include <memory>
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
namespace internal {
|
||||
|
||||
class Result_detail;
|
||||
|
||||
class Warning_detail
|
||||
: public virtual common::Printable
|
||||
{
|
||||
protected:
|
||||
|
||||
byte m_level;
|
||||
uint16_t m_code;
|
||||
string m_msg;
|
||||
|
||||
Warning_detail(Warning_detail&&) = default;
|
||||
Warning_detail(const Warning_detail&) = default;
|
||||
|
||||
Warning_detail(byte level, uint16_t code, const std::string &msg)
|
||||
: m_level(level), m_code(code), m_msg(msg)
|
||||
{}
|
||||
|
||||
void print(std::ostream &) const override;
|
||||
|
||||
friend Result_detail;
|
||||
};
|
||||
|
||||
|
||||
} // internal namespace
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif
|
||||
470
3rdparty/mysql/mysqlx/devapi/detail/result.h
vendored
470
3rdparty/mysql/mysqlx/devapi/detail/result.h
vendored
@@ -1,470 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_DETAIL_RESULT_H
|
||||
#define MYSQLX_DETAIL_RESULT_H
|
||||
|
||||
/**
|
||||
@file
|
||||
Details for public API result classes.
|
||||
*/
|
||||
|
||||
|
||||
#include "../common.h"
|
||||
#include "../error.h"
|
||||
#include "../document.h"
|
||||
#include "../row.h"
|
||||
#include "../collations.h"
|
||||
|
||||
#include <deque>
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
class RowResult;
|
||||
class Column;
|
||||
class Columns;
|
||||
class Session;
|
||||
|
||||
namespace common {
|
||||
|
||||
class Result_init;
|
||||
class Column_info;
|
||||
class Result_impl;
|
||||
|
||||
} // common
|
||||
|
||||
|
||||
namespace internal {
|
||||
|
||||
|
||||
struct Session_detail;
|
||||
|
||||
|
||||
class PUBLIC_API Result_detail
|
||||
{
|
||||
// Disable copy semantics for result classes.
|
||||
|
||||
Result_detail(const Result_detail&) = delete;
|
||||
Result_detail& operator=(const Result_detail&) = delete;
|
||||
|
||||
public:
|
||||
|
||||
using Impl = common::Result_impl;
|
||||
|
||||
protected:
|
||||
|
||||
Result_detail(common::Result_init&);
|
||||
|
||||
// Note: move semantics is implemented by move assignment operator.
|
||||
|
||||
Result_detail(Result_detail &&other)
|
||||
{
|
||||
operator=(std::move(other));
|
||||
}
|
||||
|
||||
Result_detail& operator=(Result_detail&&);
|
||||
|
||||
Result_detail() = default;
|
||||
virtual ~Result_detail();
|
||||
|
||||
Impl& get_impl();
|
||||
|
||||
const Impl& get_impl() const
|
||||
{
|
||||
return const_cast<Result_detail*>(this)->get_impl();
|
||||
}
|
||||
|
||||
void check_result() const;
|
||||
|
||||
uint64_t get_affected_rows() const;
|
||||
uint64_t get_auto_increment() const;
|
||||
|
||||
using DocIdList = internal::List_initializer<const std::vector<std::string>&>;
|
||||
|
||||
DocIdList get_generated_ids() const;
|
||||
|
||||
// Handling multi-results
|
||||
|
||||
bool has_data() const;
|
||||
|
||||
// Note: needs to be called before accessing the first result set.
|
||||
bool next_result();
|
||||
|
||||
protected:
|
||||
|
||||
Impl *m_impl = nullptr;
|
||||
bool m_owns_impl = false;
|
||||
|
||||
/*
|
||||
Source for WarningList initializer.
|
||||
*/
|
||||
|
||||
struct Warning_src
|
||||
{
|
||||
using Value = Warning;
|
||||
|
||||
Result_detail &m_res;
|
||||
|
||||
Warning_src(Result_detail &res)
|
||||
: m_res(res)
|
||||
{}
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
return m_res.get_warning_count();
|
||||
}
|
||||
|
||||
Warning operator[](size_t pos)
|
||||
{
|
||||
return m_res.get_warning(pos);
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
using WarningList = internal::List_initializer<Array_source<Warning_src>>;
|
||||
|
||||
protected:
|
||||
|
||||
unsigned get_warning_count() const;
|
||||
Warning get_warning(size_t pos);
|
||||
|
||||
WarningList get_warnings()
|
||||
{
|
||||
get_warning_count();
|
||||
return { *this };
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
friend Session_detail;
|
||||
friend List_initializer<Result_detail>;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
This class keeps a reference to column information stored in a
|
||||
common::Column_info<> instance. The meta-data is exposed in format expected
|
||||
by X DevAPI meta-data access methods. In particualr the CDK type and encoding
|
||||
format information is translated to X DevAPI type information. For example,
|
||||
a CDK column of type FLOAT can be reported as DevAPI type FLOAT, DOUBLE
|
||||
or DECIMAL, depending on the encoding format that was reported by CDK. This
|
||||
translation happens in Column::getType() method.
|
||||
|
||||
Additional encoding information is exposed via other methods such as
|
||||
is_signed().
|
||||
*/
|
||||
|
||||
class PUBLIC_API Column_detail
|
||||
: virtual common::Printable
|
||||
{
|
||||
protected:
|
||||
|
||||
using Impl = common::Column_info;
|
||||
|
||||
const Impl *m_impl = nullptr;
|
||||
|
||||
Column_detail(const Impl *impl)
|
||||
: m_impl(impl)
|
||||
{}
|
||||
|
||||
const Impl& get_impl() const
|
||||
{
|
||||
assert(m_impl);
|
||||
return *m_impl;
|
||||
}
|
||||
|
||||
string get_name() const;
|
||||
string get_label() const;
|
||||
string get_schema_name() const;
|
||||
string get_table_name() const;
|
||||
string get_table_label() const;
|
||||
|
||||
// Note: should return values of mysqlx::Type enum constants
|
||||
|
||||
unsigned get_type() const;
|
||||
|
||||
CharacterSet get_charset() const;
|
||||
const CollationInfo& get_collation() const;
|
||||
|
||||
unsigned long get_length() const;
|
||||
unsigned short get_decimals() const;
|
||||
|
||||
bool is_signed() const;
|
||||
bool is_padded() const;
|
||||
|
||||
void print(std::ostream&) const override;
|
||||
|
||||
protected:
|
||||
|
||||
Column_detail() = default;
|
||||
Column_detail(const Column_detail&) = default;
|
||||
Column_detail(Column_detail&&) = default;
|
||||
|
||||
Column_detail& operator=(const Column_detail&) = default;
|
||||
|
||||
public:
|
||||
|
||||
friend Impl;
|
||||
friend Result_detail;
|
||||
friend RowResult;
|
||||
|
||||
struct INTERNAL Access;
|
||||
friend Access;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
A wrapper around column meta-data class COL that adds copy semantics
|
||||
and default ctor. This is required by Columns_detail class which uses
|
||||
an STL container to store data for several columns.
|
||||
*/
|
||||
|
||||
template <class COL>
|
||||
struct Column_storage
|
||||
: public COL
|
||||
{
|
||||
Column_storage(const typename COL::Impl *impl)
|
||||
: COL(impl)
|
||||
{}
|
||||
|
||||
// Note: these members are needed to use it with std::deque<>
|
||||
|
||||
Column_storage() = default;
|
||||
Column_storage(const Column_storage&) = default;
|
||||
Column_storage& operator=(const Column_storage&) = default;
|
||||
};
|
||||
|
||||
|
||||
template <class COLS> class Row_result_detail;
|
||||
|
||||
|
||||
/*
|
||||
Class holding meta-data information for all columns in a result.
|
||||
|
||||
Template parameter COL is a class used to store information about a single
|
||||
column. It is made into template parameter because full definition of
|
||||
the actuall mysqlx::Column class is not available in this header.
|
||||
|
||||
Note: Because this class is implemented using std::deque<>, we wrap COL
|
||||
class with the Column_storage<> wrapper to provide copy semantics and default
|
||||
ctor required by this STL container.
|
||||
*/
|
||||
|
||||
template <class COL>
|
||||
class Columns_detail
|
||||
: public std::deque<Column_storage<COL>>
|
||||
{
|
||||
Columns_detail(const Columns_detail&) = delete;
|
||||
|
||||
protected:
|
||||
|
||||
Columns_detail() = default;
|
||||
Columns_detail(Columns_detail&&) = default;
|
||||
Columns_detail& operator=(Columns_detail&&) = default;
|
||||
|
||||
void init(const internal::Result_detail::Impl&);
|
||||
|
||||
///@cond IGNORE
|
||||
friend internal::Row_result_detail<Columns>;
|
||||
///@endcond
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
COLS is a class used to store information about result columns. It is made
|
||||
into template parameter because the actual mysqlx::Columns class, with
|
||||
the public API for accessing column information, is defined in the top-level
|
||||
header devapi/result.h.
|
||||
|
||||
The COLS class should have move semantics to enable move-semantics for result
|
||||
objects.
|
||||
*/
|
||||
|
||||
template <class COLS>
|
||||
class Row_result_detail
|
||||
: public Result_detail
|
||||
{
|
||||
public:
|
||||
|
||||
using iterator = Iterator<Row_result_detail, Row>;
|
||||
using RowList = List_initializer<Row_result_detail&>;
|
||||
using Columns = COLS;
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return iterator(*this);
|
||||
}
|
||||
|
||||
iterator end() const
|
||||
{
|
||||
return iterator();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// Row iterator implementation
|
||||
|
||||
Row m_row;
|
||||
|
||||
using Value = Row;
|
||||
|
||||
void iterator_start() {}
|
||||
|
||||
bool iterator_next();
|
||||
|
||||
Value iterator_get()
|
||||
{
|
||||
return m_row;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
Row_result_detail() = default;
|
||||
Row_result_detail(common::Result_init&);
|
||||
|
||||
Row_result_detail(Row_result_detail&&) = default;
|
||||
Row_result_detail& operator=(Row_result_detail&&) = default;
|
||||
|
||||
RowList get_rows()
|
||||
{
|
||||
/*
|
||||
Construct RowList instance passing reference to this Row_result_detail
|
||||
object which acts as a source for the list initializer.
|
||||
*/
|
||||
return *this;
|
||||
}
|
||||
|
||||
row_count_t row_count();
|
||||
|
||||
Row get_row()
|
||||
{
|
||||
if (!iterator_next())
|
||||
return Row();
|
||||
return iterator_get();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// Storage for result column information.
|
||||
|
||||
Columns m_cols;
|
||||
|
||||
protected:
|
||||
|
||||
col_count_t col_count() const;
|
||||
const Column& get_column(col_count_t) const;
|
||||
const Columns& get_columns() const;
|
||||
|
||||
bool next_result()
|
||||
{
|
||||
bool rc = Result_detail::next_result();
|
||||
if (rc)
|
||||
m_cols.init(get_impl());
|
||||
return rc;
|
||||
}
|
||||
|
||||
friend iterator;
|
||||
friend RowResult;
|
||||
friend Columns;
|
||||
};
|
||||
|
||||
|
||||
// Document based results
|
||||
// ----------------------
|
||||
|
||||
class PUBLIC_API Doc_result_detail
|
||||
: public Result_detail
|
||||
{
|
||||
public:
|
||||
|
||||
using iterator = Iterator<Doc_result_detail, DbDoc>;
|
||||
using DocList = List_initializer<Doc_result_detail&>;
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return iterator(*this);
|
||||
}
|
||||
|
||||
iterator end() const
|
||||
{
|
||||
return iterator();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// iterator implementation
|
||||
|
||||
DbDoc m_cur_doc;
|
||||
|
||||
void iterator_start() {}
|
||||
|
||||
bool iterator_next();
|
||||
|
||||
DbDoc iterator_get()
|
||||
{
|
||||
return m_cur_doc;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Doc_result_detail() = default;
|
||||
|
||||
Doc_result_detail(common::Result_init &init)
|
||||
: Result_detail(init)
|
||||
{}
|
||||
|
||||
DbDoc get_doc()
|
||||
{
|
||||
if (!iterator_next())
|
||||
return DbDoc();
|
||||
return iterator_get();
|
||||
}
|
||||
|
||||
uint64_t count();
|
||||
|
||||
DocList get_docs()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend Impl;
|
||||
friend iterator;
|
||||
};
|
||||
|
||||
|
||||
} // internal namespace
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif
|
||||
114
3rdparty/mysql/mysqlx/devapi/detail/row.h
vendored
114
3rdparty/mysql/mysqlx/devapi/detail/row.h
vendored
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_DETAIL_ROW_H
|
||||
#define MYSQLX_DETAIL_ROW_H
|
||||
|
||||
/**
|
||||
@file
|
||||
Details for Row class.
|
||||
*/
|
||||
|
||||
|
||||
#include "../common.h"
|
||||
#include "../document.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
class Columns;
|
||||
|
||||
namespace internal {
|
||||
|
||||
template <class COLS> class Row_result_detail;
|
||||
struct Table_insert_detail;
|
||||
|
||||
|
||||
class PUBLIC_API Row_detail
|
||||
{
|
||||
protected:
|
||||
|
||||
class INTERNAL Impl;
|
||||
DLL_WARNINGS_PUSH
|
||||
std::shared_ptr<Impl> m_impl;
|
||||
DLL_WARNINGS_POP
|
||||
|
||||
Row_detail() = default;
|
||||
|
||||
Row_detail(std::shared_ptr<Impl> &&impl)
|
||||
{
|
||||
m_impl = std::move(impl);
|
||||
}
|
||||
|
||||
col_count_t col_count() const;
|
||||
bytes get_bytes(col_count_t) const;
|
||||
Value& get_val(col_count_t);
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_impl.reset();
|
||||
}
|
||||
|
||||
Impl& get_impl();
|
||||
|
||||
const Impl& get_impl() const
|
||||
{
|
||||
return const_cast<Row_detail*>(this)->get_impl();
|
||||
}
|
||||
|
||||
void ensure_impl();
|
||||
|
||||
using Args_prc = Args_processor<Row_detail, std::pair<Impl*, col_count_t>*>;
|
||||
|
||||
template<typename... Types>
|
||||
void set_values(col_count_t pos, Types... args)
|
||||
{
|
||||
ensure_impl();
|
||||
assert(m_impl);
|
||||
std::pair<Impl*, col_count_t> data{ m_impl.get(), pos };
|
||||
Args_prc::process_args(&data, args...);
|
||||
}
|
||||
|
||||
static void process_one(std::pair<Impl*, col_count_t>*, const Value &val);
|
||||
|
||||
friend Table_insert_detail;
|
||||
friend Row_result_detail<Columns>;
|
||||
friend Args_prc;
|
||||
};
|
||||
|
||||
|
||||
} // internal namespace
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif
|
||||
426
3rdparty/mysql/mysqlx/devapi/detail/session.h
vendored
426
3rdparty/mysql/mysqlx/devapi/detail/session.h
vendored
@@ -1,426 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_DETAIL_SESSION_H
|
||||
#define MYSQLX_DETAIL_SESSION_H
|
||||
|
||||
#include "../common.h"
|
||||
#include "../crud.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
namespace cdk {
|
||||
class Session;
|
||||
}
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
class Value;
|
||||
class Session;
|
||||
class Schema;
|
||||
class Table;
|
||||
class Collection;
|
||||
class CollectionOptions;
|
||||
|
||||
namespace common {
|
||||
class Session_impl;
|
||||
class Session_pool;
|
||||
using Shared_session_pool = std::shared_ptr<Session_pool>;
|
||||
class Result_init;
|
||||
class Result_impl;
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
|
||||
class Schema_detail;
|
||||
using Client_impl = common::Session_pool;
|
||||
using Shared_client_impl = std::shared_ptr<Client_impl>;
|
||||
using Session_impl = common::Session_impl;
|
||||
using Shared_session_impl = std::shared_ptr<common::Session_impl>;
|
||||
|
||||
|
||||
/*
|
||||
Base class for database objects. Can't be used alone.
|
||||
*/
|
||||
|
||||
class PUBLIC_API Db_obj_base
|
||||
{
|
||||
protected:
|
||||
|
||||
DLL_WARNINGS_PUSH
|
||||
Shared_session_impl m_sess;
|
||||
string m_name;
|
||||
DLL_WARNINGS_POP
|
||||
|
||||
Db_obj_base(const Shared_session_impl& sess, const string& name)
|
||||
: m_sess(sess), m_name(name)
|
||||
{}
|
||||
|
||||
virtual ~Db_obj_base()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
class PUBLIC_API Collection_detail
|
||||
: public Db_obj_base
|
||||
{
|
||||
protected:
|
||||
|
||||
Collection_detail(const Shared_session_impl &sess, const string &name)
|
||||
: Db_obj_base(sess, name)
|
||||
{}
|
||||
|
||||
virtual Schema_detail& get_schema() = 0;
|
||||
|
||||
Result add_or_replace_one(const string &id, Value&&, bool);
|
||||
|
||||
void index_drop(const string &name);
|
||||
void index_create(const string &name, Value &&spec);
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
Base class for classes to be used by common::List_source<> which get item
|
||||
from query results.
|
||||
|
||||
It assumes that the first column in the results contains string
|
||||
data. An instance of this class iterates over the string data in the
|
||||
result until all rows are consumed.
|
||||
|
||||
Derived class must send the query to the server and set m_res member to point
|
||||
at the result of this query.
|
||||
*/
|
||||
|
||||
struct PUBLIC_API Query_src
|
||||
{
|
||||
using Value = string;
|
||||
using Res_impl = common::Result_impl;
|
||||
|
||||
Res_impl *m_res = nullptr;
|
||||
const void *m_row = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
Query_src()
|
||||
{}
|
||||
|
||||
Query_src(Query_src &&other)
|
||||
: m_res(other.m_res)
|
||||
{
|
||||
// Note: only one instance of Query_src owns m_res.
|
||||
other.m_res = nullptr;
|
||||
}
|
||||
|
||||
Query_src(const Query_src&) = delete;
|
||||
|
||||
virtual ~Query_src();
|
||||
|
||||
virtual void iterator_start()
|
||||
{
|
||||
assert(m_res);
|
||||
}
|
||||
|
||||
bool iterator_next();
|
||||
string iterator_get();
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class PUBLIC_API Schema_detail
|
||||
: public Db_obj_base
|
||||
{
|
||||
protected:
|
||||
|
||||
enum Obj_type { COLLECTION, TABLE };
|
||||
|
||||
/*
|
||||
Sources for lists of schema objects and their names.
|
||||
|
||||
When constructing a source, a SQL style patter on object names is
|
||||
given as ctor parameter -- only object matching the pattern are listed.
|
||||
Name_src accepts a parameter which tells whether names of tables or
|
||||
collections should be listed.
|
||||
*/
|
||||
|
||||
struct PUBLIC_API Name_src
|
||||
: public Query_src
|
||||
{
|
||||
const Schema &m_schema;
|
||||
Name_src(const Schema&, Obj_type, const string &pattern);
|
||||
};
|
||||
|
||||
struct PUBLIC_API Collection_src
|
||||
: Name_src
|
||||
{
|
||||
using Value = Collection;
|
||||
|
||||
Collection_src(const Schema &sch, const string &pattern)
|
||||
: Name_src(sch, COLLECTION, pattern)
|
||||
{}
|
||||
|
||||
using Name_src::iterator_start;
|
||||
using Name_src::iterator_next;
|
||||
Collection iterator_get();
|
||||
};
|
||||
|
||||
struct PUBLIC_API Table_src
|
||||
: Name_src
|
||||
{
|
||||
using Value = Table;
|
||||
|
||||
Table_src(const Schema &sch, const string &pattern)
|
||||
: Name_src(sch, TABLE, pattern)
|
||||
{}
|
||||
|
||||
using Name_src::iterator_start;
|
||||
using Name_src::iterator_next;
|
||||
Table iterator_get();
|
||||
};
|
||||
|
||||
Schema_detail(const Shared_session_impl &sess, const string &name)
|
||||
: Db_obj_base(sess, name)
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
using CollectionList = List_initializer<List_source<Collection_src>>;
|
||||
using TableList = List_initializer<List_source<Table_src>>;
|
||||
using StringList = List_initializer<List_source<Name_src>>;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
void create_collection(const mysqlx::string &name,
|
||||
CollectionOptions options);
|
||||
void modify_collection(const mysqlx::string &name,
|
||||
CollectionOptions options);
|
||||
void drop_collection(const string &name);
|
||||
|
||||
friend Collection_detail;
|
||||
|
||||
struct Access;
|
||||
friend Access;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Class representing an SQL statement that can be executed on the server.
|
||||
*/
|
||||
|
||||
struct SQL_statement;
|
||||
|
||||
using SQL_statement_cmd = Executable<SqlResult, SQL_statement>;
|
||||
|
||||
struct SQL_statement
|
||||
: public Bind_placeholders< SQL_statement_cmd >
|
||||
{
|
||||
SQL_statement(Session *sess, const string &query)
|
||||
{
|
||||
assert(sess);
|
||||
try {
|
||||
reset(internal::Crud_factory::mk_sql(*sess, query));
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
SQL_statement(SQL_statement_cmd &other)
|
||||
{
|
||||
SQL_statement_cmd::operator=(other);
|
||||
}
|
||||
|
||||
SQL_statement(SQL_statement_cmd &&other)
|
||||
{
|
||||
SQL_statement_cmd::operator=(std::move(other));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct Session_detail;
|
||||
|
||||
struct PUBLIC_API Client_detail
|
||||
{
|
||||
|
||||
// Disable copy semantics for client class.
|
||||
|
||||
Client_detail(const Client_detail&) = delete;
|
||||
Client_detail& operator=(const Client_detail&) = delete;
|
||||
|
||||
|
||||
|
||||
Client_detail(common::Settings_impl &settings);
|
||||
//Client_detail(common::Settings_impl &&settings);
|
||||
|
||||
void close();
|
||||
|
||||
protected:
|
||||
|
||||
Client_detail(Client_detail && other)
|
||||
{
|
||||
m_impl = other.m_impl;
|
||||
other.m_impl.reset();
|
||||
}
|
||||
|
||||
common::Shared_session_pool& get_session_pool();
|
||||
|
||||
|
||||
struct INTERNAL Impl;
|
||||
|
||||
DLL_WARNINGS_PUSH
|
||||
Shared_client_impl m_impl = NULL;
|
||||
DLL_WARNINGS_POP
|
||||
|
||||
friend Session;
|
||||
};
|
||||
|
||||
|
||||
struct PUBLIC_API Session_detail
|
||||
{
|
||||
// Disable copy semantics for session class.
|
||||
|
||||
Session_detail(const Session_detail&) = delete;
|
||||
Session_detail& operator=(const Session_detail&) = delete;
|
||||
|
||||
/*
|
||||
Sources for lists of schemata and schema names. Only schemata matching
|
||||
the given SQL-style pattern are listed.
|
||||
*/
|
||||
|
||||
struct PUBLIC_API Name_src
|
||||
: public Query_src
|
||||
{
|
||||
const Session &m_sess;
|
||||
Name_src(const Session&, const string &pattern);
|
||||
};
|
||||
|
||||
struct PUBLIC_API Schema_src
|
||||
: Name_src
|
||||
{
|
||||
using Value = Schema;
|
||||
|
||||
Schema_src(Session &sess, const string &pattern)
|
||||
: Name_src(sess, pattern)
|
||||
{}
|
||||
|
||||
Schema_src(Session &sess)
|
||||
: Schema_src(sess, "%")
|
||||
{}
|
||||
|
||||
using Name_src::iterator_start;
|
||||
using Name_src::iterator_next;
|
||||
Schema iterator_get();
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
using SchemaList = List_initializer<List_source<Schema_src>>;
|
||||
|
||||
protected:
|
||||
|
||||
Session_detail(Session_detail && other)
|
||||
{
|
||||
m_impl = other.m_impl;
|
||||
other.m_impl.reset();
|
||||
}
|
||||
|
||||
|
||||
struct INTERNAL Impl;
|
||||
|
||||
/*
|
||||
Note: Session implementation is shared with result objects because it
|
||||
must exists as long as result implementation exists. This means that
|
||||
even when session object is deleted, its implementation can still hang
|
||||
around.
|
||||
*/
|
||||
|
||||
DLL_WARNINGS_PUSH
|
||||
Shared_session_impl m_impl = NULL;
|
||||
DLL_WARNINGS_POP
|
||||
|
||||
Session_detail(common::Settings_impl&);
|
||||
Session_detail(common::Shared_session_pool&);
|
||||
|
||||
virtual ~Session_detail()
|
||||
{
|
||||
try {
|
||||
if (m_impl)
|
||||
close();
|
||||
}
|
||||
catch (...) {}
|
||||
}
|
||||
|
||||
void create_schema(const string &name, bool reuse);
|
||||
void drop_schema(const string &name);
|
||||
string get_default_schema_name();
|
||||
|
||||
void start_transaction();
|
||||
void commit();
|
||||
void rollback(const string &sp = string());
|
||||
string savepoint_set(const string &sp = string());
|
||||
void savepoint_remove(const string&);
|
||||
|
||||
|
||||
common::Session_impl& get_impl()
|
||||
{
|
||||
if (!m_impl)
|
||||
THROW("Invalid session");
|
||||
return *m_impl;
|
||||
}
|
||||
|
||||
INTERNAL cdk::Session& get_cdk_session();
|
||||
|
||||
void close();
|
||||
|
||||
/*
|
||||
Do necessary cleanups before sending new command to the server.
|
||||
*/
|
||||
void prepare_for_cmd();
|
||||
|
||||
public:
|
||||
|
||||
/// @cond IGNORED
|
||||
friend Result_detail::Impl;
|
||||
friend internal::Crud_factory;
|
||||
/// @endcond
|
||||
};
|
||||
|
||||
|
||||
} // internal namespace
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx namespace
|
||||
|
||||
|
||||
#endif
|
||||
276
3rdparty/mysql/mysqlx/devapi/detail/settings.h
vendored
276
3rdparty/mysql/mysqlx/devapi/detail/settings.h
vendored
@@ -1,276 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_DETAIL_SETTINGS_H
|
||||
#define MYSQLX_DETAIL_SETTINGS_H
|
||||
|
||||
#include "../common.h"
|
||||
#include "../document.h"
|
||||
#include <chrono>
|
||||
|
||||
#include <list>
|
||||
#include <chrono>
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
namespace internal {
|
||||
|
||||
/*
|
||||
Note: Options and SSLMode enumerations are given by Traits template parameter
|
||||
to allow defining (and documenting) them in the main settings.h header.
|
||||
*/
|
||||
|
||||
|
||||
template <typename Traits>
|
||||
class Settings_detail
|
||||
: public common::Settings_impl
|
||||
{
|
||||
using Value = mysqlx::Value;
|
||||
using Option = typename Traits::Options;
|
||||
using COption = typename Traits::COptions;
|
||||
using SSLMode = typename Traits::SSLMode;
|
||||
using AuthMethod = typename Traits::AuthMethod;
|
||||
using CompressionMode = typename Traits::CompressionMode;
|
||||
|
||||
public:
|
||||
|
||||
template <bool session_only, typename OPT, typename... Ty>
|
||||
void set(OPT opt, Ty&&... rest)
|
||||
{
|
||||
do_set(get_options<session_only>(opt, std::forward<Ty>(rest)...));
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/*
|
||||
Declare options that require specific type of value (mostly enumerations).
|
||||
For such options we do not accept setting them to arbitrary values. Instead
|
||||
an overload of opt_val() with appropriate type will be used to set value
|
||||
of the option.
|
||||
*/
|
||||
|
||||
#define OPT_VAL_TYPE(X) \
|
||||
X(SSL_MODE,SSLMode) \
|
||||
X(AUTH,AuthMethod)
|
||||
|
||||
#define CHECK_OPT(Opt,Type) \
|
||||
if (opt == Session_option_impl::Opt) \
|
||||
throw Error(#Opt "setting requires value of type " #Type);
|
||||
|
||||
/*
|
||||
Store option value in Value object (with basic run-time type checks)
|
||||
TODO: More precise type checking using per-option types.
|
||||
*/
|
||||
|
||||
static Value opt_val(int opt, Value &&val)
|
||||
{
|
||||
OPT_VAL_TYPE(CHECK_OPT)
|
||||
return std::move(val);
|
||||
}
|
||||
|
||||
/*
|
||||
For types which are not convertible to Value, but can be converted to string
|
||||
go through string conversion.
|
||||
*/
|
||||
|
||||
static Value opt_val(int opt, std::nullptr_t)
|
||||
{
|
||||
return opt_val(opt, Value());
|
||||
}
|
||||
|
||||
template <
|
||||
typename V,
|
||||
typename std::enable_if<std::is_convertible<V, string>::value>::type*
|
||||
= nullptr
|
||||
>
|
||||
static Value opt_val(int opt, V &&val)
|
||||
{
|
||||
return opt_val(opt, Value(string(val)));
|
||||
}
|
||||
|
||||
static Value opt_val(int opt, SSLMode m)
|
||||
{
|
||||
if (opt != Session_option_impl::SSL_MODE)
|
||||
throw Error(
|
||||
"SessionSettings::SSLMode value can only be used on SSL_MODE setting."
|
||||
);
|
||||
return unsigned(m);
|
||||
}
|
||||
|
||||
static Value opt_val(int opt, AuthMethod m)
|
||||
{
|
||||
if (opt != Session_option_impl::AUTH)
|
||||
throw Error(
|
||||
"SessionSettings::AuthMethod value can only be used on AUTH setting."
|
||||
);
|
||||
return unsigned(m);
|
||||
}
|
||||
|
||||
static Value opt_val(int opt, CompressionMode m)
|
||||
{
|
||||
if (opt != Session_option_impl::COMPRESSION)
|
||||
throw Error(
|
||||
"SessionSettings::CompressionMode value can only be used on COMPRESSION setting."
|
||||
);
|
||||
return unsigned(m);
|
||||
}
|
||||
|
||||
// Note: is_range<C> is true for string types, which should not be treated
|
||||
// as arrays of characters, but as single Values.
|
||||
|
||||
template <
|
||||
typename C,
|
||||
typename std::enable_if<is_range<C>::value>::type* = nullptr,
|
||||
typename std::enable_if<!std::is_convertible<C,Value>::value>::type*
|
||||
= nullptr
|
||||
>
|
||||
static Value opt_val(int , const C &container)
|
||||
{
|
||||
return Value(std::begin(container), std::end(container));
|
||||
}
|
||||
|
||||
template<typename _Rep, typename _Period>
|
||||
static Value opt_val(
|
||||
int opt, const std::chrono::duration<_Rep, _Period> &duration
|
||||
)
|
||||
{
|
||||
if (opt != Session_option_impl::CONNECT_TIMEOUT &&
|
||||
opt != Client_option_impl::POOL_QUEUE_TIMEOUT &&
|
||||
opt != Client_option_impl::POOL_MAX_IDLE_TIME)
|
||||
{
|
||||
std::stringstream err_msg;
|
||||
err_msg << "Option " << option_name(opt) << " does not accept time value";
|
||||
throw_error(err_msg.str().c_str());
|
||||
}
|
||||
|
||||
return Value(std::chrono::duration_cast<std::chrono::milliseconds>(duration)
|
||||
.count());
|
||||
}
|
||||
|
||||
// Handle values that are directly convertible to Value.
|
||||
|
||||
template <
|
||||
typename V,
|
||||
typename std::enable_if<std::is_convertible<V,int>::value>::type*
|
||||
= nullptr,
|
||||
typename std::enable_if<std::is_convertible<V,Value>::value>::type*
|
||||
= nullptr
|
||||
>
|
||||
static Value opt_val(int opt, V &&val)
|
||||
{
|
||||
return opt_val(opt, Value(val));
|
||||
}
|
||||
|
||||
using session_opt_val_t = std::pair<int, Value>;
|
||||
using session_opt_list_t = std::list<session_opt_val_t>;
|
||||
|
||||
/*
|
||||
Set list of options with consistency checks.
|
||||
|
||||
This operation is atomic - settings are changed only if all options could
|
||||
be set without error, otherwise settings remain unchanged.
|
||||
*/
|
||||
|
||||
void do_set(session_opt_list_t&&);
|
||||
|
||||
// Note: for ABI compatibility
|
||||
void PUBLIC_API do_set(std::list<std::pair<int, common::Value>>&&);
|
||||
|
||||
/*
|
||||
Templates that collect varargs list of options into opt_list_t list
|
||||
that can be passed to do_set().
|
||||
*/
|
||||
|
||||
template<bool session_only>
|
||||
static session_opt_list_t get_options()
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
/*
|
||||
Note: if we ever support options without values, another overload is
|
||||
needed: get_options(Option opt, Option opt1, R&... rest).
|
||||
*/
|
||||
|
||||
template <
|
||||
bool session_only, typename V, typename... Ty,
|
||||
typename std::enable_if<session_only, int>::type* = nullptr
|
||||
>
|
||||
static session_opt_list_t get_options(Option opt, V&& val, Ty&&... rest)
|
||||
{
|
||||
int oo(static_cast<int>(opt));
|
||||
session_opt_list_t opts = get_options<session_only>(std::forward<Ty>(rest)...);
|
||||
opts.emplace_front(oo,
|
||||
Settings_detail::opt_val(oo, std::forward<V>(val))
|
||||
);
|
||||
return opts;
|
||||
}
|
||||
|
||||
template <
|
||||
bool session_only, typename V, typename... Ty,
|
||||
typename std::enable_if<!session_only, int>::type* = nullptr
|
||||
>
|
||||
static session_opt_list_t get_options(COption opt, V&& val, Ty&&... rest)
|
||||
{
|
||||
int oo(static_cast<int>(opt));
|
||||
session_opt_list_t opts = get_options<session_only>(std::forward<Ty>(rest)...);
|
||||
opts.emplace_front(
|
||||
oo,
|
||||
Settings_detail::opt_val(oo, std::forward<V>(val))
|
||||
);
|
||||
return opts;
|
||||
}
|
||||
|
||||
/*
|
||||
Note: Methods below rely on the fact that DevAPI SessionOption constants
|
||||
have the same numeric values as common::Settings_impl::Option ones.
|
||||
*/
|
||||
|
||||
bool has_option(COption opt) const
|
||||
{
|
||||
return Settings_impl::has_option(opt);
|
||||
}
|
||||
|
||||
Value get(COption opt)
|
||||
{
|
||||
return Settings_impl::get(opt);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // internal namespace
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx namespace
|
||||
|
||||
#endif
|
||||
|
||||
1081
3rdparty/mysql/mysqlx/devapi/document.h
vendored
1081
3rdparty/mysql/mysqlx/devapi/document.h
vendored
File diff suppressed because it is too large
Load Diff
153
3rdparty/mysql/mysqlx/devapi/error.h
vendored
153
3rdparty/mysql/mysqlx/devapi/error.h
vendored
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_ERROR_H
|
||||
#define MYSQLX_ERROR_H
|
||||
|
||||
/**
|
||||
@file
|
||||
Classes used to access query and command execution results.
|
||||
*/
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "detail/error.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
/**
|
||||
An error, warning or other diagnostic information reported by server
|
||||
when executing queries or statements. The information can be printed to
|
||||
output stream using `<<` operator.
|
||||
|
||||
@note Normally, errors reported by server are not represented by `Warning`
|
||||
instances but instead they are thrown as instances of `mysqlx::Error`.
|
||||
|
||||
@ingroup devapi
|
||||
*/
|
||||
|
||||
class Warning
|
||||
: public virtual common::Printable
|
||||
, internal::Warning_detail
|
||||
{
|
||||
public:
|
||||
|
||||
/// Type of diagnostic information.
|
||||
|
||||
enum Level {
|
||||
LEVEL_ERROR, ///< %Error
|
||||
LEVEL_WARNING, ///< %Warning
|
||||
LEVEL_INFO ///< Other information
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Warning(Level level, uint16_t code, const string &msg)
|
||||
: Warning_detail(byte(level), code, msg)
|
||||
{
|
||||
}
|
||||
|
||||
Warning(Warning_detail &&init)
|
||||
: Warning_detail(std::move(init))
|
||||
{}
|
||||
|
||||
void print(std::ostream &out) const
|
||||
{
|
||||
try {
|
||||
Warning_detail::print(out);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Return level of the diagnostic info stored in this object.
|
||||
*/
|
||||
|
||||
Level getLevel() const
|
||||
{
|
||||
return Level(m_level);
|
||||
}
|
||||
|
||||
/**
|
||||
Return error/warning code reported by server.
|
||||
*/
|
||||
|
||||
uint16_t getCode() const
|
||||
{
|
||||
return m_code;
|
||||
}
|
||||
|
||||
/**
|
||||
Return diagnostic message reported by server.
|
||||
*/
|
||||
|
||||
const string& getMessage() const
|
||||
{
|
||||
return m_msg;
|
||||
}
|
||||
|
||||
|
||||
///@cond IGNORE
|
||||
friend internal::Result_detail;
|
||||
///@endcond
|
||||
|
||||
struct Access;
|
||||
friend Access;
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
void internal::Warning_detail::print(std::ostream &out) const
|
||||
{
|
||||
switch (Warning::Level(m_level))
|
||||
{
|
||||
case Warning::LEVEL_ERROR: out << "Error"; break;
|
||||
case Warning::LEVEL_WARNING: out << "Warning"; break;
|
||||
case Warning::LEVEL_INFO: out << "Info"; break;
|
||||
default: out << "<Unknown>"; break;
|
||||
}
|
||||
|
||||
if (m_code)
|
||||
out << " " << m_code;
|
||||
|
||||
out << ": " << m_msg;
|
||||
}
|
||||
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif
|
||||
171
3rdparty/mysql/mysqlx/devapi/executable.h
vendored
171
3rdparty/mysql/mysqlx/devapi/executable.h
vendored
@@ -1,171 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_EXECUTABLE_H
|
||||
#define MYSQLX_EXECUTABLE_H
|
||||
|
||||
/**
|
||||
@file
|
||||
Class representing executable statements.
|
||||
*/
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "result.h"
|
||||
#include "../common/op_if.h"
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
using std::ostream;
|
||||
|
||||
|
||||
/**
|
||||
Represents an operation that can be executed.
|
||||
|
||||
Creating an operation does not involve any communication with the server.
|
||||
Only when `execute()` method is called operation is sent to the server
|
||||
for execution.
|
||||
|
||||
The template parameter `Res` is the type of result that
|
||||
is returned by `execute()` method.
|
||||
|
||||
A derived class must create an implementation object for the operation and
|
||||
set it using reset() method. Such implementation object should implement
|
||||
common::Executable_if interface.
|
||||
*/
|
||||
|
||||
template <class Res, class Op>
|
||||
class Executable
|
||||
{
|
||||
private:
|
||||
using Impl = common::Executable_if;
|
||||
|
||||
std::unique_ptr<Impl> m_impl;
|
||||
protected:
|
||||
|
||||
|
||||
Executable() = default;
|
||||
|
||||
void reset(Impl *impl)
|
||||
{
|
||||
m_impl.reset(impl);
|
||||
}
|
||||
|
||||
/*
|
||||
Copy semantics implementation: the current state of the other executable
|
||||
object (of its implementation, to be precise) is copied to this new
|
||||
instance. After that the two executables are independent objects describing
|
||||
the same operation.
|
||||
*/
|
||||
|
||||
void reset(const Executable &other)
|
||||
{
|
||||
if (m_impl.get() != other.m_impl.get()) m_impl.reset(other.m_impl->clone());
|
||||
}
|
||||
|
||||
void reset(const Executable &&other)
|
||||
{
|
||||
m_impl.reset(other.m_impl->clone());
|
||||
}
|
||||
|
||||
void check_if_valid() const
|
||||
{
|
||||
if (!m_impl)
|
||||
throw Error("Attempt to use invalid operation");
|
||||
}
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
check_if_valid();
|
||||
return m_impl.get();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Executable(const Executable &other)
|
||||
{
|
||||
operator=(other);
|
||||
}
|
||||
|
||||
Executable(Executable &&other)
|
||||
{
|
||||
operator=(std::move(other));
|
||||
}
|
||||
|
||||
virtual ~Executable() {}
|
||||
|
||||
|
||||
Executable& operator=(const Executable &other)
|
||||
{
|
||||
try {
|
||||
reset(other);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
Executable& operator=(Executable &&other)
|
||||
{
|
||||
try {
|
||||
reset(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
/// Execute given operation and return its result.
|
||||
|
||||
virtual Res execute()
|
||||
{
|
||||
try {
|
||||
check_if_valid();
|
||||
/*
|
||||
Note: The implementation object's execute() methods returns a reference
|
||||
to a common::Result_init object which provides information about
|
||||
the session and pending server reply. The returned Res instance should
|
||||
be constructible from such Result_init reference.
|
||||
*/
|
||||
return m_impl->execute();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
struct Access;
|
||||
friend Access;
|
||||
};
|
||||
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif
|
||||
84
3rdparty/mysql/mysqlx/devapi/mysql_charsets.h
vendored
84
3rdparty/mysql/mysqlx/devapi/mysql_charsets.h
vendored
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
Lists of character sets known to CDK string codec (see codec.h).
|
||||
|
||||
Note: Keep this file in sync with <mysql/cdk/charsets.h>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MYSQLX_MYSQL_CHARSETS_H
|
||||
#define MYSQLX_MYSQL_CHARSETS_H
|
||||
|
||||
#define CDK_CS_LIST(X) \
|
||||
X(big5) \
|
||||
X(dec8) \
|
||||
X(cp850) \
|
||||
X(hp8) \
|
||||
X(koi8r) \
|
||||
X(latin1) \
|
||||
X(latin2) \
|
||||
X(swe7) \
|
||||
X(ascii) \
|
||||
X(ujis) \
|
||||
X(sjis) \
|
||||
X(hebrew) \
|
||||
X(tis620) \
|
||||
X(euckr) \
|
||||
X(koi8u) \
|
||||
X(gb2312) \
|
||||
X(greek) \
|
||||
X(cp1250) \
|
||||
X(gbk) \
|
||||
X(latin5) \
|
||||
X(armscii8) \
|
||||
X(utf8mb3) \
|
||||
X(ucs2) \
|
||||
X(cp866) \
|
||||
X(keybcs2) \
|
||||
X(macce) \
|
||||
X(macroman) \
|
||||
X(cp852) \
|
||||
X(latin7) \
|
||||
X(utf8mb4) \
|
||||
X(cp1251) \
|
||||
X(utf16) \
|
||||
X(utf16le) \
|
||||
X(cp1256) \
|
||||
X(cp1257) \
|
||||
X(utf32) \
|
||||
X(binary) \
|
||||
X(geostd8) \
|
||||
X(cp932) \
|
||||
X(eucjpms) \
|
||||
X(gb18030) \
|
||||
|
||||
#endif
|
||||
427
3rdparty/mysql/mysqlx/devapi/mysql_collations.h
vendored
427
3rdparty/mysql/mysqlx/devapi/mysql_collations.h
vendored
@@ -1,427 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
Lists of collations used by MySQL Server and its protocols. These lists
|
||||
define mapping from MySQL collation ID to charset ID.
|
||||
|
||||
Note: Keep this file in sync with <mysql/cdk/protocol/mysqlx/collations.h>
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_MYSQL_COLLATIONS_H
|
||||
#define MYSQLX_MYSQL_COLLATIONS_H
|
||||
|
||||
/*
|
||||
Each line X(CS, ID, COLL, SENSITIVITY) in the expansion of
|
||||
a COLLATION_XXX() macro declares collation with name COLL for character set
|
||||
CS. ID is the MySQL id number for the collation. SENSITIVITY is either 'bin'
|
||||
for binary collations or a combination of sensitivity flags such as 'ai_ci',
|
||||
using the same conventions as the ones used in MySQL collation names.
|
||||
|
||||
Note: CS, COLL and SENSITIVITY are used to reconstruct the full MySQL name of
|
||||
the collation and should follow the same naming conventions (with few
|
||||
exceptions that we handle separately)
|
||||
*/
|
||||
|
||||
|
||||
#define COLLATIONS_big5(X) \
|
||||
X(big5,1,chinese,ci) \
|
||||
X(big5,84,bin,bin) \
|
||||
|
||||
#define COLLATIONS_dec8(X) \
|
||||
X(dec8,3,swedish,ci) \
|
||||
X(dec8,69,bin,bin) \
|
||||
|
||||
#define COLLATIONS_cp850(X) \
|
||||
X(cp850,4,general,ci) \
|
||||
X(cp850,80,bin,bin) \
|
||||
|
||||
#define COLLATIONS_hp8(X) \
|
||||
X(hp8,6,english,ci) \
|
||||
X(hp8,72,bin,bin) \
|
||||
|
||||
#define COLLATIONS_koi8r(X) \
|
||||
X(koi8r,7,general,ci) \
|
||||
X(koi8r,74,bin,bin) \
|
||||
|
||||
#define COLLATIONS_latin1(X) \
|
||||
X(latin1,5,german1,ci) \
|
||||
X(latin1,8,swedish,ci) \
|
||||
X(latin1,15,danish,ci) \
|
||||
X(latin1,31,german2,ci) \
|
||||
X(latin1,47,bin,bin) \
|
||||
X(latin1,48,general,ci) \
|
||||
X(latin1,49,general,cs) \
|
||||
X(latin1,94,spanish,ci) \
|
||||
|
||||
#define COLLATIONS_latin2(X) \
|
||||
X(latin2,2,czech,cs) \
|
||||
X(latin2,9,general,ci) \
|
||||
X(latin2,21,hungarian,ci) \
|
||||
X(latin2,27,croatian,ci) \
|
||||
X(latin2,77,bin,bin) \
|
||||
|
||||
#define COLLATIONS_swe7(X) \
|
||||
X(swe7,10,swedish,ci) \
|
||||
X(swe7,82,bin,bin) \
|
||||
|
||||
#define COLLATIONS_ascii(X) \
|
||||
X(ascii,11,general,ci) \
|
||||
X(ascii,65,bin,bin) \
|
||||
|
||||
#define COLLATIONS_ujis(X) \
|
||||
X(ujis,12,japanese,ci) \
|
||||
X(ujis,91,bin,bin) \
|
||||
|
||||
#define COLLATIONS_sjis(X) \
|
||||
X(sjis,13,japanese,ci) \
|
||||
X(sjis,88,bin,bin) \
|
||||
|
||||
#define COLLATIONS_hebrew(X) \
|
||||
X(hebrew,16,general,ci) \
|
||||
X(hebrew,71,bin,bin) \
|
||||
|
||||
#define COLLATIONS_tis620(X) \
|
||||
X(tis620,18,thai,ci) \
|
||||
X(tis620,89,bin,bin) \
|
||||
|
||||
#define COLLATIONS_euckr(X) \
|
||||
X(euckr,19,korean,ci) \
|
||||
X(euckr,85,bin,bin) \
|
||||
|
||||
#define COLLATIONS_koi8u(X) \
|
||||
X(koi8u,22,general,ci) \
|
||||
X(koi8u,75,bin,bin) \
|
||||
|
||||
#define COLLATIONS_gb2312(X) \
|
||||
X(gb2312,24,chinese,ci) \
|
||||
X(gb2312,86,bin,bin) \
|
||||
|
||||
#define COLLATIONS_greek(X) \
|
||||
X(greek,25,general,ci) \
|
||||
X(greek,70,bin,bin) \
|
||||
|
||||
#define COLLATIONS_cp1250(X) \
|
||||
X(cp1250,26,general,ci) \
|
||||
X(cp1250,34,czech,cs) \
|
||||
X(cp1250,44,croatian,ci) \
|
||||
X(cp1250,66,bin,bin) \
|
||||
X(cp1250,99,polish,ci) \
|
||||
|
||||
#define COLLATIONS_gbk(X) \
|
||||
X(gbk,28,chinese,ci) \
|
||||
X(gbk,87,bin,bin) \
|
||||
|
||||
#define COLLATIONS_latin5(X) \
|
||||
X(latin5,30,turkish,ci) \
|
||||
X(latin5,78,bin,bin) \
|
||||
|
||||
#define COLLATIONS_armscii8(X) \
|
||||
X(armscii8,32,general,ci) \
|
||||
X(armscii8,64,bin,bin) \
|
||||
|
||||
#define COLLATIONS_utf8mb3(X) \
|
||||
X(utf8mb3,33,general,ci) \
|
||||
X(utf8mb3,76,tolower,ci) \
|
||||
X(utf8mb3,83,bin,bin) \
|
||||
X(utf8mb3,192,unicode,ci) \
|
||||
X(utf8mb3,193,icelandic,ci) \
|
||||
X(utf8mb3,194,latvian,ci) \
|
||||
X(utf8mb3,195,romanian,ci) \
|
||||
X(utf8mb3,196,slovenian,ci) \
|
||||
X(utf8mb3,197,polish,ci) \
|
||||
X(utf8mb3,198,estonian,ci) \
|
||||
X(utf8mb3,199,spanish,ci) \
|
||||
X(utf8mb3,200,swedish,ci) \
|
||||
X(utf8mb3,201,turkish,ci) \
|
||||
X(utf8mb3,202,czech,ci) \
|
||||
X(utf8mb3,203,danish,ci) \
|
||||
X(utf8mb3,204,lithuanian,ci) \
|
||||
X(utf8mb3,205,slovak,ci) \
|
||||
X(utf8mb3,206,spanish2,ci) \
|
||||
X(utf8mb3,207,roman,ci) \
|
||||
X(utf8mb3,208,persian,ci) \
|
||||
X(utf8mb3,209,esperanto,ci) \
|
||||
X(utf8mb3,210,hungarian,ci) \
|
||||
X(utf8mb3,211,sinhala,ci) \
|
||||
X(utf8mb3,212,german2,ci) \
|
||||
X(utf8mb3,213,croatian,ci) \
|
||||
X(utf8mb3,214,unicode_520,ci) \
|
||||
X(utf8mb3,215,vietnamese,ci) \
|
||||
X(utf8mb3,223,general_mysql500,ci) \
|
||||
|
||||
#define COLLATIONS_ucs2(X) \
|
||||
X(ucs2,35,general,ci) \
|
||||
X(ucs2,90,bin,bin) \
|
||||
X(ucs2,128,unicode,ci) \
|
||||
X(ucs2,129,icelandic,ci) \
|
||||
X(ucs2,130,latvian,ci) \
|
||||
X(ucs2,131,romanian,ci) \
|
||||
X(ucs2,132,slovenian,ci) \
|
||||
X(ucs2,133,polish,ci) \
|
||||
X(ucs2,134,estonian,ci) \
|
||||
X(ucs2,135,spanish,ci) \
|
||||
X(ucs2,136,swedish,ci) \
|
||||
X(ucs2,137,turkish,ci) \
|
||||
X(ucs2,138,czech,ci) \
|
||||
X(ucs2,139,danish,ci) \
|
||||
X(ucs2,140,lithuanian,ci) \
|
||||
X(ucs2,141,slovak,ci) \
|
||||
X(ucs2,142,spanish2,ci) \
|
||||
X(ucs2,143,roman,ci) \
|
||||
X(ucs2,144,persian,ci) \
|
||||
X(ucs2,145,esperanto,ci) \
|
||||
X(ucs2,146,hungarian,ci) \
|
||||
X(ucs2,147,sinhala,ci) \
|
||||
X(ucs2,148,german2,ci) \
|
||||
X(ucs2,149,croatian,ci) \
|
||||
X(ucs2,150,unicode_520,ci) \
|
||||
X(ucs2,151,vietnamese,ci) \
|
||||
X(ucs2,159,general_mysql500,ci) \
|
||||
|
||||
#define COLLATIONS_cp866(X) \
|
||||
X(cp866,36,general,ci) \
|
||||
X(cp866,68,bin,bin) \
|
||||
|
||||
#define COLLATIONS_keybcs2(X) \
|
||||
X(keybcs2,37,general,ci) \
|
||||
X(keybcs2,73,bin,bin) \
|
||||
|
||||
#define COLLATIONS_macce(X) \
|
||||
X(macce,38,general,ci) \
|
||||
X(macce,43,bin,bin) \
|
||||
|
||||
#define COLLATIONS_macroman(X) \
|
||||
X(macroman,39,general,ci) \
|
||||
X(macroman,53,bin,bin) \
|
||||
|
||||
#define COLLATIONS_cp852(X) \
|
||||
X(cp852,40,general,ci) \
|
||||
X(cp852,81,bin,bin) \
|
||||
|
||||
#define COLLATIONS_latin7(X) \
|
||||
X(latin7,20,estonian,cs) \
|
||||
X(latin7,41,general,ci) \
|
||||
X(latin7,42,general,cs) \
|
||||
X(latin7,79,bin,bin) \
|
||||
|
||||
#define COLLATIONS_utf8mb4(X) \
|
||||
X(utf8mb4,255,uca0900,ai_ci) \
|
||||
X(utf8mb4,278,uca0900,as_cs) \
|
||||
X(utf8mb4,46,bin,bin) \
|
||||
X(utf8mb4,245,croatian,ci) \
|
||||
X(utf8mb4,266,cs_0900,ai_ci) \
|
||||
X(utf8mb4,289,cs_0900,as_cs) \
|
||||
X(utf8mb4,234,czech,ci) \
|
||||
X(utf8mb4,235,danish,ci) \
|
||||
X(utf8mb4,267,da_0900,ai_ci) \
|
||||
X(utf8mb4,290,da_0900,as_cs) \
|
||||
X(utf8mb4,256,de_pb_0900,ai_ci) \
|
||||
X(utf8mb4,279,de_pb_0900,as_cs) \
|
||||
X(utf8mb4,273,eo_0900,ai_ci) \
|
||||
X(utf8mb4,296,eo_0900,as_cs) \
|
||||
X(utf8mb4,241,esperanto,ci) \
|
||||
X(utf8mb4,230,estonian,ci) \
|
||||
X(utf8mb4,263,es_0900,ai_ci) \
|
||||
X(utf8mb4,286,es_0900,as_cs) \
|
||||
X(utf8mb4,270,es_trad_0900,ai_ci) \
|
||||
X(utf8mb4,293,es_trad_0900,as_cs) \
|
||||
X(utf8mb4,262,et_0900,ai_ci) \
|
||||
X(utf8mb4,285,et_0900,as_cs) \
|
||||
X(utf8mb4,45,general,ci) \
|
||||
X(utf8mb4,244,german2,ci) \
|
||||
X(utf8mb4,275,hr_0900,ai_ci) \
|
||||
X(utf8mb4,298,hr_0900,as_cs) \
|
||||
X(utf8mb4,242,hungarian,ci) \
|
||||
X(utf8mb4,274,hu_0900,ai_ci) \
|
||||
X(utf8mb4,297,hu_0900,as_cs) \
|
||||
X(utf8mb4,225,icelandic,ci) \
|
||||
X(utf8mb4,257,is_0900,ai_ci) \
|
||||
X(utf8mb4,280,is_0900,as_cs) \
|
||||
X(utf8mb4,303,ja_0900,as_cs) \
|
||||
X(utf8mb4,226,latvian,ci) \
|
||||
X(utf8mb4,271,la_0900,ai_ci) \
|
||||
X(utf8mb4,294,la_0900,as_cs) \
|
||||
X(utf8mb4,236,lithuanian,ci) \
|
||||
X(utf8mb4,268,lt_0900,ai_ci) \
|
||||
X(utf8mb4,291,lt_0900,as_cs) \
|
||||
X(utf8mb4,258,lv_0900,ai_ci) \
|
||||
X(utf8mb4,281,lv_0900,as_cs) \
|
||||
X(utf8mb4,240,persian,ci) \
|
||||
X(utf8mb4,261,pl_0900,ai_ci) \
|
||||
X(utf8mb4,284,pl_0900,as_cs) \
|
||||
X(utf8mb4,229,polish,ci) \
|
||||
X(utf8mb4,227,romanian,ci) \
|
||||
X(utf8mb4,239,roman,ci) \
|
||||
X(utf8mb4,259,ro_0900,ai_ci) \
|
||||
X(utf8mb4,282,ro_0900,as_cs) \
|
||||
X(utf8mb4,243,sinhala,ci) \
|
||||
X(utf8mb4,269,sk_0900,ai_ci) \
|
||||
X(utf8mb4,292,sk_0900,as_cs) \
|
||||
X(utf8mb4,237,slovak,ci) \
|
||||
X(utf8mb4,228,slovenian,ci) \
|
||||
X(utf8mb4,260,sl_0900,ai_ci) \
|
||||
X(utf8mb4,283,sl_0900,as_cs) \
|
||||
X(utf8mb4,238,spanish2,ci) \
|
||||
X(utf8mb4,231,spanish,ci) \
|
||||
X(utf8mb4,264,sv_0900,ai_ci) \
|
||||
X(utf8mb4,287,sv_0900,as_cs) \
|
||||
X(utf8mb4,232,swedish,ci) \
|
||||
X(utf8mb4,265,tr_0900,ai_ci) \
|
||||
X(utf8mb4,288,tr_0900,as_cs) \
|
||||
X(utf8mb4,233,turkish,ci) \
|
||||
X(utf8mb4,246,unicode_520,ci) \
|
||||
X(utf8mb4,224,unicode,ci) \
|
||||
X(utf8mb4,247,vietnamese,ci) \
|
||||
X(utf8mb4,277,vi_0900,ai_ci) \
|
||||
X(utf8mb4,300,vi_0900,as_cs) \
|
||||
X(utf8mb4,304,ja_0900,as_cs_ks) \
|
||||
X(utf8mb4,305,uca0900,as_ci) \
|
||||
X(utf8mb4,306,ru_0900,ai_ci) \
|
||||
X(utf8mb4,307,ru_0900,as_cs) \
|
||||
X(utf8mb4,308,zh_0900,as_cs) \
|
||||
X(utf8mb4,309,uca0900,bin) \
|
||||
X(utf8mb4,310,nb_0900,ai_ci) \
|
||||
X(utf8mb4,311,nb_0900,as_cs) \
|
||||
X(utf8mb4,312,nn_0900,ai_ci) \
|
||||
X(utf8mb4,313,nn_0900,as_cs) \
|
||||
X(utf8mb4,314,sr_latn_0900,ai_ci) \
|
||||
X(utf8mb4,315,sr_latn_0900,as_cs) \
|
||||
X(utf8mb4,316,bs_0900,ai_ci) \
|
||||
X(utf8mb4,317,bs_0900,as_cs) \
|
||||
X(utf8mb4,318,bg_0900,ai_ci) \
|
||||
X(utf8mb4,319,bg_0900,as_cs) \
|
||||
X(utf8mb4,320,gl_0900,ai_ci) \
|
||||
X(utf8mb4,321,gl_0900,as_cs) \
|
||||
X(utf8mb4,322,mn_cyrl_0900,ai_ci) \
|
||||
X(utf8mb4,323,mn_cyrl_0900,as_cs) \
|
||||
COLLATIONS_utf8mb4_EXTRA
|
||||
|
||||
#define COLLATIONS_utf8mb4_EXTRA
|
||||
|
||||
|
||||
#define COLLATIONS_cp1251(X) \
|
||||
X(cp1251,14,bulgarian,ci) \
|
||||
X(cp1251,23,ukrainian,ci) \
|
||||
X(cp1251,50,bin,bin) \
|
||||
X(cp1251,51,general,ci) \
|
||||
X(cp1251,52,general,cs) \
|
||||
|
||||
#define COLLATIONS_utf16(X) \
|
||||
X(utf16,54,general,ci) \
|
||||
X(utf16,55,bin,bin) \
|
||||
X(utf16,101,unicode,ci) \
|
||||
X(utf16,102,icelandic,ci) \
|
||||
X(utf16,103,latvian,ci) \
|
||||
X(utf16,104,romanian,ci) \
|
||||
X(utf16,105,slovenian,ci) \
|
||||
X(utf16,106,polish,ci) \
|
||||
X(utf16,107,estonian,ci) \
|
||||
X(utf16,108,spanish,ci) \
|
||||
X(utf16,109,swedish,ci) \
|
||||
X(utf16,110,turkish,ci) \
|
||||
X(utf16,111,czech,ci) \
|
||||
X(utf16,112,danish,ci) \
|
||||
X(utf16,113,lithuanian,ci) \
|
||||
X(utf16,114,slovak,ci) \
|
||||
X(utf16,115,spanish2,ci) \
|
||||
X(utf16,116,roman,ci) \
|
||||
X(utf16,117,persian,ci) \
|
||||
X(utf16,118,esperanto,ci) \
|
||||
X(utf16,119,hungarian,ci) \
|
||||
X(utf16,120,sinhala,ci) \
|
||||
X(utf16,121,german2,ci) \
|
||||
X(utf16,122,croatian,ci) \
|
||||
X(utf16,123,unicode_520,ci) \
|
||||
X(utf16,124,vietnamese,ci) \
|
||||
|
||||
#define COLLATIONS_utf16le(X) \
|
||||
X(utf16le,56,general,ci) \
|
||||
X(utf16le,62,bin,bin) \
|
||||
|
||||
#define COLLATIONS_cp1256(X) \
|
||||
X(cp1256,57,general,ci) \
|
||||
X(cp1256,67,bin,bin) \
|
||||
|
||||
#define COLLATIONS_cp1257(X) \
|
||||
X(cp1257,29,lithuanian,ci) \
|
||||
X(cp1257,58,bin,bin) \
|
||||
X(cp1257,59,general,ci) \
|
||||
|
||||
#define COLLATIONS_utf32(X) \
|
||||
X(utf32,60,general,ci) \
|
||||
X(utf32,61,bin,bin) \
|
||||
X(utf32,160,unicode,ci) \
|
||||
X(utf32,161,icelandic,ci) \
|
||||
X(utf32,162,latvian,ci) \
|
||||
X(utf32,163,romanian,ci) \
|
||||
X(utf32,164,slovenian,ci) \
|
||||
X(utf32,165,polish,ci) \
|
||||
X(utf32,166,estonian,ci) \
|
||||
X(utf32,167,spanish,ci) \
|
||||
X(utf32,168,swedish,ci) \
|
||||
X(utf32,169,turkish,ci) \
|
||||
X(utf32,170,czech,ci) \
|
||||
X(utf32,171,danish,ci) \
|
||||
X(utf32,172,lithuanian,ci) \
|
||||
X(utf32,173,slovak,ci) \
|
||||
X(utf32,174,spanish2,ci) \
|
||||
X(utf32,175,roman,ci) \
|
||||
X(utf32,176,persian,ci) \
|
||||
X(utf32,177,esperanto,ci) \
|
||||
X(utf32,178,hungarian,ci) \
|
||||
X(utf32,179,sinhala,ci) \
|
||||
X(utf32,180,german2,ci) \
|
||||
X(utf32,181,croatian,ci) \
|
||||
X(utf32,182,unicode_520,ci) \
|
||||
X(utf32,183,vietnamese,ci) \
|
||||
|
||||
#define COLLATIONS_binary(X) \
|
||||
X(binary,63,bin,bin) \
|
||||
|
||||
#define COLLATIONS_geostd8(X) \
|
||||
X(geostd8,92,general,ci) \
|
||||
X(geostd8,93,bin,bin) \
|
||||
|
||||
#define COLLATIONS_cp932(X) \
|
||||
X(cp932,95,japanese,ci) \
|
||||
X(cp932,96,bin,bin) \
|
||||
|
||||
#define COLLATIONS_eucjpms(X) \
|
||||
X(eucjpms,97,japanese,ci) \
|
||||
X(eucjpms,98,bin,bin) \
|
||||
|
||||
#define COLLATIONS_gb18030(X) \
|
||||
X(gb18030,248,chinese,ci) \
|
||||
X(gb18030,249,bin,bin) \
|
||||
X(gb18030,250,unicode_520,ci) \
|
||||
|
||||
|
||||
#endif
|
||||
908
3rdparty/mysql/mysqlx/devapi/result.h
vendored
908
3rdparty/mysql/mysqlx/devapi/result.h
vendored
@@ -1,908 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_RESULT_H
|
||||
#define MYSQLX_RESULT_H
|
||||
|
||||
/**
|
||||
@file
|
||||
Classes used to access query and command execution results.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "document.h"
|
||||
#include "row.h"
|
||||
#include "collations.h"
|
||||
#include "detail/result.h"
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
using std::ostream;
|
||||
|
||||
class Session;
|
||||
class Schema;
|
||||
class Collection;
|
||||
class Result;
|
||||
class Row;
|
||||
class RowResult;
|
||||
class SqlResult;
|
||||
class DbDoc;
|
||||
class DocResult;
|
||||
|
||||
template <class Res, class Op> class Executable;
|
||||
|
||||
|
||||
namespace internal {
|
||||
|
||||
/*
|
||||
A wrapper which adds methods common for all result classes.
|
||||
*/
|
||||
|
||||
template <class Base>
|
||||
class Result_common
|
||||
: protected Base
|
||||
{
|
||||
using WarningList = internal::Result_detail::WarningList;
|
||||
|
||||
public:
|
||||
|
||||
/// Get the number of warnings stored in the result.
|
||||
|
||||
unsigned getWarningsCount() const
|
||||
{
|
||||
try {
|
||||
return Base::get_warning_count();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/// Get a list of warnings stored in the result.
|
||||
|
||||
WarningList getWarnings()
|
||||
{
|
||||
try {
|
||||
return Base::get_warnings();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/// Get the warning at the given, 0-based position.
|
||||
// TODO: Change arg type to size_t?
|
||||
|
||||
Warning getWarning(unsigned pos)
|
||||
{
|
||||
try {
|
||||
return Base::get_warning(pos);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
// TODO: expose this in the API?
|
||||
//using WarningsIterator = Result_detail::iterator;
|
||||
|
||||
/**
|
||||
Get the count of affected items (rows or doucuments) from manipulation statements.
|
||||
*/
|
||||
|
||||
uint64_t getAffectedItemsCount() const
|
||||
{
|
||||
try {
|
||||
return Result_detail::get_affected_rows();
|
||||
} CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// Wrap base ctors/assginment with catch handlers
|
||||
|
||||
Result_common()
|
||||
try
|
||||
: Base()
|
||||
{}
|
||||
CATCH_AND_WRAP
|
||||
|
||||
Result_common(Result_common &&other)
|
||||
try
|
||||
: Base(std::move(other))
|
||||
{}
|
||||
CATCH_AND_WRAP
|
||||
|
||||
Result_common& operator=(Result_common &&other)
|
||||
try
|
||||
{
|
||||
Base::operator=(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
|
||||
Result_common(common::Result_init &init)
|
||||
try
|
||||
: Base(init)
|
||||
{}
|
||||
CATCH_AND_WRAP
|
||||
|
||||
};
|
||||
|
||||
} // internal namespace
|
||||
|
||||
|
||||
/**
|
||||
Represents a result of an operation that does not return data.
|
||||
|
||||
A generic result which can be returned by operations which only
|
||||
modify data.
|
||||
|
||||
A `Result` instance can store the result of executing an operation:
|
||||
|
||||
~~~~~~
|
||||
Result res = operation.execute();
|
||||
~~~~~~
|
||||
|
||||
Storing another result in a `Result` instance overwrites
|
||||
the previous result.
|
||||
|
||||
@note A `Result` object should be used by at most one thread at a time. It is
|
||||
not safe to call its methods by several threads simultaneously. It is
|
||||
responsibility of the user to ensure this using a synchronization mechanism
|
||||
such as mutexes.
|
||||
|
||||
|
||||
@ingroup devapi_res
|
||||
*/
|
||||
|
||||
class Result
|
||||
: public internal::Result_common<internal::Result_detail>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
Result() = default;
|
||||
|
||||
/**
|
||||
Get the auto-increment value if one was generated by a table insert
|
||||
statement.
|
||||
*/
|
||||
|
||||
uint64_t getAutoIncrementValue() const
|
||||
{
|
||||
try {
|
||||
return Result_detail::get_auto_increment();
|
||||
} CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Return a list of identifiers of multiple documents added to a collection,
|
||||
generated by the server.
|
||||
*/
|
||||
|
||||
DocIdList getGeneratedIds() const
|
||||
{
|
||||
try {
|
||||
return Result_detail::get_generated_ids();
|
||||
} CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Result(common::Result_init &init)
|
||||
: Result_common(init)
|
||||
{}
|
||||
|
||||
template <class Res, class Op>
|
||||
friend class Executable;
|
||||
friend Collection;
|
||||
};
|
||||
|
||||
|
||||
// Row based results
|
||||
// -----------------
|
||||
|
||||
/**
|
||||
Types that can be reported in result meta-data.
|
||||
|
||||
These correspond to MySQL server datatypes described [here]
|
||||
(https://dev.mysql.com/doc/refman/8.0/en/data-types.html).
|
||||
|
||||
@ingroup devapi_res
|
||||
*/
|
||||
|
||||
enum class Type : unsigned short
|
||||
{
|
||||
#undef TYPE_ENUM
|
||||
#define TYPE_ENUM(X,N) X=N,
|
||||
|
||||
RESULT_TYPE_LIST(TYPE_ENUM)
|
||||
};
|
||||
|
||||
/*
|
||||
Note: Normally we would put these docs in the RESULT_TYPE_LIST macro
|
||||
but it would pollute documentation of methods like typeName() below
|
||||
that also use this macro.
|
||||
*/
|
||||
|
||||
/// @var Type::BIT
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/bit-type.html>
|
||||
/// @var Type::TINYINT
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/integer-types.html>
|
||||
/// @var Type::SMALLINT
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/integer-types.html>
|
||||
/// @var Type::MEDIUMINT
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/integer-types.html>
|
||||
/// @var Type::INT
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/integer-types.html>
|
||||
/// @var Type::BIGINT
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/integer-types.html>
|
||||
/// @var Type::FLOAT
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html>
|
||||
/// @var Type::DECIMAL
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/fixed-point-types.html>
|
||||
/// @var Type::DOUBLE
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html>
|
||||
/// @var Type::JSON
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/json.html>
|
||||
/// @var Type::STRING
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/string-types.html>
|
||||
/// @var Type::BYTES
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/string-types.html>
|
||||
/// @var Type::TIME
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/date-and-time-types.html>
|
||||
/// @var Type::DATE
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/date-and-time-types.html>
|
||||
/// @var Type::DATETIME
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/date-and-time-types.html>
|
||||
/// @var Type::TIMESTAMP
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/date-and-time-types.html>
|
||||
/// @var Type::SET
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/set.html>
|
||||
/// @var Type::ENUM
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/enum.html>
|
||||
/// @var Type::GEOMETRY
|
||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/spatial-types.html>
|
||||
|
||||
|
||||
/**
|
||||
Return name of a given type.
|
||||
|
||||
@ingroup devapi_res
|
||||
*/
|
||||
|
||||
inline
|
||||
const char* typeName(Type t)
|
||||
{
|
||||
#define TYPE_NAME(T,X) case Type::T: return #T;
|
||||
|
||||
switch (t)
|
||||
{
|
||||
RESULT_TYPE_LIST(TYPE_NAME)
|
||||
default:
|
||||
THROW("Unknown type");
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
std::ostream& operator<<(std::ostream &out, Type t)
|
||||
{
|
||||
return out << typeName(t);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Provides meta-data for a single result column.
|
||||
|
||||
@ingroup devapi_res
|
||||
*/
|
||||
|
||||
class Column
|
||||
: public virtual common::Printable
|
||||
, private internal::Column_detail
|
||||
{
|
||||
public:
|
||||
|
||||
string getSchemaName() const ///< TODO
|
||||
{
|
||||
try {
|
||||
return Column_detail::get_schema_name();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
string getTableName() const ///< TODO
|
||||
{
|
||||
try {
|
||||
return Column_detail::get_table_name();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
string getTableLabel() const ///< TODO
|
||||
{
|
||||
try {
|
||||
return Column_detail::get_table_label();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
string getColumnName() const ///< TODO
|
||||
{
|
||||
try {
|
||||
return Column_detail::get_name();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
string getColumnLabel() const ///< TODO
|
||||
{
|
||||
try {
|
||||
return Column_detail::get_label();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
Type getType() const ///< TODO
|
||||
{
|
||||
try {
|
||||
return Type(Column_detail::get_type());
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Get column length
|
||||
|
||||
@return The maximum length of data in the column in bytes, as reported
|
||||
by the server.
|
||||
|
||||
@note Because the column length is returned as byte length, it could be
|
||||
confusing with the multi-byte character sets. For instance, with UTF8MB4
|
||||
the length of VARCHAR(100) column is reported as 400 because each character
|
||||
is 4 bytes long.
|
||||
*/
|
||||
|
||||
unsigned long getLength() const
|
||||
{
|
||||
try {
|
||||
return Column_detail::get_length();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
unsigned short getFractionalDigits() const ///< TODO
|
||||
{
|
||||
try {
|
||||
return Column_detail::get_decimals();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
bool isNumberSigned() const ///< TODO
|
||||
{
|
||||
try {
|
||||
return Column_detail::is_signed();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
CharacterSet getCharacterSet() const ///< TODO
|
||||
{
|
||||
try {
|
||||
return Column_detail::get_charset();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/// TODO
|
||||
std::string getCharacterSetName() const
|
||||
{
|
||||
try {
|
||||
return characterSetName(getCharacterSet());
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
const CollationInfo& getCollation() const ///< TODO
|
||||
{
|
||||
try {
|
||||
return Column_detail::get_collation();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/// TODO
|
||||
std::string getCollationName() const
|
||||
{
|
||||
try {
|
||||
return getCollation().getName();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/// TODO
|
||||
bool isPadded() const
|
||||
{
|
||||
try {
|
||||
return Column_detail::is_padded();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
using Column_detail::Impl;
|
||||
|
||||
Column(const Impl *impl)
|
||||
try
|
||||
: Column_detail(impl)
|
||||
{}
|
||||
CATCH_AND_WRAP
|
||||
|
||||
Column() = default;
|
||||
Column(const Column&) = default;
|
||||
Column(Column&&) = default;
|
||||
|
||||
Column& operator=(const Column&) = default;
|
||||
|
||||
void print(std::ostream &out) const
|
||||
{
|
||||
// TODO: not sure if this code will be called by operator<<.
|
||||
try {
|
||||
Column_detail::print(out);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
friend RowResult;
|
||||
struct INTERNAL Access;
|
||||
friend Access;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Extern declarations for Columns_detail<Column> template specialization
|
||||
elements that are defined in result.cc.
|
||||
|
||||
Note: "extern template" works with MSVC but not with GCC.
|
||||
*/
|
||||
|
||||
namespace internal {
|
||||
|
||||
template<> PUBLIC_API
|
||||
void Columns_detail<Column>::init(const Result_detail::Impl&);
|
||||
|
||||
} // internal
|
||||
|
||||
|
||||
extern template PUBLIC_API
|
||||
void internal::Columns_detail<Column>::init(
|
||||
const internal::Result_detail::Impl &impl
|
||||
);
|
||||
|
||||
|
||||
class Columns
|
||||
: private internal::Columns_detail<Column>
|
||||
{
|
||||
public:
|
||||
|
||||
using Columns_detail::operator[];
|
||||
|
||||
using Columns_detail::iterator;
|
||||
|
||||
using Columns_detail::begin;
|
||||
using Columns_detail::end;
|
||||
|
||||
private:
|
||||
|
||||
using Columns_detail::init;
|
||||
|
||||
// note: Required by Row_result_detail
|
||||
|
||||
Columns() = default;
|
||||
Columns(Columns&&) = default;
|
||||
Columns& operator=(Columns&&) = default;
|
||||
|
||||
///@cond IGNORE
|
||||
friend internal::Row_result_detail<Columns>;
|
||||
///@endcond
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Extern declarations for Row_result_detail<Columns> template specialization
|
||||
elements that are defined in result.cc.
|
||||
*/
|
||||
|
||||
namespace internal {
|
||||
|
||||
template<> PUBLIC_API
|
||||
bool Row_result_detail<Columns>::iterator_next();
|
||||
|
||||
template<> PUBLIC_API
|
||||
col_count_t Row_result_detail<Columns>::col_count() const;
|
||||
|
||||
template<> PUBLIC_API
|
||||
Row_result_detail<Columns>::Row_result_detail(
|
||||
common::Result_init &init
|
||||
);
|
||||
|
||||
template<> PUBLIC_API
|
||||
auto Row_result_detail<Columns>::get_column(col_count_t pos) const
|
||||
-> const Column&;
|
||||
|
||||
template<> PUBLIC_API
|
||||
auto internal::Row_result_detail<Columns>::get_columns() const
|
||||
-> const Columns&;
|
||||
|
||||
template<> PUBLIC_API
|
||||
row_count_t internal::Row_result_detail<Columns>::row_count();
|
||||
|
||||
} // internal
|
||||
|
||||
|
||||
/**
|
||||
%Result of an operation that returns rows.
|
||||
|
||||
A `RowResult` object gives sequential access to the rows contained in
|
||||
the result. It is possible to get the rows one-by-one, or fetch and store
|
||||
all of them at once. One can iterate over the rows using range loop:
|
||||
`for (Row r : result) ...`.
|
||||
|
||||
@ingroup devapi_res
|
||||
*/
|
||||
|
||||
class RowResult
|
||||
: public internal::Result_common<internal::Row_result_detail<Columns>>
|
||||
{
|
||||
public:
|
||||
|
||||
using Columns = mysqlx::Columns;
|
||||
|
||||
RowResult() = default;
|
||||
|
||||
|
||||
/// Return the number of fields in each row.
|
||||
|
||||
col_count_t getColumnCount() const
|
||||
{
|
||||
try {
|
||||
return Row_result_detail::col_count();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/// Return `Column` object describing the given column of the result.
|
||||
|
||||
const Column& getColumn(col_count_t pos) const
|
||||
{
|
||||
try {
|
||||
return Row_result_detail::get_column(pos);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Return meta-data for all result columns.
|
||||
|
||||
TODO: explain ownership
|
||||
*/
|
||||
|
||||
const Columns& getColumns() const
|
||||
{
|
||||
try {
|
||||
return Row_result_detail::get_columns();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Return the current row and move to the next one in the sequence.
|
||||
|
||||
If there are no more rows in this result, returns a null `Row` instance.
|
||||
*/
|
||||
|
||||
Row fetchOne()
|
||||
{
|
||||
try {
|
||||
return Row_result_detail::get_row();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Return all remaining rows
|
||||
|
||||
%Result of this method can be stored in a container such as
|
||||
`std::list<Row>`. Rows that have already been fetched using `fetchOne()` are
|
||||
not included in the result of `fetchAll()`.
|
||||
*/
|
||||
|
||||
RowList fetchAll()
|
||||
{
|
||||
try {
|
||||
return Row_result_detail::get_rows();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the number of rows contained in the result.
|
||||
|
||||
The method counts only the rows that were not yet fetched and are still
|
||||
available in the result.
|
||||
*/
|
||||
|
||||
row_count_t count()
|
||||
{
|
||||
try {
|
||||
return Row_result_detail::row_count();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/*
|
||||
Iterate over rows (range-for support).
|
||||
|
||||
Rows that have been fetched using iterator are not available when
|
||||
calling fetchOne() or fetchAll()
|
||||
*/
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
try {
|
||||
return Row_result_detail::begin();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
iterator end() const
|
||||
{
|
||||
try {
|
||||
return Row_result_detail::end();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
RowResult(common::Result_init &init)
|
||||
: Result_common(init)
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
template <class Res, class Op> friend class Executable;
|
||||
friend SqlResult;
|
||||
friend DocResult;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
%Result of an SQL query or command.
|
||||
|
||||
In general, an SQL query or command can return multiple results (for example,
|
||||
a call to a stored procedure). Additionally, each or only some of these
|
||||
results can contain row data. A `SqlResult` object gives a sequential access
|
||||
to all results of a multi-result. Method `nextResult()` moves to the next
|
||||
result in the sequence, if present. Methods of `RowResult` are used to access
|
||||
row data of the current result (if it contains data).
|
||||
|
||||
@note A `SqlResult` object should be used by at most one thread at a time.
|
||||
It is not safe to call its methods by several threads simultaneously. It is
|
||||
responsibility of the user to ensure this using a synchronization mechanism
|
||||
such as mutexes.
|
||||
|
||||
@ingroup devapi_res
|
||||
*/
|
||||
|
||||
class SqlResult
|
||||
: public RowResult
|
||||
{
|
||||
public:
|
||||
|
||||
SqlResult() = default;
|
||||
|
||||
/**
|
||||
Tell if the current result contains row data.
|
||||
|
||||
If this is the case, rows can be accessed using `RowResult` interface.
|
||||
Otherwise calling `RowResult` methods throws an error.
|
||||
*/
|
||||
|
||||
bool hasData() const
|
||||
{
|
||||
try {
|
||||
return Result_detail::has_data();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Move to the next result, if there is one.
|
||||
|
||||
Returns true if the next result is available, false if there are no more
|
||||
results in the reply. Calling `nextResult()` discards the current result.
|
||||
If it has any rows that has not yet been fetched, these rows are also
|
||||
discarded.
|
||||
*/
|
||||
|
||||
bool nextResult()
|
||||
{
|
||||
try {
|
||||
return Row_result_detail::next_result();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get the auto-increment value if one was generated by a table insert
|
||||
statement.
|
||||
*/
|
||||
|
||||
uint64_t getAutoIncrementValue()
|
||||
{
|
||||
try {
|
||||
return Result_detail::get_auto_increment();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
SqlResult(common::Result_init &init)
|
||||
: RowResult(init)
|
||||
{}
|
||||
|
||||
template <class Res, class Op>
|
||||
friend class Executable;
|
||||
};
|
||||
|
||||
|
||||
// Document based results
|
||||
// ----------------------
|
||||
|
||||
|
||||
/**
|
||||
%Result of an operation that returns documents.
|
||||
|
||||
A `DocResult` object gives sequential access to the documents contained in
|
||||
the result. It is possible to get the documents one-by-one, or fetch and store
|
||||
all of them at once. One can iterate over the documents using range loop:
|
||||
`for (DbDoc d : result) ...`.
|
||||
|
||||
@note A `DocResult` object should be used by at most one thread at a time.
|
||||
It is not safe to call its methods by several threads simultaneously. It is
|
||||
responsibility of the user to ensure this using a synchronization mechanism
|
||||
such as mutexes.
|
||||
|
||||
@ingroup devapi_res
|
||||
*/
|
||||
|
||||
class DocResult
|
||||
: public internal::Result_common<internal::Doc_result_detail>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
DocResult() = default;
|
||||
|
||||
/**
|
||||
Return the current document and move to the next one in the sequence.
|
||||
|
||||
If there are no more documents in this result, returns a null document.
|
||||
*/
|
||||
|
||||
DbDoc fetchOne()
|
||||
{
|
||||
try {
|
||||
return Doc_result_detail::get_doc();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Return all remaining documents.
|
||||
|
||||
%Result of this method can be stored in a container such as
|
||||
`std::list<DbDoc>`. Documents that have already been fetched using
|
||||
`fetchOne()` are not included in the result of `fetchAll()`.
|
||||
*/
|
||||
|
||||
DocList fetchAll()
|
||||
{
|
||||
try {
|
||||
return Doc_result_detail::get_docs();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the number of documents contained in the result.
|
||||
|
||||
The method counts only the documents that were not yet fetched and are still
|
||||
available in the result.
|
||||
*/
|
||||
|
||||
uint64_t count()
|
||||
{
|
||||
try {
|
||||
return Doc_result_detail::count();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/*
|
||||
Iterate over documents (range-for support).
|
||||
|
||||
Documents that have been fetched using iterator are not available when
|
||||
calling fetchOne() or fetchAll()
|
||||
*/
|
||||
|
||||
using iterator = Doc_result_detail::iterator;
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
try {
|
||||
return Doc_result_detail::begin();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
iterator end() const
|
||||
{
|
||||
try {
|
||||
return Doc_result_detail::end();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
DocResult(common::Result_init &init)
|
||||
: Result_common(init)
|
||||
{}
|
||||
|
||||
friend DbDoc;
|
||||
template <class Res, class Op>
|
||||
friend class Executable;
|
||||
};
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif
|
||||
244
3rdparty/mysql/mysqlx/devapi/row.h
vendored
244
3rdparty/mysql/mysqlx/devapi/row.h
vendored
@@ -1,244 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_ROW_H
|
||||
#define MYSQLX_ROW_H
|
||||
|
||||
/**
|
||||
@file
|
||||
TODO
|
||||
*/
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "document.h"
|
||||
#include "detail/row.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
|
||||
/**
|
||||
Represents a single row from a result that contains rows.
|
||||
|
||||
Such a row consists of a number of fields, each storing single
|
||||
value. The number of fields and types of values stored in each
|
||||
field are described by `RowResult` instance that produced this
|
||||
row.
|
||||
|
||||
Values of fields can be accessed with `get()` method or using
|
||||
`row[pos]` expression. Fields are identified by 0-based position.
|
||||
It is also possible to get raw bytes representing value of a
|
||||
given field with `getBytes()` method.
|
||||
|
||||
@sa `Value` class.
|
||||
@todo Support for iterating over row fields with range-for loop.
|
||||
|
||||
@ingroup devapi_res
|
||||
*/
|
||||
|
||||
class Row
|
||||
: private internal::Row_detail
|
||||
{
|
||||
|
||||
Row(internal::Row_detail &&other)
|
||||
try
|
||||
: Row_detail(std::move(other))
|
||||
{}
|
||||
CATCH_AND_WRAP
|
||||
|
||||
|
||||
public:
|
||||
|
||||
Row() {}
|
||||
|
||||
template<typename T, typename... Types>
|
||||
explicit Row(T val, Types... vals)
|
||||
{
|
||||
try {
|
||||
Row_detail::set_values(0, val, vals...);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
col_count_t colCount() const
|
||||
{
|
||||
try {
|
||||
return Row_detail::col_count();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get raw bytes representing value of row field at position `pos`.
|
||||
|
||||
The raw bytes are as received from the server. In genral the value
|
||||
is represented using x-protocol encoding that corresponds to the
|
||||
type and other meta-data of the given column. This meta-data can
|
||||
be accessed via `Column` object returned by `RowResult#getColumn()`
|
||||
method.
|
||||
|
||||
The x-protocol represenation of different value types is documented
|
||||
[here]
|
||||
(https://dev.mysql.com/doc/dev/mysql-server/latest/structMysqlx_1_1Resultset_1_1ColumnMetaData.html).
|
||||
Most types reported by `Column#getType()` method correspond to an x-protocol
|
||||
value type of the same name.
|
||||
|
||||
All integer types use the x-protocol UINT or SINT encoding, which is
|
||||
the protobuf variant encoding together with zig-zag encoding for the
|
||||
signed case
|
||||
(see <https://developers.google.com/protocol-buffers/docs/encoding>)
|
||||
|
||||
STRING values are encoded using the character set encoding as reported
|
||||
by `Column#getCharacterSet()` method of the corresponding `Column` object
|
||||
(usually `utf8mb4`).
|
||||
|
||||
JSON data is represented as a JSON string. ENUM values are represented
|
||||
as strings with enum constant names. Values of type DATE and TIMESTAMP
|
||||
use the same representation as DATETIME, with time part empty in case
|
||||
of DATE values. GEOMETRY values use the internal geometry storage
|
||||
format described
|
||||
[here]
|
||||
(https://dev.mysql.com/doc/refman/8.0/en/gis-data-formats.html).
|
||||
|
||||
Note that raw representation of BYTES and STRING values has an extra
|
||||
0x00 byte added at the end, which is not part of the originial data.
|
||||
It is used to distinguish null values from empty byte sequences.
|
||||
|
||||
@returns null bytes range if given field is NULL.
|
||||
@throws out_of_range if given row was not fetched from server.
|
||||
*/
|
||||
|
||||
bytes getBytes(col_count_t pos) const
|
||||
{
|
||||
try {
|
||||
return Row_detail::get_bytes(pos);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get reference to row field at position `pos`.
|
||||
|
||||
@throws out_of_range if given field does not exist in the row.
|
||||
*/
|
||||
|
||||
Value& get(col_count_t pos)
|
||||
{
|
||||
try {
|
||||
return Row_detail::get_val(pos);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set value of row field at position `pos`.
|
||||
|
||||
Creates new field if it does not exist.
|
||||
|
||||
@returns Reference to the field that was set.
|
||||
*/
|
||||
|
||||
Value& set(col_count_t pos, const Value &val)
|
||||
{
|
||||
try {
|
||||
Row_detail::set_values(pos, val);
|
||||
return Row_detail::get_val(pos);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Get const reference to row field at position `pos`.
|
||||
|
||||
This is const version of method `get()`.
|
||||
|
||||
@throws out_of_range if given field does not exist in the row.
|
||||
*/
|
||||
|
||||
const Value& operator[](col_count_t pos) const
|
||||
{
|
||||
return const_cast<Row*>(this)->get(pos);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get modifiable reference to row field at position `pos`.
|
||||
|
||||
The field is created if it does not exist. In this case
|
||||
the initial value of the field is NULL.
|
||||
*/
|
||||
|
||||
Value& operator[](col_count_t pos)
|
||||
{
|
||||
ensure_impl();
|
||||
try {
|
||||
return get(pos);
|
||||
}
|
||||
catch (const out_of_range&)
|
||||
{
|
||||
return set(pos, Value());
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if this row contains fields or is null.
|
||||
bool isNull() const { return NULL == m_impl; }
|
||||
operator bool() const { return !isNull(); }
|
||||
|
||||
void clear()
|
||||
{
|
||||
try {
|
||||
Row_detail::clear();
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
using internal::Row_detail::m_impl;
|
||||
|
||||
/// @cond IGNORED
|
||||
friend internal::Row_result_detail<Columns>;
|
||||
friend internal::Table_insert_detail;
|
||||
/// @endcond
|
||||
};
|
||||
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif
|
||||
1101
3rdparty/mysql/mysqlx/devapi/settings.h
vendored
1101
3rdparty/mysql/mysqlx/devapi/settings.h
vendored
File diff suppressed because it is too large
Load Diff
516
3rdparty/mysql/mysqlx/devapi/table_crud.h
vendored
516
3rdparty/mysql/mysqlx/devapi/table_crud.h
vendored
@@ -1,516 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_TABLE_CRUD_H
|
||||
#define MYSQLX_TABLE_CRUD_H
|
||||
|
||||
/**
|
||||
@file
|
||||
Crud operations on tables.
|
||||
|
||||
Classes declared here represent CRUD operations on a table. They are
|
||||
analogous to collection CRUD operation classes defined in collection_crud.h.
|
||||
|
||||
The following classes for table CRUD operations are defined:
|
||||
- TableInsert
|
||||
- TableRemove
|
||||
- TableSelect
|
||||
- TableUpdate
|
||||
|
||||
CRUD operation objects can be created directly, or assigned from
|
||||
result of DevAPI methods that create such operations:
|
||||
~~~~~~
|
||||
TableInsert insert_op(table);
|
||||
TableSelect select_op = table.select(...).orderBy(...);
|
||||
~~~~~~
|
||||
|
||||
CRUD operation objects have methods which can modify the operation
|
||||
before it gets executed. For example `TableInsert::values()`
|
||||
appends a row to the list of rows that should be inserted into a table
|
||||
by the given TableInsert operation. These methods can be chained
|
||||
as allowed by the fluent API grammar.
|
||||
*/
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "result.h"
|
||||
#include "executable.h"
|
||||
#include "crud.h"
|
||||
|
||||
|
||||
namespace mysqlx {
|
||||
MYSQLX_ABI_BEGIN(2,0)
|
||||
|
||||
class Table;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class TableInsert;
|
||||
|
||||
namespace internal {
|
||||
|
||||
struct Table_insert_base
|
||||
: public Executable<Result, TableInsert>
|
||||
{};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
An operation which inserts rows into a table.
|
||||
|
||||
This class defines methods that specify the rows to be inserted into
|
||||
the table.
|
||||
|
||||
@todo Check that every row passed to .values() call has
|
||||
the same number of values. The column count should match
|
||||
the one in insert(c1,...) call. For insert() without column
|
||||
list, it should match the number of columns in the table.
|
||||
|
||||
@ingroup devapi_op
|
||||
*/
|
||||
|
||||
class TableInsert
|
||||
: public internal::Table_insert_base
|
||||
, internal::Table_insert_detail
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
template <class... Cols>
|
||||
TableInsert(Table &table, const Cols&... cols)
|
||||
: TableInsert(table)
|
||||
{
|
||||
add_columns(get_impl(), cols...);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Create operation which inserts rows into given table.
|
||||
|
||||
TableInsert(Table &table)
|
||||
{
|
||||
try {
|
||||
reset(internal::Crud_factory::mk_insert(table));
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
TableInsert(const internal::Table_insert_base &other)
|
||||
{
|
||||
internal::Table_insert_base::operator=(other);
|
||||
}
|
||||
|
||||
TableInsert(internal::Table_insert_base &&other)
|
||||
{
|
||||
internal::Table_insert_base::operator=(std::move(other));
|
||||
}
|
||||
|
||||
using internal::Table_insert_base::operator=;
|
||||
|
||||
/// Add the given row to the list of rows to be inserted.
|
||||
|
||||
virtual TableInsert& values(const Row &row)
|
||||
{
|
||||
try {
|
||||
add_rows(get_impl(), row);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Add a single row consisting of the specified values to the list of
|
||||
rows to be inserted.
|
||||
*/
|
||||
|
||||
template<typename... Types>
|
||||
TableInsert& values(Types... rest)
|
||||
{
|
||||
try {
|
||||
add_values(get_impl(), rest...);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Add rows from a container such as vector or list.
|
||||
*/
|
||||
|
||||
template<typename Container>
|
||||
TableInsert& rows(const Container &cont)
|
||||
{
|
||||
try {
|
||||
add_rows(get_impl(), cont);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Add rows from a range given by two iterators.
|
||||
*/
|
||||
|
||||
template<typename It>
|
||||
TableInsert& rows(const It &begin, const It &end)
|
||||
{
|
||||
try {
|
||||
add_rows(get_impl(), begin, end);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Add the given list of rows.
|
||||
*/
|
||||
|
||||
template<typename... Types>
|
||||
TableInsert& rows(const Row &first, Types... rest)
|
||||
{
|
||||
try {
|
||||
add_rows(get_impl(), first, rest...);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Table_insert_detail::Impl;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(internal::Table_insert_base::get_impl());
|
||||
}
|
||||
|
||||
///@cond IGNORED
|
||||
friend Table;
|
||||
///@endcond
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class TableSelect;
|
||||
|
||||
namespace internal {
|
||||
|
||||
class Op_view_create_alter;
|
||||
|
||||
struct Table_select_cmd
|
||||
: public Executable<RowResult, TableSelect>
|
||||
{};
|
||||
|
||||
struct Table_select_base
|
||||
: public Group_by < Having < Order_by < Limit < Offset< Bind_parameters<
|
||||
Set_lock< Table_select_cmd, common::Table_select_if >
|
||||
> > > > > >
|
||||
{};
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
An operation which selects rows from a table.
|
||||
|
||||
The class defines various methods, such as `where()`, to specify which rows
|
||||
should be returned and in which order.
|
||||
|
||||
For each row the operation can return all fields from the
|
||||
row or a set of values defined by projection expressions
|
||||
specified when the operation was created.
|
||||
|
||||
@ingroup devapi_op
|
||||
*/
|
||||
|
||||
class TableSelect
|
||||
: public internal::Table_select_base
|
||||
, internal::Table_select_detail
|
||||
{
|
||||
|
||||
using Operation = Table_select_base;
|
||||
|
||||
public:
|
||||
|
||||
TableSelect(Table &table)
|
||||
{
|
||||
try {
|
||||
reset(internal::Crud_factory::mk_select(table));
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
template <typename...PROJ>
|
||||
TableSelect(Table &table, const PROJ&... proj)
|
||||
: TableSelect(table)
|
||||
{
|
||||
try {
|
||||
add_proj(get_impl(), proj...);
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
TableSelect(const internal::Table_select_cmd &other)
|
||||
{
|
||||
internal::Table_select_cmd::operator=(other);
|
||||
}
|
||||
|
||||
TableSelect(internal::Table_select_cmd &&other)
|
||||
{
|
||||
internal::Table_select_cmd::operator=(std::move(other));
|
||||
}
|
||||
|
||||
using internal::Table_select_cmd::operator=;
|
||||
|
||||
/**
|
||||
Specify row selection criteria.
|
||||
|
||||
The criteria is specified as a Boolean expression string.
|
||||
*/
|
||||
|
||||
Operation& where(const string& expr)
|
||||
{
|
||||
try {
|
||||
get_impl()->set_where(expr);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Table_select_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(internal::Table_select_base::get_impl());
|
||||
}
|
||||
|
||||
///@cond IGNORED
|
||||
friend Table;
|
||||
friend internal::Op_view_create_alter;
|
||||
///@endcond
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class TableUpdate;
|
||||
|
||||
namespace internal {
|
||||
|
||||
struct Table_update_cmd
|
||||
: public Executable<Result, TableUpdate>
|
||||
{};
|
||||
|
||||
struct Table_update_base
|
||||
: public Order_by< Limit< Bind_parameters< Table_update_cmd > > >
|
||||
{};
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
An operation which updates rows stored in a table.
|
||||
|
||||
Methods of this clas specify modifications to be applied to each row as well
|
||||
as the set of rows that should be modified.
|
||||
|
||||
@ingroup devapi_op
|
||||
*/
|
||||
|
||||
class TableUpdate
|
||||
: public internal::Table_update_base
|
||||
{
|
||||
using Operation = internal::Table_update_base;
|
||||
|
||||
TableUpdate(Table& table)
|
||||
{
|
||||
try {
|
||||
reset(internal::Crud_factory::mk_update(table));
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
TableUpdate(Table &table, const string &expr)
|
||||
: TableUpdate(table)
|
||||
{
|
||||
where(expr);
|
||||
}
|
||||
|
||||
TableUpdate(const internal::Table_update_cmd &other)
|
||||
{
|
||||
internal::Table_update_cmd::operator=(other);
|
||||
}
|
||||
|
||||
TableUpdate(internal::Table_update_cmd &&other)
|
||||
{
|
||||
internal::Table_update_cmd::operator=(std::move(other));
|
||||
}
|
||||
|
||||
using internal::Table_update_cmd::operator=;
|
||||
|
||||
/**
|
||||
Set the given field in a row to the given value.
|
||||
|
||||
The value can be either a direct literal or an expression given
|
||||
as `expr(<string>)`, to be evaluated in the server.
|
||||
*/
|
||||
|
||||
TableUpdate& set(const string& field, const Value &val)
|
||||
{
|
||||
try {
|
||||
get_impl()->add_set(field, (const common::Value&)val);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
/**
|
||||
Specify selection criteria for rows that should be updated.
|
||||
*/
|
||||
|
||||
Operation& where(const string& expr)
|
||||
{
|
||||
try {
|
||||
get_impl()->set_where(expr);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Table_update_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(internal::Table_update_base::get_impl());
|
||||
}
|
||||
|
||||
///@cond IGNORED
|
||||
friend Table;
|
||||
///@endcond
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class TableRemove;
|
||||
|
||||
namespace internal {
|
||||
|
||||
struct Table_remove_cmd
|
||||
: public Executable<Result, TableRemove>
|
||||
{};
|
||||
|
||||
struct Table_remove_base
|
||||
: Order_by< Limit< Bind_parameters< Table_remove_cmd > > >
|
||||
{};
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
An operation which removes rows from a table.
|
||||
|
||||
The class defines methods to specify which rows should be removed.
|
||||
|
||||
@ingroup devapi_op
|
||||
*/
|
||||
|
||||
class TableRemove
|
||||
: public internal::Table_remove_base
|
||||
{
|
||||
using Operation = internal::Table_remove_base;
|
||||
|
||||
TableRemove(Table& table)
|
||||
{
|
||||
try {
|
||||
reset(internal::Crud_factory::mk_remove(table));
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
TableRemove(Table &table, const string &expr)
|
||||
: TableRemove(table)
|
||||
{
|
||||
where(expr);
|
||||
}
|
||||
|
||||
TableRemove(const internal::Table_remove_cmd &other)
|
||||
{
|
||||
internal::Table_remove_cmd::operator=(other);
|
||||
}
|
||||
|
||||
TableRemove(internal::Table_remove_cmd &&other)
|
||||
{
|
||||
internal::Table_remove_cmd::operator=(std::move(other));
|
||||
}
|
||||
|
||||
using internal::Table_remove_cmd::operator=;
|
||||
|
||||
/**
|
||||
Specify selection criteria for rows to be removed.
|
||||
*/
|
||||
|
||||
Operation& where(const string &expr)
|
||||
{
|
||||
try {
|
||||
get_impl()->set_where(expr);
|
||||
return *this;
|
||||
}
|
||||
CATCH_AND_WRAP
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
using Impl = common::Table_remove_if;
|
||||
|
||||
Impl* get_impl()
|
||||
{
|
||||
return static_cast<Impl*>(internal::Table_remove_base::get_impl());
|
||||
}
|
||||
|
||||
///@cond IGNORED
|
||||
friend Table;
|
||||
///@endcond
|
||||
};
|
||||
|
||||
|
||||
MYSQLX_ABI_END(2,0)
|
||||
} // mysqlx
|
||||
|
||||
#endif
|
||||
56
3rdparty/mysql/mysqlx/version_info.h
vendored
56
3rdparty/mysql/mysqlx/version_info.h
vendored
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License, version 2.0, for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MYSQLX_COMMON_VERSION_INFO
|
||||
#define MYSQLX_COMMON_VERSION_INFO
|
||||
|
||||
/*
|
||||
Version information which is used for example for default
|
||||
connection attributes.
|
||||
|
||||
When build system is configured by cmake, a new file is generated
|
||||
from this one with version and license values substituted by
|
||||
cmake and build system is configured so that the generated
|
||||
header takes precedence over this one. But code can be built even
|
||||
if header with real values was not generated - in that case the
|
||||
values specified here will be used.
|
||||
*/
|
||||
|
||||
#define MYSQL_CONCPP_NAME "mysql-connector-cpp"
|
||||
#define MYSQL_CONCPP_VERSION "8.2.0"
|
||||
#define MYSQL_CONCPP_LICENSE "GPL-2.0"
|
||||
|
||||
#define MYSQL_CONCPP_VERSION_MAJOR 8
|
||||
#define MYSQL_CONCPP_VERSION_MINOR 2
|
||||
#define MYSQL_CONCPP_VERSION_MICRO 0
|
||||
|
||||
#define MYSQL_CONCPP_VERSION_NUMBER 8020000
|
||||
|
||||
#endif
|
||||
3553
3rdparty/mysql/mysqlx/xapi.h
vendored
3553
3rdparty/mysql/mysqlx/xapi.h
vendored
File diff suppressed because it is too large
Load Diff
2143
3rdparty/mysql/mysqlx/xdevapi.h
vendored
2143
3rdparty/mysql/mysqlx/xdevapi.h
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is only used by HP C/C++ on VMS, and is included automatically
|
||||
* after each header file from this directory
|
||||
*/
|
||||
|
||||
/*
|
||||
* The C++ compiler doesn't understand these pragmas, even though it
|
||||
* understands the corresponding command line qualifier.
|
||||
*/
|
||||
#ifndef __cplusplus
|
||||
/* restore state. Must correspond to the save in __decc_include_prologue.h */
|
||||
# pragma names restore
|
||||
#endif
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is only used by HP C/C++ on VMS, and is included automatically
|
||||
* after each header file from this directory
|
||||
*/
|
||||
|
||||
/*
|
||||
* The C++ compiler doesn't understand these pragmas, even though it
|
||||
* understands the corresponding command line qualifier.
|
||||
*/
|
||||
#ifndef __cplusplus
|
||||
/* save state */
|
||||
# pragma names save
|
||||
/* have the compiler shorten symbols larger than 31 chars to 23 chars
|
||||
* followed by a 8 hex char CRC
|
||||
*/
|
||||
# pragma names as_is,shortened
|
||||
#endif
|
||||
92
3rdparty/openssl/include/openssl/aes.h
vendored
92
3rdparty/openssl/include/openssl/aes.h
vendored
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_AES_H
|
||||
# define HEADER_AES_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# include <stddef.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define AES_ENCRYPT 1
|
||||
# define AES_DECRYPT 0
|
||||
|
||||
/*
|
||||
* Because array size can't be a const in C, the following two are macros.
|
||||
* Both sizes are in bytes.
|
||||
*/
|
||||
# define AES_MAXNR 14
|
||||
# define AES_BLOCK_SIZE 16
|
||||
|
||||
/* This should be a hidden type, but EVP requires that the size be known */
|
||||
struct aes_key_st {
|
||||
# ifdef AES_LONG
|
||||
unsigned long rd_key[4 * (AES_MAXNR + 1)];
|
||||
# else
|
||||
unsigned int rd_key[4 * (AES_MAXNR + 1)];
|
||||
# endif
|
||||
int rounds;
|
||||
};
|
||||
typedef struct aes_key_st AES_KEY;
|
||||
|
||||
const char *AES_options(void);
|
||||
|
||||
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
|
||||
void AES_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
|
||||
void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key, const int enc);
|
||||
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc);
|
||||
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num);
|
||||
/* NB: the IV is _two_ blocks long */
|
||||
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc);
|
||||
/* NB: the IV is _four_ blocks long */
|
||||
void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
const AES_KEY *key2, const unsigned char *ivec,
|
||||
const int enc);
|
||||
|
||||
int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
|
||||
unsigned char *out,
|
||||
const unsigned char *in, unsigned int inlen);
|
||||
int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
|
||||
unsigned char *out,
|
||||
const unsigned char *in, unsigned int inlen);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
138
3rdparty/openssl/include/openssl/applink.c
vendored
138
3rdparty/openssl/include/openssl/applink.c
vendored
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
* Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#define APPLINK_STDIN 1
|
||||
#define APPLINK_STDOUT 2
|
||||
#define APPLINK_STDERR 3
|
||||
#define APPLINK_FPRINTF 4
|
||||
#define APPLINK_FGETS 5
|
||||
#define APPLINK_FREAD 6
|
||||
#define APPLINK_FWRITE 7
|
||||
#define APPLINK_FSETMOD 8
|
||||
#define APPLINK_FEOF 9
|
||||
#define APPLINK_FCLOSE 10 /* should not be used */
|
||||
|
||||
#define APPLINK_FOPEN 11 /* solely for completeness */
|
||||
#define APPLINK_FSEEK 12
|
||||
#define APPLINK_FTELL 13
|
||||
#define APPLINK_FFLUSH 14
|
||||
#define APPLINK_FERROR 15
|
||||
#define APPLINK_CLEARERR 16
|
||||
#define APPLINK_FILENO 17 /* to be used with below */
|
||||
|
||||
#define APPLINK_OPEN 18 /* formally can't be used, as flags can vary */
|
||||
#define APPLINK_READ 19
|
||||
#define APPLINK_WRITE 20
|
||||
#define APPLINK_LSEEK 21
|
||||
#define APPLINK_CLOSE 22
|
||||
#define APPLINK_MAX 22 /* always same as last macro */
|
||||
|
||||
#ifndef APPMACROS_ONLY
|
||||
# include <stdio.h>
|
||||
# include <io.h>
|
||||
# include <fcntl.h>
|
||||
|
||||
static void *app_stdin(void)
|
||||
{
|
||||
return stdin;
|
||||
}
|
||||
|
||||
static void *app_stdout(void)
|
||||
{
|
||||
return stdout;
|
||||
}
|
||||
|
||||
static void *app_stderr(void)
|
||||
{
|
||||
return stderr;
|
||||
}
|
||||
|
||||
static int app_feof(FILE *fp)
|
||||
{
|
||||
return feof(fp);
|
||||
}
|
||||
|
||||
static int app_ferror(FILE *fp)
|
||||
{
|
||||
return ferror(fp);
|
||||
}
|
||||
|
||||
static void app_clearerr(FILE *fp)
|
||||
{
|
||||
clearerr(fp);
|
||||
}
|
||||
|
||||
static int app_fileno(FILE *fp)
|
||||
{
|
||||
return _fileno(fp);
|
||||
}
|
||||
|
||||
static int app_fsetmod(FILE *fp, char mod)
|
||||
{
|
||||
return _setmode(_fileno(fp), mod == 'b' ? _O_BINARY : _O_TEXT);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
__declspec(dllexport)
|
||||
void **
|
||||
# if defined(__BORLANDC__)
|
||||
/*
|
||||
* __stdcall appears to be the only way to get the name
|
||||
* decoration right with Borland C. Otherwise it works
|
||||
* purely incidentally, as we pass no parameters.
|
||||
*/
|
||||
__stdcall
|
||||
# else
|
||||
__cdecl
|
||||
# endif
|
||||
OPENSSL_Applink(void)
|
||||
{
|
||||
static int once = 1;
|
||||
static void *OPENSSL_ApplinkTable[APPLINK_MAX + 1] =
|
||||
{ (void *)APPLINK_MAX };
|
||||
|
||||
if (once) {
|
||||
OPENSSL_ApplinkTable[APPLINK_STDIN] = app_stdin;
|
||||
OPENSSL_ApplinkTable[APPLINK_STDOUT] = app_stdout;
|
||||
OPENSSL_ApplinkTable[APPLINK_STDERR] = app_stderr;
|
||||
OPENSSL_ApplinkTable[APPLINK_FPRINTF] = fprintf;
|
||||
OPENSSL_ApplinkTable[APPLINK_FGETS] = fgets;
|
||||
OPENSSL_ApplinkTable[APPLINK_FREAD] = fread;
|
||||
OPENSSL_ApplinkTable[APPLINK_FWRITE] = fwrite;
|
||||
OPENSSL_ApplinkTable[APPLINK_FSETMOD] = app_fsetmod;
|
||||
OPENSSL_ApplinkTable[APPLINK_FEOF] = app_feof;
|
||||
OPENSSL_ApplinkTable[APPLINK_FCLOSE] = fclose;
|
||||
|
||||
OPENSSL_ApplinkTable[APPLINK_FOPEN] = fopen;
|
||||
OPENSSL_ApplinkTable[APPLINK_FSEEK] = fseek;
|
||||
OPENSSL_ApplinkTable[APPLINK_FTELL] = ftell;
|
||||
OPENSSL_ApplinkTable[APPLINK_FFLUSH] = fflush;
|
||||
OPENSSL_ApplinkTable[APPLINK_FERROR] = app_ferror;
|
||||
OPENSSL_ApplinkTable[APPLINK_CLEARERR] = app_clearerr;
|
||||
OPENSSL_ApplinkTable[APPLINK_FILENO] = app_fileno;
|
||||
|
||||
OPENSSL_ApplinkTable[APPLINK_OPEN] = _open;
|
||||
OPENSSL_ApplinkTable[APPLINK_READ] = _read;
|
||||
OPENSSL_ApplinkTable[APPLINK_WRITE] = _write;
|
||||
OPENSSL_ApplinkTable[APPLINK_LSEEK] = _lseek;
|
||||
OPENSSL_ApplinkTable[APPLINK_CLOSE] = _close;
|
||||
|
||||
once = 0;
|
||||
}
|
||||
|
||||
return OPENSSL_ApplinkTable;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
886
3rdparty/openssl/include/openssl/asn1.h
vendored
886
3rdparty/openssl/include/openssl/asn1.h
vendored
@@ -1,886 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ASN1_H
|
||||
# define HEADER_ASN1_H
|
||||
|
||||
# include <time.h>
|
||||
# include <openssl/e_os2.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/asn1err.h>
|
||||
# include <openssl/symhacks.h>
|
||||
|
||||
# include <openssl/ossl_typ.h>
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/bn.h>
|
||||
# endif
|
||||
|
||||
# ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
||||
# undef OPENSSL_EXTERN
|
||||
# define OPENSSL_EXTERN OPENSSL_EXPORT
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# define V_ASN1_UNIVERSAL 0x00
|
||||
# define V_ASN1_APPLICATION 0x40
|
||||
# define V_ASN1_CONTEXT_SPECIFIC 0x80
|
||||
# define V_ASN1_PRIVATE 0xc0
|
||||
|
||||
# define V_ASN1_CONSTRUCTED 0x20
|
||||
# define V_ASN1_PRIMITIVE_TAG 0x1f
|
||||
# define V_ASN1_PRIMATIVE_TAG /*compat*/ V_ASN1_PRIMITIVE_TAG
|
||||
|
||||
# define V_ASN1_APP_CHOOSE -2/* let the recipient choose */
|
||||
# define V_ASN1_OTHER -3/* used in ASN1_TYPE */
|
||||
# define V_ASN1_ANY -4/* used in ASN1 template code */
|
||||
|
||||
# define V_ASN1_UNDEF -1
|
||||
/* ASN.1 tag values */
|
||||
# define V_ASN1_EOC 0
|
||||
# define V_ASN1_BOOLEAN 1 /**/
|
||||
# define V_ASN1_INTEGER 2
|
||||
# define V_ASN1_BIT_STRING 3
|
||||
# define V_ASN1_OCTET_STRING 4
|
||||
# define V_ASN1_NULL 5
|
||||
# define V_ASN1_OBJECT 6
|
||||
# define V_ASN1_OBJECT_DESCRIPTOR 7
|
||||
# define V_ASN1_EXTERNAL 8
|
||||
# define V_ASN1_REAL 9
|
||||
# define V_ASN1_ENUMERATED 10
|
||||
# define V_ASN1_UTF8STRING 12
|
||||
# define V_ASN1_SEQUENCE 16
|
||||
# define V_ASN1_SET 17
|
||||
# define V_ASN1_NUMERICSTRING 18 /**/
|
||||
# define V_ASN1_PRINTABLESTRING 19
|
||||
# define V_ASN1_T61STRING 20
|
||||
# define V_ASN1_TELETEXSTRING 20/* alias */
|
||||
# define V_ASN1_VIDEOTEXSTRING 21 /**/
|
||||
# define V_ASN1_IA5STRING 22
|
||||
# define V_ASN1_UTCTIME 23
|
||||
# define V_ASN1_GENERALIZEDTIME 24 /**/
|
||||
# define V_ASN1_GRAPHICSTRING 25 /**/
|
||||
# define V_ASN1_ISO64STRING 26 /**/
|
||||
# define V_ASN1_VISIBLESTRING 26/* alias */
|
||||
# define V_ASN1_GENERALSTRING 27 /**/
|
||||
# define V_ASN1_UNIVERSALSTRING 28 /**/
|
||||
# define V_ASN1_BMPSTRING 30
|
||||
|
||||
/*
|
||||
* NB the constants below are used internally by ASN1_INTEGER
|
||||
* and ASN1_ENUMERATED to indicate the sign. They are *not* on
|
||||
* the wire tag values.
|
||||
*/
|
||||
|
||||
# define V_ASN1_NEG 0x100
|
||||
# define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG)
|
||||
# define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG)
|
||||
|
||||
/* For use with d2i_ASN1_type_bytes() */
|
||||
# define B_ASN1_NUMERICSTRING 0x0001
|
||||
# define B_ASN1_PRINTABLESTRING 0x0002
|
||||
# define B_ASN1_T61STRING 0x0004
|
||||
# define B_ASN1_TELETEXSTRING 0x0004
|
||||
# define B_ASN1_VIDEOTEXSTRING 0x0008
|
||||
# define B_ASN1_IA5STRING 0x0010
|
||||
# define B_ASN1_GRAPHICSTRING 0x0020
|
||||
# define B_ASN1_ISO64STRING 0x0040
|
||||
# define B_ASN1_VISIBLESTRING 0x0040
|
||||
# define B_ASN1_GENERALSTRING 0x0080
|
||||
# define B_ASN1_UNIVERSALSTRING 0x0100
|
||||
# define B_ASN1_OCTET_STRING 0x0200
|
||||
# define B_ASN1_BIT_STRING 0x0400
|
||||
# define B_ASN1_BMPSTRING 0x0800
|
||||
# define B_ASN1_UNKNOWN 0x1000
|
||||
# define B_ASN1_UTF8STRING 0x2000
|
||||
# define B_ASN1_UTCTIME 0x4000
|
||||
# define B_ASN1_GENERALIZEDTIME 0x8000
|
||||
# define B_ASN1_SEQUENCE 0x10000
|
||||
/* For use with ASN1_mbstring_copy() */
|
||||
# define MBSTRING_FLAG 0x1000
|
||||
# define MBSTRING_UTF8 (MBSTRING_FLAG)
|
||||
# define MBSTRING_ASC (MBSTRING_FLAG|1)
|
||||
# define MBSTRING_BMP (MBSTRING_FLAG|2)
|
||||
# define MBSTRING_UNIV (MBSTRING_FLAG|4)
|
||||
# define SMIME_OLDMIME 0x400
|
||||
# define SMIME_CRLFEOL 0x800
|
||||
# define SMIME_STREAM 0x1000
|
||||
struct X509_algor_st;
|
||||
DEFINE_STACK_OF(X509_ALGOR)
|
||||
|
||||
# define ASN1_STRING_FLAG_BITS_LEFT 0x08/* Set if 0x07 has bits left value */
|
||||
/*
|
||||
* This indicates that the ASN1_STRING is not a real value but just a place
|
||||
* holder for the location where indefinite length constructed data should be
|
||||
* inserted in the memory buffer
|
||||
*/
|
||||
# define ASN1_STRING_FLAG_NDEF 0x010
|
||||
|
||||
/*
|
||||
* This flag is used by the CMS code to indicate that a string is not
|
||||
* complete and is a place holder for content when it had all been accessed.
|
||||
* The flag will be reset when content has been written to it.
|
||||
*/
|
||||
|
||||
# define ASN1_STRING_FLAG_CONT 0x020
|
||||
/*
|
||||
* This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING
|
||||
* type.
|
||||
*/
|
||||
# define ASN1_STRING_FLAG_MSTRING 0x040
|
||||
/* String is embedded and only content should be freed */
|
||||
# define ASN1_STRING_FLAG_EMBED 0x080
|
||||
/* String should be parsed in RFC 5280's time format */
|
||||
# define ASN1_STRING_FLAG_X509_TIME 0x100
|
||||
/* This is the base type that holds just about everything :-) */
|
||||
struct asn1_string_st {
|
||||
int length;
|
||||
int type;
|
||||
unsigned char *data;
|
||||
/*
|
||||
* The value of the following field depends on the type being held. It
|
||||
* is mostly being used for BIT_STRING so if the input data has a
|
||||
* non-zero 'unused bits' value, it will be handled correctly
|
||||
*/
|
||||
long flags;
|
||||
};
|
||||
|
||||
/*
|
||||
* ASN1_ENCODING structure: this is used to save the received encoding of an
|
||||
* ASN1 type. This is useful to get round problems with invalid encodings
|
||||
* which can break signatures.
|
||||
*/
|
||||
|
||||
typedef struct ASN1_ENCODING_st {
|
||||
unsigned char *enc; /* DER encoding */
|
||||
long len; /* Length of encoding */
|
||||
int modified; /* set to 1 if 'enc' is invalid */
|
||||
} ASN1_ENCODING;
|
||||
|
||||
/* Used with ASN1 LONG type: if a long is set to this it is omitted */
|
||||
# define ASN1_LONG_UNDEF 0x7fffffffL
|
||||
|
||||
# define STABLE_FLAGS_MALLOC 0x01
|
||||
/*
|
||||
* A zero passed to ASN1_STRING_TABLE_new_add for the flags is interpreted
|
||||
* as "don't change" and STABLE_FLAGS_MALLOC is always set. By setting
|
||||
* STABLE_FLAGS_MALLOC only we can clear the existing value. Use the alias
|
||||
* STABLE_FLAGS_CLEAR to reflect this.
|
||||
*/
|
||||
# define STABLE_FLAGS_CLEAR STABLE_FLAGS_MALLOC
|
||||
# define STABLE_NO_MASK 0x02
|
||||
# define DIRSTRING_TYPE \
|
||||
(B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
|
||||
# define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING)
|
||||
|
||||
typedef struct asn1_string_table_st {
|
||||
int nid;
|
||||
long minsize;
|
||||
long maxsize;
|
||||
unsigned long mask;
|
||||
unsigned long flags;
|
||||
} ASN1_STRING_TABLE;
|
||||
|
||||
DEFINE_STACK_OF(ASN1_STRING_TABLE)
|
||||
|
||||
/* size limits: this stuff is taken straight from RFC2459 */
|
||||
|
||||
# define ub_name 32768
|
||||
# define ub_common_name 64
|
||||
# define ub_locality_name 128
|
||||
# define ub_state_name 128
|
||||
# define ub_organization_name 64
|
||||
# define ub_organization_unit_name 64
|
||||
# define ub_title 64
|
||||
# define ub_email_address 128
|
||||
|
||||
/*
|
||||
* Declarations for template structures: for full definitions see asn1t.h
|
||||
*/
|
||||
typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE;
|
||||
typedef struct ASN1_TLC_st ASN1_TLC;
|
||||
/* This is just an opaque pointer */
|
||||
typedef struct ASN1_VALUE_st ASN1_VALUE;
|
||||
|
||||
/* Declare ASN1 functions: the implement macro in in asn1t.h */
|
||||
|
||||
# define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)
|
||||
|
||||
# define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \
|
||||
DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type)
|
||||
|
||||
# define DECLARE_ASN1_FUNCTIONS_name(type, name) \
|
||||
DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
|
||||
DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)
|
||||
|
||||
# define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \
|
||||
DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
|
||||
DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
|
||||
|
||||
# define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
|
||||
type *d2i_##name(type **a, const unsigned char **in, long len); \
|
||||
int i2d_##name(type *a, unsigned char **out); \
|
||||
DECLARE_ASN1_ITEM(itname)
|
||||
|
||||
# define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \
|
||||
type *d2i_##name(type **a, const unsigned char **in, long len); \
|
||||
int i2d_##name(const type *a, unsigned char **out); \
|
||||
DECLARE_ASN1_ITEM(name)
|
||||
|
||||
# define DECLARE_ASN1_NDEF_FUNCTION(name) \
|
||||
int i2d_##name##_NDEF(name *a, unsigned char **out);
|
||||
|
||||
# define DECLARE_ASN1_FUNCTIONS_const(name) \
|
||||
DECLARE_ASN1_ALLOC_FUNCTIONS(name) \
|
||||
DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name)
|
||||
|
||||
# define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
|
||||
type *name##_new(void); \
|
||||
void name##_free(type *a);
|
||||
|
||||
# define DECLARE_ASN1_PRINT_FUNCTION(stname) \
|
||||
DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname)
|
||||
|
||||
# define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \
|
||||
int fname##_print_ctx(BIO *out, stname *x, int indent, \
|
||||
const ASN1_PCTX *pctx);
|
||||
|
||||
# define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
|
||||
# define I2D_OF(type) int (*)(type *,unsigned char **)
|
||||
# define I2D_OF_const(type) int (*)(const type *,unsigned char **)
|
||||
|
||||
# define CHECKED_D2I_OF(type, d2i) \
|
||||
((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0)))
|
||||
# define CHECKED_I2D_OF(type, i2d) \
|
||||
((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0)))
|
||||
# define CHECKED_NEW_OF(type, xnew) \
|
||||
((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0)))
|
||||
# define CHECKED_PTR_OF(type, p) \
|
||||
((void*) (1 ? p : (type*)0))
|
||||
# define CHECKED_PPTR_OF(type, p) \
|
||||
((void**) (1 ? p : (type**)0))
|
||||
|
||||
# define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
|
||||
# define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)
|
||||
# define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)
|
||||
|
||||
TYPEDEF_D2I2D_OF(void);
|
||||
|
||||
/*-
|
||||
* The following macros and typedefs allow an ASN1_ITEM
|
||||
* to be embedded in a structure and referenced. Since
|
||||
* the ASN1_ITEM pointers need to be globally accessible
|
||||
* (possibly from shared libraries) they may exist in
|
||||
* different forms. On platforms that support it the
|
||||
* ASN1_ITEM structure itself will be globally exported.
|
||||
* Other platforms will export a function that returns
|
||||
* an ASN1_ITEM pointer.
|
||||
*
|
||||
* To handle both cases transparently the macros below
|
||||
* should be used instead of hard coding an ASN1_ITEM
|
||||
* pointer in a structure.
|
||||
*
|
||||
* The structure will look like this:
|
||||
*
|
||||
* typedef struct SOMETHING_st {
|
||||
* ...
|
||||
* ASN1_ITEM_EXP *iptr;
|
||||
* ...
|
||||
* } SOMETHING;
|
||||
*
|
||||
* It would be initialised as e.g.:
|
||||
*
|
||||
* SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...};
|
||||
*
|
||||
* and the actual pointer extracted with:
|
||||
*
|
||||
* const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr);
|
||||
*
|
||||
* Finally an ASN1_ITEM pointer can be extracted from an
|
||||
* appropriate reference with: ASN1_ITEM_rptr(X509). This
|
||||
* would be used when a function takes an ASN1_ITEM * argument.
|
||||
*
|
||||
*/
|
||||
|
||||
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
|
||||
|
||||
/* ASN1_ITEM pointer exported type */
|
||||
typedef const ASN1_ITEM ASN1_ITEM_EXP;
|
||||
|
||||
/* Macro to obtain ASN1_ITEM pointer from exported type */
|
||||
# define ASN1_ITEM_ptr(iptr) (iptr)
|
||||
|
||||
/* Macro to include ASN1_ITEM pointer from base type */
|
||||
# define ASN1_ITEM_ref(iptr) (&(iptr##_it))
|
||||
|
||||
# define ASN1_ITEM_rptr(ref) (&(ref##_it))
|
||||
|
||||
# define DECLARE_ASN1_ITEM(name) \
|
||||
OPENSSL_EXTERN const ASN1_ITEM name##_it;
|
||||
|
||||
# else
|
||||
|
||||
/*
|
||||
* Platforms that can't easily handle shared global variables are declared as
|
||||
* functions returning ASN1_ITEM pointers.
|
||||
*/
|
||||
|
||||
/* ASN1_ITEM pointer exported type */
|
||||
typedef const ASN1_ITEM *ASN1_ITEM_EXP (void);
|
||||
|
||||
/* Macro to obtain ASN1_ITEM pointer from exported type */
|
||||
# define ASN1_ITEM_ptr(iptr) (iptr())
|
||||
|
||||
/* Macro to include ASN1_ITEM pointer from base type */
|
||||
# define ASN1_ITEM_ref(iptr) (iptr##_it)
|
||||
|
||||
# define ASN1_ITEM_rptr(ref) (ref##_it())
|
||||
|
||||
# define DECLARE_ASN1_ITEM(name) \
|
||||
const ASN1_ITEM * name##_it(void);
|
||||
|
||||
# endif
|
||||
|
||||
/* Parameters used by ASN1_STRING_print_ex() */
|
||||
|
||||
/*
|
||||
* These determine which characters to escape: RFC2253 special characters,
|
||||
* control characters and MSB set characters
|
||||
*/
|
||||
|
||||
# define ASN1_STRFLGS_ESC_2253 1
|
||||
# define ASN1_STRFLGS_ESC_CTRL 2
|
||||
# define ASN1_STRFLGS_ESC_MSB 4
|
||||
|
||||
/*
|
||||
* This flag determines how we do escaping: normally RC2253 backslash only,
|
||||
* set this to use backslash and quote.
|
||||
*/
|
||||
|
||||
# define ASN1_STRFLGS_ESC_QUOTE 8
|
||||
|
||||
/* These three flags are internal use only. */
|
||||
|
||||
/* Character is a valid PrintableString character */
|
||||
# define CHARTYPE_PRINTABLESTRING 0x10
|
||||
/* Character needs escaping if it is the first character */
|
||||
# define CHARTYPE_FIRST_ESC_2253 0x20
|
||||
/* Character needs escaping if it is the last character */
|
||||
# define CHARTYPE_LAST_ESC_2253 0x40
|
||||
|
||||
/*
|
||||
* NB the internal flags are safely reused below by flags handled at the top
|
||||
* level.
|
||||
*/
|
||||
|
||||
/*
|
||||
* If this is set we convert all character strings to UTF8 first
|
||||
*/
|
||||
|
||||
# define ASN1_STRFLGS_UTF8_CONVERT 0x10
|
||||
|
||||
/*
|
||||
* If this is set we don't attempt to interpret content: just assume all
|
||||
* strings are 1 byte per character. This will produce some pretty odd
|
||||
* looking output!
|
||||
*/
|
||||
|
||||
# define ASN1_STRFLGS_IGNORE_TYPE 0x20
|
||||
|
||||
/* If this is set we include the string type in the output */
|
||||
# define ASN1_STRFLGS_SHOW_TYPE 0x40
|
||||
|
||||
/*
|
||||
* This determines which strings to display and which to 'dump' (hex dump of
|
||||
* content octets or DER encoding). We can only dump non character strings or
|
||||
* everything. If we don't dump 'unknown' they are interpreted as character
|
||||
* strings with 1 octet per character and are subject to the usual escaping
|
||||
* options.
|
||||
*/
|
||||
|
||||
# define ASN1_STRFLGS_DUMP_ALL 0x80
|
||||
# define ASN1_STRFLGS_DUMP_UNKNOWN 0x100
|
||||
|
||||
/*
|
||||
* These determine what 'dumping' does, we can dump the content octets or the
|
||||
* DER encoding: both use the RFC2253 #XXXXX notation.
|
||||
*/
|
||||
|
||||
# define ASN1_STRFLGS_DUMP_DER 0x200
|
||||
|
||||
/*
|
||||
* This flag specifies that RC2254 escaping shall be performed.
|
||||
*/
|
||||
#define ASN1_STRFLGS_ESC_2254 0x400
|
||||
|
||||
/*
|
||||
* All the string flags consistent with RFC2253, escaping control characters
|
||||
* isn't essential in RFC2253 but it is advisable anyway.
|
||||
*/
|
||||
|
||||
# define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \
|
||||
ASN1_STRFLGS_ESC_CTRL | \
|
||||
ASN1_STRFLGS_ESC_MSB | \
|
||||
ASN1_STRFLGS_UTF8_CONVERT | \
|
||||
ASN1_STRFLGS_DUMP_UNKNOWN | \
|
||||
ASN1_STRFLGS_DUMP_DER)
|
||||
|
||||
DEFINE_STACK_OF(ASN1_INTEGER)
|
||||
|
||||
DEFINE_STACK_OF(ASN1_GENERALSTRING)
|
||||
|
||||
DEFINE_STACK_OF(ASN1_UTF8STRING)
|
||||
|
||||
typedef struct asn1_type_st {
|
||||
int type;
|
||||
union {
|
||||
char *ptr;
|
||||
ASN1_BOOLEAN boolean;
|
||||
ASN1_STRING *asn1_string;
|
||||
ASN1_OBJECT *object;
|
||||
ASN1_INTEGER *integer;
|
||||
ASN1_ENUMERATED *enumerated;
|
||||
ASN1_BIT_STRING *bit_string;
|
||||
ASN1_OCTET_STRING *octet_string;
|
||||
ASN1_PRINTABLESTRING *printablestring;
|
||||
ASN1_T61STRING *t61string;
|
||||
ASN1_IA5STRING *ia5string;
|
||||
ASN1_GENERALSTRING *generalstring;
|
||||
ASN1_BMPSTRING *bmpstring;
|
||||
ASN1_UNIVERSALSTRING *universalstring;
|
||||
ASN1_UTCTIME *utctime;
|
||||
ASN1_GENERALIZEDTIME *generalizedtime;
|
||||
ASN1_VISIBLESTRING *visiblestring;
|
||||
ASN1_UTF8STRING *utf8string;
|
||||
/*
|
||||
* set and sequence are left complete and still contain the set or
|
||||
* sequence bytes
|
||||
*/
|
||||
ASN1_STRING *set;
|
||||
ASN1_STRING *sequence;
|
||||
ASN1_VALUE *asn1_value;
|
||||
} value;
|
||||
} ASN1_TYPE;
|
||||
|
||||
DEFINE_STACK_OF(ASN1_TYPE)
|
||||
|
||||
typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;
|
||||
|
||||
DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
|
||||
DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY)
|
||||
|
||||
/* This is used to contain a list of bit names */
|
||||
typedef struct BIT_STRING_BITNAME_st {
|
||||
int bitnum;
|
||||
const char *lname;
|
||||
const char *sname;
|
||||
} BIT_STRING_BITNAME;
|
||||
|
||||
# define B_ASN1_TIME \
|
||||
B_ASN1_UTCTIME | \
|
||||
B_ASN1_GENERALIZEDTIME
|
||||
|
||||
# define B_ASN1_PRINTABLE \
|
||||
B_ASN1_NUMERICSTRING| \
|
||||
B_ASN1_PRINTABLESTRING| \
|
||||
B_ASN1_T61STRING| \
|
||||
B_ASN1_IA5STRING| \
|
||||
B_ASN1_BIT_STRING| \
|
||||
B_ASN1_UNIVERSALSTRING|\
|
||||
B_ASN1_BMPSTRING|\
|
||||
B_ASN1_UTF8STRING|\
|
||||
B_ASN1_SEQUENCE|\
|
||||
B_ASN1_UNKNOWN
|
||||
|
||||
# define B_ASN1_DIRECTORYSTRING \
|
||||
B_ASN1_PRINTABLESTRING| \
|
||||
B_ASN1_TELETEXSTRING|\
|
||||
B_ASN1_BMPSTRING|\
|
||||
B_ASN1_UNIVERSALSTRING|\
|
||||
B_ASN1_UTF8STRING
|
||||
|
||||
# define B_ASN1_DISPLAYTEXT \
|
||||
B_ASN1_IA5STRING| \
|
||||
B_ASN1_VISIBLESTRING| \
|
||||
B_ASN1_BMPSTRING|\
|
||||
B_ASN1_UTF8STRING
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
|
||||
|
||||
int ASN1_TYPE_get(const ASN1_TYPE *a);
|
||||
void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
|
||||
int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
|
||||
int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);
|
||||
|
||||
ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t);
|
||||
void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t);
|
||||
|
||||
ASN1_OBJECT *ASN1_OBJECT_new(void);
|
||||
void ASN1_OBJECT_free(ASN1_OBJECT *a);
|
||||
int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp);
|
||||
ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
|
||||
long length);
|
||||
|
||||
DECLARE_ASN1_ITEM(ASN1_OBJECT)
|
||||
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
|
||||
ASN1_STRING *ASN1_STRING_new(void);
|
||||
void ASN1_STRING_free(ASN1_STRING *a);
|
||||
void ASN1_STRING_clear_free(ASN1_STRING *a);
|
||||
int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str);
|
||||
ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a);
|
||||
ASN1_STRING *ASN1_STRING_type_new(int type);
|
||||
int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);
|
||||
/*
|
||||
* Since this is used to store all sorts of things, via macros, for now,
|
||||
* make its data void *
|
||||
*/
|
||||
int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
|
||||
void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
|
||||
int ASN1_STRING_length(const ASN1_STRING *x);
|
||||
void ASN1_STRING_length_set(ASN1_STRING *x, int n);
|
||||
int ASN1_STRING_type(const ASN1_STRING *x);
|
||||
DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
|
||||
const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x);
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
|
||||
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length);
|
||||
int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
|
||||
int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n);
|
||||
int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a,
|
||||
const unsigned char *flags, int flags_len);
|
||||
|
||||
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
|
||||
BIT_STRING_BITNAME *tbl, int indent);
|
||||
int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl);
|
||||
int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value,
|
||||
BIT_STRING_BITNAME *tbl);
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
|
||||
ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
|
||||
long length);
|
||||
ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x);
|
||||
int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
|
||||
|
||||
int ASN1_UTCTIME_check(const ASN1_UTCTIME *a);
|
||||
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t);
|
||||
ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
|
||||
int offset_day, long offset_sec);
|
||||
int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
|
||||
int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
|
||||
|
||||
int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a);
|
||||
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
|
||||
time_t t);
|
||||
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
|
||||
time_t t, int offset_day,
|
||||
long offset_sec);
|
||||
int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
|
||||
|
||||
int ASN1_TIME_diff(int *pday, int *psec,
|
||||
const ASN1_TIME *from, const ASN1_TIME *to);
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
|
||||
ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);
|
||||
int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a,
|
||||
const ASN1_OCTET_STRING *b);
|
||||
int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data,
|
||||
int len);
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING)
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_NULL)
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING)
|
||||
|
||||
int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
|
||||
int UTF8_putc(unsigned char *str, int len, unsigned long value);
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING)
|
||||
DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING)
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING)
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING)
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING)
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
|
||||
|
||||
DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
|
||||
|
||||
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
|
||||
ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t,
|
||||
int offset_day, long offset_sec);
|
||||
int ASN1_TIME_check(const ASN1_TIME *t);
|
||||
ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t,
|
||||
ASN1_GENERALIZEDTIME **out);
|
||||
int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
|
||||
int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str);
|
||||
int ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm);
|
||||
int ASN1_TIME_normalize(ASN1_TIME *s);
|
||||
int ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t);
|
||||
int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b);
|
||||
|
||||
int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a);
|
||||
int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size);
|
||||
int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a);
|
||||
int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size);
|
||||
int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a);
|
||||
int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size);
|
||||
int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type);
|
||||
int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a);
|
||||
|
||||
int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num);
|
||||
ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
|
||||
const char *sn, const char *ln);
|
||||
|
||||
int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a);
|
||||
int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r);
|
||||
int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a);
|
||||
int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r);
|
||||
|
||||
int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
|
||||
long ASN1_INTEGER_get(const ASN1_INTEGER *a);
|
||||
ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
|
||||
BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn);
|
||||
|
||||
int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a);
|
||||
int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r);
|
||||
|
||||
|
||||
int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
|
||||
long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a);
|
||||
ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai);
|
||||
BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn);
|
||||
|
||||
/* General */
|
||||
/* given a string, return the correct type, max is the maximum length */
|
||||
int ASN1_PRINTABLE_type(const unsigned char *s, int max);
|
||||
|
||||
unsigned long ASN1_tag2bit(int tag);
|
||||
|
||||
/* SPECIALS */
|
||||
int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
|
||||
int *pclass, long omax);
|
||||
int ASN1_check_infinite_end(unsigned char **p, long len);
|
||||
int ASN1_const_check_infinite_end(const unsigned char **p, long len);
|
||||
void ASN1_put_object(unsigned char **pp, int constructed, int length,
|
||||
int tag, int xclass);
|
||||
int ASN1_put_eoc(unsigned char **pp);
|
||||
int ASN1_object_size(int constructed, int length, int tag);
|
||||
|
||||
/* Used to implement other functions */
|
||||
void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x);
|
||||
|
||||
# define ASN1_dup_of(type,i2d,d2i,x) \
|
||||
((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \
|
||||
CHECKED_D2I_OF(type, d2i), \
|
||||
CHECKED_PTR_OF(type, x)))
|
||||
|
||||
# define ASN1_dup_of_const(type,i2d,d2i,x) \
|
||||
((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \
|
||||
CHECKED_D2I_OF(type, d2i), \
|
||||
CHECKED_PTR_OF(const type, x)))
|
||||
|
||||
void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
|
||||
|
||||
/* ASN1 alloc/free macros for when a type is only used internally */
|
||||
|
||||
# define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type))
|
||||
# define M_ASN1_free_of(x, type) \
|
||||
ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))
|
||||
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x);
|
||||
|
||||
# define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
|
||||
((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \
|
||||
CHECKED_D2I_OF(type, d2i), \
|
||||
in, \
|
||||
CHECKED_PPTR_OF(type, x)))
|
||||
|
||||
void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
|
||||
int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x);
|
||||
|
||||
# define ASN1_i2d_fp_of(type,i2d,out,x) \
|
||||
(ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \
|
||||
out, \
|
||||
CHECKED_PTR_OF(type, x)))
|
||||
|
||||
# define ASN1_i2d_fp_of_const(type,i2d,out,x) \
|
||||
(ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \
|
||||
out, \
|
||||
CHECKED_PTR_OF(const type, x)))
|
||||
|
||||
int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
|
||||
int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags);
|
||||
# endif
|
||||
|
||||
int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in);
|
||||
|
||||
void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x);
|
||||
|
||||
# define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
|
||||
((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \
|
||||
CHECKED_D2I_OF(type, d2i), \
|
||||
in, \
|
||||
CHECKED_PPTR_OF(type, x)))
|
||||
|
||||
void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
|
||||
int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x);
|
||||
|
||||
# define ASN1_i2d_bio_of(type,i2d,out,x) \
|
||||
(ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \
|
||||
out, \
|
||||
CHECKED_PTR_OF(type, x)))
|
||||
|
||||
# define ASN1_i2d_bio_of_const(type,i2d,out,x) \
|
||||
(ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \
|
||||
out, \
|
||||
CHECKED_PTR_OF(const type, x)))
|
||||
|
||||
int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
|
||||
int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a);
|
||||
int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a);
|
||||
int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
|
||||
int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
|
||||
int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags);
|
||||
int ASN1_buf_print(BIO *bp, const unsigned char *buf, size_t buflen, int off);
|
||||
int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
|
||||
unsigned char *buf, int off);
|
||||
int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent);
|
||||
int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent,
|
||||
int dump);
|
||||
const char *ASN1_tag2str(int tag);
|
||||
|
||||
/* Used to load and write Netscape format cert */
|
||||
|
||||
int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
|
||||
|
||||
int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len);
|
||||
int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len);
|
||||
int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
|
||||
unsigned char *data, int len);
|
||||
int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num,
|
||||
unsigned char *data, int max_len);
|
||||
|
||||
void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it);
|
||||
|
||||
ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it,
|
||||
ASN1_OCTET_STRING **oct);
|
||||
|
||||
void ASN1_STRING_set_default_mask(unsigned long mask);
|
||||
int ASN1_STRING_set_default_mask_asc(const char *p);
|
||||
unsigned long ASN1_STRING_get_default_mask(void);
|
||||
int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
|
||||
int inform, unsigned long mask);
|
||||
int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
|
||||
int inform, unsigned long mask,
|
||||
long minsize, long maxsize);
|
||||
|
||||
ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
|
||||
const unsigned char *in, int inlen,
|
||||
int inform, int nid);
|
||||
ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
|
||||
int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
|
||||
void ASN1_STRING_TABLE_cleanup(void);
|
||||
|
||||
/* ASN1 template functions */
|
||||
|
||||
/* Old API compatible functions */
|
||||
ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
|
||||
void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
|
||||
ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in,
|
||||
long len, const ASN1_ITEM *it);
|
||||
int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
|
||||
int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out,
|
||||
const ASN1_ITEM *it);
|
||||
|
||||
void ASN1_add_oid_module(void);
|
||||
void ASN1_add_stable_module(void);
|
||||
|
||||
ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf);
|
||||
ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf);
|
||||
int ASN1_str2mask(const char *str, unsigned long *pmask);
|
||||
|
||||
/* ASN1 Print flags */
|
||||
|
||||
/* Indicate missing OPTIONAL fields */
|
||||
# define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001
|
||||
/* Mark start and end of SEQUENCE */
|
||||
# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002
|
||||
/* Mark start and end of SEQUENCE/SET OF */
|
||||
# define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004
|
||||
/* Show the ASN1 type of primitives */
|
||||
# define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008
|
||||
/* Don't show ASN1 type of ANY */
|
||||
# define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010
|
||||
/* Don't show ASN1 type of MSTRINGs */
|
||||
# define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020
|
||||
/* Don't show field names in SEQUENCE */
|
||||
# define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040
|
||||
/* Show structure names of each SEQUENCE field */
|
||||
# define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080
|
||||
/* Don't show structure name even at top level */
|
||||
# define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100
|
||||
|
||||
int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
|
||||
const ASN1_ITEM *it, const ASN1_PCTX *pctx);
|
||||
ASN1_PCTX *ASN1_PCTX_new(void);
|
||||
void ASN1_PCTX_free(ASN1_PCTX *p);
|
||||
unsigned long ASN1_PCTX_get_flags(const ASN1_PCTX *p);
|
||||
void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags);
|
||||
unsigned long ASN1_PCTX_get_nm_flags(const ASN1_PCTX *p);
|
||||
void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags);
|
||||
unsigned long ASN1_PCTX_get_cert_flags(const ASN1_PCTX *p);
|
||||
void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags);
|
||||
unsigned long ASN1_PCTX_get_oid_flags(const ASN1_PCTX *p);
|
||||
void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags);
|
||||
unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p);
|
||||
void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags);
|
||||
|
||||
ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb) (ASN1_SCTX *ctx));
|
||||
void ASN1_SCTX_free(ASN1_SCTX *p);
|
||||
const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p);
|
||||
const ASN1_TEMPLATE *ASN1_SCTX_get_template(ASN1_SCTX *p);
|
||||
unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p);
|
||||
void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data);
|
||||
void *ASN1_SCTX_get_app_data(ASN1_SCTX *p);
|
||||
|
||||
const BIO_METHOD *BIO_f_asn1(void);
|
||||
|
||||
BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it);
|
||||
|
||||
int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
|
||||
const ASN1_ITEM *it);
|
||||
int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
|
||||
const char *hdr, const ASN1_ITEM *it);
|
||||
int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
|
||||
int ctype_nid, int econt_nid,
|
||||
STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it);
|
||||
ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
|
||||
int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
|
||||
int SMIME_text(BIO *in, BIO *out);
|
||||
|
||||
const ASN1_ITEM *ASN1_ITEM_lookup(const char *name);
|
||||
const ASN1_ITEM *ASN1_ITEM_get(size_t i);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
10
3rdparty/openssl/include/openssl/asn1_mac.h
vendored
10
3rdparty/openssl/include/openssl/asn1_mac.h
vendored
@@ -1,10 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#error "This file is obsolete; please update your software."
|
||||
256
3rdparty/openssl/include/openssl/asn1err.h
vendored
256
3rdparty/openssl/include/openssl/asn1err.h
vendored
@@ -1,256 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ASN1ERR_H
|
||||
# define HEADER_ASN1ERR_H
|
||||
|
||||
# include <openssl/symhacks.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_ASN1_strings(void);
|
||||
|
||||
/*
|
||||
* ASN1 function codes.
|
||||
*/
|
||||
# define ASN1_F_A2D_ASN1_OBJECT 100
|
||||
# define ASN1_F_A2I_ASN1_INTEGER 102
|
||||
# define ASN1_F_A2I_ASN1_STRING 103
|
||||
# define ASN1_F_APPEND_EXP 176
|
||||
# define ASN1_F_ASN1_BIO_INIT 113
|
||||
# define ASN1_F_ASN1_BIT_STRING_SET_BIT 183
|
||||
# define ASN1_F_ASN1_CB 177
|
||||
# define ASN1_F_ASN1_CHECK_TLEN 104
|
||||
# define ASN1_F_ASN1_COLLECT 106
|
||||
# define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108
|
||||
# define ASN1_F_ASN1_D2I_FP 109
|
||||
# define ASN1_F_ASN1_D2I_READ_BIO 107
|
||||
# define ASN1_F_ASN1_DIGEST 184
|
||||
# define ASN1_F_ASN1_DO_ADB 110
|
||||
# define ASN1_F_ASN1_DO_LOCK 233
|
||||
# define ASN1_F_ASN1_DUP 111
|
||||
# define ASN1_F_ASN1_ENC_SAVE 115
|
||||
# define ASN1_F_ASN1_EX_C2I 204
|
||||
# define ASN1_F_ASN1_FIND_END 190
|
||||
# define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 216
|
||||
# define ASN1_F_ASN1_GENERATE_V3 178
|
||||
# define ASN1_F_ASN1_GET_INT64 224
|
||||
# define ASN1_F_ASN1_GET_OBJECT 114
|
||||
# define ASN1_F_ASN1_GET_UINT64 225
|
||||
# define ASN1_F_ASN1_I2D_BIO 116
|
||||
# define ASN1_F_ASN1_I2D_FP 117
|
||||
# define ASN1_F_ASN1_ITEM_D2I_FP 206
|
||||
# define ASN1_F_ASN1_ITEM_DUP 191
|
||||
# define ASN1_F_ASN1_ITEM_EMBED_D2I 120
|
||||
# define ASN1_F_ASN1_ITEM_EMBED_NEW 121
|
||||
# define ASN1_F_ASN1_ITEM_EX_I2D 144
|
||||
# define ASN1_F_ASN1_ITEM_FLAGS_I2D 118
|
||||
# define ASN1_F_ASN1_ITEM_I2D_BIO 192
|
||||
# define ASN1_F_ASN1_ITEM_I2D_FP 193
|
||||
# define ASN1_F_ASN1_ITEM_PACK 198
|
||||
# define ASN1_F_ASN1_ITEM_SIGN 195
|
||||
# define ASN1_F_ASN1_ITEM_SIGN_CTX 220
|
||||
# define ASN1_F_ASN1_ITEM_UNPACK 199
|
||||
# define ASN1_F_ASN1_ITEM_VERIFY 197
|
||||
# define ASN1_F_ASN1_MBSTRING_NCOPY 122
|
||||
# define ASN1_F_ASN1_OBJECT_NEW 123
|
||||
# define ASN1_F_ASN1_OUTPUT_DATA 214
|
||||
# define ASN1_F_ASN1_PCTX_NEW 205
|
||||
# define ASN1_F_ASN1_PRIMITIVE_NEW 119
|
||||
# define ASN1_F_ASN1_SCTX_NEW 221
|
||||
# define ASN1_F_ASN1_SIGN 128
|
||||
# define ASN1_F_ASN1_STR2TYPE 179
|
||||
# define ASN1_F_ASN1_STRING_GET_INT64 227
|
||||
# define ASN1_F_ASN1_STRING_GET_UINT64 230
|
||||
# define ASN1_F_ASN1_STRING_SET 186
|
||||
# define ASN1_F_ASN1_STRING_TABLE_ADD 129
|
||||
# define ASN1_F_ASN1_STRING_TO_BN 228
|
||||
# define ASN1_F_ASN1_STRING_TYPE_NEW 130
|
||||
# define ASN1_F_ASN1_TEMPLATE_EX_D2I 132
|
||||
# define ASN1_F_ASN1_TEMPLATE_NEW 133
|
||||
# define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131
|
||||
# define ASN1_F_ASN1_TIME_ADJ 217
|
||||
# define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134
|
||||
# define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135
|
||||
# define ASN1_F_ASN1_UTCTIME_ADJ 218
|
||||
# define ASN1_F_ASN1_VERIFY 137
|
||||
# define ASN1_F_B64_READ_ASN1 209
|
||||
# define ASN1_F_B64_WRITE_ASN1 210
|
||||
# define ASN1_F_BIO_NEW_NDEF 208
|
||||
# define ASN1_F_BITSTR_CB 180
|
||||
# define ASN1_F_BN_TO_ASN1_STRING 229
|
||||
# define ASN1_F_C2I_ASN1_BIT_STRING 189
|
||||
# define ASN1_F_C2I_ASN1_INTEGER 194
|
||||
# define ASN1_F_C2I_ASN1_OBJECT 196
|
||||
# define ASN1_F_C2I_IBUF 226
|
||||
# define ASN1_F_C2I_UINT64_INT 101
|
||||
# define ASN1_F_COLLECT_DATA 140
|
||||
# define ASN1_F_D2I_ASN1_OBJECT 147
|
||||
# define ASN1_F_D2I_ASN1_UINTEGER 150
|
||||
# define ASN1_F_D2I_AUTOPRIVATEKEY 207
|
||||
# define ASN1_F_D2I_PRIVATEKEY 154
|
||||
# define ASN1_F_D2I_PUBLICKEY 155
|
||||
# define ASN1_F_DO_BUF 142
|
||||
# define ASN1_F_DO_CREATE 124
|
||||
# define ASN1_F_DO_DUMP 125
|
||||
# define ASN1_F_DO_TCREATE 222
|
||||
# define ASN1_F_I2A_ASN1_OBJECT 126
|
||||
# define ASN1_F_I2D_ASN1_BIO_STREAM 211
|
||||
# define ASN1_F_I2D_ASN1_OBJECT 143
|
||||
# define ASN1_F_I2D_DSA_PUBKEY 161
|
||||
# define ASN1_F_I2D_EC_PUBKEY 181
|
||||
# define ASN1_F_I2D_PRIVATEKEY 163
|
||||
# define ASN1_F_I2D_PUBLICKEY 164
|
||||
# define ASN1_F_I2D_RSA_PUBKEY 165
|
||||
# define ASN1_F_LONG_C2I 166
|
||||
# define ASN1_F_NDEF_PREFIX 127
|
||||
# define ASN1_F_NDEF_SUFFIX 136
|
||||
# define ASN1_F_OID_MODULE_INIT 174
|
||||
# define ASN1_F_PARSE_TAGGING 182
|
||||
# define ASN1_F_PKCS5_PBE2_SET_IV 167
|
||||
# define ASN1_F_PKCS5_PBE2_SET_SCRYPT 231
|
||||
# define ASN1_F_PKCS5_PBE_SET 202
|
||||
# define ASN1_F_PKCS5_PBE_SET0_ALGOR 215
|
||||
# define ASN1_F_PKCS5_PBKDF2_SET 219
|
||||
# define ASN1_F_PKCS5_SCRYPT_SET 232
|
||||
# define ASN1_F_SMIME_READ_ASN1 212
|
||||
# define ASN1_F_SMIME_TEXT 213
|
||||
# define ASN1_F_STABLE_GET 138
|
||||
# define ASN1_F_STBL_MODULE_INIT 223
|
||||
# define ASN1_F_UINT32_C2I 105
|
||||
# define ASN1_F_UINT32_NEW 139
|
||||
# define ASN1_F_UINT64_C2I 112
|
||||
# define ASN1_F_UINT64_NEW 141
|
||||
# define ASN1_F_X509_CRL_ADD0_REVOKED 169
|
||||
# define ASN1_F_X509_INFO_NEW 170
|
||||
# define ASN1_F_X509_NAME_ENCODE 203
|
||||
# define ASN1_F_X509_NAME_EX_D2I 158
|
||||
# define ASN1_F_X509_NAME_EX_NEW 171
|
||||
# define ASN1_F_X509_PKEY_NEW 173
|
||||
|
||||
/*
|
||||
* ASN1 reason codes.
|
||||
*/
|
||||
# define ASN1_R_ADDING_OBJECT 171
|
||||
# define ASN1_R_ASN1_PARSE_ERROR 203
|
||||
# define ASN1_R_ASN1_SIG_PARSE_ERROR 204
|
||||
# define ASN1_R_AUX_ERROR 100
|
||||
# define ASN1_R_BAD_OBJECT_HEADER 102
|
||||
# define ASN1_R_BAD_TEMPLATE 230
|
||||
# define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214
|
||||
# define ASN1_R_BN_LIB 105
|
||||
# define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106
|
||||
# define ASN1_R_BUFFER_TOO_SMALL 107
|
||||
# define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108
|
||||
# define ASN1_R_CONTEXT_NOT_INITIALISED 217
|
||||
# define ASN1_R_DATA_IS_WRONG 109
|
||||
# define ASN1_R_DECODE_ERROR 110
|
||||
# define ASN1_R_DEPTH_EXCEEDED 174
|
||||
# define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198
|
||||
# define ASN1_R_ENCODE_ERROR 112
|
||||
# define ASN1_R_ERROR_GETTING_TIME 173
|
||||
# define ASN1_R_ERROR_LOADING_SECTION 172
|
||||
# define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114
|
||||
# define ASN1_R_EXPECTING_AN_INTEGER 115
|
||||
# define ASN1_R_EXPECTING_AN_OBJECT 116
|
||||
# define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119
|
||||
# define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120
|
||||
# define ASN1_R_FIELD_MISSING 121
|
||||
# define ASN1_R_FIRST_NUM_TOO_LARGE 122
|
||||
# define ASN1_R_HEADER_TOO_LONG 123
|
||||
# define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175
|
||||
# define ASN1_R_ILLEGAL_BOOLEAN 176
|
||||
# define ASN1_R_ILLEGAL_CHARACTERS 124
|
||||
# define ASN1_R_ILLEGAL_FORMAT 177
|
||||
# define ASN1_R_ILLEGAL_HEX 178
|
||||
# define ASN1_R_ILLEGAL_IMPLICIT_TAG 179
|
||||
# define ASN1_R_ILLEGAL_INTEGER 180
|
||||
# define ASN1_R_ILLEGAL_NEGATIVE_VALUE 226
|
||||
# define ASN1_R_ILLEGAL_NESTED_TAGGING 181
|
||||
# define ASN1_R_ILLEGAL_NULL 125
|
||||
# define ASN1_R_ILLEGAL_NULL_VALUE 182
|
||||
# define ASN1_R_ILLEGAL_OBJECT 183
|
||||
# define ASN1_R_ILLEGAL_OPTIONAL_ANY 126
|
||||
# define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170
|
||||
# define ASN1_R_ILLEGAL_PADDING 221
|
||||
# define ASN1_R_ILLEGAL_TAGGED_ANY 127
|
||||
# define ASN1_R_ILLEGAL_TIME_VALUE 184
|
||||
# define ASN1_R_ILLEGAL_ZERO_CONTENT 222
|
||||
# define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185
|
||||
# define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
|
||||
# define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220
|
||||
# define ASN1_R_INVALID_BMPSTRING_LENGTH 129
|
||||
# define ASN1_R_INVALID_DIGIT 130
|
||||
# define ASN1_R_INVALID_MIME_TYPE 205
|
||||
# define ASN1_R_INVALID_MODIFIER 186
|
||||
# define ASN1_R_INVALID_NUMBER 187
|
||||
# define ASN1_R_INVALID_OBJECT_ENCODING 216
|
||||
# define ASN1_R_INVALID_SCRYPT_PARAMETERS 227
|
||||
# define ASN1_R_INVALID_SEPARATOR 131
|
||||
# define ASN1_R_INVALID_STRING_TABLE_VALUE 218
|
||||
# define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
|
||||
# define ASN1_R_INVALID_UTF8STRING 134
|
||||
# define ASN1_R_INVALID_VALUE 219
|
||||
# define ASN1_R_LIST_ERROR 188
|
||||
# define ASN1_R_MIME_NO_CONTENT_TYPE 206
|
||||
# define ASN1_R_MIME_PARSE_ERROR 207
|
||||
# define ASN1_R_MIME_SIG_PARSE_ERROR 208
|
||||
# define ASN1_R_MISSING_EOC 137
|
||||
# define ASN1_R_MISSING_SECOND_NUMBER 138
|
||||
# define ASN1_R_MISSING_VALUE 189
|
||||
# define ASN1_R_MSTRING_NOT_UNIVERSAL 139
|
||||
# define ASN1_R_MSTRING_WRONG_TAG 140
|
||||
# define ASN1_R_NESTED_ASN1_STRING 197
|
||||
# define ASN1_R_NESTED_TOO_DEEP 201
|
||||
# define ASN1_R_NON_HEX_CHARACTERS 141
|
||||
# define ASN1_R_NOT_ASCII_FORMAT 190
|
||||
# define ASN1_R_NOT_ENOUGH_DATA 142
|
||||
# define ASN1_R_NO_CONTENT_TYPE 209
|
||||
# define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
|
||||
# define ASN1_R_NO_MULTIPART_BODY_FAILURE 210
|
||||
# define ASN1_R_NO_MULTIPART_BOUNDARY 211
|
||||
# define ASN1_R_NO_SIG_CONTENT_TYPE 212
|
||||
# define ASN1_R_NULL_IS_WRONG_LENGTH 144
|
||||
# define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191
|
||||
# define ASN1_R_ODD_NUMBER_OF_CHARS 145
|
||||
# define ASN1_R_SECOND_NUMBER_TOO_LARGE 147
|
||||
# define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148
|
||||
# define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149
|
||||
# define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192
|
||||
# define ASN1_R_SHORT_LINE 150
|
||||
# define ASN1_R_SIG_INVALID_MIME_TYPE 213
|
||||
# define ASN1_R_STREAMING_NOT_SUPPORTED 202
|
||||
# define ASN1_R_STRING_TOO_LONG 151
|
||||
# define ASN1_R_STRING_TOO_SHORT 152
|
||||
# define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
|
||||
# define ASN1_R_TIME_NOT_ASCII_FORMAT 193
|
||||
# define ASN1_R_TOO_LARGE 223
|
||||
# define ASN1_R_TOO_LONG 155
|
||||
# define ASN1_R_TOO_SMALL 224
|
||||
# define ASN1_R_TYPE_NOT_CONSTRUCTED 156
|
||||
# define ASN1_R_TYPE_NOT_PRIMITIVE 195
|
||||
# define ASN1_R_UNEXPECTED_EOC 159
|
||||
# define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215
|
||||
# define ASN1_R_UNKNOWN_FORMAT 160
|
||||
# define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161
|
||||
# define ASN1_R_UNKNOWN_OBJECT_TYPE 162
|
||||
# define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163
|
||||
# define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199
|
||||
# define ASN1_R_UNKNOWN_TAG 194
|
||||
# define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164
|
||||
# define ASN1_R_UNSUPPORTED_CIPHER 228
|
||||
# define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167
|
||||
# define ASN1_R_UNSUPPORTED_TYPE 196
|
||||
# define ASN1_R_WRONG_INTEGER_TYPE 225
|
||||
# define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200
|
||||
# define ASN1_R_WRONG_TAG 168
|
||||
|
||||
#endif
|
||||
945
3rdparty/openssl/include/openssl/asn1t.h
vendored
945
3rdparty/openssl/include/openssl/asn1t.h
vendored
@@ -1,945 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ASN1T_H
|
||||
# define HEADER_ASN1T_H
|
||||
|
||||
# include <stddef.h>
|
||||
# include <openssl/e_os2.h>
|
||||
# include <openssl/asn1.h>
|
||||
|
||||
# ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
||||
# undef OPENSSL_EXTERN
|
||||
# define OPENSSL_EXTERN OPENSSL_EXPORT
|
||||
# endif
|
||||
|
||||
/* ASN1 template defines, structures and functions */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
|
||||
|
||||
/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
|
||||
# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr))
|
||||
|
||||
/* Macros for start and end of ASN1_ITEM definition */
|
||||
|
||||
# define ASN1_ITEM_start(itname) \
|
||||
const ASN1_ITEM itname##_it = {
|
||||
|
||||
# define static_ASN1_ITEM_start(itname) \
|
||||
static const ASN1_ITEM itname##_it = {
|
||||
|
||||
# define ASN1_ITEM_end(itname) \
|
||||
};
|
||||
|
||||
# else
|
||||
|
||||
/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
|
||||
# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)()))
|
||||
|
||||
/* Macros for start and end of ASN1_ITEM definition */
|
||||
|
||||
# define ASN1_ITEM_start(itname) \
|
||||
const ASN1_ITEM * itname##_it(void) \
|
||||
{ \
|
||||
static const ASN1_ITEM local_it = {
|
||||
|
||||
# define static_ASN1_ITEM_start(itname) \
|
||||
static ASN1_ITEM_start(itname)
|
||||
|
||||
# define ASN1_ITEM_end(itname) \
|
||||
}; \
|
||||
return &local_it; \
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
/* Macros to aid ASN1 template writing */
|
||||
|
||||
# define ASN1_ITEM_TEMPLATE(tname) \
|
||||
static const ASN1_TEMPLATE tname##_item_tt
|
||||
|
||||
# define ASN1_ITEM_TEMPLATE_END(tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_PRIMITIVE,\
|
||||
-1,\
|
||||
&tname##_item_tt,\
|
||||
0,\
|
||||
NULL,\
|
||||
0,\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
# define static_ASN1_ITEM_TEMPLATE_END(tname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_PRIMITIVE,\
|
||||
-1,\
|
||||
&tname##_item_tt,\
|
||||
0,\
|
||||
NULL,\
|
||||
0,\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
/* This is a ASN1 type which just embeds a template */
|
||||
|
||||
/*-
|
||||
* This pair helps declare a SEQUENCE. We can do:
|
||||
*
|
||||
* ASN1_SEQUENCE(stname) = {
|
||||
* ... SEQUENCE components ...
|
||||
* } ASN1_SEQUENCE_END(stname)
|
||||
*
|
||||
* This will produce an ASN1_ITEM called stname_it
|
||||
* for a structure called stname.
|
||||
*
|
||||
* If you want the same structure but a different
|
||||
* name then use:
|
||||
*
|
||||
* ASN1_SEQUENCE(itname) = {
|
||||
* ... SEQUENCE components ...
|
||||
* } ASN1_SEQUENCE_END_name(stname, itname)
|
||||
*
|
||||
* This will create an item called itname_it using
|
||||
* a structure called stname.
|
||||
*/
|
||||
|
||||
# define ASN1_SEQUENCE(tname) \
|
||||
static const ASN1_TEMPLATE tname##_seq_tt[]
|
||||
|
||||
# define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)
|
||||
|
||||
# define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname)
|
||||
|
||||
# define ASN1_SEQUENCE_END_name(stname, tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(stname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define static_ASN1_SEQUENCE_END_name(stname, tname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define ASN1_NDEF_SEQUENCE(tname) \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
# define ASN1_NDEF_SEQUENCE_cb(tname, cb) \
|
||||
ASN1_SEQUENCE_cb(tname, cb)
|
||||
|
||||
# define ASN1_SEQUENCE_cb(tname, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
# define ASN1_BROKEN_SEQUENCE(tname) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
# define ASN1_SEQUENCE_ref(tname, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
# define ASN1_SEQUENCE_enc(tname, enc, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
# define ASN1_NDEF_SEQUENCE_END(tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_NDEF_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(tname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
# define static_ASN1_NDEF_SEQUENCE_END(tname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_NDEF_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(tname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname)
|
||||
# define static_ASN1_BROKEN_SEQUENCE_END(stname) \
|
||||
static_ASN1_SEQUENCE_END_ref(stname, stname)
|
||||
|
||||
# define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
|
||||
|
||||
# define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
|
||||
# define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname)
|
||||
|
||||
# define ASN1_SEQUENCE_END_ref(stname, tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
&tname##_aux,\
|
||||
sizeof(stname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
# define static_ASN1_SEQUENCE_END_ref(stname, tname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
&tname##_aux,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_NDEF_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
&tname##_aux,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
/*-
|
||||
* This pair helps declare a CHOICE type. We can do:
|
||||
*
|
||||
* ASN1_CHOICE(chname) = {
|
||||
* ... CHOICE options ...
|
||||
* ASN1_CHOICE_END(chname)
|
||||
*
|
||||
* This will produce an ASN1_ITEM called chname_it
|
||||
* for a structure called chname. The structure
|
||||
* definition must look like this:
|
||||
* typedef struct {
|
||||
* int type;
|
||||
* union {
|
||||
* ASN1_SOMETHING *opt1;
|
||||
* ASN1_SOMEOTHER *opt2;
|
||||
* } value;
|
||||
* } chname;
|
||||
*
|
||||
* the name of the selector must be 'type'.
|
||||
* to use an alternative selector name use the
|
||||
* ASN1_CHOICE_END_selector() version.
|
||||
*/
|
||||
|
||||
# define ASN1_CHOICE(tname) \
|
||||
static const ASN1_TEMPLATE tname##_ch_tt[]
|
||||
|
||||
# define ASN1_CHOICE_cb(tname, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
|
||||
ASN1_CHOICE(tname)
|
||||
|
||||
# define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)
|
||||
|
||||
# define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname)
|
||||
|
||||
# define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type)
|
||||
|
||||
# define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type)
|
||||
|
||||
# define ASN1_CHOICE_END_selector(stname, tname, selname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_CHOICE,\
|
||||
offsetof(stname,selname) ,\
|
||||
tname##_ch_tt,\
|
||||
sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define static_ASN1_CHOICE_END_selector(stname, tname, selname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_CHOICE,\
|
||||
offsetof(stname,selname) ,\
|
||||
tname##_ch_tt,\
|
||||
sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define ASN1_CHOICE_END_cb(stname, tname, selname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_CHOICE,\
|
||||
offsetof(stname,selname) ,\
|
||||
tname##_ch_tt,\
|
||||
sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
&tname##_aux,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
/* This helps with the template wrapper form of ASN1_ITEM */
|
||||
|
||||
# define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \
|
||||
(flags), (tag), 0,\
|
||||
#name, ASN1_ITEM_ref(type) }
|
||||
|
||||
/* These help with SEQUENCE or CHOICE components */
|
||||
|
||||
/* used to declare other types */
|
||||
|
||||
# define ASN1_EX_TYPE(flags, tag, stname, field, type) { \
|
||||
(flags), (tag), offsetof(stname, field),\
|
||||
#field, ASN1_ITEM_ref(type) }
|
||||
|
||||
/* implicit and explicit helper macros */
|
||||
|
||||
# define ASN1_IMP_EX(stname, field, type, tag, ex) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type)
|
||||
|
||||
# define ASN1_EXP_EX(stname, field, type, tag, ex) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type)
|
||||
|
||||
/* Any defined by macros: the field used is in the table itself */
|
||||
|
||||
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
|
||||
# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }
|
||||
# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }
|
||||
# else
|
||||
# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb }
|
||||
# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb }
|
||||
# endif
|
||||
/* Plain simple type */
|
||||
# define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type)
|
||||
/* Embedded simple type */
|
||||
# define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type)
|
||||
|
||||
/* OPTIONAL simple type */
|
||||
# define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type)
|
||||
# define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED, 0, stname, field, type)
|
||||
|
||||
/* IMPLICIT tagged simple type */
|
||||
# define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0)
|
||||
# define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED)
|
||||
|
||||
/* IMPLICIT tagged OPTIONAL simple type */
|
||||
# define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
|
||||
# define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED)
|
||||
|
||||
/* Same as above but EXPLICIT */
|
||||
|
||||
# define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0)
|
||||
# define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED)
|
||||
# define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
|
||||
# define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED)
|
||||
|
||||
/* SEQUENCE OF type */
|
||||
# define ASN1_SEQUENCE_OF(stname, field, type) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type)
|
||||
|
||||
/* OPTIONAL SEQUENCE OF */
|
||||
# define ASN1_SEQUENCE_OF_OPT(stname, field, type) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
|
||||
|
||||
/* Same as above but for SET OF */
|
||||
|
||||
# define ASN1_SET_OF(stname, field, type) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type)
|
||||
|
||||
# define ASN1_SET_OF_OPT(stname, field, type) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
|
||||
|
||||
/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */
|
||||
|
||||
# define ASN1_IMP_SET_OF(stname, field, type, tag) \
|
||||
ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
|
||||
|
||||
# define ASN1_EXP_SET_OF(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
|
||||
|
||||
# define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \
|
||||
ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
|
||||
|
||||
# define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
|
||||
|
||||
# define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \
|
||||
ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
|
||||
|
||||
# define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \
|
||||
ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
|
||||
|
||||
# define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
|
||||
|
||||
# define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
|
||||
|
||||
/* EXPLICIT using indefinite length constructed form */
|
||||
# define ASN1_NDEF_EXP(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF)
|
||||
|
||||
/* EXPLICIT OPTIONAL using indefinite length constructed form */
|
||||
# define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF)
|
||||
|
||||
/* Macros for the ASN1_ADB structure */
|
||||
|
||||
# define ASN1_ADB(name) \
|
||||
static const ASN1_ADB_TABLE name##_adbtbl[]
|
||||
|
||||
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
|
||||
|
||||
# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \
|
||||
;\
|
||||
static const ASN1_ADB name##_adb = {\
|
||||
flags,\
|
||||
offsetof(name, field),\
|
||||
adb_cb,\
|
||||
name##_adbtbl,\
|
||||
sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
|
||||
def,\
|
||||
none\
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \
|
||||
;\
|
||||
static const ASN1_ITEM *name##_adb(void) \
|
||||
{ \
|
||||
static const ASN1_ADB internal_adb = \
|
||||
{\
|
||||
flags,\
|
||||
offsetof(name, field),\
|
||||
adb_cb,\
|
||||
name##_adbtbl,\
|
||||
sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
|
||||
def,\
|
||||
none\
|
||||
}; \
|
||||
return (const ASN1_ITEM *) &internal_adb; \
|
||||
} \
|
||||
void dummy_function(void)
|
||||
|
||||
# endif
|
||||
|
||||
# define ADB_ENTRY(val, template) {val, template}
|
||||
|
||||
# define ASN1_ADB_TEMPLATE(name) \
|
||||
static const ASN1_TEMPLATE name##_tt
|
||||
|
||||
/*
|
||||
* This is the ASN1 template structure that defines a wrapper round the
|
||||
* actual type. It determines the actual position of the field in the value
|
||||
* structure, various flags such as OPTIONAL and the field name.
|
||||
*/
|
||||
|
||||
struct ASN1_TEMPLATE_st {
|
||||
unsigned long flags; /* Various flags */
|
||||
long tag; /* tag, not used if no tagging */
|
||||
unsigned long offset; /* Offset of this field in structure */
|
||||
const char *field_name; /* Field name */
|
||||
ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */
|
||||
};
|
||||
|
||||
/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */
|
||||
|
||||
# define ASN1_TEMPLATE_item(t) (t->item_ptr)
|
||||
# define ASN1_TEMPLATE_adb(t) (t->item_ptr)
|
||||
|
||||
typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE;
|
||||
typedef struct ASN1_ADB_st ASN1_ADB;
|
||||
|
||||
struct ASN1_ADB_st {
|
||||
unsigned long flags; /* Various flags */
|
||||
unsigned long offset; /* Offset of selector field */
|
||||
int (*adb_cb)(long *psel); /* Application callback */
|
||||
const ASN1_ADB_TABLE *tbl; /* Table of possible types */
|
||||
long tblcount; /* Number of entries in tbl */
|
||||
const ASN1_TEMPLATE *default_tt; /* Type to use if no match */
|
||||
const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */
|
||||
};
|
||||
|
||||
struct ASN1_ADB_TABLE_st {
|
||||
long value; /* NID for an object or value for an int */
|
||||
const ASN1_TEMPLATE tt; /* item for this value */
|
||||
};
|
||||
|
||||
/* template flags */
|
||||
|
||||
/* Field is optional */
|
||||
# define ASN1_TFLG_OPTIONAL (0x1)
|
||||
|
||||
/* Field is a SET OF */
|
||||
# define ASN1_TFLG_SET_OF (0x1 << 1)
|
||||
|
||||
/* Field is a SEQUENCE OF */
|
||||
# define ASN1_TFLG_SEQUENCE_OF (0x2 << 1)
|
||||
|
||||
/*
|
||||
* Special case: this refers to a SET OF that will be sorted into DER order
|
||||
* when encoded *and* the corresponding STACK will be modified to match the
|
||||
* new order.
|
||||
*/
|
||||
# define ASN1_TFLG_SET_ORDER (0x3 << 1)
|
||||
|
||||
/* Mask for SET OF or SEQUENCE OF */
|
||||
# define ASN1_TFLG_SK_MASK (0x3 << 1)
|
||||
|
||||
/*
|
||||
* These flags mean the tag should be taken from the tag field. If EXPLICIT
|
||||
* then the underlying type is used for the inner tag.
|
||||
*/
|
||||
|
||||
/* IMPLICIT tagging */
|
||||
# define ASN1_TFLG_IMPTAG (0x1 << 3)
|
||||
|
||||
/* EXPLICIT tagging, inner tag from underlying type */
|
||||
# define ASN1_TFLG_EXPTAG (0x2 << 3)
|
||||
|
||||
# define ASN1_TFLG_TAG_MASK (0x3 << 3)
|
||||
|
||||
/* context specific IMPLICIT */
|
||||
# define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT)
|
||||
|
||||
/* context specific EXPLICIT */
|
||||
# define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT)
|
||||
|
||||
/*
|
||||
* If tagging is in force these determine the type of tag to use. Otherwise
|
||||
* the tag is determined by the underlying type. These values reflect the
|
||||
* actual octet format.
|
||||
*/
|
||||
|
||||
/* Universal tag */
|
||||
# define ASN1_TFLG_UNIVERSAL (0x0<<6)
|
||||
/* Application tag */
|
||||
# define ASN1_TFLG_APPLICATION (0x1<<6)
|
||||
/* Context specific tag */
|
||||
# define ASN1_TFLG_CONTEXT (0x2<<6)
|
||||
/* Private tag */
|
||||
# define ASN1_TFLG_PRIVATE (0x3<<6)
|
||||
|
||||
# define ASN1_TFLG_TAG_CLASS (0x3<<6)
|
||||
|
||||
/*
|
||||
* These are for ANY DEFINED BY type. In this case the 'item' field points to
|
||||
* an ASN1_ADB structure which contains a table of values to decode the
|
||||
* relevant type
|
||||
*/
|
||||
|
||||
# define ASN1_TFLG_ADB_MASK (0x3<<8)
|
||||
|
||||
# define ASN1_TFLG_ADB_OID (0x1<<8)
|
||||
|
||||
# define ASN1_TFLG_ADB_INT (0x1<<9)
|
||||
|
||||
/*
|
||||
* This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes
|
||||
* indefinite length constructed encoding to be used if required.
|
||||
*/
|
||||
|
||||
# define ASN1_TFLG_NDEF (0x1<<11)
|
||||
|
||||
/* Field is embedded and not a pointer */
|
||||
# define ASN1_TFLG_EMBED (0x1 << 12)
|
||||
|
||||
/* This is the actual ASN1 item itself */
|
||||
|
||||
struct ASN1_ITEM_st {
|
||||
char itype; /* The item type, primitive, SEQUENCE, CHOICE
|
||||
* or extern */
|
||||
long utype; /* underlying type */
|
||||
const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains
|
||||
* the contents */
|
||||
long tcount; /* Number of templates if SEQUENCE or CHOICE */
|
||||
const void *funcs; /* functions that handle this type */
|
||||
long size; /* Structure size (usually) */
|
||||
const char *sname; /* Structure name */
|
||||
};
|
||||
|
||||
/*-
|
||||
* These are values for the itype field and
|
||||
* determine how the type is interpreted.
|
||||
*
|
||||
* For PRIMITIVE types the underlying type
|
||||
* determines the behaviour if items is NULL.
|
||||
*
|
||||
* Otherwise templates must contain a single
|
||||
* template and the type is treated in the
|
||||
* same way as the type specified in the template.
|
||||
*
|
||||
* For SEQUENCE types the templates field points
|
||||
* to the members, the size field is the
|
||||
* structure size.
|
||||
*
|
||||
* For CHOICE types the templates field points
|
||||
* to each possible member (typically a union)
|
||||
* and the 'size' field is the offset of the
|
||||
* selector.
|
||||
*
|
||||
* The 'funcs' field is used for application
|
||||
* specific functions.
|
||||
*
|
||||
* The EXTERN type uses a new style d2i/i2d.
|
||||
* The new style should be used where possible
|
||||
* because it avoids things like the d2i IMPLICIT
|
||||
* hack.
|
||||
*
|
||||
* MSTRING is a multiple string type, it is used
|
||||
* for a CHOICE of character strings where the
|
||||
* actual strings all occupy an ASN1_STRING
|
||||
* structure. In this case the 'utype' field
|
||||
* has a special meaning, it is used as a mask
|
||||
* of acceptable types using the B_ASN1 constants.
|
||||
*
|
||||
* NDEF_SEQUENCE is the same as SEQUENCE except
|
||||
* that it will use indefinite length constructed
|
||||
* encoding if requested.
|
||||
*
|
||||
*/
|
||||
|
||||
# define ASN1_ITYPE_PRIMITIVE 0x0
|
||||
|
||||
# define ASN1_ITYPE_SEQUENCE 0x1
|
||||
|
||||
# define ASN1_ITYPE_CHOICE 0x2
|
||||
|
||||
# define ASN1_ITYPE_EXTERN 0x4
|
||||
|
||||
# define ASN1_ITYPE_MSTRING 0x5
|
||||
|
||||
# define ASN1_ITYPE_NDEF_SEQUENCE 0x6
|
||||
|
||||
/*
|
||||
* Cache for ASN1 tag and length, so we don't keep re-reading it for things
|
||||
* like CHOICE
|
||||
*/
|
||||
|
||||
struct ASN1_TLC_st {
|
||||
char valid; /* Values below are valid */
|
||||
int ret; /* return value */
|
||||
long plen; /* length */
|
||||
int ptag; /* class value */
|
||||
int pclass; /* class value */
|
||||
int hdrlen; /* header length */
|
||||
};
|
||||
|
||||
/* Typedefs for ASN1 function pointers */
|
||||
typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
const ASN1_ITEM *it, int tag, int aclass, char opt,
|
||||
ASN1_TLC *ctx);
|
||||
|
||||
typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
const ASN1_ITEM *it, int tag, int aclass);
|
||||
typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
|
||||
typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval,
|
||||
int indent, const char *fname,
|
||||
const ASN1_PCTX *pctx);
|
||||
|
||||
typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont,
|
||||
int *putype, const ASN1_ITEM *it);
|
||||
typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont,
|
||||
int len, int utype, char *free_cont,
|
||||
const ASN1_ITEM *it);
|
||||
typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval,
|
||||
const ASN1_ITEM *it, int indent,
|
||||
const ASN1_PCTX *pctx);
|
||||
|
||||
typedef struct ASN1_EXTERN_FUNCS_st {
|
||||
void *app_data;
|
||||
ASN1_ex_new_func *asn1_ex_new;
|
||||
ASN1_ex_free_func *asn1_ex_free;
|
||||
ASN1_ex_free_func *asn1_ex_clear;
|
||||
ASN1_ex_d2i *asn1_ex_d2i;
|
||||
ASN1_ex_i2d *asn1_ex_i2d;
|
||||
ASN1_ex_print_func *asn1_ex_print;
|
||||
} ASN1_EXTERN_FUNCS;
|
||||
|
||||
typedef struct ASN1_PRIMITIVE_FUNCS_st {
|
||||
void *app_data;
|
||||
unsigned long flags;
|
||||
ASN1_ex_new_func *prim_new;
|
||||
ASN1_ex_free_func *prim_free;
|
||||
ASN1_ex_free_func *prim_clear;
|
||||
ASN1_primitive_c2i *prim_c2i;
|
||||
ASN1_primitive_i2c *prim_i2c;
|
||||
ASN1_primitive_print *prim_print;
|
||||
} ASN1_PRIMITIVE_FUNCS;
|
||||
|
||||
/*
|
||||
* This is the ASN1_AUX structure: it handles various miscellaneous
|
||||
* requirements. For example the use of reference counts and an informational
|
||||
* callback. The "informational callback" is called at various points during
|
||||
* the ASN1 encoding and decoding. It can be used to provide minor
|
||||
* customisation of the structures used. This is most useful where the
|
||||
* supplied routines *almost* do the right thing but need some extra help at
|
||||
* a few points. If the callback returns zero then it is assumed a fatal
|
||||
* error has occurred and the main operation should be abandoned. If major
|
||||
* changes in the default behaviour are required then an external type is
|
||||
* more appropriate.
|
||||
*/
|
||||
|
||||
typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it,
|
||||
void *exarg);
|
||||
|
||||
typedef struct ASN1_AUX_st {
|
||||
void *app_data;
|
||||
int flags;
|
||||
int ref_offset; /* Offset of reference value */
|
||||
int ref_lock; /* Lock type to use */
|
||||
ASN1_aux_cb *asn1_cb;
|
||||
int enc_offset; /* Offset of ASN1_ENCODING structure */
|
||||
} ASN1_AUX;
|
||||
|
||||
/* For print related callbacks exarg points to this structure */
|
||||
typedef struct ASN1_PRINT_ARG_st {
|
||||
BIO *out;
|
||||
int indent;
|
||||
const ASN1_PCTX *pctx;
|
||||
} ASN1_PRINT_ARG;
|
||||
|
||||
/* For streaming related callbacks exarg points to this structure */
|
||||
typedef struct ASN1_STREAM_ARG_st {
|
||||
/* BIO to stream through */
|
||||
BIO *out;
|
||||
/* BIO with filters appended */
|
||||
BIO *ndef_bio;
|
||||
/* Streaming I/O boundary */
|
||||
unsigned char **boundary;
|
||||
} ASN1_STREAM_ARG;
|
||||
|
||||
/* Flags in ASN1_AUX */
|
||||
|
||||
/* Use a reference count */
|
||||
# define ASN1_AFLG_REFCOUNT 1
|
||||
/* Save the encoding of structure (useful for signatures) */
|
||||
# define ASN1_AFLG_ENCODING 2
|
||||
/* The Sequence length is invalid */
|
||||
# define ASN1_AFLG_BROKEN 4
|
||||
|
||||
/* operation values for asn1_cb */
|
||||
|
||||
# define ASN1_OP_NEW_PRE 0
|
||||
# define ASN1_OP_NEW_POST 1
|
||||
# define ASN1_OP_FREE_PRE 2
|
||||
# define ASN1_OP_FREE_POST 3
|
||||
# define ASN1_OP_D2I_PRE 4
|
||||
# define ASN1_OP_D2I_POST 5
|
||||
# define ASN1_OP_I2D_PRE 6
|
||||
# define ASN1_OP_I2D_POST 7
|
||||
# define ASN1_OP_PRINT_PRE 8
|
||||
# define ASN1_OP_PRINT_POST 9
|
||||
# define ASN1_OP_STREAM_PRE 10
|
||||
# define ASN1_OP_STREAM_POST 11
|
||||
# define ASN1_OP_DETACHED_PRE 12
|
||||
# define ASN1_OP_DETACHED_POST 13
|
||||
|
||||
/* Macro to implement a primitive type */
|
||||
# define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0)
|
||||
# define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \
|
||||
ASN1_ITEM_start(itname) \
|
||||
ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
|
||||
ASN1_ITEM_end(itname)
|
||||
|
||||
/* Macro to implement a multi string type */
|
||||
# define IMPLEMENT_ASN1_MSTRING(itname, mask) \
|
||||
ASN1_ITEM_start(itname) \
|
||||
ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
|
||||
ASN1_ITEM_end(itname)
|
||||
|
||||
# define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \
|
||||
ASN1_ITEM_start(sname) \
|
||||
ASN1_ITYPE_EXTERN, \
|
||||
tag, \
|
||||
NULL, \
|
||||
0, \
|
||||
&fptrs, \
|
||||
0, \
|
||||
#sname \
|
||||
ASN1_ITEM_end(sname)
|
||||
|
||||
/* Macro to implement standard functions in terms of ASN1_ITEM structures */
|
||||
|
||||
# define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname)
|
||||
|
||||
# define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname)
|
||||
|
||||
# define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \
|
||||
IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
|
||||
|
||||
# define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \
|
||||
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname)
|
||||
|
||||
# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \
|
||||
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)
|
||||
|
||||
# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \
|
||||
pre stname *fname##_new(void) \
|
||||
{ \
|
||||
return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
|
||||
} \
|
||||
pre void fname##_free(stname *a) \
|
||||
{ \
|
||||
ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
|
||||
}
|
||||
|
||||
# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \
|
||||
stname *fname##_new(void) \
|
||||
{ \
|
||||
return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
|
||||
} \
|
||||
void fname##_free(stname *a) \
|
||||
{ \
|
||||
ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
|
||||
}
|
||||
|
||||
# define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \
|
||||
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
|
||||
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
|
||||
|
||||
# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
|
||||
stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
|
||||
{ \
|
||||
return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
|
||||
} \
|
||||
int i2d_##fname(stname *a, unsigned char **out) \
|
||||
{ \
|
||||
return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
|
||||
}
|
||||
|
||||
# define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \
|
||||
int i2d_##stname##_NDEF(stname *a, unsigned char **out) \
|
||||
{ \
|
||||
return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\
|
||||
}
|
||||
|
||||
# define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \
|
||||
static stname *d2i_##stname(stname **a, \
|
||||
const unsigned char **in, long len) \
|
||||
{ \
|
||||
return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \
|
||||
ASN1_ITEM_rptr(stname)); \
|
||||
} \
|
||||
static int i2d_##stname(stname *a, unsigned char **out) \
|
||||
{ \
|
||||
return ASN1_item_i2d((ASN1_VALUE *)a, out, \
|
||||
ASN1_ITEM_rptr(stname)); \
|
||||
}
|
||||
|
||||
/*
|
||||
* This includes evil casts to remove const: they will go away when full ASN1
|
||||
* constification is done.
|
||||
*/
|
||||
# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
|
||||
stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
|
||||
{ \
|
||||
return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
|
||||
} \
|
||||
int i2d_##fname(const stname *a, unsigned char **out) \
|
||||
{ \
|
||||
return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
|
||||
}
|
||||
|
||||
# define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \
|
||||
stname * stname##_dup(stname *x) \
|
||||
{ \
|
||||
return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \
|
||||
}
|
||||
|
||||
# define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \
|
||||
IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname)
|
||||
|
||||
# define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \
|
||||
int fname##_print_ctx(BIO *out, stname *x, int indent, \
|
||||
const ASN1_PCTX *pctx) \
|
||||
{ \
|
||||
return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \
|
||||
ASN1_ITEM_rptr(itname), pctx); \
|
||||
}
|
||||
|
||||
# define IMPLEMENT_ASN1_FUNCTIONS_const(name) \
|
||||
IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name)
|
||||
|
||||
# define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \
|
||||
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
|
||||
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
|
||||
|
||||
/* external definitions for primitive types */
|
||||
|
||||
DECLARE_ASN1_ITEM(ASN1_BOOLEAN)
|
||||
DECLARE_ASN1_ITEM(ASN1_TBOOLEAN)
|
||||
DECLARE_ASN1_ITEM(ASN1_FBOOLEAN)
|
||||
DECLARE_ASN1_ITEM(ASN1_SEQUENCE)
|
||||
DECLARE_ASN1_ITEM(CBIGNUM)
|
||||
DECLARE_ASN1_ITEM(BIGNUM)
|
||||
DECLARE_ASN1_ITEM(INT32)
|
||||
DECLARE_ASN1_ITEM(ZINT32)
|
||||
DECLARE_ASN1_ITEM(UINT32)
|
||||
DECLARE_ASN1_ITEM(ZUINT32)
|
||||
DECLARE_ASN1_ITEM(INT64)
|
||||
DECLARE_ASN1_ITEM(ZINT64)
|
||||
DECLARE_ASN1_ITEM(UINT64)
|
||||
DECLARE_ASN1_ITEM(ZUINT64)
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10200000L
|
||||
/*
|
||||
* LONG and ZLONG are strongly discouraged for use as stored data, as the
|
||||
* underlying C type (long) differs in size depending on the architecture.
|
||||
* They are designed with 32-bit longs in mind.
|
||||
*/
|
||||
DECLARE_ASN1_ITEM(LONG)
|
||||
DECLARE_ASN1_ITEM(ZLONG)
|
||||
# endif
|
||||
|
||||
DEFINE_STACK_OF(ASN1_VALUE)
|
||||
|
||||
/* Functions used internally by the ASN1 code */
|
||||
|
||||
int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
|
||||
int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
const ASN1_ITEM *it, int tag, int aclass, char opt,
|
||||
ASN1_TLC *ctx);
|
||||
|
||||
int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
const ASN1_ITEM *it, int tag, int aclass);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
76
3rdparty/openssl/include/openssl/async.h
vendored
76
3rdparty/openssl/include/openssl/async.h
vendored
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef HEADER_ASYNC_H
|
||||
# define HEADER_ASYNC_H
|
||||
|
||||
#if defined(_WIN32)
|
||||
# if defined(BASETYPES) || defined(_WINDEF_H)
|
||||
/* application has to include <windows.h> to use this */
|
||||
#define OSSL_ASYNC_FD HANDLE
|
||||
#define OSSL_BAD_ASYNC_FD INVALID_HANDLE_VALUE
|
||||
# endif
|
||||
#else
|
||||
#define OSSL_ASYNC_FD int
|
||||
#define OSSL_BAD_ASYNC_FD -1
|
||||
#endif
|
||||
# include <openssl/asyncerr.h>
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
typedef struct async_job_st ASYNC_JOB;
|
||||
typedef struct async_wait_ctx_st ASYNC_WAIT_CTX;
|
||||
|
||||
#define ASYNC_ERR 0
|
||||
#define ASYNC_NO_JOBS 1
|
||||
#define ASYNC_PAUSE 2
|
||||
#define ASYNC_FINISH 3
|
||||
|
||||
int ASYNC_init_thread(size_t max_size, size_t init_size);
|
||||
void ASYNC_cleanup_thread(void);
|
||||
|
||||
#ifdef OSSL_ASYNC_FD
|
||||
ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void);
|
||||
void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx);
|
||||
int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key,
|
||||
OSSL_ASYNC_FD fd,
|
||||
void *custom_data,
|
||||
void (*cleanup)(ASYNC_WAIT_CTX *, const void *,
|
||||
OSSL_ASYNC_FD, void *));
|
||||
int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key,
|
||||
OSSL_ASYNC_FD *fd, void **custom_data);
|
||||
int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd,
|
||||
size_t *numfds);
|
||||
int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd,
|
||||
size_t *numaddfds, OSSL_ASYNC_FD *delfd,
|
||||
size_t *numdelfds);
|
||||
int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key);
|
||||
#endif
|
||||
|
||||
int ASYNC_is_capable(void);
|
||||
|
||||
int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret,
|
||||
int (*func)(void *), void *args, size_t size);
|
||||
int ASYNC_pause_job(void);
|
||||
|
||||
ASYNC_JOB *ASYNC_get_current_job(void);
|
||||
ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job);
|
||||
void ASYNC_block_pause(void);
|
||||
void ASYNC_unblock_pause(void);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
42
3rdparty/openssl/include/openssl/asyncerr.h
vendored
42
3rdparty/openssl/include/openssl/asyncerr.h
vendored
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ASYNCERR_H
|
||||
# define HEADER_ASYNCERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_ASYNC_strings(void);
|
||||
|
||||
/*
|
||||
* ASYNC function codes.
|
||||
*/
|
||||
# define ASYNC_F_ASYNC_CTX_NEW 100
|
||||
# define ASYNC_F_ASYNC_INIT_THREAD 101
|
||||
# define ASYNC_F_ASYNC_JOB_NEW 102
|
||||
# define ASYNC_F_ASYNC_PAUSE_JOB 103
|
||||
# define ASYNC_F_ASYNC_START_FUNC 104
|
||||
# define ASYNC_F_ASYNC_START_JOB 105
|
||||
# define ASYNC_F_ASYNC_WAIT_CTX_SET_WAIT_FD 106
|
||||
|
||||
/*
|
||||
* ASYNC reason codes.
|
||||
*/
|
||||
# define ASYNC_R_FAILED_TO_SET_POOL 101
|
||||
# define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102
|
||||
# define ASYNC_R_INIT_FAILED 105
|
||||
# define ASYNC_R_INVALID_POOL_SIZE 103
|
||||
|
||||
#endif
|
||||
801
3rdparty/openssl/include/openssl/bio.h
vendored
801
3rdparty/openssl/include/openssl/bio.h
vendored
@@ -1,801 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BIO_H
|
||||
# define HEADER_BIO_H
|
||||
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
# include <stdarg.h>
|
||||
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/bioerr.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* There are the classes of BIOs */
|
||||
# define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */
|
||||
# define BIO_TYPE_FILTER 0x0200
|
||||
# define BIO_TYPE_SOURCE_SINK 0x0400
|
||||
|
||||
/* These are the 'types' of BIOs */
|
||||
# define BIO_TYPE_NONE 0
|
||||
# define BIO_TYPE_MEM ( 1|BIO_TYPE_SOURCE_SINK)
|
||||
# define BIO_TYPE_FILE ( 2|BIO_TYPE_SOURCE_SINK)
|
||||
|
||||
# define BIO_TYPE_FD ( 4|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
|
||||
# define BIO_TYPE_SOCKET ( 5|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
|
||||
# define BIO_TYPE_NULL ( 6|BIO_TYPE_SOURCE_SINK)
|
||||
# define BIO_TYPE_SSL ( 7|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_MD ( 8|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_BUFFER ( 9|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_CIPHER (10|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_BASE64 (11|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_CONNECT (12|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
|
||||
# define BIO_TYPE_ACCEPT (13|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
|
||||
|
||||
# define BIO_TYPE_NBIO_TEST (16|BIO_TYPE_FILTER)/* server proxy BIO */
|
||||
# define BIO_TYPE_NULL_FILTER (17|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_BIO (19|BIO_TYPE_SOURCE_SINK)/* half a BIO pair */
|
||||
# define BIO_TYPE_LINEBUFFER (20|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_DGRAM (21|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
|
||||
# define BIO_TYPE_ASN1 (22|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_COMP (23|BIO_TYPE_FILTER)
|
||||
# ifndef OPENSSL_NO_SCTP
|
||||
# define BIO_TYPE_DGRAM_SCTP (24|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
|
||||
# endif
|
||||
|
||||
#define BIO_TYPE_START 128
|
||||
|
||||
/*
|
||||
* BIO_FILENAME_READ|BIO_CLOSE to open or close on free.
|
||||
* BIO_set_fp(in,stdin,BIO_NOCLOSE);
|
||||
*/
|
||||
# define BIO_NOCLOSE 0x00
|
||||
# define BIO_CLOSE 0x01
|
||||
|
||||
/*
|
||||
* These are used in the following macros and are passed to BIO_ctrl()
|
||||
*/
|
||||
# define BIO_CTRL_RESET 1/* opt - rewind/zero etc */
|
||||
# define BIO_CTRL_EOF 2/* opt - are we at the eof */
|
||||
# define BIO_CTRL_INFO 3/* opt - extra tit-bits */
|
||||
# define BIO_CTRL_SET 4/* man - set the 'IO' type */
|
||||
# define BIO_CTRL_GET 5/* man - get the 'IO' type */
|
||||
# define BIO_CTRL_PUSH 6/* opt - internal, used to signify change */
|
||||
# define BIO_CTRL_POP 7/* opt - internal, used to signify change */
|
||||
# define BIO_CTRL_GET_CLOSE 8/* man - set the 'close' on free */
|
||||
# define BIO_CTRL_SET_CLOSE 9/* man - set the 'close' on free */
|
||||
# define BIO_CTRL_PENDING 10/* opt - is their more data buffered */
|
||||
# define BIO_CTRL_FLUSH 11/* opt - 'flush' buffered output */
|
||||
# define BIO_CTRL_DUP 12/* man - extra stuff for 'duped' BIO */
|
||||
# define BIO_CTRL_WPENDING 13/* opt - number of bytes still to write */
|
||||
# define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */
|
||||
# define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */
|
||||
|
||||
# define BIO_CTRL_PEEK 29/* BIO_f_buffer special */
|
||||
# define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */
|
||||
|
||||
/* dgram BIO stuff */
|
||||
# define BIO_CTRL_DGRAM_CONNECT 31/* BIO dgram special */
|
||||
# define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected
|
||||
* socket to be passed in */
|
||||
# define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */
|
||||
# define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */
|
||||
# define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */
|
||||
# define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */
|
||||
|
||||
# define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */
|
||||
# define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation tiemd out */
|
||||
|
||||
/* #ifdef IP_MTU_DISCOVER */
|
||||
# define BIO_CTRL_DGRAM_MTU_DISCOVER 39/* set DF bit on egress packets */
|
||||
/* #endif */
|
||||
|
||||
# define BIO_CTRL_DGRAM_QUERY_MTU 40/* as kernel for current MTU */
|
||||
# define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47
|
||||
# define BIO_CTRL_DGRAM_GET_MTU 41/* get cached value for MTU */
|
||||
# define BIO_CTRL_DGRAM_SET_MTU 42/* set cached value for MTU.
|
||||
* want to use this if asking
|
||||
* the kernel fails */
|
||||
|
||||
# define BIO_CTRL_DGRAM_MTU_EXCEEDED 43/* check whether the MTU was
|
||||
* exceed in the previous write
|
||||
* operation */
|
||||
|
||||
# define BIO_CTRL_DGRAM_GET_PEER 46
|
||||
# define BIO_CTRL_DGRAM_SET_PEER 44/* Destination for the data */
|
||||
|
||||
# define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45/* Next DTLS handshake timeout
|
||||
* to adjust socket timeouts */
|
||||
# define BIO_CTRL_DGRAM_SET_DONT_FRAG 48
|
||||
|
||||
# define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49
|
||||
|
||||
/* Deliberately outside of OPENSSL_NO_SCTP - used in bss_dgram.c */
|
||||
# define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50
|
||||
# ifndef OPENSSL_NO_SCTP
|
||||
/* SCTP stuff */
|
||||
# define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51
|
||||
# define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52
|
||||
# define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53
|
||||
# define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60
|
||||
# define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61
|
||||
# define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62
|
||||
# define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63
|
||||
# define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64
|
||||
# define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65
|
||||
# define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70
|
||||
# endif
|
||||
|
||||
# define BIO_CTRL_DGRAM_SET_PEEK_MODE 71
|
||||
|
||||
/* modifiers */
|
||||
# define BIO_FP_READ 0x02
|
||||
# define BIO_FP_WRITE 0x04
|
||||
# define BIO_FP_APPEND 0x08
|
||||
# define BIO_FP_TEXT 0x10
|
||||
|
||||
# define BIO_FLAGS_READ 0x01
|
||||
# define BIO_FLAGS_WRITE 0x02
|
||||
# define BIO_FLAGS_IO_SPECIAL 0x04
|
||||
# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
|
||||
# define BIO_FLAGS_SHOULD_RETRY 0x08
|
||||
# ifndef BIO_FLAGS_UPLINK
|
||||
/*
|
||||
* "UPLINK" flag denotes file descriptors provided by application. It
|
||||
* defaults to 0, as most platforms don't require UPLINK interface.
|
||||
*/
|
||||
# define BIO_FLAGS_UPLINK 0
|
||||
# endif
|
||||
|
||||
# define BIO_FLAGS_BASE64_NO_NL 0x100
|
||||
|
||||
/*
|
||||
* This is used with memory BIOs:
|
||||
* BIO_FLAGS_MEM_RDONLY means we shouldn't free up or change the data in any way;
|
||||
* BIO_FLAGS_NONCLEAR_RST means we shouldn't clear data on reset.
|
||||
*/
|
||||
# define BIO_FLAGS_MEM_RDONLY 0x200
|
||||
# define BIO_FLAGS_NONCLEAR_RST 0x400
|
||||
# define BIO_FLAGS_IN_EOF 0x800
|
||||
|
||||
typedef union bio_addr_st BIO_ADDR;
|
||||
typedef struct bio_addrinfo_st BIO_ADDRINFO;
|
||||
|
||||
int BIO_get_new_index(void);
|
||||
void BIO_set_flags(BIO *b, int flags);
|
||||
int BIO_test_flags(const BIO *b, int flags);
|
||||
void BIO_clear_flags(BIO *b, int flags);
|
||||
|
||||
# define BIO_get_flags(b) BIO_test_flags(b, ~(0x0))
|
||||
# define BIO_set_retry_special(b) \
|
||||
BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY))
|
||||
# define BIO_set_retry_read(b) \
|
||||
BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))
|
||||
# define BIO_set_retry_write(b) \
|
||||
BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY))
|
||||
|
||||
/* These are normally used internally in BIOs */
|
||||
# define BIO_clear_retry_flags(b) \
|
||||
BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
|
||||
# define BIO_get_retry_flags(b) \
|
||||
BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
|
||||
|
||||
/* These should be used by the application to tell why we should retry */
|
||||
# define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ)
|
||||
# define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE)
|
||||
# define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL)
|
||||
# define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS)
|
||||
# define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY)
|
||||
|
||||
/*
|
||||
* The next three are used in conjunction with the BIO_should_io_special()
|
||||
* condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int
|
||||
* *reason); will walk the BIO stack and return the 'reason' for the special
|
||||
* and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return
|
||||
* the code.
|
||||
*/
|
||||
/*
|
||||
* Returned from the SSL bio when the certificate retrieval code had an error
|
||||
*/
|
||||
# define BIO_RR_SSL_X509_LOOKUP 0x01
|
||||
/* Returned from the connect BIO when a connect would have blocked */
|
||||
# define BIO_RR_CONNECT 0x02
|
||||
/* Returned from the accept BIO when an accept would have blocked */
|
||||
# define BIO_RR_ACCEPT 0x03
|
||||
|
||||
/* These are passed by the BIO callback */
|
||||
# define BIO_CB_FREE 0x01
|
||||
# define BIO_CB_READ 0x02
|
||||
# define BIO_CB_WRITE 0x03
|
||||
# define BIO_CB_PUTS 0x04
|
||||
# define BIO_CB_GETS 0x05
|
||||
# define BIO_CB_CTRL 0x06
|
||||
|
||||
/*
|
||||
* The callback is called before and after the underling operation, The
|
||||
* BIO_CB_RETURN flag indicates if it is after the call
|
||||
*/
|
||||
# define BIO_CB_RETURN 0x80
|
||||
# define BIO_CB_return(a) ((a)|BIO_CB_RETURN)
|
||||
# define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN))
|
||||
# define BIO_cb_post(a) ((a)&BIO_CB_RETURN)
|
||||
|
||||
typedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi,
|
||||
long argl, long ret);
|
||||
typedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp,
|
||||
size_t len, int argi,
|
||||
long argl, int ret, size_t *processed);
|
||||
BIO_callback_fn BIO_get_callback(const BIO *b);
|
||||
void BIO_set_callback(BIO *b, BIO_callback_fn callback);
|
||||
|
||||
BIO_callback_fn_ex BIO_get_callback_ex(const BIO *b);
|
||||
void BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback);
|
||||
|
||||
char *BIO_get_callback_arg(const BIO *b);
|
||||
void BIO_set_callback_arg(BIO *b, char *arg);
|
||||
|
||||
typedef struct bio_method_st BIO_METHOD;
|
||||
|
||||
const char *BIO_method_name(const BIO *b);
|
||||
int BIO_method_type(const BIO *b);
|
||||
|
||||
typedef int BIO_info_cb(BIO *, int, int);
|
||||
typedef BIO_info_cb bio_info_cb; /* backward compatibility */
|
||||
|
||||
DEFINE_STACK_OF(BIO)
|
||||
|
||||
/* Prefix and suffix callback in ASN1 BIO */
|
||||
typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen,
|
||||
void *parg);
|
||||
|
||||
# ifndef OPENSSL_NO_SCTP
|
||||
/* SCTP parameter structs */
|
||||
struct bio_dgram_sctp_sndinfo {
|
||||
uint16_t snd_sid;
|
||||
uint16_t snd_flags;
|
||||
uint32_t snd_ppid;
|
||||
uint32_t snd_context;
|
||||
};
|
||||
|
||||
struct bio_dgram_sctp_rcvinfo {
|
||||
uint16_t rcv_sid;
|
||||
uint16_t rcv_ssn;
|
||||
uint16_t rcv_flags;
|
||||
uint32_t rcv_ppid;
|
||||
uint32_t rcv_tsn;
|
||||
uint32_t rcv_cumtsn;
|
||||
uint32_t rcv_context;
|
||||
};
|
||||
|
||||
struct bio_dgram_sctp_prinfo {
|
||||
uint16_t pr_policy;
|
||||
uint32_t pr_value;
|
||||
};
|
||||
# endif
|
||||
|
||||
/*
|
||||
* #define BIO_CONN_get_param_hostname BIO_ctrl
|
||||
*/
|
||||
|
||||
# define BIO_C_SET_CONNECT 100
|
||||
# define BIO_C_DO_STATE_MACHINE 101
|
||||
# define BIO_C_SET_NBIO 102
|
||||
/* # define BIO_C_SET_PROXY_PARAM 103 */
|
||||
# define BIO_C_SET_FD 104
|
||||
# define BIO_C_GET_FD 105
|
||||
# define BIO_C_SET_FILE_PTR 106
|
||||
# define BIO_C_GET_FILE_PTR 107
|
||||
# define BIO_C_SET_FILENAME 108
|
||||
# define BIO_C_SET_SSL 109
|
||||
# define BIO_C_GET_SSL 110
|
||||
# define BIO_C_SET_MD 111
|
||||
# define BIO_C_GET_MD 112
|
||||
# define BIO_C_GET_CIPHER_STATUS 113
|
||||
# define BIO_C_SET_BUF_MEM 114
|
||||
# define BIO_C_GET_BUF_MEM_PTR 115
|
||||
# define BIO_C_GET_BUFF_NUM_LINES 116
|
||||
# define BIO_C_SET_BUFF_SIZE 117
|
||||
# define BIO_C_SET_ACCEPT 118
|
||||
# define BIO_C_SSL_MODE 119
|
||||
# define BIO_C_GET_MD_CTX 120
|
||||
/* # define BIO_C_GET_PROXY_PARAM 121 */
|
||||
# define BIO_C_SET_BUFF_READ_DATA 122/* data to read first */
|
||||
# define BIO_C_GET_CONNECT 123
|
||||
# define BIO_C_GET_ACCEPT 124
|
||||
# define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125
|
||||
# define BIO_C_GET_SSL_NUM_RENEGOTIATES 126
|
||||
# define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127
|
||||
# define BIO_C_FILE_SEEK 128
|
||||
# define BIO_C_GET_CIPHER_CTX 129
|
||||
# define BIO_C_SET_BUF_MEM_EOF_RETURN 130/* return end of input
|
||||
* value */
|
||||
# define BIO_C_SET_BIND_MODE 131
|
||||
# define BIO_C_GET_BIND_MODE 132
|
||||
# define BIO_C_FILE_TELL 133
|
||||
# define BIO_C_GET_SOCKS 134
|
||||
# define BIO_C_SET_SOCKS 135
|
||||
|
||||
# define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */
|
||||
# define BIO_C_GET_WRITE_BUF_SIZE 137
|
||||
# define BIO_C_MAKE_BIO_PAIR 138
|
||||
# define BIO_C_DESTROY_BIO_PAIR 139
|
||||
# define BIO_C_GET_WRITE_GUARANTEE 140
|
||||
# define BIO_C_GET_READ_REQUEST 141
|
||||
# define BIO_C_SHUTDOWN_WR 142
|
||||
# define BIO_C_NREAD0 143
|
||||
# define BIO_C_NREAD 144
|
||||
# define BIO_C_NWRITE0 145
|
||||
# define BIO_C_NWRITE 146
|
||||
# define BIO_C_RESET_READ_REQUEST 147
|
||||
# define BIO_C_SET_MD_CTX 148
|
||||
|
||||
# define BIO_C_SET_PREFIX 149
|
||||
# define BIO_C_GET_PREFIX 150
|
||||
# define BIO_C_SET_SUFFIX 151
|
||||
# define BIO_C_GET_SUFFIX 152
|
||||
|
||||
# define BIO_C_SET_EX_ARG 153
|
||||
# define BIO_C_GET_EX_ARG 154
|
||||
|
||||
# define BIO_C_SET_CONNECT_MODE 155
|
||||
|
||||
# define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg)
|
||||
# define BIO_get_app_data(s) BIO_get_ex_data(s,0)
|
||||
|
||||
# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)
|
||||
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
/* IP families we support, for BIO_s_connect() and BIO_s_accept() */
|
||||
/* Note: the underlying operating system may not support some of them */
|
||||
# define BIO_FAMILY_IPV4 4
|
||||
# define BIO_FAMILY_IPV6 6
|
||||
# define BIO_FAMILY_IPANY 256
|
||||
|
||||
/* BIO_s_connect() */
|
||||
# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0, \
|
||||
(char *)(name))
|
||||
# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1, \
|
||||
(char *)(port))
|
||||
# define BIO_set_conn_address(b,addr) BIO_ctrl(b,BIO_C_SET_CONNECT,2, \
|
||||
(char *)(addr))
|
||||
# define BIO_set_conn_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,f)
|
||||
# define BIO_get_conn_hostname(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0))
|
||||
# define BIO_get_conn_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1))
|
||||
# define BIO_get_conn_address(b) ((const BIO_ADDR *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2))
|
||||
# define BIO_get_conn_ip_family(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL)
|
||||
# define BIO_set_conn_mode(b,n) BIO_ctrl(b,BIO_C_SET_CONNECT_MODE,(n),NULL)
|
||||
|
||||
/* BIO_s_accept() */
|
||||
# define BIO_set_accept_name(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0, \
|
||||
(char *)(name))
|
||||
# define BIO_set_accept_port(b,port) BIO_ctrl(b,BIO_C_SET_ACCEPT,1, \
|
||||
(char *)(port))
|
||||
# define BIO_get_accept_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0))
|
||||
# define BIO_get_accept_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,1))
|
||||
# define BIO_get_peer_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,2))
|
||||
# define BIO_get_peer_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,3))
|
||||
/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */
|
||||
# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(n)?(void *)"a":NULL)
|
||||
# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,3, \
|
||||
(char *)(bio))
|
||||
# define BIO_set_accept_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_ACCEPT,4,f)
|
||||
# define BIO_get_accept_ip_family(b) BIO_ctrl(b,BIO_C_GET_ACCEPT,4,NULL)
|
||||
|
||||
/* Aliases kept for backward compatibility */
|
||||
# define BIO_BIND_NORMAL 0
|
||||
# define BIO_BIND_REUSEADDR BIO_SOCK_REUSEADDR
|
||||
# define BIO_BIND_REUSEADDR_IF_UNUSED BIO_SOCK_REUSEADDR
|
||||
# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL)
|
||||
# define BIO_get_bind_mode(b) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL)
|
||||
|
||||
/* BIO_s_accept() and BIO_s_connect() */
|
||||
# define BIO_do_connect(b) BIO_do_handshake(b)
|
||||
# define BIO_do_accept(b) BIO_do_handshake(b)
|
||||
# endif /* OPENSSL_NO_SOCK */
|
||||
|
||||
# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)
|
||||
|
||||
/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */
|
||||
# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd)
|
||||
# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)(c))
|
||||
|
||||
/* BIO_s_file() */
|
||||
# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)(fp))
|
||||
# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)(fpp))
|
||||
|
||||
/* BIO_s_fd() and BIO_s_file() */
|
||||
# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)
|
||||
# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)
|
||||
|
||||
/*
|
||||
* name is cast to lose const, but might be better to route through a
|
||||
* function so we can do it safely
|
||||
*/
|
||||
# ifdef CONST_STRICT
|
||||
/*
|
||||
* If you are wondering why this isn't defined, its because CONST_STRICT is
|
||||
* purely a compile-time kludge to allow const to be checked.
|
||||
*/
|
||||
int BIO_read_filename(BIO *b, const char *name);
|
||||
# else
|
||||
# define BIO_read_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \
|
||||
BIO_CLOSE|BIO_FP_READ,(char *)(name))
|
||||
# endif
|
||||
# define BIO_write_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \
|
||||
BIO_CLOSE|BIO_FP_WRITE,name)
|
||||
# define BIO_append_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \
|
||||
BIO_CLOSE|BIO_FP_APPEND,name)
|
||||
# define BIO_rw_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \
|
||||
BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name)
|
||||
|
||||
/*
|
||||
* WARNING WARNING, this ups the reference count on the read bio of the SSL
|
||||
* structure. This is because the ssl read BIO is now pointed to by the
|
||||
* next_bio field in the bio. So when you free the BIO, make sure you are
|
||||
* doing a BIO_free_all() to catch the underlying BIO.
|
||||
*/
|
||||
# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)(ssl))
|
||||
# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)(sslp))
|
||||
# define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL)
|
||||
# define BIO_set_ssl_renegotiate_bytes(b,num) \
|
||||
BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL)
|
||||
# define BIO_get_num_renegotiates(b) \
|
||||
BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL)
|
||||
# define BIO_set_ssl_renegotiate_timeout(b,seconds) \
|
||||
BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL)
|
||||
|
||||
/* defined in evp.h */
|
||||
/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)(md)) */
|
||||
|
||||
# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)(pp))
|
||||
# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)(bm))
|
||||
# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0, \
|
||||
(char *)(pp))
|
||||
# define BIO_set_mem_eof_return(b,v) \
|
||||
BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL)
|
||||
|
||||
/* For the BIO_f_buffer() type */
|
||||
# define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL)
|
||||
# define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL)
|
||||
# define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0)
|
||||
# define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1)
|
||||
# define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf)
|
||||
|
||||
/* Don't use the next one unless you know what you are doing :-) */
|
||||
# define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret))
|
||||
|
||||
# define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL)
|
||||
# define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL)
|
||||
# define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL)
|
||||
# define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL)
|
||||
# define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL)
|
||||
# define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL)
|
||||
/* ...pending macros have inappropriate return type */
|
||||
size_t BIO_ctrl_pending(BIO *b);
|
||||
size_t BIO_ctrl_wpending(BIO *b);
|
||||
# define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)
|
||||
# define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \
|
||||
cbp)
|
||||
# define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb)
|
||||
|
||||
/* For the BIO_f_buffer() type */
|
||||
# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL)
|
||||
# define BIO_buffer_peek(b,s,l) BIO_ctrl(b,BIO_CTRL_PEEK,(l),(s))
|
||||
|
||||
/* For BIO_s_bio() */
|
||||
# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL)
|
||||
# define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL)
|
||||
# define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2)
|
||||
# define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL)
|
||||
# define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL)
|
||||
/* macros with inappropriate type -- but ...pending macros use int too: */
|
||||
# define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL)
|
||||
# define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL)
|
||||
size_t BIO_ctrl_get_write_guarantee(BIO *b);
|
||||
size_t BIO_ctrl_get_read_request(BIO *b);
|
||||
int BIO_ctrl_reset_read_request(BIO *b);
|
||||
|
||||
/* ctrl macros for dgram */
|
||||
# define BIO_ctrl_dgram_connect(b,peer) \
|
||||
(int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)(peer))
|
||||
# define BIO_ctrl_set_connected(b,peer) \
|
||||
(int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, 0, (char *)(peer))
|
||||
# define BIO_dgram_recv_timedout(b) \
|
||||
(int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL)
|
||||
# define BIO_dgram_send_timedout(b) \
|
||||
(int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL)
|
||||
# define BIO_dgram_get_peer(b,peer) \
|
||||
(int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)(peer))
|
||||
# define BIO_dgram_set_peer(b,peer) \
|
||||
(int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)(peer))
|
||||
# define BIO_dgram_get_mtu_overhead(b) \
|
||||
(unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL)
|
||||
|
||||
#define BIO_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, l, p, newf, dupf, freef)
|
||||
int BIO_set_ex_data(BIO *bio, int idx, void *data);
|
||||
void *BIO_get_ex_data(BIO *bio, int idx);
|
||||
uint64_t BIO_number_read(BIO *bio);
|
||||
uint64_t BIO_number_written(BIO *bio);
|
||||
|
||||
/* For BIO_f_asn1() */
|
||||
int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix,
|
||||
asn1_ps_func *prefix_free);
|
||||
int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix,
|
||||
asn1_ps_func **pprefix_free);
|
||||
int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix,
|
||||
asn1_ps_func *suffix_free);
|
||||
int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,
|
||||
asn1_ps_func **psuffix_free);
|
||||
|
||||
const BIO_METHOD *BIO_s_file(void);
|
||||
BIO *BIO_new_file(const char *filename, const char *mode);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
BIO *BIO_new_fp(FILE *stream, int close_flag);
|
||||
# endif
|
||||
BIO *BIO_new(const BIO_METHOD *type);
|
||||
int BIO_free(BIO *a);
|
||||
void BIO_set_data(BIO *a, void *ptr);
|
||||
void *BIO_get_data(BIO *a);
|
||||
void BIO_set_init(BIO *a, int init);
|
||||
int BIO_get_init(BIO *a);
|
||||
void BIO_set_shutdown(BIO *a, int shut);
|
||||
int BIO_get_shutdown(BIO *a);
|
||||
void BIO_vfree(BIO *a);
|
||||
int BIO_up_ref(BIO *a);
|
||||
int BIO_read(BIO *b, void *data, int dlen);
|
||||
int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes);
|
||||
int BIO_gets(BIO *bp, char *buf, int size);
|
||||
int BIO_write(BIO *b, const void *data, int dlen);
|
||||
int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written);
|
||||
int BIO_puts(BIO *bp, const char *buf);
|
||||
int BIO_indent(BIO *b, int indent, int max);
|
||||
long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg);
|
||||
long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp);
|
||||
void *BIO_ptr_ctrl(BIO *bp, int cmd, long larg);
|
||||
long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg);
|
||||
BIO *BIO_push(BIO *b, BIO *append);
|
||||
BIO *BIO_pop(BIO *b);
|
||||
void BIO_free_all(BIO *a);
|
||||
BIO *BIO_find_type(BIO *b, int bio_type);
|
||||
BIO *BIO_next(BIO *b);
|
||||
void BIO_set_next(BIO *b, BIO *next);
|
||||
BIO *BIO_get_retry_BIO(BIO *bio, int *reason);
|
||||
int BIO_get_retry_reason(BIO *bio);
|
||||
void BIO_set_retry_reason(BIO *bio, int reason);
|
||||
BIO *BIO_dup_chain(BIO *in);
|
||||
|
||||
int BIO_nread0(BIO *bio, char **buf);
|
||||
int BIO_nread(BIO *bio, char **buf, int num);
|
||||
int BIO_nwrite0(BIO *bio, char **buf);
|
||||
int BIO_nwrite(BIO *bio, char **buf, int num);
|
||||
|
||||
long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi,
|
||||
long argl, long ret);
|
||||
|
||||
const BIO_METHOD *BIO_s_mem(void);
|
||||
const BIO_METHOD *BIO_s_secmem(void);
|
||||
BIO *BIO_new_mem_buf(const void *buf, int len);
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
const BIO_METHOD *BIO_s_socket(void);
|
||||
const BIO_METHOD *BIO_s_connect(void);
|
||||
const BIO_METHOD *BIO_s_accept(void);
|
||||
# endif
|
||||
const BIO_METHOD *BIO_s_fd(void);
|
||||
const BIO_METHOD *BIO_s_log(void);
|
||||
const BIO_METHOD *BIO_s_bio(void);
|
||||
const BIO_METHOD *BIO_s_null(void);
|
||||
const BIO_METHOD *BIO_f_null(void);
|
||||
const BIO_METHOD *BIO_f_buffer(void);
|
||||
const BIO_METHOD *BIO_f_linebuffer(void);
|
||||
const BIO_METHOD *BIO_f_nbio_test(void);
|
||||
# ifndef OPENSSL_NO_DGRAM
|
||||
const BIO_METHOD *BIO_s_datagram(void);
|
||||
int BIO_dgram_non_fatal_error(int error);
|
||||
BIO *BIO_new_dgram(int fd, int close_flag);
|
||||
# ifndef OPENSSL_NO_SCTP
|
||||
const BIO_METHOD *BIO_s_datagram_sctp(void);
|
||||
BIO *BIO_new_dgram_sctp(int fd, int close_flag);
|
||||
int BIO_dgram_is_sctp(BIO *bio);
|
||||
int BIO_dgram_sctp_notification_cb(BIO *b,
|
||||
void (*handle_notifications) (BIO *bio,
|
||||
void *context,
|
||||
void *buf),
|
||||
void *context);
|
||||
int BIO_dgram_sctp_wait_for_dry(BIO *b);
|
||||
int BIO_dgram_sctp_msg_waiting(BIO *b);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
int BIO_sock_should_retry(int i);
|
||||
int BIO_sock_non_fatal_error(int error);
|
||||
# endif
|
||||
|
||||
int BIO_fd_should_retry(int i);
|
||||
int BIO_fd_non_fatal_error(int error);
|
||||
int BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u),
|
||||
void *u, const char *s, int len);
|
||||
int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u),
|
||||
void *u, const char *s, int len, int indent);
|
||||
int BIO_dump(BIO *b, const char *bytes, int len);
|
||||
int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int BIO_dump_fp(FILE *fp, const char *s, int len);
|
||||
int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent);
|
||||
# endif
|
||||
int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data,
|
||||
int datalen);
|
||||
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
BIO_ADDR *BIO_ADDR_new(void);
|
||||
int BIO_ADDR_rawmake(BIO_ADDR *ap, int family,
|
||||
const void *where, size_t wherelen, unsigned short port);
|
||||
void BIO_ADDR_free(BIO_ADDR *);
|
||||
void BIO_ADDR_clear(BIO_ADDR *ap);
|
||||
int BIO_ADDR_family(const BIO_ADDR *ap);
|
||||
int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l);
|
||||
unsigned short BIO_ADDR_rawport(const BIO_ADDR *ap);
|
||||
char *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric);
|
||||
char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric);
|
||||
char *BIO_ADDR_path_string(const BIO_ADDR *ap);
|
||||
|
||||
const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai);
|
||||
int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai);
|
||||
int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai);
|
||||
int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai);
|
||||
const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai);
|
||||
void BIO_ADDRINFO_free(BIO_ADDRINFO *bai);
|
||||
|
||||
enum BIO_hostserv_priorities {
|
||||
BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV
|
||||
};
|
||||
int BIO_parse_hostserv(const char *hostserv, char **host, char **service,
|
||||
enum BIO_hostserv_priorities hostserv_prio);
|
||||
enum BIO_lookup_type {
|
||||
BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER
|
||||
};
|
||||
int BIO_lookup(const char *host, const char *service,
|
||||
enum BIO_lookup_type lookup_type,
|
||||
int family, int socktype, BIO_ADDRINFO **res);
|
||||
int BIO_lookup_ex(const char *host, const char *service,
|
||||
int lookup_type, int family, int socktype, int protocol,
|
||||
BIO_ADDRINFO **res);
|
||||
int BIO_sock_error(int sock);
|
||||
int BIO_socket_ioctl(int fd, long type, void *arg);
|
||||
int BIO_socket_nbio(int fd, int mode);
|
||||
int BIO_sock_init(void);
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define BIO_sock_cleanup() while(0) continue
|
||||
# endif
|
||||
int BIO_set_tcp_ndelay(int sock, int turn_on);
|
||||
|
||||
DEPRECATEDIN_1_1_0(struct hostent *BIO_gethostbyname(const char *name))
|
||||
DEPRECATEDIN_1_1_0(int BIO_get_port(const char *str, unsigned short *port_ptr))
|
||||
DEPRECATEDIN_1_1_0(int BIO_get_host_ip(const char *str, unsigned char *ip))
|
||||
DEPRECATEDIN_1_1_0(int BIO_get_accept_socket(char *host_port, int mode))
|
||||
DEPRECATEDIN_1_1_0(int BIO_accept(int sock, char **ip_port))
|
||||
|
||||
union BIO_sock_info_u {
|
||||
BIO_ADDR *addr;
|
||||
};
|
||||
enum BIO_sock_info_type {
|
||||
BIO_SOCK_INFO_ADDRESS
|
||||
};
|
||||
int BIO_sock_info(int sock,
|
||||
enum BIO_sock_info_type type, union BIO_sock_info_u *info);
|
||||
|
||||
# define BIO_SOCK_REUSEADDR 0x01
|
||||
# define BIO_SOCK_V6_ONLY 0x02
|
||||
# define BIO_SOCK_KEEPALIVE 0x04
|
||||
# define BIO_SOCK_NONBLOCK 0x08
|
||||
# define BIO_SOCK_NODELAY 0x10
|
||||
|
||||
int BIO_socket(int domain, int socktype, int protocol, int options);
|
||||
int BIO_connect(int sock, const BIO_ADDR *addr, int options);
|
||||
int BIO_bind(int sock, const BIO_ADDR *addr, int options);
|
||||
int BIO_listen(int sock, const BIO_ADDR *addr, int options);
|
||||
int BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options);
|
||||
int BIO_closesocket(int sock);
|
||||
|
||||
BIO *BIO_new_socket(int sock, int close_flag);
|
||||
BIO *BIO_new_connect(const char *host_port);
|
||||
BIO *BIO_new_accept(const char *host_port);
|
||||
# endif /* OPENSSL_NO_SOCK*/
|
||||
|
||||
BIO *BIO_new_fd(int fd, int close_flag);
|
||||
|
||||
int BIO_new_bio_pair(BIO **bio1, size_t writebuf1,
|
||||
BIO **bio2, size_t writebuf2);
|
||||
/*
|
||||
* If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints.
|
||||
* Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default
|
||||
* value.
|
||||
*/
|
||||
|
||||
void BIO_copy_next_retry(BIO *b);
|
||||
|
||||
/*
|
||||
* long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);
|
||||
*/
|
||||
|
||||
# define ossl_bio__attr__(x)
|
||||
# if defined(__GNUC__) && defined(__STDC_VERSION__) \
|
||||
&& !defined(__APPLE__)
|
||||
/*
|
||||
* Because we support the 'z' modifier, which made its appearance in C99,
|
||||
* we can't use __attribute__ with pre C99 dialects.
|
||||
*/
|
||||
# if __STDC_VERSION__ >= 199901L
|
||||
# undef ossl_bio__attr__
|
||||
# define ossl_bio__attr__ __attribute__
|
||||
# if __GNUC__*10 + __GNUC_MINOR__ >= 44
|
||||
# define ossl_bio__printf__ __gnu_printf__
|
||||
# else
|
||||
# define ossl_bio__printf__ __printf__
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
int BIO_printf(BIO *bio, const char *format, ...)
|
||||
ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3)));
|
||||
int BIO_vprintf(BIO *bio, const char *format, va_list args)
|
||||
ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0)));
|
||||
int BIO_snprintf(char *buf, size_t n, const char *format, ...)
|
||||
ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4)));
|
||||
int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
|
||||
ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0)));
|
||||
# undef ossl_bio__attr__
|
||||
# undef ossl_bio__printf__
|
||||
|
||||
|
||||
BIO_METHOD *BIO_meth_new(int type, const char *name);
|
||||
void BIO_meth_free(BIO_METHOD *biom);
|
||||
int (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int);
|
||||
int (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t,
|
||||
size_t *);
|
||||
int BIO_meth_set_write(BIO_METHOD *biom,
|
||||
int (*write) (BIO *, const char *, int));
|
||||
int BIO_meth_set_write_ex(BIO_METHOD *biom,
|
||||
int (*bwrite) (BIO *, const char *, size_t, size_t *));
|
||||
int (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int);
|
||||
int (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *);
|
||||
int BIO_meth_set_read(BIO_METHOD *biom,
|
||||
int (*read) (BIO *, char *, int));
|
||||
int BIO_meth_set_read_ex(BIO_METHOD *biom,
|
||||
int (*bread) (BIO *, char *, size_t, size_t *));
|
||||
int (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *);
|
||||
int BIO_meth_set_puts(BIO_METHOD *biom,
|
||||
int (*puts) (BIO *, const char *));
|
||||
int (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int);
|
||||
int BIO_meth_set_gets(BIO_METHOD *biom,
|
||||
int (*gets) (BIO *, char *, int));
|
||||
long (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *);
|
||||
int BIO_meth_set_ctrl(BIO_METHOD *biom,
|
||||
long (*ctrl) (BIO *, int, long, void *));
|
||||
int (*BIO_meth_get_create(const BIO_METHOD *bion)) (BIO *);
|
||||
int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *));
|
||||
int (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *);
|
||||
int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *));
|
||||
long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom))
|
||||
(BIO *, int, BIO_info_cb *);
|
||||
int BIO_meth_set_callback_ctrl(BIO_METHOD *biom,
|
||||
long (*callback_ctrl) (BIO *, int,
|
||||
BIO_info_cb *));
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
124
3rdparty/openssl/include/openssl/bioerr.h
vendored
124
3rdparty/openssl/include/openssl/bioerr.h
vendored
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BIOERR_H
|
||||
# define HEADER_BIOERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_BIO_strings(void);
|
||||
|
||||
/*
|
||||
* BIO function codes.
|
||||
*/
|
||||
# define BIO_F_ACPT_STATE 100
|
||||
# define BIO_F_ADDRINFO_WRAP 148
|
||||
# define BIO_F_ADDR_STRINGS 134
|
||||
# define BIO_F_BIO_ACCEPT 101
|
||||
# define BIO_F_BIO_ACCEPT_EX 137
|
||||
# define BIO_F_BIO_ACCEPT_NEW 152
|
||||
# define BIO_F_BIO_ADDR_NEW 144
|
||||
# define BIO_F_BIO_BIND 147
|
||||
# define BIO_F_BIO_CALLBACK_CTRL 131
|
||||
# define BIO_F_BIO_CONNECT 138
|
||||
# define BIO_F_BIO_CONNECT_NEW 153
|
||||
# define BIO_F_BIO_CTRL 103
|
||||
# define BIO_F_BIO_GETS 104
|
||||
# define BIO_F_BIO_GET_HOST_IP 106
|
||||
# define BIO_F_BIO_GET_NEW_INDEX 102
|
||||
# define BIO_F_BIO_GET_PORT 107
|
||||
# define BIO_F_BIO_LISTEN 139
|
||||
# define BIO_F_BIO_LOOKUP 135
|
||||
# define BIO_F_BIO_LOOKUP_EX 143
|
||||
# define BIO_F_BIO_MAKE_PAIR 121
|
||||
# define BIO_F_BIO_METH_NEW 146
|
||||
# define BIO_F_BIO_NEW 108
|
||||
# define BIO_F_BIO_NEW_DGRAM_SCTP 145
|
||||
# define BIO_F_BIO_NEW_FILE 109
|
||||
# define BIO_F_BIO_NEW_MEM_BUF 126
|
||||
# define BIO_F_BIO_NREAD 123
|
||||
# define BIO_F_BIO_NREAD0 124
|
||||
# define BIO_F_BIO_NWRITE 125
|
||||
# define BIO_F_BIO_NWRITE0 122
|
||||
# define BIO_F_BIO_PARSE_HOSTSERV 136
|
||||
# define BIO_F_BIO_PUTS 110
|
||||
# define BIO_F_BIO_READ 111
|
||||
# define BIO_F_BIO_READ_EX 105
|
||||
# define BIO_F_BIO_READ_INTERN 120
|
||||
# define BIO_F_BIO_SOCKET 140
|
||||
# define BIO_F_BIO_SOCKET_NBIO 142
|
||||
# define BIO_F_BIO_SOCK_INFO 141
|
||||
# define BIO_F_BIO_SOCK_INIT 112
|
||||
# define BIO_F_BIO_WRITE 113
|
||||
# define BIO_F_BIO_WRITE_EX 119
|
||||
# define BIO_F_BIO_WRITE_INTERN 128
|
||||
# define BIO_F_BUFFER_CTRL 114
|
||||
# define BIO_F_CONN_CTRL 127
|
||||
# define BIO_F_CONN_STATE 115
|
||||
# define BIO_F_DGRAM_SCTP_NEW 149
|
||||
# define BIO_F_DGRAM_SCTP_READ 132
|
||||
# define BIO_F_DGRAM_SCTP_WRITE 133
|
||||
# define BIO_F_DOAPR_OUTCH 150
|
||||
# define BIO_F_FILE_CTRL 116
|
||||
# define BIO_F_FILE_READ 130
|
||||
# define BIO_F_LINEBUFFER_CTRL 129
|
||||
# define BIO_F_LINEBUFFER_NEW 151
|
||||
# define BIO_F_MEM_WRITE 117
|
||||
# define BIO_F_NBIOF_NEW 154
|
||||
# define BIO_F_SLG_WRITE 155
|
||||
# define BIO_F_SSL_NEW 118
|
||||
|
||||
/*
|
||||
* BIO reason codes.
|
||||
*/
|
||||
# define BIO_R_ACCEPT_ERROR 100
|
||||
# define BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET 141
|
||||
# define BIO_R_AMBIGUOUS_HOST_OR_SERVICE 129
|
||||
# define BIO_R_BAD_FOPEN_MODE 101
|
||||
# define BIO_R_BROKEN_PIPE 124
|
||||
# define BIO_R_CONNECT_ERROR 103
|
||||
# define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107
|
||||
# define BIO_R_GETSOCKNAME_ERROR 132
|
||||
# define BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS 133
|
||||
# define BIO_R_GETTING_SOCKTYPE 134
|
||||
# define BIO_R_INVALID_ARGUMENT 125
|
||||
# define BIO_R_INVALID_SOCKET 135
|
||||
# define BIO_R_IN_USE 123
|
||||
# define BIO_R_LENGTH_TOO_LONG 102
|
||||
# define BIO_R_LISTEN_V6_ONLY 136
|
||||
# define BIO_R_LOOKUP_RETURNED_NOTHING 142
|
||||
# define BIO_R_MALFORMED_HOST_OR_SERVICE 130
|
||||
# define BIO_R_NBIO_CONNECT_ERROR 110
|
||||
# define BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED 143
|
||||
# define BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED 144
|
||||
# define BIO_R_NO_PORT_DEFINED 113
|
||||
# define BIO_R_NO_SUCH_FILE 128
|
||||
# define BIO_R_NULL_PARAMETER 115
|
||||
# define BIO_R_UNABLE_TO_BIND_SOCKET 117
|
||||
# define BIO_R_UNABLE_TO_CREATE_SOCKET 118
|
||||
# define BIO_R_UNABLE_TO_KEEPALIVE 137
|
||||
# define BIO_R_UNABLE_TO_LISTEN_SOCKET 119
|
||||
# define BIO_R_UNABLE_TO_NODELAY 138
|
||||
# define BIO_R_UNABLE_TO_REUSEADDR 139
|
||||
# define BIO_R_UNAVAILABLE_IP_FAMILY 145
|
||||
# define BIO_R_UNINITIALIZED 120
|
||||
# define BIO_R_UNKNOWN_INFO_TYPE 140
|
||||
# define BIO_R_UNSUPPORTED_IP_FAMILY 146
|
||||
# define BIO_R_UNSUPPORTED_METHOD 121
|
||||
# define BIO_R_UNSUPPORTED_PROTOCOL_FAMILY 131
|
||||
# define BIO_R_WRITE_TO_READ_ONLY_BIO 126
|
||||
# define BIO_R_WSASTARTUP 122
|
||||
|
||||
#endif
|
||||
61
3rdparty/openssl/include/openssl/blowfish.h
vendored
61
3rdparty/openssl/include/openssl/blowfish.h
vendored
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BLOWFISH_H
|
||||
# define HEADER_BLOWFISH_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_BF
|
||||
# include <openssl/e_os2.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define BF_ENCRYPT 1
|
||||
# define BF_DECRYPT 0
|
||||
|
||||
/*-
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* ! BF_LONG has to be at least 32 bits wide. !
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*/
|
||||
# define BF_LONG unsigned int
|
||||
|
||||
# define BF_ROUNDS 16
|
||||
# define BF_BLOCK 8
|
||||
|
||||
typedef struct bf_key_st {
|
||||
BF_LONG P[BF_ROUNDS + 2];
|
||||
BF_LONG S[4 * 256];
|
||||
} BF_KEY;
|
||||
|
||||
void BF_set_key(BF_KEY *key, int len, const unsigned char *data);
|
||||
|
||||
void BF_encrypt(BF_LONG *data, const BF_KEY *key);
|
||||
void BF_decrypt(BF_LONG *data, const BF_KEY *key);
|
||||
|
||||
void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const BF_KEY *key, int enc);
|
||||
void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
|
||||
const BF_KEY *schedule, unsigned char *ivec, int enc);
|
||||
void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, const BF_KEY *schedule,
|
||||
unsigned char *ivec, int *num, int enc);
|
||||
void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, const BF_KEY *schedule,
|
||||
unsigned char *ivec, int *num);
|
||||
const char *BF_options(void);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
539
3rdparty/openssl/include/openssl/bn.h
vendored
539
3rdparty/openssl/include/openssl/bn.h
vendored
@@ -1,539 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BN_H
|
||||
# define HEADER_BN_H
|
||||
|
||||
# include <openssl/e_os2.h>
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/bnerr.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 64-bit processor with LP64 ABI
|
||||
*/
|
||||
# ifdef SIXTY_FOUR_BIT_LONG
|
||||
# define BN_ULONG unsigned long
|
||||
# define BN_BYTES 8
|
||||
# endif
|
||||
|
||||
/*
|
||||
* 64-bit processor other than LP64 ABI
|
||||
*/
|
||||
# ifdef SIXTY_FOUR_BIT
|
||||
# define BN_ULONG unsigned long long
|
||||
# define BN_BYTES 8
|
||||
# endif
|
||||
|
||||
# ifdef THIRTY_TWO_BIT
|
||||
# define BN_ULONG unsigned int
|
||||
# define BN_BYTES 4
|
||||
# endif
|
||||
|
||||
# define BN_BITS2 (BN_BYTES * 8)
|
||||
# define BN_BITS (BN_BITS2 * 2)
|
||||
# define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1))
|
||||
|
||||
# define BN_FLG_MALLOCED 0x01
|
||||
# define BN_FLG_STATIC_DATA 0x02
|
||||
|
||||
/*
|
||||
* avoid leaking exponent information through timing,
|
||||
* BN_mod_exp_mont() will call BN_mod_exp_mont_consttime,
|
||||
* BN_div() will call BN_div_no_branch,
|
||||
* BN_mod_inverse() will call bn_mod_inverse_no_branch.
|
||||
*/
|
||||
# define BN_FLG_CONSTTIME 0x04
|
||||
# define BN_FLG_SECURE 0x08
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x00908000L
|
||||
/* deprecated name for the flag */
|
||||
# define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME
|
||||
# define BN_FLG_FREE 0x8000 /* used for debugging */
|
||||
# endif
|
||||
|
||||
void BN_set_flags(BIGNUM *b, int n);
|
||||
int BN_get_flags(const BIGNUM *b, int n);
|
||||
|
||||
/* Values for |top| in BN_rand() */
|
||||
#define BN_RAND_TOP_ANY -1
|
||||
#define BN_RAND_TOP_ONE 0
|
||||
#define BN_RAND_TOP_TWO 1
|
||||
|
||||
/* Values for |bottom| in BN_rand() */
|
||||
#define BN_RAND_BOTTOM_ANY 0
|
||||
#define BN_RAND_BOTTOM_ODD 1
|
||||
|
||||
/*
|
||||
* get a clone of a BIGNUM with changed flags, for *temporary* use only (the
|
||||
* two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The
|
||||
* value |dest| should be a newly allocated BIGNUM obtained via BN_new() that
|
||||
* has not been otherwise initialised or used.
|
||||
*/
|
||||
void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags);
|
||||
|
||||
/* Wrapper function to make using BN_GENCB easier */
|
||||
int BN_GENCB_call(BN_GENCB *cb, int a, int b);
|
||||
|
||||
BN_GENCB *BN_GENCB_new(void);
|
||||
void BN_GENCB_free(BN_GENCB *cb);
|
||||
|
||||
/* Populate a BN_GENCB structure with an "old"-style callback */
|
||||
void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback) (int, int, void *),
|
||||
void *cb_arg);
|
||||
|
||||
/* Populate a BN_GENCB structure with a "new"-style callback */
|
||||
void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *),
|
||||
void *cb_arg);
|
||||
|
||||
void *BN_GENCB_get_arg(BN_GENCB *cb);
|
||||
|
||||
# define BN_prime_checks 0 /* default: select number of iterations based
|
||||
* on the size of the number */
|
||||
|
||||
/*
|
||||
* BN_prime_checks_for_size() returns the number of Miller-Rabin iterations
|
||||
* that will be done for checking that a random number is probably prime. The
|
||||
* error rate for accepting a composite number as prime depends on the size of
|
||||
* the prime |b|. The error rates used are for calculating an RSA key with 2 primes,
|
||||
* and so the level is what you would expect for a key of double the size of the
|
||||
* prime.
|
||||
*
|
||||
* This table is generated using the algorithm of FIPS PUB 186-4
|
||||
* Digital Signature Standard (DSS), section F.1, page 117.
|
||||
* (https://dx.doi.org/10.6028/NIST.FIPS.186-4)
|
||||
*
|
||||
* The following magma script was used to generate the output:
|
||||
* securitybits:=125;
|
||||
* k:=1024;
|
||||
* for t:=1 to 65 do
|
||||
* for M:=3 to Floor(2*Sqrt(k-1)-1) do
|
||||
* S:=0;
|
||||
* // Sum over m
|
||||
* for m:=3 to M do
|
||||
* s:=0;
|
||||
* // Sum over j
|
||||
* for j:=2 to m do
|
||||
* s+:=(RealField(32)!2)^-(j+(k-1)/j);
|
||||
* end for;
|
||||
* S+:=2^(m-(m-1)*t)*s;
|
||||
* end for;
|
||||
* A:=2^(k-2-M*t);
|
||||
* B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S;
|
||||
* pkt:=2.00743*Log(2)*k*2^-k*(A+B);
|
||||
* seclevel:=Floor(-Log(2,pkt));
|
||||
* if seclevel ge securitybits then
|
||||
* printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M;
|
||||
* break;
|
||||
* end if;
|
||||
* end for;
|
||||
* if seclevel ge securitybits then break; end if;
|
||||
* end for;
|
||||
*
|
||||
* It can be run online at:
|
||||
* http://magma.maths.usyd.edu.au/calc
|
||||
*
|
||||
* And will output:
|
||||
* k: 1024, security: 129 bits (t: 6, M: 23)
|
||||
*
|
||||
* k is the number of bits of the prime, securitybits is the level we want to
|
||||
* reach.
|
||||
*
|
||||
* prime length | RSA key size | # MR tests | security level
|
||||
* -------------+--------------|------------+---------------
|
||||
* (b) >= 6394 | >= 12788 | 3 | 256 bit
|
||||
* (b) >= 3747 | >= 7494 | 3 | 192 bit
|
||||
* (b) >= 1345 | >= 2690 | 4 | 128 bit
|
||||
* (b) >= 1080 | >= 2160 | 5 | 128 bit
|
||||
* (b) >= 852 | >= 1704 | 5 | 112 bit
|
||||
* (b) >= 476 | >= 952 | 5 | 80 bit
|
||||
* (b) >= 400 | >= 800 | 6 | 80 bit
|
||||
* (b) >= 347 | >= 694 | 7 | 80 bit
|
||||
* (b) >= 308 | >= 616 | 8 | 80 bit
|
||||
* (b) >= 55 | >= 110 | 27 | 64 bit
|
||||
* (b) >= 6 | >= 12 | 34 | 64 bit
|
||||
*/
|
||||
|
||||
# define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \
|
||||
(b) >= 1345 ? 4 : \
|
||||
(b) >= 476 ? 5 : \
|
||||
(b) >= 400 ? 6 : \
|
||||
(b) >= 347 ? 7 : \
|
||||
(b) >= 308 ? 8 : \
|
||||
(b) >= 55 ? 27 : \
|
||||
/* b >= 6 */ 34)
|
||||
|
||||
# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
|
||||
|
||||
int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);
|
||||
int BN_is_zero(const BIGNUM *a);
|
||||
int BN_is_one(const BIGNUM *a);
|
||||
int BN_is_word(const BIGNUM *a, const BN_ULONG w);
|
||||
int BN_is_odd(const BIGNUM *a);
|
||||
|
||||
# define BN_one(a) (BN_set_word((a),1))
|
||||
|
||||
void BN_zero_ex(BIGNUM *a);
|
||||
|
||||
# if OPENSSL_API_COMPAT >= 0x00908000L
|
||||
# define BN_zero(a) BN_zero_ex(a)
|
||||
# else
|
||||
# define BN_zero(a) (BN_set_word((a),0))
|
||||
# endif
|
||||
|
||||
const BIGNUM *BN_value_one(void);
|
||||
char *BN_options(void);
|
||||
BN_CTX *BN_CTX_new(void);
|
||||
BN_CTX *BN_CTX_secure_new(void);
|
||||
void BN_CTX_free(BN_CTX *c);
|
||||
void BN_CTX_start(BN_CTX *ctx);
|
||||
BIGNUM *BN_CTX_get(BN_CTX *ctx);
|
||||
void BN_CTX_end(BN_CTX *ctx);
|
||||
int BN_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
int BN_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||
int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||
int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||
int BN_num_bits(const BIGNUM *a);
|
||||
int BN_num_bits_word(BN_ULONG l);
|
||||
int BN_security_bits(int L, int N);
|
||||
BIGNUM *BN_new(void);
|
||||
BIGNUM *BN_secure_new(void);
|
||||
void BN_clear_free(BIGNUM *a);
|
||||
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
|
||||
void BN_swap(BIGNUM *a, BIGNUM *b);
|
||||
BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
int BN_bn2bin(const BIGNUM *a, unsigned char *to);
|
||||
int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen);
|
||||
BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen);
|
||||
BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
int BN_bn2mpi(const BIGNUM *a, unsigned char *to);
|
||||
int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
|
||||
int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx);
|
||||
/** BN_set_negative sets sign of a BIGNUM
|
||||
* \param b pointer to the BIGNUM object
|
||||
* \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise
|
||||
*/
|
||||
void BN_set_negative(BIGNUM *b, int n);
|
||||
/** BN_is_negative returns 1 if the BIGNUM is negative
|
||||
* \param b pointer to the BIGNUM object
|
||||
* \return 1 if a < 0 and 0 otherwise
|
||||
*/
|
||||
int BN_is_negative(const BIGNUM *b);
|
||||
|
||||
int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
|
||||
BN_CTX *ctx);
|
||||
# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
|
||||
int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
|
||||
int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
|
||||
BN_CTX *ctx);
|
||||
int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const BIGNUM *m);
|
||||
int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
|
||||
BN_CTX *ctx);
|
||||
int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const BIGNUM *m);
|
||||
int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
|
||||
BN_CTX *ctx);
|
||||
int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
|
||||
int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
|
||||
int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m);
|
||||
int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m,
|
||||
BN_CTX *ctx);
|
||||
int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m);
|
||||
|
||||
BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
|
||||
BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
|
||||
int BN_mul_word(BIGNUM *a, BN_ULONG w);
|
||||
int BN_add_word(BIGNUM *a, BN_ULONG w);
|
||||
int BN_sub_word(BIGNUM *a, BN_ULONG w);
|
||||
int BN_set_word(BIGNUM *a, BN_ULONG w);
|
||||
BN_ULONG BN_get_word(const BIGNUM *a);
|
||||
|
||||
int BN_cmp(const BIGNUM *a, const BIGNUM *b);
|
||||
void BN_free(BIGNUM *a);
|
||||
int BN_is_bit_set(const BIGNUM *a, int n);
|
||||
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n);
|
||||
int BN_lshift1(BIGNUM *r, const BIGNUM *a);
|
||||
int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
|
||||
int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx);
|
||||
int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||
int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx,
|
||||
BN_MONT_CTX *in_mont);
|
||||
int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||
int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,
|
||||
const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m,
|
||||
BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||
int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx);
|
||||
|
||||
int BN_mask_bits(BIGNUM *a, int n);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int BN_print_fp(FILE *fp, const BIGNUM *a);
|
||||
# endif
|
||||
int BN_print(BIO *bio, const BIGNUM *a);
|
||||
int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);
|
||||
int BN_rshift(BIGNUM *r, const BIGNUM *a, int n);
|
||||
int BN_rshift1(BIGNUM *r, const BIGNUM *a);
|
||||
void BN_clear(BIGNUM *a);
|
||||
BIGNUM *BN_dup(const BIGNUM *a);
|
||||
int BN_ucmp(const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_set_bit(BIGNUM *a, int n);
|
||||
int BN_clear_bit(BIGNUM *a, int n);
|
||||
char *BN_bn2hex(const BIGNUM *a);
|
||||
char *BN_bn2dec(const BIGNUM *a);
|
||||
int BN_hex2bn(BIGNUM **a, const char *str);
|
||||
int BN_dec2bn(BIGNUM **a, const char *str);
|
||||
int BN_asc2bn(BIGNUM **a, const char *str);
|
||||
int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
|
||||
int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns
|
||||
* -2 for
|
||||
* error */
|
||||
BIGNUM *BN_mod_inverse(BIGNUM *ret,
|
||||
const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
|
||||
BIGNUM *BN_mod_sqrt(BIGNUM *ret,
|
||||
const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
|
||||
|
||||
void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
|
||||
|
||||
/* Deprecated versions */
|
||||
DEPRECATEDIN_0_9_8(BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
|
||||
const BIGNUM *add,
|
||||
const BIGNUM *rem,
|
||||
void (*callback) (int, int,
|
||||
void *),
|
||||
void *cb_arg))
|
||||
DEPRECATEDIN_0_9_8(int
|
||||
BN_is_prime(const BIGNUM *p, int nchecks,
|
||||
void (*callback) (int, int, void *),
|
||||
BN_CTX *ctx, void *cb_arg))
|
||||
DEPRECATEDIN_0_9_8(int
|
||||
BN_is_prime_fasttest(const BIGNUM *p, int nchecks,
|
||||
void (*callback) (int, int, void *),
|
||||
BN_CTX *ctx, void *cb_arg,
|
||||
int do_trial_division))
|
||||
|
||||
/* Newer versions */
|
||||
int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add,
|
||||
const BIGNUM *rem, BN_GENCB *cb);
|
||||
int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb);
|
||||
int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx,
|
||||
int do_trial_division, BN_GENCB *cb);
|
||||
|
||||
int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx);
|
||||
|
||||
int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,
|
||||
const BIGNUM *Xp, const BIGNUM *Xp1,
|
||||
const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx,
|
||||
BN_GENCB *cb);
|
||||
int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1,
|
||||
BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e,
|
||||
BN_CTX *ctx, BN_GENCB *cb);
|
||||
|
||||
BN_MONT_CTX *BN_MONT_CTX_new(void);
|
||||
int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
BN_MONT_CTX *mont, BN_CTX *ctx);
|
||||
int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||
BN_CTX *ctx);
|
||||
int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||
BN_CTX *ctx);
|
||||
void BN_MONT_CTX_free(BN_MONT_CTX *mont);
|
||||
int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx);
|
||||
BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from);
|
||||
BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock,
|
||||
const BIGNUM *mod, BN_CTX *ctx);
|
||||
|
||||
/* BN_BLINDING flags */
|
||||
# define BN_BLINDING_NO_UPDATE 0x00000001
|
||||
# define BN_BLINDING_NO_RECREATE 0x00000002
|
||||
|
||||
BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod);
|
||||
void BN_BLINDING_free(BN_BLINDING *b);
|
||||
int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx);
|
||||
int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
|
||||
int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
|
||||
int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
|
||||
int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
|
||||
BN_CTX *);
|
||||
|
||||
int BN_BLINDING_is_current_thread(BN_BLINDING *b);
|
||||
void BN_BLINDING_set_current_thread(BN_BLINDING *b);
|
||||
int BN_BLINDING_lock(BN_BLINDING *b);
|
||||
int BN_BLINDING_unlock(BN_BLINDING *b);
|
||||
|
||||
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
|
||||
void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
|
||||
BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
|
||||
const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
|
||||
int (*bn_mod_exp) (BIGNUM *r,
|
||||
const BIGNUM *a,
|
||||
const BIGNUM *p,
|
||||
const BIGNUM *m,
|
||||
BN_CTX *ctx,
|
||||
BN_MONT_CTX *m_ctx),
|
||||
BN_MONT_CTX *m_ctx);
|
||||
|
||||
DEPRECATEDIN_0_9_8(void BN_set_params(int mul, int high, int low, int mont))
|
||||
DEPRECATEDIN_0_9_8(int BN_get_params(int which)) /* 0, mul, 1 high, 2 low, 3
|
||||
* mont */
|
||||
|
||||
BN_RECP_CTX *BN_RECP_CTX_new(void);
|
||||
void BN_RECP_CTX_free(BN_RECP_CTX *recp);
|
||||
int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx);
|
||||
int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
|
||||
BN_RECP_CTX *recp, BN_CTX *ctx);
|
||||
int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx);
|
||||
int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
|
||||
BN_RECP_CTX *recp, BN_CTX *ctx);
|
||||
|
||||
# ifndef OPENSSL_NO_EC2M
|
||||
|
||||
/*
|
||||
* Functions for arithmetic over binary polynomials represented by BIGNUMs.
|
||||
* The BIGNUM::neg property of BIGNUMs representing binary polynomials is
|
||||
* ignored. Note that input arguments are not const so that their bit arrays
|
||||
* can be expanded to the appropriate size if needed.
|
||||
*/
|
||||
|
||||
/*
|
||||
* r = a + b
|
||||
*/
|
||||
int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
# define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b)
|
||||
/*
|
||||
* r=a mod p
|
||||
*/
|
||||
int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p);
|
||||
/* r = (a * b) mod p */
|
||||
int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const BIGNUM *p, BN_CTX *ctx);
|
||||
/* r = (a * a) mod p */
|
||||
int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
/* r = (1 / b) mod p */
|
||||
int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx);
|
||||
/* r = (a / b) mod p */
|
||||
int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const BIGNUM *p, BN_CTX *ctx);
|
||||
/* r = (a ^ b) mod p */
|
||||
int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const BIGNUM *p, BN_CTX *ctx);
|
||||
/* r = sqrt(a) mod p */
|
||||
int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
BN_CTX *ctx);
|
||||
/* r^2 + r = a mod p */
|
||||
int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
BN_CTX *ctx);
|
||||
# define BN_GF2m_cmp(a, b) BN_ucmp((a), (b))
|
||||
/*-
|
||||
* Some functions allow for representation of the irreducible polynomials
|
||||
* as an unsigned int[], say p. The irreducible f(t) is then of the form:
|
||||
* t^p[0] + t^p[1] + ... + t^p[k]
|
||||
* where m = p[0] > p[1] > ... > p[k] = 0.
|
||||
*/
|
||||
/* r = a mod p */
|
||||
int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]);
|
||||
/* r = (a * b) mod p */
|
||||
int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const int p[], BN_CTX *ctx);
|
||||
/* r = (a * a) mod p */
|
||||
int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[],
|
||||
BN_CTX *ctx);
|
||||
/* r = (1 / b) mod p */
|
||||
int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[],
|
||||
BN_CTX *ctx);
|
||||
/* r = (a / b) mod p */
|
||||
int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const int p[], BN_CTX *ctx);
|
||||
/* r = (a ^ b) mod p */
|
||||
int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const int p[], BN_CTX *ctx);
|
||||
/* r = sqrt(a) mod p */
|
||||
int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,
|
||||
const int p[], BN_CTX *ctx);
|
||||
/* r^2 + r = a mod p */
|
||||
int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,
|
||||
const int p[], BN_CTX *ctx);
|
||||
int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max);
|
||||
int BN_GF2m_arr2poly(const int p[], BIGNUM *a);
|
||||
|
||||
# endif
|
||||
|
||||
/*
|
||||
* faster mod functions for the 'NIST primes' 0 <= a < p^2
|
||||
*/
|
||||
int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
|
||||
const BIGNUM *BN_get0_nist_prime_192(void);
|
||||
const BIGNUM *BN_get0_nist_prime_224(void);
|
||||
const BIGNUM *BN_get0_nist_prime_256(void);
|
||||
const BIGNUM *BN_get0_nist_prime_384(void);
|
||||
const BIGNUM *BN_get0_nist_prime_521(void);
|
||||
|
||||
int (*BN_nist_mod_func(const BIGNUM *p)) (BIGNUM *r, const BIGNUM *a,
|
||||
const BIGNUM *field, BN_CTX *ctx);
|
||||
|
||||
int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,
|
||||
const BIGNUM *priv, const unsigned char *message,
|
||||
size_t message_len, BN_CTX *ctx);
|
||||
|
||||
/* Primes from RFC 2409 */
|
||||
BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn);
|
||||
|
||||
/* Primes from RFC 3526 */
|
||||
BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn);
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define get_rfc2409_prime_768 BN_get_rfc2409_prime_768
|
||||
# define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024
|
||||
# define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536
|
||||
# define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048
|
||||
# define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072
|
||||
# define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096
|
||||
# define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144
|
||||
# define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192
|
||||
# endif
|
||||
|
||||
int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
101
3rdparty/openssl/include/openssl/bnerr.h
vendored
101
3rdparty/openssl/include/openssl/bnerr.h
vendored
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BNERR_H
|
||||
# define HEADER_BNERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_BN_strings(void);
|
||||
|
||||
/*
|
||||
* BN function codes.
|
||||
*/
|
||||
# define BN_F_BNRAND 127
|
||||
# define BN_F_BNRAND_RANGE 138
|
||||
# define BN_F_BN_BLINDING_CONVERT_EX 100
|
||||
# define BN_F_BN_BLINDING_CREATE_PARAM 128
|
||||
# define BN_F_BN_BLINDING_INVERT_EX 101
|
||||
# define BN_F_BN_BLINDING_NEW 102
|
||||
# define BN_F_BN_BLINDING_UPDATE 103
|
||||
# define BN_F_BN_BN2DEC 104
|
||||
# define BN_F_BN_BN2HEX 105
|
||||
# define BN_F_BN_COMPUTE_WNAF 142
|
||||
# define BN_F_BN_CTX_GET 116
|
||||
# define BN_F_BN_CTX_NEW 106
|
||||
# define BN_F_BN_CTX_START 129
|
||||
# define BN_F_BN_DIV 107
|
||||
# define BN_F_BN_DIV_RECP 130
|
||||
# define BN_F_BN_EXP 123
|
||||
# define BN_F_BN_EXPAND_INTERNAL 120
|
||||
# define BN_F_BN_GENCB_NEW 143
|
||||
# define BN_F_BN_GENERATE_DSA_NONCE 140
|
||||
# define BN_F_BN_GENERATE_PRIME_EX 141
|
||||
# define BN_F_BN_GF2M_MOD 131
|
||||
# define BN_F_BN_GF2M_MOD_EXP 132
|
||||
# define BN_F_BN_GF2M_MOD_MUL 133
|
||||
# define BN_F_BN_GF2M_MOD_SOLVE_QUAD 134
|
||||
# define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 135
|
||||
# define BN_F_BN_GF2M_MOD_SQR 136
|
||||
# define BN_F_BN_GF2M_MOD_SQRT 137
|
||||
# define BN_F_BN_LSHIFT 145
|
||||
# define BN_F_BN_MOD_EXP2_MONT 118
|
||||
# define BN_F_BN_MOD_EXP_MONT 109
|
||||
# define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124
|
||||
# define BN_F_BN_MOD_EXP_MONT_WORD 117
|
||||
# define BN_F_BN_MOD_EXP_RECP 125
|
||||
# define BN_F_BN_MOD_EXP_SIMPLE 126
|
||||
# define BN_F_BN_MOD_INVERSE 110
|
||||
# define BN_F_BN_MOD_INVERSE_NO_BRANCH 139
|
||||
# define BN_F_BN_MOD_LSHIFT_QUICK 119
|
||||
# define BN_F_BN_MOD_SQRT 121
|
||||
# define BN_F_BN_MONT_CTX_NEW 149
|
||||
# define BN_F_BN_MPI2BN 112
|
||||
# define BN_F_BN_NEW 113
|
||||
# define BN_F_BN_POOL_GET 147
|
||||
# define BN_F_BN_RAND 114
|
||||
# define BN_F_BN_RAND_RANGE 122
|
||||
# define BN_F_BN_RECP_CTX_NEW 150
|
||||
# define BN_F_BN_RSHIFT 146
|
||||
# define BN_F_BN_SET_WORDS 144
|
||||
# define BN_F_BN_STACK_PUSH 148
|
||||
# define BN_F_BN_USUB 115
|
||||
# define BN_F_OSSL_BN_RSA_DO_UNBLIND 151
|
||||
|
||||
/*
|
||||
* BN reason codes.
|
||||
*/
|
||||
# define BN_R_ARG2_LT_ARG3 100
|
||||
# define BN_R_BAD_RECIPROCAL 101
|
||||
# define BN_R_BIGNUM_TOO_LONG 114
|
||||
# define BN_R_BITS_TOO_SMALL 118
|
||||
# define BN_R_CALLED_WITH_EVEN_MODULUS 102
|
||||
# define BN_R_DIV_BY_ZERO 103
|
||||
# define BN_R_ENCODING_ERROR 104
|
||||
# define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105
|
||||
# define BN_R_INPUT_NOT_REDUCED 110
|
||||
# define BN_R_INVALID_LENGTH 106
|
||||
# define BN_R_INVALID_RANGE 115
|
||||
# define BN_R_INVALID_SHIFT 119
|
||||
# define BN_R_NOT_A_SQUARE 111
|
||||
# define BN_R_NOT_INITIALIZED 107
|
||||
# define BN_R_NO_INVERSE 108
|
||||
# define BN_R_NO_SOLUTION 116
|
||||
# define BN_R_PRIVATE_KEY_TOO_LARGE 117
|
||||
# define BN_R_P_IS_NOT_PRIME 112
|
||||
# define BN_R_TOO_MANY_ITERATIONS 113
|
||||
# define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109
|
||||
|
||||
#endif
|
||||
58
3rdparty/openssl/include/openssl/buffer.h
vendored
58
3rdparty/openssl/include/openssl/buffer.h
vendored
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BUFFER_H
|
||||
# define HEADER_BUFFER_H
|
||||
|
||||
# include <openssl/ossl_typ.h>
|
||||
# ifndef HEADER_CRYPTO_H
|
||||
# include <openssl/crypto.h>
|
||||
# endif
|
||||
# include <openssl/buffererr.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# include <stddef.h>
|
||||
# include <sys/types.h>
|
||||
|
||||
/*
|
||||
* These names are outdated as of OpenSSL 1.1; a future release
|
||||
* will move them to be deprecated.
|
||||
*/
|
||||
# define BUF_strdup(s) OPENSSL_strdup(s)
|
||||
# define BUF_strndup(s, size) OPENSSL_strndup(s, size)
|
||||
# define BUF_memdup(data, size) OPENSSL_memdup(data, size)
|
||||
# define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size)
|
||||
# define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size)
|
||||
# define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen)
|
||||
|
||||
struct buf_mem_st {
|
||||
size_t length; /* current number of bytes */
|
||||
char *data;
|
||||
size_t max; /* size of buffer */
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
# define BUF_MEM_FLAG_SECURE 0x01
|
||||
|
||||
BUF_MEM *BUF_MEM_new(void);
|
||||
BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
|
||||
void BUF_MEM_free(BUF_MEM *a);
|
||||
size_t BUF_MEM_grow(BUF_MEM *str, size_t len);
|
||||
size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
|
||||
void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
34
3rdparty/openssl/include/openssl/buffererr.h
vendored
34
3rdparty/openssl/include/openssl/buffererr.h
vendored
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BUFERR_H
|
||||
# define HEADER_BUFERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_BUF_strings(void);
|
||||
|
||||
/*
|
||||
* BUF function codes.
|
||||
*/
|
||||
# define BUF_F_BUF_MEM_GROW 100
|
||||
# define BUF_F_BUF_MEM_GROW_CLEAN 105
|
||||
# define BUF_F_BUF_MEM_NEW 101
|
||||
|
||||
/*
|
||||
* BUF reason codes.
|
||||
*/
|
||||
|
||||
#endif
|
||||
83
3rdparty/openssl/include/openssl/camellia.h
vendored
83
3rdparty/openssl/include/openssl/camellia.h
vendored
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CAMELLIA_H
|
||||
# define HEADER_CAMELLIA_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CAMELLIA
|
||||
# include <stddef.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# define CAMELLIA_ENCRYPT 1
|
||||
# define CAMELLIA_DECRYPT 0
|
||||
|
||||
/*
|
||||
* Because array size can't be a const in C, the following two are macros.
|
||||
* Both sizes are in bytes.
|
||||
*/
|
||||
|
||||
/* This should be a hidden type, but EVP requires that the size be known */
|
||||
|
||||
# define CAMELLIA_BLOCK_SIZE 16
|
||||
# define CAMELLIA_TABLE_BYTE_LEN 272
|
||||
# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
|
||||
|
||||
typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match
|
||||
* with WORD */
|
||||
|
||||
struct camellia_key_st {
|
||||
union {
|
||||
double d; /* ensures 64-bit align */
|
||||
KEY_TABLE_TYPE rd_key;
|
||||
} u;
|
||||
int grand_rounds;
|
||||
};
|
||||
typedef struct camellia_key_st CAMELLIA_KEY;
|
||||
|
||||
int Camellia_set_key(const unsigned char *userKey, const int bits,
|
||||
CAMELLIA_KEY *key);
|
||||
|
||||
void Camellia_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAMELLIA_KEY *key);
|
||||
void Camellia_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAMELLIA_KEY *key);
|
||||
|
||||
void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAMELLIA_KEY *key, const int enc);
|
||||
void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, const int enc);
|
||||
void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, int *num);
|
||||
void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const CAMELLIA_KEY *key,
|
||||
unsigned char ivec[CAMELLIA_BLOCK_SIZE],
|
||||
unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],
|
||||
unsigned int *num);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
53
3rdparty/openssl/include/openssl/cast.h
vendored
53
3rdparty/openssl/include/openssl/cast.h
vendored
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CAST_H
|
||||
# define HEADER_CAST_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CAST
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define CAST_ENCRYPT 1
|
||||
# define CAST_DECRYPT 0
|
||||
|
||||
# define CAST_LONG unsigned int
|
||||
|
||||
# define CAST_BLOCK 8
|
||||
# define CAST_KEY_LENGTH 16
|
||||
|
||||
typedef struct cast_key_st {
|
||||
CAST_LONG data[32];
|
||||
int short_key; /* Use reduced rounds for short key */
|
||||
} CAST_KEY;
|
||||
|
||||
void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);
|
||||
void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAST_KEY *key, int enc);
|
||||
void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key);
|
||||
void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key);
|
||||
void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, const CAST_KEY *ks, unsigned char *iv,
|
||||
int enc);
|
||||
void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, const CAST_KEY *schedule,
|
||||
unsigned char *ivec, int *num, int enc);
|
||||
void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, const CAST_KEY *schedule,
|
||||
unsigned char *ivec, int *num);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
41
3rdparty/openssl/include/openssl/cmac.h
vendored
41
3rdparty/openssl/include/openssl/cmac.h
vendored
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CMAC_H
|
||||
# define HEADER_CMAC_H
|
||||
|
||||
# ifndef OPENSSL_NO_CMAC
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# include <openssl/evp.h>
|
||||
|
||||
/* Opaque */
|
||||
typedef struct CMAC_CTX_st CMAC_CTX;
|
||||
|
||||
CMAC_CTX *CMAC_CTX_new(void);
|
||||
void CMAC_CTX_cleanup(CMAC_CTX *ctx);
|
||||
void CMAC_CTX_free(CMAC_CTX *ctx);
|
||||
EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx);
|
||||
int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in);
|
||||
|
||||
int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen,
|
||||
const EVP_CIPHER *cipher, ENGINE *impl);
|
||||
int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen);
|
||||
int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen);
|
||||
int CMAC_resume(CMAC_CTX *ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
# endif
|
||||
#endif
|
||||
339
3rdparty/openssl/include/openssl/cms.h
vendored
339
3rdparty/openssl/include/openssl/cms.h
vendored
@@ -1,339 +0,0 @@
|
||||
/*
|
||||
* Copyright 2008-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CMS_H
|
||||
# define HEADER_CMS_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/x509v3.h>
|
||||
# include <openssl/cmserr.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
typedef struct CMS_ContentInfo_st CMS_ContentInfo;
|
||||
typedef struct CMS_SignerInfo_st CMS_SignerInfo;
|
||||
typedef struct CMS_CertificateChoices CMS_CertificateChoices;
|
||||
typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice;
|
||||
typedef struct CMS_RecipientInfo_st CMS_RecipientInfo;
|
||||
typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest;
|
||||
typedef struct CMS_Receipt_st CMS_Receipt;
|
||||
typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey;
|
||||
typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute;
|
||||
|
||||
DEFINE_STACK_OF(CMS_SignerInfo)
|
||||
DEFINE_STACK_OF(CMS_RecipientEncryptedKey)
|
||||
DEFINE_STACK_OF(CMS_RecipientInfo)
|
||||
DEFINE_STACK_OF(CMS_RevocationInfoChoice)
|
||||
DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
|
||||
DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest)
|
||||
DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
|
||||
|
||||
# define CMS_SIGNERINFO_ISSUER_SERIAL 0
|
||||
# define CMS_SIGNERINFO_KEYIDENTIFIER 1
|
||||
|
||||
# define CMS_RECIPINFO_NONE -1
|
||||
# define CMS_RECIPINFO_TRANS 0
|
||||
# define CMS_RECIPINFO_AGREE 1
|
||||
# define CMS_RECIPINFO_KEK 2
|
||||
# define CMS_RECIPINFO_PASS 3
|
||||
# define CMS_RECIPINFO_OTHER 4
|
||||
|
||||
/* S/MIME related flags */
|
||||
|
||||
# define CMS_TEXT 0x1
|
||||
# define CMS_NOCERTS 0x2
|
||||
# define CMS_NO_CONTENT_VERIFY 0x4
|
||||
# define CMS_NO_ATTR_VERIFY 0x8
|
||||
# define CMS_NOSIGS \
|
||||
(CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY)
|
||||
# define CMS_NOINTERN 0x10
|
||||
# define CMS_NO_SIGNER_CERT_VERIFY 0x20
|
||||
# define CMS_NOVERIFY 0x20
|
||||
# define CMS_DETACHED 0x40
|
||||
# define CMS_BINARY 0x80
|
||||
# define CMS_NOATTR 0x100
|
||||
# define CMS_NOSMIMECAP 0x200
|
||||
# define CMS_NOOLDMIMETYPE 0x400
|
||||
# define CMS_CRLFEOL 0x800
|
||||
# define CMS_STREAM 0x1000
|
||||
# define CMS_NOCRL 0x2000
|
||||
# define CMS_PARTIAL 0x4000
|
||||
# define CMS_REUSE_DIGEST 0x8000
|
||||
# define CMS_USE_KEYID 0x10000
|
||||
# define CMS_DEBUG_DECRYPT 0x20000
|
||||
# define CMS_KEY_PARAM 0x40000
|
||||
# define CMS_ASCIICRLF 0x80000
|
||||
|
||||
const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);
|
||||
|
||||
BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
|
||||
int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
|
||||
|
||||
ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
|
||||
int CMS_is_detached(CMS_ContentInfo *cms);
|
||||
int CMS_set_detached(CMS_ContentInfo *cms, int detached);
|
||||
|
||||
# ifdef HEADER_PEM_H
|
||||
DECLARE_PEM_rw_const(CMS, CMS_ContentInfo)
|
||||
# endif
|
||||
int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms);
|
||||
CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms);
|
||||
int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms);
|
||||
|
||||
BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
|
||||
int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);
|
||||
int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in,
|
||||
int flags);
|
||||
CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont);
|
||||
int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags);
|
||||
|
||||
int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont,
|
||||
unsigned int flags);
|
||||
|
||||
CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey,
|
||||
STACK_OF(X509) *certs, BIO *data,
|
||||
unsigned int flags);
|
||||
|
||||
CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
|
||||
X509 *signcert, EVP_PKEY *pkey,
|
||||
STACK_OF(X509) *certs, unsigned int flags);
|
||||
|
||||
int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags);
|
||||
CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);
|
||||
|
||||
int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
|
||||
unsigned int flags);
|
||||
CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
|
||||
unsigned int flags);
|
||||
|
||||
int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
|
||||
const unsigned char *key, size_t keylen,
|
||||
BIO *dcont, BIO *out, unsigned int flags);
|
||||
|
||||
CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
|
||||
const unsigned char *key,
|
||||
size_t keylen, unsigned int flags);
|
||||
|
||||
int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,
|
||||
const unsigned char *key, size_t keylen);
|
||||
|
||||
int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
|
||||
X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags);
|
||||
|
||||
int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,
|
||||
STACK_OF(X509) *certs,
|
||||
X509_STORE *store, unsigned int flags);
|
||||
|
||||
STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
|
||||
|
||||
CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in,
|
||||
const EVP_CIPHER *cipher, unsigned int flags);
|
||||
|
||||
int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,
|
||||
BIO *dcont, BIO *out, unsigned int flags);
|
||||
|
||||
int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);
|
||||
int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
|
||||
unsigned char *key, size_t keylen,
|
||||
const unsigned char *id, size_t idlen);
|
||||
int CMS_decrypt_set1_password(CMS_ContentInfo *cms,
|
||||
unsigned char *pass, ossl_ssize_t passlen);
|
||||
|
||||
STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
|
||||
int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
|
||||
EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri);
|
||||
CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
|
||||
CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
|
||||
X509 *recip, unsigned int flags);
|
||||
int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
|
||||
int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
|
||||
int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri,
|
||||
EVP_PKEY **pk, X509 **recip,
|
||||
X509_ALGOR **palg);
|
||||
int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,
|
||||
ASN1_OCTET_STRING **keyid,
|
||||
X509_NAME **issuer,
|
||||
ASN1_INTEGER **sno);
|
||||
|
||||
CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
|
||||
unsigned char *key, size_t keylen,
|
||||
unsigned char *id, size_t idlen,
|
||||
ASN1_GENERALIZEDTIME *date,
|
||||
ASN1_OBJECT *otherTypeId,
|
||||
ASN1_TYPE *otherType);
|
||||
|
||||
int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri,
|
||||
X509_ALGOR **palg,
|
||||
ASN1_OCTET_STRING **pid,
|
||||
ASN1_GENERALIZEDTIME **pdate,
|
||||
ASN1_OBJECT **potherid,
|
||||
ASN1_TYPE **pothertype);
|
||||
|
||||
int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri,
|
||||
unsigned char *key, size_t keylen);
|
||||
|
||||
int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,
|
||||
const unsigned char *id, size_t idlen);
|
||||
|
||||
int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri,
|
||||
unsigned char *pass,
|
||||
ossl_ssize_t passlen);
|
||||
|
||||
CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
|
||||
int iter, int wrap_nid,
|
||||
int pbe_nid,
|
||||
unsigned char *pass,
|
||||
ossl_ssize_t passlen,
|
||||
const EVP_CIPHER *kekciph);
|
||||
|
||||
int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
|
||||
int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
|
||||
|
||||
int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
|
||||
unsigned int flags);
|
||||
CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
|
||||
|
||||
int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
|
||||
const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
|
||||
|
||||
CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms);
|
||||
int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
|
||||
int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
|
||||
STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
|
||||
|
||||
CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms);
|
||||
int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
|
||||
int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
|
||||
STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
|
||||
|
||||
int CMS_SignedData_init(CMS_ContentInfo *cms);
|
||||
CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
|
||||
X509 *signer, EVP_PKEY *pk, const EVP_MD *md,
|
||||
unsigned int flags);
|
||||
EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si);
|
||||
EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si);
|
||||
STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
|
||||
|
||||
void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
|
||||
int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si,
|
||||
ASN1_OCTET_STRING **keyid,
|
||||
X509_NAME **issuer, ASN1_INTEGER **sno);
|
||||
int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
|
||||
int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
|
||||
unsigned int flags);
|
||||
void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk,
|
||||
X509 **signer, X509_ALGOR **pdig,
|
||||
X509_ALGOR **psig);
|
||||
ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);
|
||||
int CMS_SignerInfo_sign(CMS_SignerInfo *si);
|
||||
int CMS_SignerInfo_verify(CMS_SignerInfo *si);
|
||||
int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain);
|
||||
|
||||
int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs);
|
||||
int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs,
|
||||
int algnid, int keysize);
|
||||
int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap);
|
||||
|
||||
int CMS_signed_get_attr_count(const CMS_SignerInfo *si);
|
||||
int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
|
||||
int lastpos);
|
||||
int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj,
|
||||
int lastpos);
|
||||
X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);
|
||||
X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);
|
||||
int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
|
||||
int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,
|
||||
const ASN1_OBJECT *obj, int type,
|
||||
const void *bytes, int len);
|
||||
int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,
|
||||
int nid, int type,
|
||||
const void *bytes, int len);
|
||||
int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,
|
||||
const char *attrname, int type,
|
||||
const void *bytes, int len);
|
||||
void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid,
|
||||
int lastpos, int type);
|
||||
|
||||
int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);
|
||||
int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
|
||||
int lastpos);
|
||||
int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si,
|
||||
const ASN1_OBJECT *obj, int lastpos);
|
||||
X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);
|
||||
X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);
|
||||
int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
|
||||
int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,
|
||||
const ASN1_OBJECT *obj, int type,
|
||||
const void *bytes, int len);
|
||||
int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,
|
||||
int nid, int type,
|
||||
const void *bytes, int len);
|
||||
int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,
|
||||
const char *attrname, int type,
|
||||
const void *bytes, int len);
|
||||
void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
|
||||
int lastpos, int type);
|
||||
|
||||
int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);
|
||||
CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen,
|
||||
int allorfirst,
|
||||
STACK_OF(GENERAL_NAMES)
|
||||
*receiptList, STACK_OF(GENERAL_NAMES)
|
||||
*receiptsTo);
|
||||
int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);
|
||||
void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr,
|
||||
ASN1_STRING **pcid,
|
||||
int *pallorfirst,
|
||||
STACK_OF(GENERAL_NAMES) **plist,
|
||||
STACK_OF(GENERAL_NAMES) **prto);
|
||||
int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri,
|
||||
X509_ALGOR **palg,
|
||||
ASN1_OCTET_STRING **pukm);
|
||||
STACK_OF(CMS_RecipientEncryptedKey)
|
||||
*CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri);
|
||||
|
||||
int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri,
|
||||
X509_ALGOR **pubalg,
|
||||
ASN1_BIT_STRING **pubkey,
|
||||
ASN1_OCTET_STRING **keyid,
|
||||
X509_NAME **issuer,
|
||||
ASN1_INTEGER **sno);
|
||||
|
||||
int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert);
|
||||
|
||||
int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek,
|
||||
ASN1_OCTET_STRING **keyid,
|
||||
ASN1_GENERALIZEDTIME **tm,
|
||||
CMS_OtherKeyAttribute **other,
|
||||
X509_NAME **issuer, ASN1_INTEGER **sno);
|
||||
int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek,
|
||||
X509 *cert);
|
||||
int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk);
|
||||
EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri);
|
||||
int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms,
|
||||
CMS_RecipientInfo *ri,
|
||||
CMS_RecipientEncryptedKey *rek);
|
||||
|
||||
int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg,
|
||||
ASN1_OCTET_STRING *ukm, int keylen);
|
||||
|
||||
/* Backward compatibility for spelling errors. */
|
||||
# define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM
|
||||
# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \
|
||||
CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
203
3rdparty/openssl/include/openssl/cmserr.h
vendored
203
3rdparty/openssl/include/openssl/cmserr.h
vendored
@@ -1,203 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CMSERR_H
|
||||
# define HEADER_CMSERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_CMS_strings(void);
|
||||
|
||||
/*
|
||||
* CMS function codes.
|
||||
*/
|
||||
# define CMS_F_CHECK_CONTENT 99
|
||||
# define CMS_F_CMS_ADD0_CERT 164
|
||||
# define CMS_F_CMS_ADD0_RECIPIENT_KEY 100
|
||||
# define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD 165
|
||||
# define CMS_F_CMS_ADD1_RECEIPTREQUEST 158
|
||||
# define CMS_F_CMS_ADD1_RECIPIENT_CERT 101
|
||||
# define CMS_F_CMS_ADD1_SIGNER 102
|
||||
# define CMS_F_CMS_ADD1_SIGNINGTIME 103
|
||||
# define CMS_F_CMS_COMPRESS 104
|
||||
# define CMS_F_CMS_COMPRESSEDDATA_CREATE 105
|
||||
# define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO 106
|
||||
# define CMS_F_CMS_COPY_CONTENT 107
|
||||
# define CMS_F_CMS_COPY_MESSAGEDIGEST 108
|
||||
# define CMS_F_CMS_DATA 109
|
||||
# define CMS_F_CMS_DATAFINAL 110
|
||||
# define CMS_F_CMS_DATAINIT 111
|
||||
# define CMS_F_CMS_DECRYPT 112
|
||||
# define CMS_F_CMS_DECRYPT_SET1_KEY 113
|
||||
# define CMS_F_CMS_DECRYPT_SET1_PASSWORD 166
|
||||
# define CMS_F_CMS_DECRYPT_SET1_PKEY 114
|
||||
# define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX 115
|
||||
# define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO 116
|
||||
# define CMS_F_CMS_DIGESTEDDATA_DO_FINAL 117
|
||||
# define CMS_F_CMS_DIGEST_VERIFY 118
|
||||
# define CMS_F_CMS_ENCODE_RECEIPT 161
|
||||
# define CMS_F_CMS_ENCRYPT 119
|
||||
# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT 179
|
||||
# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO 120
|
||||
# define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT 121
|
||||
# define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT 122
|
||||
# define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY 123
|
||||
# define CMS_F_CMS_ENVELOPEDDATA_CREATE 124
|
||||
# define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO 125
|
||||
# define CMS_F_CMS_ENVELOPED_DATA_INIT 126
|
||||
# define CMS_F_CMS_ENV_ASN1_CTRL 171
|
||||
# define CMS_F_CMS_FINAL 127
|
||||
# define CMS_F_CMS_GET0_CERTIFICATE_CHOICES 128
|
||||
# define CMS_F_CMS_GET0_CONTENT 129
|
||||
# define CMS_F_CMS_GET0_ECONTENT_TYPE 130
|
||||
# define CMS_F_CMS_GET0_ENVELOPED 131
|
||||
# define CMS_F_CMS_GET0_REVOCATION_CHOICES 132
|
||||
# define CMS_F_CMS_GET0_SIGNED 133
|
||||
# define CMS_F_CMS_MSGSIGDIGEST_ADD1 162
|
||||
# define CMS_F_CMS_RECEIPTREQUEST_CREATE0 159
|
||||
# define CMS_F_CMS_RECEIPT_VERIFY 160
|
||||
# define CMS_F_CMS_RECIPIENTINFO_DECRYPT 134
|
||||
# define CMS_F_CMS_RECIPIENTINFO_ENCRYPT 169
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT 178
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG 175
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID 173
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS 172
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP 174
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT 135
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT 136
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID 137
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP 138
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP 139
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT 140
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT 141
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS 142
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID 143
|
||||
# define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT 167
|
||||
# define CMS_F_CMS_RECIPIENTINFO_SET0_KEY 144
|
||||
# define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD 168
|
||||
# define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY 145
|
||||
# define CMS_F_CMS_SD_ASN1_CTRL 170
|
||||
# define CMS_F_CMS_SET1_IAS 176
|
||||
# define CMS_F_CMS_SET1_KEYID 177
|
||||
# define CMS_F_CMS_SET1_SIGNERIDENTIFIER 146
|
||||
# define CMS_F_CMS_SET_DETACHED 147
|
||||
# define CMS_F_CMS_SIGN 148
|
||||
# define CMS_F_CMS_SIGNED_DATA_INIT 149
|
||||
# define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN 150
|
||||
# define CMS_F_CMS_SIGNERINFO_SIGN 151
|
||||
# define CMS_F_CMS_SIGNERINFO_VERIFY 152
|
||||
# define CMS_F_CMS_SIGNERINFO_VERIFY_CERT 153
|
||||
# define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT 154
|
||||
# define CMS_F_CMS_SIGN_RECEIPT 163
|
||||
# define CMS_F_CMS_SI_CHECK_ATTRIBUTES 183
|
||||
# define CMS_F_CMS_STREAM 155
|
||||
# define CMS_F_CMS_UNCOMPRESS 156
|
||||
# define CMS_F_CMS_VERIFY 157
|
||||
# define CMS_F_KEK_UNWRAP_KEY 180
|
||||
|
||||
/*
|
||||
* CMS reason codes.
|
||||
*/
|
||||
# define CMS_R_ADD_SIGNER_ERROR 99
|
||||
# define CMS_R_ATTRIBUTE_ERROR 161
|
||||
# define CMS_R_CERTIFICATE_ALREADY_PRESENT 175
|
||||
# define CMS_R_CERTIFICATE_HAS_NO_KEYID 160
|
||||
# define CMS_R_CERTIFICATE_VERIFY_ERROR 100
|
||||
# define CMS_R_CIPHER_INITIALISATION_ERROR 101
|
||||
# define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102
|
||||
# define CMS_R_CMS_DATAFINAL_ERROR 103
|
||||
# define CMS_R_CMS_LIB 104
|
||||
# define CMS_R_CONTENTIDENTIFIER_MISMATCH 170
|
||||
# define CMS_R_CONTENT_NOT_FOUND 105
|
||||
# define CMS_R_CONTENT_TYPE_MISMATCH 171
|
||||
# define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106
|
||||
# define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107
|
||||
# define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108
|
||||
# define CMS_R_CONTENT_VERIFY_ERROR 109
|
||||
# define CMS_R_CTRL_ERROR 110
|
||||
# define CMS_R_CTRL_FAILURE 111
|
||||
# define CMS_R_DECRYPT_ERROR 112
|
||||
# define CMS_R_ERROR_GETTING_PUBLIC_KEY 113
|
||||
# define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114
|
||||
# define CMS_R_ERROR_SETTING_KEY 115
|
||||
# define CMS_R_ERROR_SETTING_RECIPIENTINFO 116
|
||||
# define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117
|
||||
# define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176
|
||||
# define CMS_R_INVALID_KEY_LENGTH 118
|
||||
# define CMS_R_MD_BIO_INIT_ERROR 119
|
||||
# define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120
|
||||
# define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121
|
||||
# define CMS_R_MSGSIGDIGEST_ERROR 172
|
||||
# define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162
|
||||
# define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163
|
||||
# define CMS_R_NEED_ONE_SIGNER 164
|
||||
# define CMS_R_NOT_A_SIGNED_RECEIPT 165
|
||||
# define CMS_R_NOT_ENCRYPTED_DATA 122
|
||||
# define CMS_R_NOT_KEK 123
|
||||
# define CMS_R_NOT_KEY_AGREEMENT 181
|
||||
# define CMS_R_NOT_KEY_TRANSPORT 124
|
||||
# define CMS_R_NOT_PWRI 177
|
||||
# define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125
|
||||
# define CMS_R_NO_CIPHER 126
|
||||
# define CMS_R_NO_CONTENT 127
|
||||
# define CMS_R_NO_CONTENT_TYPE 173
|
||||
# define CMS_R_NO_DEFAULT_DIGEST 128
|
||||
# define CMS_R_NO_DIGEST_SET 129
|
||||
# define CMS_R_NO_KEY 130
|
||||
# define CMS_R_NO_KEY_OR_CERT 174
|
||||
# define CMS_R_NO_MATCHING_DIGEST 131
|
||||
# define CMS_R_NO_MATCHING_RECIPIENT 132
|
||||
# define CMS_R_NO_MATCHING_SIGNATURE 166
|
||||
# define CMS_R_NO_MSGSIGDIGEST 167
|
||||
# define CMS_R_NO_PASSWORD 178
|
||||
# define CMS_R_NO_PRIVATE_KEY 133
|
||||
# define CMS_R_NO_PUBLIC_KEY 134
|
||||
# define CMS_R_NO_RECEIPT_REQUEST 168
|
||||
# define CMS_R_NO_SIGNERS 135
|
||||
# define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136
|
||||
# define CMS_R_RECEIPT_DECODE_ERROR 169
|
||||
# define CMS_R_RECIPIENT_ERROR 137
|
||||
# define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138
|
||||
# define CMS_R_SIGNFINAL_ERROR 139
|
||||
# define CMS_R_SMIME_TEXT_ERROR 140
|
||||
# define CMS_R_STORE_INIT_ERROR 141
|
||||
# define CMS_R_TYPE_NOT_COMPRESSED_DATA 142
|
||||
# define CMS_R_TYPE_NOT_DATA 143
|
||||
# define CMS_R_TYPE_NOT_DIGESTED_DATA 144
|
||||
# define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145
|
||||
# define CMS_R_TYPE_NOT_ENVELOPED_DATA 146
|
||||
# define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147
|
||||
# define CMS_R_UNKNOWN_CIPHER 148
|
||||
# define CMS_R_UNKNOWN_DIGEST_ALGORITHM 149
|
||||
# define CMS_R_UNKNOWN_ID 150
|
||||
# define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151
|
||||
# define CMS_R_UNSUPPORTED_CONTENT_ENCRYPTION_ALGORITHM 194
|
||||
# define CMS_R_UNSUPPORTED_CONTENT_TYPE 152
|
||||
# define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153
|
||||
# define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179
|
||||
# define CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE 155
|
||||
# define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154
|
||||
# define CMS_R_UNSUPPORTED_TYPE 156
|
||||
# define CMS_R_UNWRAP_ERROR 157
|
||||
# define CMS_R_UNWRAP_FAILURE 180
|
||||
# define CMS_R_VERIFICATION_FAILURE 158
|
||||
# define CMS_R_WRAP_ERROR 159
|
||||
|
||||
# endif
|
||||
#endif
|
||||
53
3rdparty/openssl/include/openssl/comp.h
vendored
53
3rdparty/openssl/include/openssl/comp.h
vendored
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_COMP_H
|
||||
# define HEADER_COMP_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_COMP
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/comperr.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
|
||||
|
||||
COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
|
||||
const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx);
|
||||
int COMP_CTX_get_type(const COMP_CTX* comp);
|
||||
int COMP_get_type(const COMP_METHOD *meth);
|
||||
const char *COMP_get_name(const COMP_METHOD *meth);
|
||||
void COMP_CTX_free(COMP_CTX *ctx);
|
||||
|
||||
int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
||||
unsigned char *in, int ilen);
|
||||
int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
||||
unsigned char *in, int ilen);
|
||||
|
||||
COMP_METHOD *COMP_zlib(void);
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
#define COMP_zlib_cleanup() while(0) continue
|
||||
#endif
|
||||
|
||||
# ifdef HEADER_BIO_H
|
||||
# ifdef ZLIB
|
||||
const BIO_METHOD *BIO_f_zlib(void);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
44
3rdparty/openssl/include/openssl/comperr.h
vendored
44
3rdparty/openssl/include/openssl/comperr.h
vendored
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_COMPERR_H
|
||||
# define HEADER_COMPERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_COMP
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_COMP_strings(void);
|
||||
|
||||
/*
|
||||
* COMP function codes.
|
||||
*/
|
||||
# define COMP_F_BIO_ZLIB_FLUSH 99
|
||||
# define COMP_F_BIO_ZLIB_NEW 100
|
||||
# define COMP_F_BIO_ZLIB_READ 101
|
||||
# define COMP_F_BIO_ZLIB_WRITE 102
|
||||
# define COMP_F_COMP_CTX_NEW 103
|
||||
|
||||
/*
|
||||
* COMP reason codes.
|
||||
*/
|
||||
# define COMP_R_ZLIB_DEFLATE_ERROR 99
|
||||
# define COMP_R_ZLIB_INFLATE_ERROR 100
|
||||
# define COMP_R_ZLIB_NOT_SUPPORTED 101
|
||||
|
||||
# endif
|
||||
#endif
|
||||
168
3rdparty/openssl/include/openssl/conf.h
vendored
168
3rdparty/openssl/include/openssl/conf.h
vendored
@@ -1,168 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CONF_H
|
||||
# define HEADER_CONF_H
|
||||
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/lhash.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/e_os2.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/conferr.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
char *section;
|
||||
char *name;
|
||||
char *value;
|
||||
} CONF_VALUE;
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_LHASH_OF(CONF_VALUE);
|
||||
|
||||
struct conf_st;
|
||||
struct conf_method_st;
|
||||
typedef struct conf_method_st CONF_METHOD;
|
||||
|
||||
struct conf_method_st {
|
||||
const char *name;
|
||||
CONF *(*create) (CONF_METHOD *meth);
|
||||
int (*init) (CONF *conf);
|
||||
int (*destroy) (CONF *conf);
|
||||
int (*destroy_data) (CONF *conf);
|
||||
int (*load_bio) (CONF *conf, BIO *bp, long *eline);
|
||||
int (*dump) (const CONF *conf, BIO *bp);
|
||||
int (*is_number) (const CONF *conf, char c);
|
||||
int (*to_int) (const CONF *conf, char c);
|
||||
int (*load) (CONF *conf, const char *name, long *eline);
|
||||
};
|
||||
|
||||
/* Module definitions */
|
||||
|
||||
typedef struct conf_imodule_st CONF_IMODULE;
|
||||
typedef struct conf_module_st CONF_MODULE;
|
||||
|
||||
DEFINE_STACK_OF(CONF_MODULE)
|
||||
DEFINE_STACK_OF(CONF_IMODULE)
|
||||
|
||||
/* DSO module function typedefs */
|
||||
typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf);
|
||||
typedef void conf_finish_func (CONF_IMODULE *md);
|
||||
|
||||
# define CONF_MFLAGS_IGNORE_ERRORS 0x1
|
||||
# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
|
||||
# define CONF_MFLAGS_SILENT 0x4
|
||||
# define CONF_MFLAGS_NO_DSO 0x8
|
||||
# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
|
||||
# define CONF_MFLAGS_DEFAULT_SECTION 0x20
|
||||
|
||||
int CONF_set_default_method(CONF_METHOD *meth);
|
||||
void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
|
||||
LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
|
||||
long *eline);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
|
||||
long *eline);
|
||||
# endif
|
||||
LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,
|
||||
long *eline);
|
||||
STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
|
||||
const char *section);
|
||||
char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
|
||||
const char *name);
|
||||
long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
|
||||
const char *name);
|
||||
void CONF_free(LHASH_OF(CONF_VALUE) *conf);
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
|
||||
#endif
|
||||
int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
|
||||
|
||||
DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define OPENSSL_no_config() \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* New conf code. The semantics are different from the functions above. If
|
||||
* that wasn't the case, the above functions would have been replaced
|
||||
*/
|
||||
|
||||
struct conf_st {
|
||||
CONF_METHOD *meth;
|
||||
void *meth_data;
|
||||
LHASH_OF(CONF_VALUE) *data;
|
||||
};
|
||||
|
||||
CONF *NCONF_new(CONF_METHOD *meth);
|
||||
CONF_METHOD *NCONF_default(void);
|
||||
CONF_METHOD *NCONF_WIN32(void);
|
||||
void NCONF_free(CONF *conf);
|
||||
void NCONF_free_data(CONF *conf);
|
||||
|
||||
int NCONF_load(CONF *conf, const char *file, long *eline);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
|
||||
# endif
|
||||
int NCONF_load_bio(CONF *conf, BIO *bp, long *eline);
|
||||
STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
|
||||
const char *section);
|
||||
char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
|
||||
int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
|
||||
long *result);
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int NCONF_dump_fp(const CONF *conf, FILE *out);
|
||||
#endif
|
||||
int NCONF_dump_bio(const CONF *conf, BIO *out);
|
||||
|
||||
#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
|
||||
|
||||
/* Module functions */
|
||||
|
||||
int CONF_modules_load(const CONF *cnf, const char *appname,
|
||||
unsigned long flags);
|
||||
int CONF_modules_load_file(const char *filename, const char *appname,
|
||||
unsigned long flags);
|
||||
void CONF_modules_unload(int all);
|
||||
void CONF_modules_finish(void);
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define CONF_modules_free() while(0) continue
|
||||
#endif
|
||||
int CONF_module_add(const char *name, conf_init_func *ifunc,
|
||||
conf_finish_func *ffunc);
|
||||
|
||||
const char *CONF_imodule_get_name(const CONF_IMODULE *md);
|
||||
const char *CONF_imodule_get_value(const CONF_IMODULE *md);
|
||||
void *CONF_imodule_get_usr_data(const CONF_IMODULE *md);
|
||||
void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);
|
||||
CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);
|
||||
unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);
|
||||
void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
|
||||
void *CONF_module_get_usr_data(CONF_MODULE *pmod);
|
||||
void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
|
||||
|
||||
char *CONF_get1_default_config_file(void);
|
||||
|
||||
int CONF_parse_list(const char *list, int sep, int nospc,
|
||||
int (*list_cb) (const char *elem, int len, void *usr),
|
||||
void *arg);
|
||||
|
||||
void OPENSSL_load_builtin_modules(void);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
40
3rdparty/openssl/include/openssl/conf_api.h
vendored
40
3rdparty/openssl/include/openssl/conf_api.h
vendored
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CONF_API_H
|
||||
# define HEADER_CONF_API_H
|
||||
|
||||
# include <openssl/lhash.h>
|
||||
# include <openssl/conf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Up until OpenSSL 0.9.5a, this was new_section */
|
||||
CONF_VALUE *_CONF_new_section(CONF *conf, const char *section);
|
||||
/* Up until OpenSSL 0.9.5a, this was get_section */
|
||||
CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section);
|
||||
/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
|
||||
STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
|
||||
const char *section);
|
||||
|
||||
int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value);
|
||||
char *_CONF_get_string(const CONF *conf, const char *section,
|
||||
const char *name);
|
||||
long _CONF_get_number(const CONF *conf, const char *section,
|
||||
const char *name);
|
||||
|
||||
int _CONF_new_data(CONF *conf);
|
||||
void _CONF_free_data(CONF *conf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
76
3rdparty/openssl/include/openssl/conferr.h
vendored
76
3rdparty/openssl/include/openssl/conferr.h
vendored
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CONFERR_H
|
||||
# define HEADER_CONFERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_CONF_strings(void);
|
||||
|
||||
/*
|
||||
* CONF function codes.
|
||||
*/
|
||||
# define CONF_F_CONF_DUMP_FP 104
|
||||
# define CONF_F_CONF_LOAD 100
|
||||
# define CONF_F_CONF_LOAD_FP 103
|
||||
# define CONF_F_CONF_PARSE_LIST 119
|
||||
# define CONF_F_DEF_LOAD 120
|
||||
# define CONF_F_DEF_LOAD_BIO 121
|
||||
# define CONF_F_GET_NEXT_FILE 107
|
||||
# define CONF_F_MODULE_ADD 122
|
||||
# define CONF_F_MODULE_INIT 115
|
||||
# define CONF_F_MODULE_LOAD_DSO 117
|
||||
# define CONF_F_MODULE_RUN 118
|
||||
# define CONF_F_NCONF_DUMP_BIO 105
|
||||
# define CONF_F_NCONF_DUMP_FP 106
|
||||
# define CONF_F_NCONF_GET_NUMBER_E 112
|
||||
# define CONF_F_NCONF_GET_SECTION 108
|
||||
# define CONF_F_NCONF_GET_STRING 109
|
||||
# define CONF_F_NCONF_LOAD 113
|
||||
# define CONF_F_NCONF_LOAD_BIO 110
|
||||
# define CONF_F_NCONF_LOAD_FP 114
|
||||
# define CONF_F_NCONF_NEW 111
|
||||
# define CONF_F_PROCESS_INCLUDE 116
|
||||
# define CONF_F_SSL_MODULE_INIT 123
|
||||
# define CONF_F_STR_COPY 101
|
||||
|
||||
/*
|
||||
* CONF reason codes.
|
||||
*/
|
||||
# define CONF_R_ERROR_LOADING_DSO 110
|
||||
# define CONF_R_LIST_CANNOT_BE_NULL 115
|
||||
# define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
|
||||
# define CONF_R_MISSING_EQUAL_SIGN 101
|
||||
# define CONF_R_MISSING_INIT_FUNCTION 112
|
||||
# define CONF_R_MODULE_INITIALIZATION_ERROR 109
|
||||
# define CONF_R_NO_CLOSE_BRACE 102
|
||||
# define CONF_R_NO_CONF 105
|
||||
# define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106
|
||||
# define CONF_R_NO_SECTION 107
|
||||
# define CONF_R_NO_SUCH_FILE 114
|
||||
# define CONF_R_NO_VALUE 108
|
||||
# define CONF_R_NUMBER_TOO_LARGE 121
|
||||
# define CONF_R_RECURSIVE_DIRECTORY_INCLUDE 111
|
||||
# define CONF_R_SSL_COMMAND_SECTION_EMPTY 117
|
||||
# define CONF_R_SSL_COMMAND_SECTION_NOT_FOUND 118
|
||||
# define CONF_R_SSL_SECTION_EMPTY 119
|
||||
# define CONF_R_SSL_SECTION_NOT_FOUND 120
|
||||
# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
|
||||
# define CONF_R_UNKNOWN_MODULE_NAME 113
|
||||
# define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116
|
||||
# define CONF_R_VARIABLE_HAS_NO_VALUE 104
|
||||
|
||||
#endif
|
||||
445
3rdparty/openssl/include/openssl/crypto.h
vendored
445
3rdparty/openssl/include/openssl/crypto.h
vendored
@@ -1,445 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CRYPTO_H
|
||||
# define HEADER_CRYPTO_H
|
||||
|
||||
# include <stdlib.h>
|
||||
# include <time.h>
|
||||
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/opensslv.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/cryptoerr.h>
|
||||
|
||||
# ifdef CHARSET_EBCDIC
|
||||
# include <openssl/ebcdic.h>
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Resolve problems on some operating systems with symbol names that clash
|
||||
* one way or another
|
||||
*/
|
||||
# include <openssl/symhacks.h>
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/opensslv.h>
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define SSLeay OpenSSL_version_num
|
||||
# define SSLeay_version OpenSSL_version
|
||||
# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
|
||||
# define SSLEAY_VERSION OPENSSL_VERSION
|
||||
# define SSLEAY_CFLAGS OPENSSL_CFLAGS
|
||||
# define SSLEAY_BUILT_ON OPENSSL_BUILT_ON
|
||||
# define SSLEAY_PLATFORM OPENSSL_PLATFORM
|
||||
# define SSLEAY_DIR OPENSSL_DIR
|
||||
|
||||
/*
|
||||
* Old type for allocating dynamic locks. No longer used. Use the new thread
|
||||
* API instead.
|
||||
*/
|
||||
typedef struct {
|
||||
int dummy;
|
||||
} CRYPTO_dynlock;
|
||||
|
||||
# endif /* OPENSSL_API_COMPAT */
|
||||
|
||||
typedef void CRYPTO_RWLOCK;
|
||||
|
||||
CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void);
|
||||
int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock);
|
||||
int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock);
|
||||
int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock);
|
||||
void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock);
|
||||
|
||||
int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock);
|
||||
|
||||
/*
|
||||
* The following can be used to detect memory leaks in the library. If
|
||||
* used, it turns on malloc checking
|
||||
*/
|
||||
# define CRYPTO_MEM_CHECK_OFF 0x0 /* Control only */
|
||||
# define CRYPTO_MEM_CHECK_ON 0x1 /* Control and mode bit */
|
||||
# define CRYPTO_MEM_CHECK_ENABLE 0x2 /* Control and mode bit */
|
||||
# define CRYPTO_MEM_CHECK_DISABLE 0x3 /* Control only */
|
||||
|
||||
struct crypto_ex_data_st {
|
||||
STACK_OF(void) *sk;
|
||||
};
|
||||
DEFINE_STACK_OF(void)
|
||||
|
||||
/*
|
||||
* Per class, we have a STACK of function pointers.
|
||||
*/
|
||||
# define CRYPTO_EX_INDEX_SSL 0
|
||||
# define CRYPTO_EX_INDEX_SSL_CTX 1
|
||||
# define CRYPTO_EX_INDEX_SSL_SESSION 2
|
||||
# define CRYPTO_EX_INDEX_X509 3
|
||||
# define CRYPTO_EX_INDEX_X509_STORE 4
|
||||
# define CRYPTO_EX_INDEX_X509_STORE_CTX 5
|
||||
# define CRYPTO_EX_INDEX_DH 6
|
||||
# define CRYPTO_EX_INDEX_DSA 7
|
||||
# define CRYPTO_EX_INDEX_EC_KEY 8
|
||||
# define CRYPTO_EX_INDEX_RSA 9
|
||||
# define CRYPTO_EX_INDEX_ENGINE 10
|
||||
# define CRYPTO_EX_INDEX_UI 11
|
||||
# define CRYPTO_EX_INDEX_BIO 12
|
||||
# define CRYPTO_EX_INDEX_APP 13
|
||||
# define CRYPTO_EX_INDEX_UI_METHOD 14
|
||||
# define CRYPTO_EX_INDEX_DRBG 15
|
||||
# define CRYPTO_EX_INDEX__COUNT 16
|
||||
|
||||
/* No longer needed, so this is a no-op */
|
||||
#define OPENSSL_malloc_init() while(0) continue
|
||||
|
||||
int CRYPTO_mem_ctrl(int mode);
|
||||
|
||||
# define OPENSSL_malloc(num) \
|
||||
CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_zalloc(num) \
|
||||
CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_realloc(addr, num) \
|
||||
CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_clear_realloc(addr, old_num, num) \
|
||||
CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_clear_free(addr, num) \
|
||||
CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_free(addr) \
|
||||
CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_memdup(str, s) \
|
||||
CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_strdup(str) \
|
||||
CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_strndup(str, n) \
|
||||
CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_malloc(num) \
|
||||
CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_zalloc(num) \
|
||||
CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_free(addr) \
|
||||
CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_clear_free(addr, num) \
|
||||
CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_actual_size(ptr) \
|
||||
CRYPTO_secure_actual_size(ptr)
|
||||
|
||||
size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz);
|
||||
size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz);
|
||||
size_t OPENSSL_strnlen(const char *str, size_t maxlen);
|
||||
char *OPENSSL_buf2hexstr(const unsigned char *buffer, long len);
|
||||
unsigned char *OPENSSL_hexstr2buf(const char *str, long *len);
|
||||
int OPENSSL_hexchar2int(unsigned char c);
|
||||
|
||||
# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type))
|
||||
|
||||
unsigned long OpenSSL_version_num(void);
|
||||
const char *OpenSSL_version(int type);
|
||||
# define OPENSSL_VERSION 0
|
||||
# define OPENSSL_CFLAGS 1
|
||||
# define OPENSSL_BUILT_ON 2
|
||||
# define OPENSSL_PLATFORM 3
|
||||
# define OPENSSL_DIR 4
|
||||
# define OPENSSL_ENGINES_DIR 5
|
||||
|
||||
int OPENSSL_issetugid(void);
|
||||
|
||||
typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from,
|
||||
void *from_d, int idx, long argl, void *argp);
|
||||
__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
|
||||
CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
|
||||
CRYPTO_EX_free *free_func);
|
||||
/* No longer use an index. */
|
||||
int CRYPTO_free_ex_index(int class_index, int idx);
|
||||
|
||||
/*
|
||||
* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a
|
||||
* given class (invokes whatever per-class callbacks are applicable)
|
||||
*/
|
||||
int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
|
||||
int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
|
||||
const CRYPTO_EX_DATA *from);
|
||||
|
||||
void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
|
||||
|
||||
/*
|
||||
* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular
|
||||
* index (relative to the class type involved)
|
||||
*/
|
||||
int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
|
||||
void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx);
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
/*
|
||||
* This function cleans up all "ex_data" state. It mustn't be called under
|
||||
* potential race-conditions.
|
||||
*/
|
||||
# define CRYPTO_cleanup_all_ex_data() while(0) continue
|
||||
|
||||
/*
|
||||
* The old locking functions have been removed completely without compatibility
|
||||
* macros. This is because the old functions either could not properly report
|
||||
* errors, or the returned error values were not clearly documented.
|
||||
* Replacing the locking functions with no-ops would cause race condition
|
||||
* issues in the affected applications. It is far better for them to fail at
|
||||
* compile time.
|
||||
* On the other hand, the locking callbacks are no longer used. Consequently,
|
||||
* the callback management functions can be safely replaced with no-op macros.
|
||||
*/
|
||||
# define CRYPTO_num_locks() (1)
|
||||
# define CRYPTO_set_locking_callback(func)
|
||||
# define CRYPTO_get_locking_callback() (NULL)
|
||||
# define CRYPTO_set_add_lock_callback(func)
|
||||
# define CRYPTO_get_add_lock_callback() (NULL)
|
||||
|
||||
/*
|
||||
* These defines where used in combination with the old locking callbacks,
|
||||
* they are not called anymore, but old code that's not called might still
|
||||
* use them.
|
||||
*/
|
||||
# define CRYPTO_LOCK 1
|
||||
# define CRYPTO_UNLOCK 2
|
||||
# define CRYPTO_READ 4
|
||||
# define CRYPTO_WRITE 8
|
||||
|
||||
/* This structure is no longer used */
|
||||
typedef struct crypto_threadid_st {
|
||||
int dummy;
|
||||
} CRYPTO_THREADID;
|
||||
/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */
|
||||
# define CRYPTO_THREADID_set_numeric(id, val)
|
||||
# define CRYPTO_THREADID_set_pointer(id, ptr)
|
||||
# define CRYPTO_THREADID_set_callback(threadid_func) (0)
|
||||
# define CRYPTO_THREADID_get_callback() (NULL)
|
||||
# define CRYPTO_THREADID_current(id)
|
||||
# define CRYPTO_THREADID_cmp(a, b) (-1)
|
||||
# define CRYPTO_THREADID_cpy(dest, src)
|
||||
# define CRYPTO_THREADID_hash(id) (0UL)
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10000000L
|
||||
# define CRYPTO_set_id_callback(func)
|
||||
# define CRYPTO_get_id_callback() (NULL)
|
||||
# define CRYPTO_thread_id() (0UL)
|
||||
# endif /* OPENSSL_API_COMPAT < 0x10000000L */
|
||||
|
||||
# define CRYPTO_set_dynlock_create_callback(dyn_create_function)
|
||||
# define CRYPTO_set_dynlock_lock_callback(dyn_lock_function)
|
||||
# define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function)
|
||||
# define CRYPTO_get_dynlock_create_callback() (NULL)
|
||||
# define CRYPTO_get_dynlock_lock_callback() (NULL)
|
||||
# define CRYPTO_get_dynlock_destroy_callback() (NULL)
|
||||
# endif /* OPENSSL_API_COMPAT < 0x10100000L */
|
||||
|
||||
int CRYPTO_set_mem_functions(
|
||||
void *(*m) (size_t, const char *, int),
|
||||
void *(*r) (void *, size_t, const char *, int),
|
||||
void (*f) (void *, const char *, int));
|
||||
int CRYPTO_set_mem_debug(int flag);
|
||||
void CRYPTO_get_mem_functions(
|
||||
void *(**m) (size_t, const char *, int),
|
||||
void *(**r) (void *, size_t, const char *, int),
|
||||
void (**f) (void *, const char *, int));
|
||||
|
||||
void *CRYPTO_malloc(size_t num, const char *file, int line);
|
||||
void *CRYPTO_zalloc(size_t num, const char *file, int line);
|
||||
void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line);
|
||||
char *CRYPTO_strdup(const char *str, const char *file, int line);
|
||||
char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line);
|
||||
void CRYPTO_free(void *ptr, const char *file, int line);
|
||||
void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line);
|
||||
void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line);
|
||||
void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num,
|
||||
const char *file, int line);
|
||||
|
||||
int CRYPTO_secure_malloc_init(size_t sz, int minsize);
|
||||
int CRYPTO_secure_malloc_done(void);
|
||||
void *CRYPTO_secure_malloc(size_t num, const char *file, int line);
|
||||
void *CRYPTO_secure_zalloc(size_t num, const char *file, int line);
|
||||
void CRYPTO_secure_free(void *ptr, const char *file, int line);
|
||||
void CRYPTO_secure_clear_free(void *ptr, size_t num,
|
||||
const char *file, int line);
|
||||
int CRYPTO_secure_allocated(const void *ptr);
|
||||
int CRYPTO_secure_malloc_initialized(void);
|
||||
size_t CRYPTO_secure_actual_size(void *ptr);
|
||||
size_t CRYPTO_secure_used(void);
|
||||
|
||||
void OPENSSL_cleanse(void *ptr, size_t len);
|
||||
|
||||
# ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
# define OPENSSL_mem_debug_push(info) \
|
||||
CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_mem_debug_pop() \
|
||||
CRYPTO_mem_debug_pop()
|
||||
int CRYPTO_mem_debug_push(const char *info, const char *file, int line);
|
||||
int CRYPTO_mem_debug_pop(void);
|
||||
void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount);
|
||||
|
||||
/*-
|
||||
* Debugging functions (enabled by CRYPTO_set_mem_debug(1))
|
||||
* The flag argument has the following significance:
|
||||
* 0: called before the actual memory allocation has taken place
|
||||
* 1: called after the actual memory allocation has taken place
|
||||
*/
|
||||
void CRYPTO_mem_debug_malloc(void *addr, size_t num, int flag,
|
||||
const char *file, int line);
|
||||
void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag,
|
||||
const char *file, int line);
|
||||
void CRYPTO_mem_debug_free(void *addr, int flag,
|
||||
const char *file, int line);
|
||||
|
||||
int CRYPTO_mem_leaks_cb(int (*cb) (const char *str, size_t len, void *u),
|
||||
void *u);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int CRYPTO_mem_leaks_fp(FILE *);
|
||||
# endif
|
||||
int CRYPTO_mem_leaks(BIO *bio);
|
||||
# endif
|
||||
|
||||
/* die if we have to */
|
||||
ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line);
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define OpenSSLDie(f,l,a) OPENSSL_die((a),(f),(l))
|
||||
# endif
|
||||
# define OPENSSL_assert(e) \
|
||||
(void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
|
||||
|
||||
int OPENSSL_isservice(void);
|
||||
|
||||
int FIPS_mode(void);
|
||||
int FIPS_mode_set(int r);
|
||||
|
||||
void OPENSSL_init(void);
|
||||
# ifdef OPENSSL_SYS_UNIX
|
||||
void OPENSSL_fork_prepare(void);
|
||||
void OPENSSL_fork_parent(void);
|
||||
void OPENSSL_fork_child(void);
|
||||
# endif
|
||||
|
||||
struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result);
|
||||
int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec);
|
||||
int OPENSSL_gmtime_diff(int *pday, int *psec,
|
||||
const struct tm *from, const struct tm *to);
|
||||
|
||||
/*
|
||||
* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal.
|
||||
* It takes an amount of time dependent on |len|, but independent of the
|
||||
* contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements
|
||||
* into a defined order as the return value when a != b is undefined, other
|
||||
* than to be non-zero.
|
||||
*/
|
||||
int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len);
|
||||
|
||||
/* Standard initialisation options */
|
||||
# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L
|
||||
# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L
|
||||
# define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L
|
||||
# define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L
|
||||
# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L
|
||||
# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L
|
||||
# define OPENSSL_INIT_LOAD_CONFIG 0x00000040L
|
||||
# define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L
|
||||
# define OPENSSL_INIT_ASYNC 0x00000100L
|
||||
# define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L
|
||||
# define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L
|
||||
# define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L
|
||||
# define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L
|
||||
# define OPENSSL_INIT_ENGINE_CAPI 0x00002000L
|
||||
# define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L
|
||||
# define OPENSSL_INIT_ENGINE_AFALG 0x00008000L
|
||||
/* OPENSSL_INIT_ZLIB 0x00010000L */
|
||||
# define OPENSSL_INIT_ATFORK 0x00020000L
|
||||
/* OPENSSL_INIT_BASE_ONLY 0x00040000L */
|
||||
# define OPENSSL_INIT_NO_ATEXIT 0x00080000L
|
||||
/* OPENSSL_INIT flag range 0xfff00000 reserved for OPENSSL_init_ssl() */
|
||||
/* Max OPENSSL_INIT flag value is 0x80000000 */
|
||||
|
||||
/* openssl and dasync not counted as builtin */
|
||||
# define OPENSSL_INIT_ENGINE_ALL_BUILTIN \
|
||||
(OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
|
||||
| OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
|
||||
OPENSSL_INIT_ENGINE_PADLOCK)
|
||||
|
||||
|
||||
/* Library initialisation functions */
|
||||
void OPENSSL_cleanup(void);
|
||||
int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
|
||||
int OPENSSL_atexit(void (*handler)(void));
|
||||
void OPENSSL_thread_stop(void);
|
||||
|
||||
/* Low-level control of initialization */
|
||||
OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings,
|
||||
const char *config_filename);
|
||||
void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings,
|
||||
unsigned long flags);
|
||||
int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings,
|
||||
const char *config_appname);
|
||||
# endif
|
||||
void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings);
|
||||
|
||||
# if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
|
||||
# if defined(_WIN32)
|
||||
# if defined(BASETYPES) || defined(_WINDEF_H)
|
||||
/* application has to include <windows.h> in order to use this */
|
||||
typedef DWORD CRYPTO_THREAD_LOCAL;
|
||||
typedef DWORD CRYPTO_THREAD_ID;
|
||||
|
||||
typedef LONG CRYPTO_ONCE;
|
||||
# define CRYPTO_ONCE_STATIC_INIT 0
|
||||
# endif
|
||||
# else
|
||||
# include <pthread.h>
|
||||
typedef pthread_once_t CRYPTO_ONCE;
|
||||
typedef pthread_key_t CRYPTO_THREAD_LOCAL;
|
||||
typedef pthread_t CRYPTO_THREAD_ID;
|
||||
|
||||
# define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if !defined(CRYPTO_ONCE_STATIC_INIT)
|
||||
typedef unsigned int CRYPTO_ONCE;
|
||||
typedef unsigned int CRYPTO_THREAD_LOCAL;
|
||||
typedef unsigned int CRYPTO_THREAD_ID;
|
||||
# define CRYPTO_ONCE_STATIC_INIT 0
|
||||
# endif
|
||||
|
||||
int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void));
|
||||
|
||||
int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *));
|
||||
void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key);
|
||||
int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val);
|
||||
int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key);
|
||||
|
||||
CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void);
|
||||
int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
57
3rdparty/openssl/include/openssl/cryptoerr.h
vendored
57
3rdparty/openssl/include/openssl/cryptoerr.h
vendored
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CRYPTOERR_H
|
||||
# define HEADER_CRYPTOERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_CRYPTO_strings(void);
|
||||
|
||||
/*
|
||||
* CRYPTO function codes.
|
||||
*/
|
||||
# define CRYPTO_F_CMAC_CTX_NEW 120
|
||||
# define CRYPTO_F_CRYPTO_DUP_EX_DATA 110
|
||||
# define CRYPTO_F_CRYPTO_FREE_EX_DATA 111
|
||||
# define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100
|
||||
# define CRYPTO_F_CRYPTO_MEMDUP 115
|
||||
# define CRYPTO_F_CRYPTO_NEW_EX_DATA 112
|
||||
# define CRYPTO_F_CRYPTO_OCB128_COPY_CTX 121
|
||||
# define CRYPTO_F_CRYPTO_OCB128_INIT 122
|
||||
# define CRYPTO_F_CRYPTO_SET_EX_DATA 102
|
||||
# define CRYPTO_F_FIPS_MODE_SET 109
|
||||
# define CRYPTO_F_GET_AND_LOCK 113
|
||||
# define CRYPTO_F_OPENSSL_ATEXIT 114
|
||||
# define CRYPTO_F_OPENSSL_BUF2HEXSTR 117
|
||||
# define CRYPTO_F_OPENSSL_FOPEN 119
|
||||
# define CRYPTO_F_OPENSSL_HEXSTR2BUF 118
|
||||
# define CRYPTO_F_OPENSSL_INIT_CRYPTO 116
|
||||
# define CRYPTO_F_OPENSSL_LH_NEW 126
|
||||
# define CRYPTO_F_OPENSSL_SK_DEEP_COPY 127
|
||||
# define CRYPTO_F_OPENSSL_SK_DUP 128
|
||||
# define CRYPTO_F_PKEY_HMAC_INIT 123
|
||||
# define CRYPTO_F_PKEY_POLY1305_INIT 124
|
||||
# define CRYPTO_F_PKEY_SIPHASH_INIT 125
|
||||
# define CRYPTO_F_SK_RESERVE 129
|
||||
|
||||
/*
|
||||
* CRYPTO reason codes.
|
||||
*/
|
||||
# define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED 101
|
||||
# define CRYPTO_R_ILLEGAL_HEX_DIGIT 102
|
||||
# define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103
|
||||
|
||||
#endif
|
||||
474
3rdparty/openssl/include/openssl/ct.h
vendored
474
3rdparty/openssl/include/openssl/ct.h
vendored
@@ -1,474 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CT_H
|
||||
# define HEADER_CT_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CT
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/cterr.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
|
||||
/* Minimum RSA key size, from RFC6962 */
|
||||
# define SCT_MIN_RSA_BITS 2048
|
||||
|
||||
/* All hashes are SHA256 in v1 of Certificate Transparency */
|
||||
# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH
|
||||
|
||||
typedef enum {
|
||||
CT_LOG_ENTRY_TYPE_NOT_SET = -1,
|
||||
CT_LOG_ENTRY_TYPE_X509 = 0,
|
||||
CT_LOG_ENTRY_TYPE_PRECERT = 1
|
||||
} ct_log_entry_type_t;
|
||||
|
||||
typedef enum {
|
||||
SCT_VERSION_NOT_SET = -1,
|
||||
SCT_VERSION_V1 = 0
|
||||
} sct_version_t;
|
||||
|
||||
typedef enum {
|
||||
SCT_SOURCE_UNKNOWN,
|
||||
SCT_SOURCE_TLS_EXTENSION,
|
||||
SCT_SOURCE_X509V3_EXTENSION,
|
||||
SCT_SOURCE_OCSP_STAPLED_RESPONSE
|
||||
} sct_source_t;
|
||||
|
||||
typedef enum {
|
||||
SCT_VALIDATION_STATUS_NOT_SET,
|
||||
SCT_VALIDATION_STATUS_UNKNOWN_LOG,
|
||||
SCT_VALIDATION_STATUS_VALID,
|
||||
SCT_VALIDATION_STATUS_INVALID,
|
||||
SCT_VALIDATION_STATUS_UNVERIFIED,
|
||||
SCT_VALIDATION_STATUS_UNKNOWN_VERSION
|
||||
} sct_validation_status_t;
|
||||
|
||||
DEFINE_STACK_OF(SCT)
|
||||
DEFINE_STACK_OF(CTLOG)
|
||||
|
||||
/******************************************
|
||||
* CT policy evaluation context functions *
|
||||
******************************************/
|
||||
|
||||
/*
|
||||
* Creates a new, empty policy evaluation context.
|
||||
* The caller is responsible for calling CT_POLICY_EVAL_CTX_free when finished
|
||||
* with the CT_POLICY_EVAL_CTX.
|
||||
*/
|
||||
CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void);
|
||||
|
||||
/* Deletes a policy evaluation context and anything it owns. */
|
||||
void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/* Gets the peer certificate that the SCTs are for */
|
||||
X509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Sets the certificate associated with the received SCTs.
|
||||
* Increments the reference count of cert.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert);
|
||||
|
||||
/* Gets the issuer of the aforementioned certificate */
|
||||
X509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Sets the issuer of the certificate associated with the received SCTs.
|
||||
* Increments the reference count of issuer.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer);
|
||||
|
||||
/* Gets the CT logs that are trusted sources of SCTs */
|
||||
const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/* Sets the log store that is in use. It must outlive the CT_POLICY_EVAL_CTX. */
|
||||
void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx,
|
||||
CTLOG_STORE *log_store);
|
||||
|
||||
/*
|
||||
* Gets the time, in milliseconds since the Unix epoch, that will be used as the
|
||||
* current time when checking whether an SCT was issued in the future.
|
||||
* Such SCTs will fail validation, as required by RFC6962.
|
||||
*/
|
||||
uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Sets the time to evaluate SCTs against, in milliseconds since the Unix epoch.
|
||||
* If an SCT's timestamp is after this time, it will be interpreted as having
|
||||
* been issued in the future. RFC6962 states that "TLS clients MUST reject SCTs
|
||||
* whose timestamp is in the future", so an SCT will not validate in this case.
|
||||
*/
|
||||
void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms);
|
||||
|
||||
/*****************
|
||||
* SCT functions *
|
||||
*****************/
|
||||
|
||||
/*
|
||||
* Creates a new, blank SCT.
|
||||
* The caller is responsible for calling SCT_free when finished with the SCT.
|
||||
*/
|
||||
SCT *SCT_new(void);
|
||||
|
||||
/*
|
||||
* Creates a new SCT from some base64-encoded strings.
|
||||
* The caller is responsible for calling SCT_free when finished with the SCT.
|
||||
*/
|
||||
SCT *SCT_new_from_base64(unsigned char version,
|
||||
const char *logid_base64,
|
||||
ct_log_entry_type_t entry_type,
|
||||
uint64_t timestamp,
|
||||
const char *extensions_base64,
|
||||
const char *signature_base64);
|
||||
|
||||
/*
|
||||
* Frees the SCT and the underlying data structures.
|
||||
*/
|
||||
void SCT_free(SCT *sct);
|
||||
|
||||
/*
|
||||
* Free a stack of SCTs, and the underlying SCTs themselves.
|
||||
* Intended to be compatible with X509V3_EXT_FREE.
|
||||
*/
|
||||
void SCT_LIST_free(STACK_OF(SCT) *a);
|
||||
|
||||
/*
|
||||
* Returns the version of the SCT.
|
||||
*/
|
||||
sct_version_t SCT_get_version(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the version of an SCT.
|
||||
* Returns 1 on success, 0 if the version is unrecognized.
|
||||
*/
|
||||
__owur int SCT_set_version(SCT *sct, sct_version_t version);
|
||||
|
||||
/*
|
||||
* Returns the log entry type of the SCT.
|
||||
*/
|
||||
ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the log entry type of an SCT.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type);
|
||||
|
||||
/*
|
||||
* Gets the ID of the log that an SCT came from.
|
||||
* Ownership of the log ID remains with the SCT.
|
||||
* Returns the length of the log ID.
|
||||
*/
|
||||
size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id);
|
||||
|
||||
/*
|
||||
* Set the log ID of an SCT to point directly to the *log_id specified.
|
||||
* The SCT takes ownership of the specified pointer.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len);
|
||||
|
||||
/*
|
||||
* Set the log ID of an SCT.
|
||||
* This makes a copy of the log_id.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set1_log_id(SCT *sct, const unsigned char *log_id,
|
||||
size_t log_id_len);
|
||||
|
||||
/*
|
||||
* Returns the timestamp for the SCT (epoch time in milliseconds).
|
||||
*/
|
||||
uint64_t SCT_get_timestamp(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the timestamp of an SCT (epoch time in milliseconds).
|
||||
*/
|
||||
void SCT_set_timestamp(SCT *sct, uint64_t timestamp);
|
||||
|
||||
/*
|
||||
* Return the NID for the signature used by the SCT.
|
||||
* For CT v1, this will be either NID_sha256WithRSAEncryption or
|
||||
* NID_ecdsa_with_SHA256 (or NID_undef if incorrect/unset).
|
||||
*/
|
||||
int SCT_get_signature_nid(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the signature type of an SCT
|
||||
* For CT v1, this should be either NID_sha256WithRSAEncryption or
|
||||
* NID_ecdsa_with_SHA256.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set_signature_nid(SCT *sct, int nid);
|
||||
|
||||
/*
|
||||
* Set *ext to point to the extension data for the SCT. ext must not be NULL.
|
||||
* The SCT retains ownership of this pointer.
|
||||
* Returns length of the data pointed to.
|
||||
*/
|
||||
size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext);
|
||||
|
||||
/*
|
||||
* Set the extensions of an SCT to point directly to the *ext specified.
|
||||
* The SCT takes ownership of the specified pointer.
|
||||
*/
|
||||
void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len);
|
||||
|
||||
/*
|
||||
* Set the extensions of an SCT.
|
||||
* This takes a copy of the ext.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set1_extensions(SCT *sct, const unsigned char *ext,
|
||||
size_t ext_len);
|
||||
|
||||
/*
|
||||
* Set *sig to point to the signature for the SCT. sig must not be NULL.
|
||||
* The SCT retains ownership of this pointer.
|
||||
* Returns length of the data pointed to.
|
||||
*/
|
||||
size_t SCT_get0_signature(const SCT *sct, unsigned char **sig);
|
||||
|
||||
/*
|
||||
* Set the signature of an SCT to point directly to the *sig specified.
|
||||
* The SCT takes ownership of the specified pointer.
|
||||
*/
|
||||
void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len);
|
||||
|
||||
/*
|
||||
* Set the signature of an SCT to be a copy of the *sig specified.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set1_signature(SCT *sct, const unsigned char *sig,
|
||||
size_t sig_len);
|
||||
|
||||
/*
|
||||
* The origin of this SCT, e.g. TLS extension, OCSP response, etc.
|
||||
*/
|
||||
sct_source_t SCT_get_source(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the origin of this SCT, e.g. TLS extension, OCSP response, etc.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set_source(SCT *sct, sct_source_t source);
|
||||
|
||||
/*
|
||||
* Returns a text string describing the validation status of |sct|.
|
||||
*/
|
||||
const char *SCT_validation_status_string(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Pretty-prints an |sct| to |out|.
|
||||
* It will be indented by the number of spaces specified by |indent|.
|
||||
* If |logs| is not NULL, it will be used to lookup the CT log that the SCT came
|
||||
* from, so that the log name can be printed.
|
||||
*/
|
||||
void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs);
|
||||
|
||||
/*
|
||||
* Pretty-prints an |sct_list| to |out|.
|
||||
* It will be indented by the number of spaces specified by |indent|.
|
||||
* SCTs will be delimited by |separator|.
|
||||
* If |logs| is not NULL, it will be used to lookup the CT log that each SCT
|
||||
* came from, so that the log names can be printed.
|
||||
*/
|
||||
void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent,
|
||||
const char *separator, const CTLOG_STORE *logs);
|
||||
|
||||
/*
|
||||
* Gets the last result of validating this SCT.
|
||||
* If it has not been validated yet, returns SCT_VALIDATION_STATUS_NOT_SET.
|
||||
*/
|
||||
sct_validation_status_t SCT_get_validation_status(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Validates the given SCT with the provided context.
|
||||
* Sets the "validation_status" field of the SCT.
|
||||
* Returns 1 if the SCT is valid and the signature verifies.
|
||||
* Returns 0 if the SCT is invalid or could not be verified.
|
||||
* Returns -1 if an error occurs.
|
||||
*/
|
||||
__owur int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Validates the given list of SCTs with the provided context.
|
||||
* Sets the "validation_status" field of each SCT.
|
||||
* Returns 1 if there are no invalid SCTs and all signatures verify.
|
||||
* Returns 0 if at least one SCT is invalid or could not be verified.
|
||||
* Returns a negative integer if an error occurs.
|
||||
*/
|
||||
__owur int SCT_LIST_validate(const STACK_OF(SCT) *scts,
|
||||
CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
|
||||
/*********************************
|
||||
* SCT parsing and serialisation *
|
||||
*********************************/
|
||||
|
||||
/*
|
||||
* Serialize (to TLS format) a stack of SCTs and return the length.
|
||||
* "a" must not be NULL.
|
||||
* If "pp" is NULL, just return the length of what would have been serialized.
|
||||
* If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
|
||||
* for data that caller is responsible for freeing (only if function returns
|
||||
* successfully).
|
||||
* If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
|
||||
* that "*pp" is large enough to accept all of the serialized data.
|
||||
* Returns < 0 on error, >= 0 indicating bytes written (or would have been)
|
||||
* on success.
|
||||
*/
|
||||
__owur int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
|
||||
|
||||
/*
|
||||
* Convert TLS format SCT list to a stack of SCTs.
|
||||
* If "a" or "*a" is NULL, a new stack will be created that the caller is
|
||||
* responsible for freeing (by calling SCT_LIST_free).
|
||||
* "**pp" and "*pp" must not be NULL.
|
||||
* Upon success, "*pp" will point to after the last bytes read, and a stack
|
||||
* will be returned.
|
||||
* Upon failure, a NULL pointer will be returned, and the position of "*pp" is
|
||||
* not defined.
|
||||
*/
|
||||
STACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
|
||||
size_t len);
|
||||
|
||||
/*
|
||||
* Serialize (to DER format) a stack of SCTs and return the length.
|
||||
* "a" must not be NULL.
|
||||
* If "pp" is NULL, just returns the length of what would have been serialized.
|
||||
* If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
|
||||
* for data that caller is responsible for freeing (only if function returns
|
||||
* successfully).
|
||||
* If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
|
||||
* that "*pp" is large enough to accept all of the serialized data.
|
||||
* Returns < 0 on error, >= 0 indicating bytes written (or would have been)
|
||||
* on success.
|
||||
*/
|
||||
__owur int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
|
||||
|
||||
/*
|
||||
* Parses an SCT list in DER format and returns it.
|
||||
* If "a" or "*a" is NULL, a new stack will be created that the caller is
|
||||
* responsible for freeing (by calling SCT_LIST_free).
|
||||
* "**pp" and "*pp" must not be NULL.
|
||||
* Upon success, "*pp" will point to after the last bytes read, and a stack
|
||||
* will be returned.
|
||||
* Upon failure, a NULL pointer will be returned, and the position of "*pp" is
|
||||
* not defined.
|
||||
*/
|
||||
STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
|
||||
long len);
|
||||
|
||||
/*
|
||||
* Serialize (to TLS format) an |sct| and write it to |out|.
|
||||
* If |out| is null, no SCT will be output but the length will still be returned.
|
||||
* If |out| points to a null pointer, a string will be allocated to hold the
|
||||
* TLS-format SCT. It is the responsibility of the caller to free it.
|
||||
* If |out| points to an allocated string, the TLS-format SCT will be written
|
||||
* to it.
|
||||
* The length of the SCT in TLS format will be returned.
|
||||
*/
|
||||
__owur int i2o_SCT(const SCT *sct, unsigned char **out);
|
||||
|
||||
/*
|
||||
* Parses an SCT in TLS format and returns it.
|
||||
* If |psct| is not null, it will end up pointing to the parsed SCT. If it
|
||||
* already points to a non-null pointer, the pointer will be free'd.
|
||||
* |in| should be a pointer to a string containing the TLS-format SCT.
|
||||
* |in| will be advanced to the end of the SCT if parsing succeeds.
|
||||
* |len| should be the length of the SCT in |in|.
|
||||
* Returns NULL if an error occurs.
|
||||
* If the SCT is an unsupported version, only the SCT's 'sct' and 'sct_len'
|
||||
* fields will be populated (with |in| and |len| respectively).
|
||||
*/
|
||||
SCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len);
|
||||
|
||||
/********************
|
||||
* CT log functions *
|
||||
********************/
|
||||
|
||||
/*
|
||||
* Creates a new CT log instance with the given |public_key| and |name|.
|
||||
* Takes ownership of |public_key| but copies |name|.
|
||||
* Returns NULL if malloc fails or if |public_key| cannot be converted to DER.
|
||||
* Should be deleted by the caller using CTLOG_free when no longer needed.
|
||||
*/
|
||||
CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name);
|
||||
|
||||
/*
|
||||
* Creates a new CTLOG instance with the base64-encoded SubjectPublicKeyInfo DER
|
||||
* in |pkey_base64|. The |name| is a string to help users identify this log.
|
||||
* Returns 1 on success, 0 on failure.
|
||||
* Should be deleted by the caller using CTLOG_free when no longer needed.
|
||||
*/
|
||||
int CTLOG_new_from_base64(CTLOG ** ct_log,
|
||||
const char *pkey_base64, const char *name);
|
||||
|
||||
/*
|
||||
* Deletes a CT log instance and its fields.
|
||||
*/
|
||||
void CTLOG_free(CTLOG *log);
|
||||
|
||||
/* Gets the name of the CT log */
|
||||
const char *CTLOG_get0_name(const CTLOG *log);
|
||||
/* Gets the ID of the CT log */
|
||||
void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id,
|
||||
size_t *log_id_len);
|
||||
/* Gets the public key of the CT log */
|
||||
EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log);
|
||||
|
||||
/**************************
|
||||
* CT log store functions *
|
||||
**************************/
|
||||
|
||||
/*
|
||||
* Creates a new CT log store.
|
||||
* Should be deleted by the caller using CTLOG_STORE_free when no longer needed.
|
||||
*/
|
||||
CTLOG_STORE *CTLOG_STORE_new(void);
|
||||
|
||||
/*
|
||||
* Deletes a CT log store and all of the CT log instances held within.
|
||||
*/
|
||||
void CTLOG_STORE_free(CTLOG_STORE *store);
|
||||
|
||||
/*
|
||||
* Finds a CT log in the store based on its log ID.
|
||||
* Returns the CT log, or NULL if no match is found.
|
||||
*/
|
||||
const CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store,
|
||||
const uint8_t *log_id,
|
||||
size_t log_id_len);
|
||||
|
||||
/*
|
||||
* Loads a CT log list into a |store| from a |file|.
|
||||
* Returns 1 if loading is successful, or 0 otherwise.
|
||||
*/
|
||||
__owur int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file);
|
||||
|
||||
/*
|
||||
* Loads the default CT log list into a |store|.
|
||||
* Returns 1 if loading is successful, or 0 otherwise.
|
||||
*/
|
||||
__owur int CTLOG_STORE_load_default_file(CTLOG_STORE *store);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
80
3rdparty/openssl/include/openssl/cterr.h
vendored
80
3rdparty/openssl/include/openssl/cterr.h
vendored
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CTERR_H
|
||||
# define HEADER_CTERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CT
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_CT_strings(void);
|
||||
|
||||
/*
|
||||
* CT function codes.
|
||||
*/
|
||||
# define CT_F_CTLOG_NEW 117
|
||||
# define CT_F_CTLOG_NEW_FROM_BASE64 118
|
||||
# define CT_F_CTLOG_NEW_FROM_CONF 119
|
||||
# define CT_F_CTLOG_STORE_LOAD_CTX_NEW 122
|
||||
# define CT_F_CTLOG_STORE_LOAD_FILE 123
|
||||
# define CT_F_CTLOG_STORE_LOAD_LOG 130
|
||||
# define CT_F_CTLOG_STORE_NEW 131
|
||||
# define CT_F_CT_BASE64_DECODE 124
|
||||
# define CT_F_CT_POLICY_EVAL_CTX_NEW 133
|
||||
# define CT_F_CT_V1_LOG_ID_FROM_PKEY 125
|
||||
# define CT_F_I2O_SCT 107
|
||||
# define CT_F_I2O_SCT_LIST 108
|
||||
# define CT_F_I2O_SCT_SIGNATURE 109
|
||||
# define CT_F_O2I_SCT 110
|
||||
# define CT_F_O2I_SCT_LIST 111
|
||||
# define CT_F_O2I_SCT_SIGNATURE 112
|
||||
# define CT_F_SCT_CTX_NEW 126
|
||||
# define CT_F_SCT_CTX_VERIFY 128
|
||||
# define CT_F_SCT_NEW 100
|
||||
# define CT_F_SCT_NEW_FROM_BASE64 127
|
||||
# define CT_F_SCT_SET0_LOG_ID 101
|
||||
# define CT_F_SCT_SET1_EXTENSIONS 114
|
||||
# define CT_F_SCT_SET1_LOG_ID 115
|
||||
# define CT_F_SCT_SET1_SIGNATURE 116
|
||||
# define CT_F_SCT_SET_LOG_ENTRY_TYPE 102
|
||||
# define CT_F_SCT_SET_SIGNATURE_NID 103
|
||||
# define CT_F_SCT_SET_VERSION 104
|
||||
|
||||
/*
|
||||
* CT reason codes.
|
||||
*/
|
||||
# define CT_R_BASE64_DECODE_ERROR 108
|
||||
# define CT_R_INVALID_LOG_ID_LENGTH 100
|
||||
# define CT_R_LOG_CONF_INVALID 109
|
||||
# define CT_R_LOG_CONF_INVALID_KEY 110
|
||||
# define CT_R_LOG_CONF_MISSING_DESCRIPTION 111
|
||||
# define CT_R_LOG_CONF_MISSING_KEY 112
|
||||
# define CT_R_LOG_KEY_INVALID 113
|
||||
# define CT_R_SCT_FUTURE_TIMESTAMP 116
|
||||
# define CT_R_SCT_INVALID 104
|
||||
# define CT_R_SCT_INVALID_SIGNATURE 107
|
||||
# define CT_R_SCT_LIST_INVALID 105
|
||||
# define CT_R_SCT_LOG_ID_MISMATCH 114
|
||||
# define CT_R_SCT_NOT_SET 106
|
||||
# define CT_R_SCT_UNSUPPORTED_VERSION 115
|
||||
# define CT_R_UNRECOGNIZED_SIGNATURE_NID 101
|
||||
# define CT_R_UNSUPPORTED_ENTRY_TYPE 102
|
||||
# define CT_R_UNSUPPORTED_VERSION 103
|
||||
|
||||
# endif
|
||||
#endif
|
||||
174
3rdparty/openssl/include/openssl/des.h
vendored
174
3rdparty/openssl/include/openssl/des.h
vendored
@@ -1,174 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DES_H
|
||||
# define HEADER_DES_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DES
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
typedef unsigned int DES_LONG;
|
||||
|
||||
# ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
||||
# undef OPENSSL_EXTERN
|
||||
# define OPENSSL_EXTERN OPENSSL_EXPORT
|
||||
# endif
|
||||
|
||||
typedef unsigned char DES_cblock[8];
|
||||
typedef /* const */ unsigned char const_DES_cblock[8];
|
||||
/*
|
||||
* With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and
|
||||
* const_DES_cblock * are incompatible pointer types.
|
||||
*/
|
||||
|
||||
typedef struct DES_ks {
|
||||
union {
|
||||
DES_cblock cblock;
|
||||
/*
|
||||
* make sure things are correct size on machines with 8 byte longs
|
||||
*/
|
||||
DES_LONG deslong[2];
|
||||
} ks[16];
|
||||
} DES_key_schedule;
|
||||
|
||||
# define DES_KEY_SZ (sizeof(DES_cblock))
|
||||
# define DES_SCHEDULE_SZ (sizeof(DES_key_schedule))
|
||||
|
||||
# define DES_ENCRYPT 1
|
||||
# define DES_DECRYPT 0
|
||||
|
||||
# define DES_CBC_MODE 0
|
||||
# define DES_PCBC_MODE 1
|
||||
|
||||
# define DES_ecb2_encrypt(i,o,k1,k2,e) \
|
||||
DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
|
||||
|
||||
# define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
|
||||
DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
|
||||
|
||||
# define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
|
||||
DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
|
||||
|
||||
# define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
|
||||
DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
|
||||
|
||||
OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */
|
||||
# define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key)
|
||||
|
||||
const char *DES_options(void);
|
||||
void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
|
||||
DES_key_schedule *ks1, DES_key_schedule *ks2,
|
||||
DES_key_schedule *ks3, int enc);
|
||||
DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output,
|
||||
long length, DES_key_schedule *schedule,
|
||||
const_DES_cblock *ivec);
|
||||
/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */
|
||||
void DES_cbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int enc);
|
||||
void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int enc);
|
||||
void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, const_DES_cblock *inw,
|
||||
const_DES_cblock *outw, int enc);
|
||||
void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int enc);
|
||||
void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,
|
||||
DES_key_schedule *ks, int enc);
|
||||
|
||||
/*
|
||||
* This is the DES encryption function that gets called by just about every
|
||||
* other DES routine in the library. You should not use this function except
|
||||
* to implement 'modes' of DES. I say this because the functions that call
|
||||
* this routine do the conversion from 'char *' to long, and this needs to be
|
||||
* done to make sure 'non-aligned' memory access do not occur. The
|
||||
* characters are loaded 'little endian'. Data is a pointer to 2 unsigned
|
||||
* long's and ks is the DES_key_schedule to use. enc, is non zero specifies
|
||||
* encryption, zero if decryption.
|
||||
*/
|
||||
void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc);
|
||||
|
||||
/*
|
||||
* This functions is the same as DES_encrypt1() except that the DES initial
|
||||
* permutation (IP) and final permutation (FP) have been left out. As for
|
||||
* DES_encrypt1(), you should not use this function. It is used by the
|
||||
* routines in the library that implement triple DES. IP() DES_encrypt2()
|
||||
* DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1()
|
||||
* DES_encrypt1() DES_encrypt1() except faster :-).
|
||||
*/
|
||||
void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc);
|
||||
|
||||
void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3);
|
||||
void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3);
|
||||
void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||
long length,
|
||||
DES_key_schedule *ks1, DES_key_schedule *ks2,
|
||||
DES_key_schedule *ks3, DES_cblock *ivec, int enc);
|
||||
void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3,
|
||||
DES_cblock *ivec, int *num, int enc);
|
||||
void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
int numbits, long length, DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3,
|
||||
DES_cblock *ivec, int enc);
|
||||
void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3,
|
||||
DES_cblock *ivec, int *num);
|
||||
char *DES_fcrypt(const char *buf, const char *salt, char *ret);
|
||||
char *DES_crypt(const char *buf, const char *salt);
|
||||
void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec);
|
||||
void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int enc);
|
||||
DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[],
|
||||
long length, int out_count, DES_cblock *seed);
|
||||
int DES_random_key(DES_cblock *ret);
|
||||
void DES_set_odd_parity(DES_cblock *key);
|
||||
int DES_check_key_parity(const_DES_cblock *key);
|
||||
int DES_is_weak_key(const_DES_cblock *key);
|
||||
/*
|
||||
* DES_set_key (= set_key = DES_key_sched = key_sched) calls
|
||||
* DES_set_key_checked if global variable DES_check_key is set,
|
||||
* DES_set_key_unchecked otherwise.
|
||||
*/
|
||||
int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||
int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||
int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||
void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||
void DES_string_to_key(const char *str, DES_cblock *key);
|
||||
void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2);
|
||||
void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int *num, int enc);
|
||||
void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int *num);
|
||||
|
||||
# define DES_fixup_key_parity DES_set_odd_parity
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
340
3rdparty/openssl/include/openssl/dh.h
vendored
340
3rdparty/openssl/include/openssl/dh.h
vendored
@@ -1,340 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DH_H
|
||||
# define HEADER_DH_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DH
|
||||
# include <openssl/e_os2.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/asn1.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/bn.h>
|
||||
# endif
|
||||
# include <openssl/dherr.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_DH_MAX_MODULUS_BITS
|
||||
# define OPENSSL_DH_MAX_MODULUS_BITS 10000
|
||||
# endif
|
||||
|
||||
# define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024
|
||||
|
||||
# define DH_FLAG_CACHE_MONT_P 0x01
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
/*
|
||||
* Does nothing. Previously this switched off constant time behaviour.
|
||||
*/
|
||||
# define DH_FLAG_NO_EXP_CONSTTIME 0x00
|
||||
# endif
|
||||
|
||||
/*
|
||||
* If this flag is set the DH method is FIPS compliant and can be used in
|
||||
* FIPS mode. This is set in the validated module method. If an application
|
||||
* sets this flag in its own methods it is its responsibility to ensure the
|
||||
* result is compliant.
|
||||
*/
|
||||
|
||||
# define DH_FLAG_FIPS_METHOD 0x0400
|
||||
|
||||
/*
|
||||
* If this flag is set the operations normally disabled in FIPS mode are
|
||||
* permitted it is then the applications responsibility to ensure that the
|
||||
* usage is compliant.
|
||||
*/
|
||||
|
||||
# define DH_FLAG_NON_FIPS_ALLOW 0x0400
|
||||
|
||||
/* Already defined in ossl_typ.h */
|
||||
/* typedef struct dh_st DH; */
|
||||
/* typedef struct dh_method DH_METHOD; */
|
||||
|
||||
DECLARE_ASN1_ITEM(DHparams)
|
||||
|
||||
# define DH_GENERATOR_2 2
|
||||
/* #define DH_GENERATOR_3 3 */
|
||||
# define DH_GENERATOR_5 5
|
||||
|
||||
/* DH_check error codes */
|
||||
# define DH_CHECK_P_NOT_PRIME 0x01
|
||||
# define DH_CHECK_P_NOT_SAFE_PRIME 0x02
|
||||
# define DH_UNABLE_TO_CHECK_GENERATOR 0x04
|
||||
# define DH_NOT_SUITABLE_GENERATOR 0x08
|
||||
# define DH_CHECK_Q_NOT_PRIME 0x10
|
||||
# define DH_CHECK_INVALID_Q_VALUE 0x20
|
||||
# define DH_CHECK_INVALID_J_VALUE 0x40
|
||||
|
||||
/* DH_check_pub_key error codes */
|
||||
# define DH_CHECK_PUBKEY_TOO_SMALL 0x01
|
||||
# define DH_CHECK_PUBKEY_TOO_LARGE 0x02
|
||||
# define DH_CHECK_PUBKEY_INVALID 0x04
|
||||
|
||||
/*
|
||||
* primes p where (p-1)/2 is prime too are called "safe"; we define this for
|
||||
* backward compatibility:
|
||||
*/
|
||||
# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
|
||||
|
||||
# define d2i_DHparams_fp(fp,x) \
|
||||
(DH *)ASN1_d2i_fp((char *(*)())DH_new, \
|
||||
(char *(*)())d2i_DHparams, \
|
||||
(fp), \
|
||||
(unsigned char **)(x))
|
||||
# define i2d_DHparams_fp(fp,x) \
|
||||
ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x))
|
||||
# define d2i_DHparams_bio(bp,x) \
|
||||
ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x)
|
||||
# define i2d_DHparams_bio(bp,x) \
|
||||
ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
|
||||
|
||||
# define d2i_DHxparams_fp(fp,x) \
|
||||
(DH *)ASN1_d2i_fp((char *(*)())DH_new, \
|
||||
(char *(*)())d2i_DHxparams, \
|
||||
(fp), \
|
||||
(unsigned char **)(x))
|
||||
# define i2d_DHxparams_fp(fp,x) \
|
||||
ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x))
|
||||
# define d2i_DHxparams_bio(bp,x) \
|
||||
ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x)
|
||||
# define i2d_DHxparams_bio(bp,x) \
|
||||
ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x)
|
||||
|
||||
DH *DHparams_dup(DH *);
|
||||
|
||||
const DH_METHOD *DH_OpenSSL(void);
|
||||
|
||||
void DH_set_default_method(const DH_METHOD *meth);
|
||||
const DH_METHOD *DH_get_default_method(void);
|
||||
int DH_set_method(DH *dh, const DH_METHOD *meth);
|
||||
DH *DH_new_method(ENGINE *engine);
|
||||
|
||||
DH *DH_new(void);
|
||||
void DH_free(DH *dh);
|
||||
int DH_up_ref(DH *dh);
|
||||
int DH_bits(const DH *dh);
|
||||
int DH_size(const DH *dh);
|
||||
int DH_security_bits(const DH *dh);
|
||||
#define DH_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, l, p, newf, dupf, freef)
|
||||
int DH_set_ex_data(DH *d, int idx, void *arg);
|
||||
void *DH_get_ex_data(DH *d, int idx);
|
||||
|
||||
/* Deprecated version */
|
||||
DEPRECATEDIN_0_9_8(DH *DH_generate_parameters(int prime_len, int generator,
|
||||
void (*callback) (int, int,
|
||||
void *),
|
||||
void *cb_arg))
|
||||
|
||||
/* New version */
|
||||
int DH_generate_parameters_ex(DH *dh, int prime_len, int generator,
|
||||
BN_GENCB *cb);
|
||||
|
||||
int DH_check_params_ex(const DH *dh);
|
||||
int DH_check_ex(const DH *dh);
|
||||
int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key);
|
||||
int DH_check_params(const DH *dh, int *ret);
|
||||
int DH_check(const DH *dh, int *codes);
|
||||
int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *codes);
|
||||
int DH_generate_key(DH *dh);
|
||||
int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh);
|
||||
int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh);
|
||||
DH *d2i_DHparams(DH **a, const unsigned char **pp, long length);
|
||||
int i2d_DHparams(const DH *a, unsigned char **pp);
|
||||
DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length);
|
||||
int i2d_DHxparams(const DH *a, unsigned char **pp);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int DHparams_print_fp(FILE *fp, const DH *x);
|
||||
# endif
|
||||
int DHparams_print(BIO *bp, const DH *x);
|
||||
|
||||
/* RFC 5114 parameters */
|
||||
DH *DH_get_1024_160(void);
|
||||
DH *DH_get_2048_224(void);
|
||||
DH *DH_get_2048_256(void);
|
||||
|
||||
/* Named parameters, currently RFC7919 */
|
||||
DH *DH_new_by_nid(int nid);
|
||||
int DH_get_nid(const DH *dh);
|
||||
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
/* RFC2631 KDF */
|
||||
int DH_KDF_X9_42(unsigned char *out, size_t outlen,
|
||||
const unsigned char *Z, size_t Zlen,
|
||||
ASN1_OBJECT *key_oid,
|
||||
const unsigned char *ukm, size_t ukmlen, const EVP_MD *md);
|
||||
# endif
|
||||
|
||||
void DH_get0_pqg(const DH *dh,
|
||||
const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
|
||||
int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
|
||||
void DH_get0_key(const DH *dh,
|
||||
const BIGNUM **pub_key, const BIGNUM **priv_key);
|
||||
int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
|
||||
const BIGNUM *DH_get0_p(const DH *dh);
|
||||
const BIGNUM *DH_get0_q(const DH *dh);
|
||||
const BIGNUM *DH_get0_g(const DH *dh);
|
||||
const BIGNUM *DH_get0_priv_key(const DH *dh);
|
||||
const BIGNUM *DH_get0_pub_key(const DH *dh);
|
||||
void DH_clear_flags(DH *dh, int flags);
|
||||
int DH_test_flags(const DH *dh, int flags);
|
||||
void DH_set_flags(DH *dh, int flags);
|
||||
ENGINE *DH_get0_engine(DH *d);
|
||||
long DH_get_length(const DH *dh);
|
||||
int DH_set_length(DH *dh, long length);
|
||||
|
||||
DH_METHOD *DH_meth_new(const char *name, int flags);
|
||||
void DH_meth_free(DH_METHOD *dhm);
|
||||
DH_METHOD *DH_meth_dup(const DH_METHOD *dhm);
|
||||
const char *DH_meth_get0_name(const DH_METHOD *dhm);
|
||||
int DH_meth_set1_name(DH_METHOD *dhm, const char *name);
|
||||
int DH_meth_get_flags(const DH_METHOD *dhm);
|
||||
int DH_meth_set_flags(DH_METHOD *dhm, int flags);
|
||||
void *DH_meth_get0_app_data(const DH_METHOD *dhm);
|
||||
int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data);
|
||||
int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *);
|
||||
int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *));
|
||||
int (*DH_meth_get_compute_key(const DH_METHOD *dhm))
|
||||
(unsigned char *key, const BIGNUM *pub_key, DH *dh);
|
||||
int DH_meth_set_compute_key(DH_METHOD *dhm,
|
||||
int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh));
|
||||
int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm))
|
||||
(const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
BN_CTX *, BN_MONT_CTX *);
|
||||
int DH_meth_set_bn_mod_exp(DH_METHOD *dhm,
|
||||
int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
const BIGNUM *, BN_CTX *, BN_MONT_CTX *));
|
||||
int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *);
|
||||
int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *));
|
||||
int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *);
|
||||
int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *));
|
||||
int (*DH_meth_get_generate_params(const DH_METHOD *dhm))
|
||||
(DH *, int, int, BN_GENCB *);
|
||||
int DH_meth_set_generate_params(DH_METHOD *dhm,
|
||||
int (*generate_params) (DH *, int, int, BN_GENCB *));
|
||||
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_paramgen_subprime_len(ctx, len) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN, len, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_paramgen_type(ctx, typ) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DH_PARAMGEN_TYPE, typ, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_rfc5114(ctx, gen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DH_RFC5114, gen, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dhx_rfc5114(ctx, gen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DH_RFC5114, gen, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_nid(ctx, nid) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, \
|
||||
EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN, \
|
||||
EVP_PKEY_CTRL_DH_NID, nid, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_pad(ctx, pad) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_PAD, pad, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_kdf_type(ctx, kdf) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_TYPE, kdf, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_get_dh_kdf_type(ctx) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_TYPE, -2, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set0_dh_kdf_oid(ctx, oid) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_OID, 0, (void *)(oid))
|
||||
|
||||
# define EVP_PKEY_CTX_get0_dh_kdf_oid(ctx, poid) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_OID, 0, (void *)(poid))
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_kdf_md(ctx, md) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_MD, 0, (void *)(md))
|
||||
|
||||
# define EVP_PKEY_CTX_get_dh_kdf_md(ctx, pmd) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_MD, 0, (void *)(pmd))
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_kdf_outlen(ctx, len) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_OUTLEN, len, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_get_dh_kdf_outlen(ctx, plen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN, 0, (void *)(plen))
|
||||
|
||||
# define EVP_PKEY_CTX_set0_dh_kdf_ukm(ctx, p, plen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_UKM, plen, (void *)(p))
|
||||
|
||||
# define EVP_PKEY_CTX_get0_dh_kdf_ukm(ctx, p) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_UKM, 0, (void *)(p))
|
||||
|
||||
# define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1)
|
||||
# define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2)
|
||||
# define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3)
|
||||
# define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4)
|
||||
# define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5)
|
||||
# define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6)
|
||||
# define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7)
|
||||
# define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8)
|
||||
# define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9)
|
||||
# define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10)
|
||||
# define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11)
|
||||
# define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12)
|
||||
# define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13)
|
||||
# define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14)
|
||||
# define EVP_PKEY_CTRL_DH_NID (EVP_PKEY_ALG_CTRL + 15)
|
||||
# define EVP_PKEY_CTRL_DH_PAD (EVP_PKEY_ALG_CTRL + 16)
|
||||
|
||||
/* KDF types */
|
||||
# define EVP_PKEY_DH_KDF_NONE 1
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
# define EVP_PKEY_DH_KDF_X9_42 2
|
||||
# endif
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
88
3rdparty/openssl/include/openssl/dherr.h
vendored
88
3rdparty/openssl/include/openssl/dherr.h
vendored
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DHERR_H
|
||||
# define HEADER_DHERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DH
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_DH_strings(void);
|
||||
|
||||
/*
|
||||
* DH function codes.
|
||||
*/
|
||||
# define DH_F_COMPUTE_KEY 102
|
||||
# define DH_F_DHPARAMS_PRINT_FP 101
|
||||
# define DH_F_DH_BUILTIN_GENPARAMS 106
|
||||
# define DH_F_DH_CHECK_EX 121
|
||||
# define DH_F_DH_CHECK_PARAMS_EX 122
|
||||
# define DH_F_DH_CHECK_PUB_KEY_EX 123
|
||||
# define DH_F_DH_CMS_DECRYPT 114
|
||||
# define DH_F_DH_CMS_SET_PEERKEY 115
|
||||
# define DH_F_DH_CMS_SET_SHARED_INFO 116
|
||||
# define DH_F_DH_METH_DUP 117
|
||||
# define DH_F_DH_METH_NEW 118
|
||||
# define DH_F_DH_METH_SET1_NAME 119
|
||||
# define DH_F_DH_NEW_BY_NID 104
|
||||
# define DH_F_DH_NEW_METHOD 105
|
||||
# define DH_F_DH_PARAM_DECODE 107
|
||||
# define DH_F_DH_PKEY_PUBLIC_CHECK 124
|
||||
# define DH_F_DH_PRIV_DECODE 110
|
||||
# define DH_F_DH_PRIV_ENCODE 111
|
||||
# define DH_F_DH_PUB_DECODE 108
|
||||
# define DH_F_DH_PUB_ENCODE 109
|
||||
# define DH_F_DO_DH_PRINT 100
|
||||
# define DH_F_GENERATE_KEY 103
|
||||
# define DH_F_PKEY_DH_CTRL_STR 120
|
||||
# define DH_F_PKEY_DH_DERIVE 112
|
||||
# define DH_F_PKEY_DH_INIT 125
|
||||
# define DH_F_PKEY_DH_KEYGEN 113
|
||||
|
||||
/*
|
||||
* DH reason codes.
|
||||
*/
|
||||
# define DH_R_BAD_GENERATOR 101
|
||||
# define DH_R_BN_DECODE_ERROR 109
|
||||
# define DH_R_BN_ERROR 106
|
||||
# define DH_R_CHECK_INVALID_J_VALUE 115
|
||||
# define DH_R_CHECK_INVALID_Q_VALUE 116
|
||||
# define DH_R_CHECK_PUBKEY_INVALID 122
|
||||
# define DH_R_CHECK_PUBKEY_TOO_LARGE 123
|
||||
# define DH_R_CHECK_PUBKEY_TOO_SMALL 124
|
||||
# define DH_R_CHECK_P_NOT_PRIME 117
|
||||
# define DH_R_CHECK_P_NOT_SAFE_PRIME 118
|
||||
# define DH_R_CHECK_Q_NOT_PRIME 119
|
||||
# define DH_R_DECODE_ERROR 104
|
||||
# define DH_R_INVALID_PARAMETER_NAME 110
|
||||
# define DH_R_INVALID_PARAMETER_NID 114
|
||||
# define DH_R_INVALID_PUBKEY 102
|
||||
# define DH_R_KDF_PARAMETER_ERROR 112
|
||||
# define DH_R_KEYS_NOT_SET 108
|
||||
# define DH_R_MISSING_PUBKEY 125
|
||||
# define DH_R_MODULUS_TOO_LARGE 103
|
||||
# define DH_R_NOT_SUITABLE_GENERATOR 120
|
||||
# define DH_R_NO_PARAMETERS_SET 107
|
||||
# define DH_R_NO_PRIVATE_VALUE 100
|
||||
# define DH_R_PARAMETER_ENCODING_ERROR 105
|
||||
# define DH_R_PEER_KEY_ERROR 111
|
||||
# define DH_R_SHARED_INFO_ERROR 113
|
||||
# define DH_R_UNABLE_TO_CHECK_GENERATOR 121
|
||||
|
||||
# endif
|
||||
#endif
|
||||
244
3rdparty/openssl/include/openssl/dsa.h
vendored
244
3rdparty/openssl/include/openssl/dsa.h
vendored
@@ -1,244 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DSA_H
|
||||
# define HEADER_DSA_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
# include <openssl/e_os2.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/bn.h>
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/dh.h>
|
||||
# endif
|
||||
# include <openssl/dsaerr.h>
|
||||
|
||||
# ifndef OPENSSL_DSA_MAX_MODULUS_BITS
|
||||
# define OPENSSL_DSA_MAX_MODULUS_BITS 10000
|
||||
# endif
|
||||
|
||||
# define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024
|
||||
|
||||
# define DSA_FLAG_CACHE_MONT_P 0x01
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
/*
|
||||
* Does nothing. Previously this switched off constant time behaviour.
|
||||
*/
|
||||
# define DSA_FLAG_NO_EXP_CONSTTIME 0x00
|
||||
# endif
|
||||
|
||||
/*
|
||||
* If this flag is set the DSA method is FIPS compliant and can be used in
|
||||
* FIPS mode. This is set in the validated module method. If an application
|
||||
* sets this flag in its own methods it is its responsibility to ensure the
|
||||
* result is compliant.
|
||||
*/
|
||||
|
||||
# define DSA_FLAG_FIPS_METHOD 0x0400
|
||||
|
||||
/*
|
||||
* If this flag is set the operations normally disabled in FIPS mode are
|
||||
* permitted it is then the applications responsibility to ensure that the
|
||||
* usage is compliant.
|
||||
*/
|
||||
|
||||
# define DSA_FLAG_NON_FIPS_ALLOW 0x0400
|
||||
# define DSA_FLAG_FIPS_CHECKED 0x0800
|
||||
|
||||
/* Already defined in ossl_typ.h */
|
||||
/* typedef struct dsa_st DSA; */
|
||||
/* typedef struct dsa_method DSA_METHOD; */
|
||||
|
||||
typedef struct DSA_SIG_st DSA_SIG;
|
||||
|
||||
# define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \
|
||||
(char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x))
|
||||
# define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \
|
||||
(unsigned char *)(x))
|
||||
# define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x)
|
||||
# define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x)
|
||||
|
||||
DSA *DSAparams_dup(DSA *x);
|
||||
DSA_SIG *DSA_SIG_new(void);
|
||||
void DSA_SIG_free(DSA_SIG *a);
|
||||
int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);
|
||||
DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length);
|
||||
void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);
|
||||
int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s);
|
||||
|
||||
DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);
|
||||
int DSA_do_verify(const unsigned char *dgst, int dgst_len,
|
||||
DSA_SIG *sig, DSA *dsa);
|
||||
|
||||
const DSA_METHOD *DSA_OpenSSL(void);
|
||||
|
||||
void DSA_set_default_method(const DSA_METHOD *);
|
||||
const DSA_METHOD *DSA_get_default_method(void);
|
||||
int DSA_set_method(DSA *dsa, const DSA_METHOD *);
|
||||
const DSA_METHOD *DSA_get_method(DSA *d);
|
||||
|
||||
DSA *DSA_new(void);
|
||||
DSA *DSA_new_method(ENGINE *engine);
|
||||
void DSA_free(DSA *r);
|
||||
/* "up" the DSA object's reference count */
|
||||
int DSA_up_ref(DSA *r);
|
||||
int DSA_size(const DSA *);
|
||||
int DSA_bits(const DSA *d);
|
||||
int DSA_security_bits(const DSA *d);
|
||||
/* next 4 return -1 on error */
|
||||
DEPRECATEDIN_1_2_0(int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp))
|
||||
int DSA_sign(int type, const unsigned char *dgst, int dlen,
|
||||
unsigned char *sig, unsigned int *siglen, DSA *dsa);
|
||||
int DSA_verify(int type, const unsigned char *dgst, int dgst_len,
|
||||
const unsigned char *sigbuf, int siglen, DSA *dsa);
|
||||
#define DSA_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, l, p, newf, dupf, freef)
|
||||
int DSA_set_ex_data(DSA *d, int idx, void *arg);
|
||||
void *DSA_get_ex_data(DSA *d, int idx);
|
||||
|
||||
DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);
|
||||
DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
|
||||
DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length);
|
||||
|
||||
/* Deprecated version */
|
||||
DEPRECATEDIN_0_9_8(DSA *DSA_generate_parameters(int bits,
|
||||
unsigned char *seed,
|
||||
int seed_len,
|
||||
int *counter_ret,
|
||||
unsigned long *h_ret, void
|
||||
(*callback) (int, int,
|
||||
void *),
|
||||
void *cb_arg))
|
||||
|
||||
/* New version */
|
||||
int DSA_generate_parameters_ex(DSA *dsa, int bits,
|
||||
const unsigned char *seed, int seed_len,
|
||||
int *counter_ret, unsigned long *h_ret,
|
||||
BN_GENCB *cb);
|
||||
|
||||
int DSA_generate_key(DSA *a);
|
||||
int i2d_DSAPublicKey(const DSA *a, unsigned char **pp);
|
||||
int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp);
|
||||
int i2d_DSAparams(const DSA *a, unsigned char **pp);
|
||||
|
||||
int DSAparams_print(BIO *bp, const DSA *x);
|
||||
int DSA_print(BIO *bp, const DSA *x, int off);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int DSAparams_print_fp(FILE *fp, const DSA *x);
|
||||
int DSA_print_fp(FILE *bp, const DSA *x, int off);
|
||||
# endif
|
||||
|
||||
# define DSS_prime_checks 64
|
||||
/*
|
||||
* Primality test according to FIPS PUB 186-4, Appendix C.3. Since we only
|
||||
* have one value here we set the number of checks to 64 which is the 128 bit
|
||||
* security level that is the highest level and valid for creating a 3072 bit
|
||||
* DSA key.
|
||||
*/
|
||||
# define DSA_is_prime(n, callback, cb_arg) \
|
||||
BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg)
|
||||
|
||||
# ifndef OPENSSL_NO_DH
|
||||
/*
|
||||
* Convert DSA structure (key or just parameters) into DH structure (be
|
||||
* careful to avoid small subgroup attacks when using this!)
|
||||
*/
|
||||
DH *DSA_dup_DH(const DSA *r);
|
||||
# endif
|
||||
|
||||
# define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL)
|
||||
# define EVP_PKEY_CTX_set_dsa_paramgen_q_bits(ctx, qbits) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS, qbits, NULL)
|
||||
# define EVP_PKEY_CTX_set_dsa_paramgen_md(ctx, md) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DSA_PARAMGEN_MD, 0, (void *)(md))
|
||||
|
||||
# define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1)
|
||||
# define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2)
|
||||
# define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3)
|
||||
|
||||
void DSA_get0_pqg(const DSA *d,
|
||||
const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
|
||||
int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
|
||||
void DSA_get0_key(const DSA *d,
|
||||
const BIGNUM **pub_key, const BIGNUM **priv_key);
|
||||
int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
|
||||
const BIGNUM *DSA_get0_p(const DSA *d);
|
||||
const BIGNUM *DSA_get0_q(const DSA *d);
|
||||
const BIGNUM *DSA_get0_g(const DSA *d);
|
||||
const BIGNUM *DSA_get0_pub_key(const DSA *d);
|
||||
const BIGNUM *DSA_get0_priv_key(const DSA *d);
|
||||
void DSA_clear_flags(DSA *d, int flags);
|
||||
int DSA_test_flags(const DSA *d, int flags);
|
||||
void DSA_set_flags(DSA *d, int flags);
|
||||
ENGINE *DSA_get0_engine(DSA *d);
|
||||
|
||||
DSA_METHOD *DSA_meth_new(const char *name, int flags);
|
||||
void DSA_meth_free(DSA_METHOD *dsam);
|
||||
DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam);
|
||||
const char *DSA_meth_get0_name(const DSA_METHOD *dsam);
|
||||
int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name);
|
||||
int DSA_meth_get_flags(const DSA_METHOD *dsam);
|
||||
int DSA_meth_set_flags(DSA_METHOD *dsam, int flags);
|
||||
void *DSA_meth_get0_app_data(const DSA_METHOD *dsam);
|
||||
int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data);
|
||||
DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam))
|
||||
(const unsigned char *, int, DSA *);
|
||||
int DSA_meth_set_sign(DSA_METHOD *dsam,
|
||||
DSA_SIG *(*sign) (const unsigned char *, int, DSA *));
|
||||
int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam))
|
||||
(DSA *, BN_CTX *, BIGNUM **, BIGNUM **);
|
||||
int DSA_meth_set_sign_setup(DSA_METHOD *dsam,
|
||||
int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **));
|
||||
int (*DSA_meth_get_verify(const DSA_METHOD *dsam))
|
||||
(const unsigned char *, int, DSA_SIG *, DSA *);
|
||||
int DSA_meth_set_verify(DSA_METHOD *dsam,
|
||||
int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *));
|
||||
int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))
|
||||
(DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *);
|
||||
int DSA_meth_set_mod_exp(DSA_METHOD *dsam,
|
||||
int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *,
|
||||
BN_MONT_CTX *));
|
||||
int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))
|
||||
(DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
BN_CTX *, BN_MONT_CTX *);
|
||||
int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam,
|
||||
int (*bn_mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
const BIGNUM *, BN_CTX *, BN_MONT_CTX *));
|
||||
int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *);
|
||||
int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *));
|
||||
int (*DSA_meth_get_finish(const DSA_METHOD *dsam)) (DSA *);
|
||||
int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish) (DSA *));
|
||||
int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam))
|
||||
(DSA *, int, const unsigned char *, int, int *, unsigned long *,
|
||||
BN_GENCB *);
|
||||
int DSA_meth_set_paramgen(DSA_METHOD *dsam,
|
||||
int (*paramgen) (DSA *, int, const unsigned char *, int, int *,
|
||||
unsigned long *, BN_GENCB *));
|
||||
int (*DSA_meth_get_keygen(const DSA_METHOD *dsam)) (DSA *);
|
||||
int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *));
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
72
3rdparty/openssl/include/openssl/dsaerr.h
vendored
72
3rdparty/openssl/include/openssl/dsaerr.h
vendored
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DSAERR_H
|
||||
# define HEADER_DSAERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_DSA_strings(void);
|
||||
|
||||
/*
|
||||
* DSA function codes.
|
||||
*/
|
||||
# define DSA_F_DSAPARAMS_PRINT 100
|
||||
# define DSA_F_DSAPARAMS_PRINT_FP 101
|
||||
# define DSA_F_DSA_BUILTIN_PARAMGEN 125
|
||||
# define DSA_F_DSA_BUILTIN_PARAMGEN2 126
|
||||
# define DSA_F_DSA_DO_SIGN 112
|
||||
# define DSA_F_DSA_DO_VERIFY 113
|
||||
# define DSA_F_DSA_METH_DUP 127
|
||||
# define DSA_F_DSA_METH_NEW 128
|
||||
# define DSA_F_DSA_METH_SET1_NAME 129
|
||||
# define DSA_F_DSA_NEW_METHOD 103
|
||||
# define DSA_F_DSA_PARAM_DECODE 119
|
||||
# define DSA_F_DSA_PRINT_FP 105
|
||||
# define DSA_F_DSA_PRIV_DECODE 115
|
||||
# define DSA_F_DSA_PRIV_ENCODE 116
|
||||
# define DSA_F_DSA_PUB_DECODE 117
|
||||
# define DSA_F_DSA_PUB_ENCODE 118
|
||||
# define DSA_F_DSA_SIGN 106
|
||||
# define DSA_F_DSA_SIGN_SETUP 107
|
||||
# define DSA_F_DSA_SIG_NEW 102
|
||||
# define DSA_F_OLD_DSA_PRIV_DECODE 122
|
||||
# define DSA_F_PKEY_DSA_CTRL 120
|
||||
# define DSA_F_PKEY_DSA_CTRL_STR 104
|
||||
# define DSA_F_PKEY_DSA_KEYGEN 121
|
||||
|
||||
/*
|
||||
* DSA reason codes.
|
||||
*/
|
||||
# define DSA_R_BAD_Q_VALUE 102
|
||||
# define DSA_R_BN_DECODE_ERROR 108
|
||||
# define DSA_R_BN_ERROR 109
|
||||
# define DSA_R_DECODE_ERROR 104
|
||||
# define DSA_R_INVALID_DIGEST_TYPE 106
|
||||
# define DSA_R_INVALID_PARAMETERS 112
|
||||
# define DSA_R_MISSING_PARAMETERS 101
|
||||
# define DSA_R_MISSING_PRIVATE_KEY 111
|
||||
# define DSA_R_MODULUS_TOO_LARGE 103
|
||||
# define DSA_R_NO_PARAMETERS_SET 107
|
||||
# define DSA_R_PARAMETER_ENCODING_ERROR 105
|
||||
# define DSA_R_Q_NOT_PRIME 113
|
||||
# define DSA_R_SEED_LEN_SMALL 110
|
||||
|
||||
# endif
|
||||
#endif
|
||||
55
3rdparty/openssl/include/openssl/dtls1.h
vendored
55
3rdparty/openssl/include/openssl/dtls1.h
vendored
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DTLS1_H
|
||||
# define HEADER_DTLS1_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# define DTLS1_VERSION 0xFEFF
|
||||
# define DTLS1_2_VERSION 0xFEFD
|
||||
# define DTLS_MIN_VERSION DTLS1_VERSION
|
||||
# define DTLS_MAX_VERSION DTLS1_2_VERSION
|
||||
# define DTLS1_VERSION_MAJOR 0xFE
|
||||
|
||||
# define DTLS1_BAD_VER 0x0100
|
||||
|
||||
/* Special value for method supporting multiple versions */
|
||||
# define DTLS_ANY_VERSION 0x1FFFF
|
||||
|
||||
/* lengths of messages */
|
||||
/*
|
||||
* Actually the max cookie length in DTLS is 255. But we can't change this now
|
||||
* due to compatibility concerns.
|
||||
*/
|
||||
# define DTLS1_COOKIE_LENGTH 256
|
||||
|
||||
# define DTLS1_RT_HEADER_LENGTH 13
|
||||
|
||||
# define DTLS1_HM_HEADER_LENGTH 12
|
||||
|
||||
# define DTLS1_HM_BAD_FRAGMENT -2
|
||||
# define DTLS1_HM_FRAGMENT_RETRY -3
|
||||
|
||||
# define DTLS1_CCS_HEADER_LENGTH 1
|
||||
|
||||
# define DTLS1_AL_HEADER_LENGTH 2
|
||||
|
||||
/* Timeout multipliers */
|
||||
# define DTLS1_TMO_READ_COUNT 2
|
||||
# define DTLS1_TMO_WRITE_COUNT 2
|
||||
|
||||
# define DTLS1_TMO_ALERT_COUNT 12
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
301
3rdparty/openssl/include/openssl/e_os2.h
vendored
301
3rdparty/openssl/include/openssl/e_os2.h
vendored
@@ -1,301 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_E_OS2_H
|
||||
# define HEADER_E_OS2_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* Detect operating systems. This probably needs completing.
|
||||
* The result is that at least one OPENSSL_SYS_os macro should be defined.
|
||||
* However, if none is defined, Unix is assumed.
|
||||
**/
|
||||
|
||||
# define OPENSSL_SYS_UNIX
|
||||
|
||||
/* --------------------- Microsoft operating systems ---------------------- */
|
||||
|
||||
/*
|
||||
* Note that MSDOS actually denotes 32-bit environments running on top of
|
||||
* MS-DOS, such as DJGPP one.
|
||||
*/
|
||||
# if defined(OPENSSL_SYS_MSDOS)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# endif
|
||||
|
||||
/*
|
||||
* For 32 bit environment, there seems to be the CygWin environment and then
|
||||
* all the others that try to do the same thing Microsoft does...
|
||||
*/
|
||||
/*
|
||||
* UEFI lives here because it might be built with a Microsoft toolchain and
|
||||
* we need to avoid the false positive match on Windows.
|
||||
*/
|
||||
# if defined(OPENSSL_SYS_UEFI)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# elif defined(OPENSSL_SYS_UWIN)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_WIN32_UWIN
|
||||
# else
|
||||
# if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN)
|
||||
# define OPENSSL_SYS_WIN32_CYGWIN
|
||||
# else
|
||||
# if defined(_WIN32) || defined(OPENSSL_SYS_WIN32)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# if !defined(OPENSSL_SYS_WIN32)
|
||||
# define OPENSSL_SYS_WIN32
|
||||
# endif
|
||||
# endif
|
||||
# if defined(_WIN64) || defined(OPENSSL_SYS_WIN64)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# if !defined(OPENSSL_SYS_WIN64)
|
||||
# define OPENSSL_SYS_WIN64
|
||||
# endif
|
||||
# endif
|
||||
# if defined(OPENSSL_SYS_WINNT)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# endif
|
||||
# if defined(OPENSSL_SYS_WINCE)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Anything that tries to look like Microsoft is "Windows" */
|
||||
# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_WINDOWS
|
||||
# ifndef OPENSSL_SYS_MSDOS
|
||||
# define OPENSSL_SYS_MSDOS
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/*
|
||||
* DLL settings. This part is a bit tough, because it's up to the
|
||||
* application implementor how he or she will link the application, so it
|
||||
* requires some macro to be used.
|
||||
*/
|
||||
# ifdef OPENSSL_SYS_WINDOWS
|
||||
# ifndef OPENSSL_OPT_WINDLL
|
||||
# if defined(_WINDLL) /* This is used when building OpenSSL to
|
||||
* indicate that DLL linkage should be used */
|
||||
# define OPENSSL_OPT_WINDLL
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* ------------------------------- OpenVMS -------------------------------- */
|
||||
# if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYS_VMS)
|
||||
# if !defined(OPENSSL_SYS_VMS)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# endif
|
||||
# define OPENSSL_SYS_VMS
|
||||
# if defined(__DECC)
|
||||
# define OPENSSL_SYS_VMS_DECC
|
||||
# elif defined(__DECCXX)
|
||||
# define OPENSSL_SYS_VMS_DECC
|
||||
# define OPENSSL_SYS_VMS_DECCXX
|
||||
# else
|
||||
# define OPENSSL_SYS_VMS_NODECC
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* -------------------------------- Unix ---------------------------------- */
|
||||
# ifdef OPENSSL_SYS_UNIX
|
||||
# if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX)
|
||||
# define OPENSSL_SYS_LINUX
|
||||
# endif
|
||||
# if defined(_AIX) && !defined(OPENSSL_SYS_AIX)
|
||||
# define OPENSSL_SYS_AIX
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* -------------------------------- VOS ----------------------------------- */
|
||||
# if defined(__VOS__) && !defined(OPENSSL_SYS_VOS)
|
||||
# define OPENSSL_SYS_VOS
|
||||
# ifdef __HPPA__
|
||||
# define OPENSSL_SYS_VOS_HPPA
|
||||
# endif
|
||||
# ifdef __IA32__
|
||||
# define OPENSSL_SYS_VOS_IA32
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/**
|
||||
* That's it for OS-specific stuff
|
||||
*****************************************************************************/
|
||||
|
||||
/* Specials for I/O an exit */
|
||||
# ifdef OPENSSL_SYS_MSDOS
|
||||
# define OPENSSL_UNISTD_IO <io.h>
|
||||
# define OPENSSL_DECLARE_EXIT extern void exit(int);
|
||||
# else
|
||||
# define OPENSSL_UNISTD_IO OPENSSL_UNISTD
|
||||
# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */
|
||||
# endif
|
||||
|
||||
/*-
|
||||
* OPENSSL_EXTERN is normally used to declare a symbol with possible extra
|
||||
* attributes to handle its presence in a shared library.
|
||||
* OPENSSL_EXPORT is used to define a symbol with extra possible attributes
|
||||
* to make it visible in a shared library.
|
||||
* Care needs to be taken when a header file is used both to declare and
|
||||
* define symbols. Basically, for any library that exports some global
|
||||
* variables, the following code must be present in the header file that
|
||||
* declares them, before OPENSSL_EXTERN is used:
|
||||
*
|
||||
* #ifdef SOME_BUILD_FLAG_MACRO
|
||||
* # undef OPENSSL_EXTERN
|
||||
* # define OPENSSL_EXTERN OPENSSL_EXPORT
|
||||
* #endif
|
||||
*
|
||||
* The default is to have OPENSSL_EXPORT and OPENSSL_EXTERN
|
||||
* have some generally sensible values.
|
||||
*/
|
||||
|
||||
# if defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL)
|
||||
# define OPENSSL_EXPORT extern __declspec(dllexport)
|
||||
# define OPENSSL_EXTERN extern __declspec(dllimport)
|
||||
# else
|
||||
# define OPENSSL_EXPORT extern
|
||||
# define OPENSSL_EXTERN extern
|
||||
# endif
|
||||
|
||||
/*-
|
||||
* Macros to allow global variables to be reached through function calls when
|
||||
* required (if a shared library version requires it, for example.
|
||||
* The way it's done allows definitions like this:
|
||||
*
|
||||
* // in foobar.c
|
||||
* OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0)
|
||||
* // in foobar.h
|
||||
* OPENSSL_DECLARE_GLOBAL(int,foobar);
|
||||
* #define foobar OPENSSL_GLOBAL_REF(foobar)
|
||||
*/
|
||||
# ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
|
||||
# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \
|
||||
type *_shadow_##name(void) \
|
||||
{ static type _hide_##name=value; return &_hide_##name; }
|
||||
# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
|
||||
# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
|
||||
# else
|
||||
# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) type _shadow_##name=value;
|
||||
# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name
|
||||
# define OPENSSL_GLOBAL_REF(name) _shadow_##name
|
||||
# endif
|
||||
|
||||
# ifdef _WIN32
|
||||
# ifdef _WIN64
|
||||
# define ossl_ssize_t __int64
|
||||
# define OSSL_SSIZE_MAX _I64_MAX
|
||||
# else
|
||||
# define ossl_ssize_t int
|
||||
# define OSSL_SSIZE_MAX INT_MAX
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t)
|
||||
# define ossl_ssize_t INTN
|
||||
# define OSSL_SSIZE_MAX MAX_INTN
|
||||
# endif
|
||||
|
||||
# ifndef ossl_ssize_t
|
||||
# define ossl_ssize_t ssize_t
|
||||
# if defined(SSIZE_MAX)
|
||||
# define OSSL_SSIZE_MAX SSIZE_MAX
|
||||
# elif defined(_POSIX_SSIZE_MAX)
|
||||
# define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX
|
||||
# else
|
||||
# define OSSL_SSIZE_MAX ((ssize_t)(SIZE_MAX>>1))
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef DEBUG_UNUSED
|
||||
# define __owur __attribute__((__warn_unused_result__))
|
||||
# else
|
||||
# define __owur
|
||||
# endif
|
||||
|
||||
/* Standard integer types */
|
||||
# if defined(OPENSSL_SYS_UEFI)
|
||||
typedef INT8 int8_t;
|
||||
typedef UINT8 uint8_t;
|
||||
typedef INT16 int16_t;
|
||||
typedef UINT16 uint16_t;
|
||||
typedef INT32 int32_t;
|
||||
typedef UINT32 uint32_t;
|
||||
typedef INT64 int64_t;
|
||||
typedef UINT64 uint64_t;
|
||||
# elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
|
||||
defined(__osf__) || defined(__sgi) || defined(__hpux) || \
|
||||
defined(OPENSSL_SYS_VMS) || defined (__OpenBSD__)
|
||||
# include <inttypes.h>
|
||||
# elif defined(_MSC_VER) && _MSC_VER<1600
|
||||
/*
|
||||
* minimally required typdefs for systems not supporting inttypes.h or
|
||||
* stdint.h: currently just older VC++
|
||||
*/
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
# else
|
||||
# include <stdint.h>
|
||||
# endif
|
||||
|
||||
/* ossl_inline: portable inline definition usable in public headers */
|
||||
# if !defined(inline) && !defined(__cplusplus)
|
||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
|
||||
/* just use inline */
|
||||
# define ossl_inline inline
|
||||
# elif defined(__GNUC__) && __GNUC__>=2
|
||||
# define ossl_inline __inline__
|
||||
# elif defined(_MSC_VER)
|
||||
/*
|
||||
* Visual Studio: inline is available in C++ only, however
|
||||
* __inline is available for C, see
|
||||
* http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx
|
||||
*/
|
||||
# define ossl_inline __inline
|
||||
# else
|
||||
# define ossl_inline
|
||||
# endif
|
||||
# else
|
||||
# define ossl_inline inline
|
||||
# endif
|
||||
|
||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && \
|
||||
!defined(__cplusplus)
|
||||
# define ossl_noreturn _Noreturn
|
||||
# elif defined(__GNUC__) && __GNUC__ >= 2
|
||||
# define ossl_noreturn __attribute__((noreturn))
|
||||
# else
|
||||
# define ossl_noreturn
|
||||
# endif
|
||||
|
||||
/* ossl_unused: portable unused attribute for use in public headers */
|
||||
# if defined(__GNUC__)
|
||||
# define ossl_unused __attribute__((unused))
|
||||
# else
|
||||
# define ossl_unused
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
33
3rdparty/openssl/include/openssl/ebcdic.h
vendored
33
3rdparty/openssl/include/openssl/ebcdic.h
vendored
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_EBCDIC_H
|
||||
# define HEADER_EBCDIC_H
|
||||
|
||||
# include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Avoid name clashes with other applications */
|
||||
# define os_toascii _openssl_os_toascii
|
||||
# define os_toebcdic _openssl_os_toebcdic
|
||||
# define ebcdic2ascii _openssl_ebcdic2ascii
|
||||
# define ascii2ebcdic _openssl_ascii2ebcdic
|
||||
|
||||
extern const unsigned char os_toascii[256];
|
||||
extern const unsigned char os_toebcdic[256];
|
||||
void *ebcdic2ascii(void *dest, const void *srce, size_t count);
|
||||
void *ascii2ebcdic(void *dest, const void *srce, size_t count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
1484
3rdparty/openssl/include/openssl/ec.h
vendored
1484
3rdparty/openssl/include/openssl/ec.h
vendored
File diff suppressed because it is too large
Load Diff
10
3rdparty/openssl/include/openssl/ecdh.h
vendored
10
3rdparty/openssl/include/openssl/ecdh.h
vendored
@@ -1,10 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <openssl/ec.h>
|
||||
10
3rdparty/openssl/include/openssl/ecdsa.h
vendored
10
3rdparty/openssl/include/openssl/ecdsa.h
vendored
@@ -1,10 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <openssl/ec.h>
|
||||
276
3rdparty/openssl/include/openssl/ecerr.h
vendored
276
3rdparty/openssl/include/openssl/ecerr.h
vendored
@@ -1,276 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ECERR_H
|
||||
# define HEADER_ECERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_EC
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_EC_strings(void);
|
||||
|
||||
/*
|
||||
* EC function codes.
|
||||
*/
|
||||
# define EC_F_BN_TO_FELEM 224
|
||||
# define EC_F_D2I_ECPARAMETERS 144
|
||||
# define EC_F_D2I_ECPKPARAMETERS 145
|
||||
# define EC_F_D2I_ECPRIVATEKEY 146
|
||||
# define EC_F_DO_EC_KEY_PRINT 221
|
||||
# define EC_F_ECDH_CMS_DECRYPT 238
|
||||
# define EC_F_ECDH_CMS_SET_SHARED_INFO 239
|
||||
# define EC_F_ECDH_COMPUTE_KEY 246
|
||||
# define EC_F_ECDH_SIMPLE_COMPUTE_KEY 257
|
||||
# define EC_F_ECDSA_DO_SIGN_EX 251
|
||||
# define EC_F_ECDSA_DO_VERIFY 252
|
||||
# define EC_F_ECDSA_SIGN_EX 254
|
||||
# define EC_F_ECDSA_SIGN_SETUP 248
|
||||
# define EC_F_ECDSA_SIG_NEW 265
|
||||
# define EC_F_ECDSA_VERIFY 253
|
||||
# define EC_F_ECD_ITEM_VERIFY 270
|
||||
# define EC_F_ECKEY_PARAM2TYPE 223
|
||||
# define EC_F_ECKEY_PARAM_DECODE 212
|
||||
# define EC_F_ECKEY_PRIV_DECODE 213
|
||||
# define EC_F_ECKEY_PRIV_ENCODE 214
|
||||
# define EC_F_ECKEY_PUB_DECODE 215
|
||||
# define EC_F_ECKEY_PUB_ENCODE 216
|
||||
# define EC_F_ECKEY_TYPE2PARAM 220
|
||||
# define EC_F_ECPARAMETERS_PRINT 147
|
||||
# define EC_F_ECPARAMETERS_PRINT_FP 148
|
||||
# define EC_F_ECPKPARAMETERS_PRINT 149
|
||||
# define EC_F_ECPKPARAMETERS_PRINT_FP 150
|
||||
# define EC_F_ECP_NISTZ256_GET_AFFINE 240
|
||||
# define EC_F_ECP_NISTZ256_INV_MOD_ORD 275
|
||||
# define EC_F_ECP_NISTZ256_MULT_PRECOMPUTE 243
|
||||
# define EC_F_ECP_NISTZ256_POINTS_MUL 241
|
||||
# define EC_F_ECP_NISTZ256_PRE_COMP_NEW 244
|
||||
# define EC_F_ECP_NISTZ256_WINDOWED_MUL 242
|
||||
# define EC_F_ECX_KEY_OP 266
|
||||
# define EC_F_ECX_PRIV_ENCODE 267
|
||||
# define EC_F_ECX_PUB_ENCODE 268
|
||||
# define EC_F_EC_ASN1_GROUP2CURVE 153
|
||||
# define EC_F_EC_ASN1_GROUP2FIELDID 154
|
||||
# define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY 208
|
||||
# define EC_F_EC_GF2M_SIMPLE_FIELD_INV 296
|
||||
# define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 159
|
||||
# define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE 195
|
||||
# define EC_F_EC_GF2M_SIMPLE_LADDER_POST 285
|
||||
# define EC_F_EC_GF2M_SIMPLE_LADDER_PRE 288
|
||||
# define EC_F_EC_GF2M_SIMPLE_OCT2POINT 160
|
||||
# define EC_F_EC_GF2M_SIMPLE_POINT2OCT 161
|
||||
# define EC_F_EC_GF2M_SIMPLE_POINTS_MUL 289
|
||||
# define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162
|
||||
# define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163
|
||||
# define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES 164
|
||||
# define EC_F_EC_GFP_MONT_FIELD_DECODE 133
|
||||
# define EC_F_EC_GFP_MONT_FIELD_ENCODE 134
|
||||
# define EC_F_EC_GFP_MONT_FIELD_INV 297
|
||||
# define EC_F_EC_GFP_MONT_FIELD_MUL 131
|
||||
# define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE 209
|
||||
# define EC_F_EC_GFP_MONT_FIELD_SQR 132
|
||||
# define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 189
|
||||
# define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE 225
|
||||
# define EC_F_EC_GFP_NISTP224_POINTS_MUL 228
|
||||
# define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 226
|
||||
# define EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE 230
|
||||
# define EC_F_EC_GFP_NISTP256_POINTS_MUL 231
|
||||
# define EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES 232
|
||||
# define EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE 233
|
||||
# define EC_F_EC_GFP_NISTP521_POINTS_MUL 234
|
||||
# define EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES 235
|
||||
# define EC_F_EC_GFP_NIST_FIELD_MUL 200
|
||||
# define EC_F_EC_GFP_NIST_FIELD_SQR 201
|
||||
# define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 202
|
||||
# define EC_F_EC_GFP_SIMPLE_BLIND_COORDINATES 287
|
||||
# define EC_F_EC_GFP_SIMPLE_FIELD_INV 298
|
||||
# define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT 165
|
||||
# define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE 166
|
||||
# define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE 102
|
||||
# define EC_F_EC_GFP_SIMPLE_OCT2POINT 103
|
||||
# define EC_F_EC_GFP_SIMPLE_POINT2OCT 104
|
||||
# define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE 137
|
||||
# define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES 167
|
||||
# define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES 168
|
||||
# define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES 169
|
||||
# define EC_F_EC_GROUP_CHECK 170
|
||||
# define EC_F_EC_GROUP_CHECK_DISCRIMINANT 171
|
||||
# define EC_F_EC_GROUP_COPY 106
|
||||
# define EC_F_EC_GROUP_GET_CURVE 291
|
||||
# define EC_F_EC_GROUP_GET_CURVE_GF2M 172
|
||||
# define EC_F_EC_GROUP_GET_CURVE_GFP 130
|
||||
# define EC_F_EC_GROUP_GET_DEGREE 173
|
||||
# define EC_F_EC_GROUP_GET_ECPARAMETERS 261
|
||||
# define EC_F_EC_GROUP_GET_ECPKPARAMETERS 262
|
||||
# define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS 193
|
||||
# define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194
|
||||
# define EC_F_EC_GROUP_NEW 108
|
||||
# define EC_F_EC_GROUP_NEW_BY_CURVE_NAME 174
|
||||
# define EC_F_EC_GROUP_NEW_FROM_DATA 175
|
||||
# define EC_F_EC_GROUP_NEW_FROM_ECPARAMETERS 263
|
||||
# define EC_F_EC_GROUP_NEW_FROM_ECPKPARAMETERS 264
|
||||
# define EC_F_EC_GROUP_SET_CURVE 292
|
||||
# define EC_F_EC_GROUP_SET_CURVE_GF2M 176
|
||||
# define EC_F_EC_GROUP_SET_CURVE_GFP 109
|
||||
# define EC_F_EC_GROUP_SET_GENERATOR 111
|
||||
# define EC_F_EC_GROUP_SET_SEED 286
|
||||
# define EC_F_EC_KEY_CHECK_KEY 177
|
||||
# define EC_F_EC_KEY_COPY 178
|
||||
# define EC_F_EC_KEY_GENERATE_KEY 179
|
||||
# define EC_F_EC_KEY_NEW 182
|
||||
# define EC_F_EC_KEY_NEW_METHOD 245
|
||||
# define EC_F_EC_KEY_OCT2PRIV 255
|
||||
# define EC_F_EC_KEY_PRINT 180
|
||||
# define EC_F_EC_KEY_PRINT_FP 181
|
||||
# define EC_F_EC_KEY_PRIV2BUF 279
|
||||
# define EC_F_EC_KEY_PRIV2OCT 256
|
||||
# define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES 229
|
||||
# define EC_F_EC_KEY_SIMPLE_CHECK_KEY 258
|
||||
# define EC_F_EC_KEY_SIMPLE_OCT2PRIV 259
|
||||
# define EC_F_EC_KEY_SIMPLE_PRIV2OCT 260
|
||||
# define EC_F_EC_PKEY_CHECK 273
|
||||
# define EC_F_EC_PKEY_PARAM_CHECK 274
|
||||
# define EC_F_EC_POINTS_MAKE_AFFINE 136
|
||||
# define EC_F_EC_POINTS_MUL 290
|
||||
# define EC_F_EC_POINT_ADD 112
|
||||
# define EC_F_EC_POINT_BN2POINT 280
|
||||
# define EC_F_EC_POINT_CMP 113
|
||||
# define EC_F_EC_POINT_COPY 114
|
||||
# define EC_F_EC_POINT_DBL 115
|
||||
# define EC_F_EC_POINT_GET_AFFINE_COORDINATES 293
|
||||
# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 183
|
||||
# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP 116
|
||||
# define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP 117
|
||||
# define EC_F_EC_POINT_INVERT 210
|
||||
# define EC_F_EC_POINT_IS_AT_INFINITY 118
|
||||
# define EC_F_EC_POINT_IS_ON_CURVE 119
|
||||
# define EC_F_EC_POINT_MAKE_AFFINE 120
|
||||
# define EC_F_EC_POINT_NEW 121
|
||||
# define EC_F_EC_POINT_OCT2POINT 122
|
||||
# define EC_F_EC_POINT_POINT2BUF 281
|
||||
# define EC_F_EC_POINT_POINT2OCT 123
|
||||
# define EC_F_EC_POINT_SET_AFFINE_COORDINATES 294
|
||||
# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 185
|
||||
# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP 124
|
||||
# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES 295
|
||||
# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 186
|
||||
# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP 125
|
||||
# define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 126
|
||||
# define EC_F_EC_POINT_SET_TO_INFINITY 127
|
||||
# define EC_F_EC_PRE_COMP_NEW 196
|
||||
# define EC_F_EC_SCALAR_MUL_LADDER 284
|
||||
# define EC_F_EC_WNAF_MUL 187
|
||||
# define EC_F_EC_WNAF_PRECOMPUTE_MULT 188
|
||||
# define EC_F_I2D_ECPARAMETERS 190
|
||||
# define EC_F_I2D_ECPKPARAMETERS 191
|
||||
# define EC_F_I2D_ECPRIVATEKEY 192
|
||||
# define EC_F_I2O_ECPUBLICKEY 151
|
||||
# define EC_F_NISTP224_PRE_COMP_NEW 227
|
||||
# define EC_F_NISTP256_PRE_COMP_NEW 236
|
||||
# define EC_F_NISTP521_PRE_COMP_NEW 237
|
||||
# define EC_F_O2I_ECPUBLICKEY 152
|
||||
# define EC_F_OLD_EC_PRIV_DECODE 222
|
||||
# define EC_F_OSSL_ECDH_COMPUTE_KEY 247
|
||||
# define EC_F_OSSL_ECDSA_SIGN_SIG 249
|
||||
# define EC_F_OSSL_ECDSA_VERIFY_SIG 250
|
||||
# define EC_F_PKEY_ECD_CTRL 271
|
||||
# define EC_F_PKEY_ECD_DIGESTSIGN 272
|
||||
# define EC_F_PKEY_ECD_DIGESTSIGN25519 276
|
||||
# define EC_F_PKEY_ECD_DIGESTSIGN448 277
|
||||
# define EC_F_PKEY_ECX_DERIVE 269
|
||||
# define EC_F_PKEY_EC_CTRL 197
|
||||
# define EC_F_PKEY_EC_CTRL_STR 198
|
||||
# define EC_F_PKEY_EC_DERIVE 217
|
||||
# define EC_F_PKEY_EC_INIT 282
|
||||
# define EC_F_PKEY_EC_KDF_DERIVE 283
|
||||
# define EC_F_PKEY_EC_KEYGEN 199
|
||||
# define EC_F_PKEY_EC_PARAMGEN 219
|
||||
# define EC_F_PKEY_EC_SIGN 218
|
||||
# define EC_F_VALIDATE_ECX_DERIVE 278
|
||||
|
||||
/*
|
||||
* EC reason codes.
|
||||
*/
|
||||
# define EC_R_ASN1_ERROR 115
|
||||
# define EC_R_BAD_SIGNATURE 156
|
||||
# define EC_R_BIGNUM_OUT_OF_RANGE 144
|
||||
# define EC_R_BUFFER_TOO_SMALL 100
|
||||
# define EC_R_CANNOT_INVERT 165
|
||||
# define EC_R_COORDINATES_OUT_OF_RANGE 146
|
||||
# define EC_R_CURVE_DOES_NOT_SUPPORT_ECDH 160
|
||||
# define EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING 159
|
||||
# define EC_R_D2I_ECPKPARAMETERS_FAILURE 117
|
||||
# define EC_R_DECODE_ERROR 142
|
||||
# define EC_R_DISCRIMINANT_IS_ZERO 118
|
||||
# define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119
|
||||
# define EC_R_FIELD_TOO_LARGE 143
|
||||
# define EC_R_GF2M_NOT_SUPPORTED 147
|
||||
# define EC_R_GROUP2PKPARAMETERS_FAILURE 120
|
||||
# define EC_R_I2D_ECPKPARAMETERS_FAILURE 121
|
||||
# define EC_R_INCOMPATIBLE_OBJECTS 101
|
||||
# define EC_R_INVALID_ARGUMENT 112
|
||||
# define EC_R_INVALID_COMPRESSED_POINT 110
|
||||
# define EC_R_INVALID_COMPRESSION_BIT 109
|
||||
# define EC_R_INVALID_CURVE 141
|
||||
# define EC_R_INVALID_DIGEST 151
|
||||
# define EC_R_INVALID_DIGEST_TYPE 138
|
||||
# define EC_R_INVALID_ENCODING 102
|
||||
# define EC_R_INVALID_FIELD 103
|
||||
# define EC_R_INVALID_FORM 104
|
||||
# define EC_R_INVALID_GROUP_ORDER 122
|
||||
# define EC_R_INVALID_KEY 116
|
||||
# define EC_R_INVALID_OUTPUT_LENGTH 161
|
||||
# define EC_R_INVALID_PEER_KEY 133
|
||||
# define EC_R_INVALID_PENTANOMIAL_BASIS 132
|
||||
# define EC_R_INVALID_PRIVATE_KEY 123
|
||||
# define EC_R_INVALID_TRINOMIAL_BASIS 137
|
||||
# define EC_R_KDF_PARAMETER_ERROR 148
|
||||
# define EC_R_KEYS_NOT_SET 140
|
||||
# define EC_R_LADDER_POST_FAILURE 136
|
||||
# define EC_R_LADDER_PRE_FAILURE 153
|
||||
# define EC_R_LADDER_STEP_FAILURE 162
|
||||
# define EC_R_MISSING_OID 167
|
||||
# define EC_R_MISSING_PARAMETERS 124
|
||||
# define EC_R_MISSING_PRIVATE_KEY 125
|
||||
# define EC_R_NEED_NEW_SETUP_VALUES 157
|
||||
# define EC_R_NOT_A_NIST_PRIME 135
|
||||
# define EC_R_NOT_IMPLEMENTED 126
|
||||
# define EC_R_NOT_INITIALIZED 111
|
||||
# define EC_R_NO_PARAMETERS_SET 139
|
||||
# define EC_R_NO_PRIVATE_VALUE 154
|
||||
# define EC_R_OPERATION_NOT_SUPPORTED 152
|
||||
# define EC_R_PASSED_NULL_PARAMETER 134
|
||||
# define EC_R_PEER_KEY_ERROR 149
|
||||
# define EC_R_PKPARAMETERS2GROUP_FAILURE 127
|
||||
# define EC_R_POINT_ARITHMETIC_FAILURE 155
|
||||
# define EC_R_POINT_AT_INFINITY 106
|
||||
# define EC_R_POINT_COORDINATES_BLIND_FAILURE 163
|
||||
# define EC_R_POINT_IS_NOT_ON_CURVE 107
|
||||
# define EC_R_RANDOM_NUMBER_GENERATION_FAILED 158
|
||||
# define EC_R_SHARED_INFO_ERROR 150
|
||||
# define EC_R_SLOT_FULL 108
|
||||
# define EC_R_UNDEFINED_GENERATOR 113
|
||||
# define EC_R_UNDEFINED_ORDER 128
|
||||
# define EC_R_UNKNOWN_COFACTOR 164
|
||||
# define EC_R_UNKNOWN_GROUP 129
|
||||
# define EC_R_UNKNOWN_ORDER 114
|
||||
# define EC_R_UNSUPPORTED_FIELD 131
|
||||
# define EC_R_WRONG_CURVE_PARAMETERS 145
|
||||
# define EC_R_WRONG_ORDER 130
|
||||
|
||||
# endif
|
||||
#endif
|
||||
752
3rdparty/openssl/include/openssl/engine.h
vendored
752
3rdparty/openssl/include/openssl/engine.h
vendored
@@ -1,752 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ENGINE_H
|
||||
# define HEADER_ENGINE_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/bn.h>
|
||||
# include <openssl/rsa.h>
|
||||
# include <openssl/dsa.h>
|
||||
# include <openssl/dh.h>
|
||||
# include <openssl/ec.h>
|
||||
# include <openssl/rand.h>
|
||||
# include <openssl/ui.h>
|
||||
# include <openssl/err.h>
|
||||
# endif
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/engineerr.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
/*
|
||||
* These flags are used to control combinations of algorithm (methods) by
|
||||
* bitwise "OR"ing.
|
||||
*/
|
||||
# define ENGINE_METHOD_RSA (unsigned int)0x0001
|
||||
# define ENGINE_METHOD_DSA (unsigned int)0x0002
|
||||
# define ENGINE_METHOD_DH (unsigned int)0x0004
|
||||
# define ENGINE_METHOD_RAND (unsigned int)0x0008
|
||||
# define ENGINE_METHOD_CIPHERS (unsigned int)0x0040
|
||||
# define ENGINE_METHOD_DIGESTS (unsigned int)0x0080
|
||||
# define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200
|
||||
# define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400
|
||||
# define ENGINE_METHOD_EC (unsigned int)0x0800
|
||||
/* Obvious all-or-nothing cases. */
|
||||
# define ENGINE_METHOD_ALL (unsigned int)0xFFFF
|
||||
# define ENGINE_METHOD_NONE (unsigned int)0x0000
|
||||
|
||||
/*
|
||||
* This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used
|
||||
* internally to control registration of ENGINE implementations, and can be
|
||||
* set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to
|
||||
* initialise registered ENGINEs if they are not already initialised.
|
||||
*/
|
||||
# define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001
|
||||
|
||||
/* ENGINE flags that can be set by ENGINE_set_flags(). */
|
||||
/* Not used */
|
||||
/* #define ENGINE_FLAGS_MALLOCED 0x0001 */
|
||||
|
||||
/*
|
||||
* This flag is for ENGINEs that wish to handle the various 'CMD'-related
|
||||
* control commands on their own. Without this flag, ENGINE_ctrl() handles
|
||||
* these control commands on behalf of the ENGINE using their "cmd_defns"
|
||||
* data.
|
||||
*/
|
||||
# define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002
|
||||
|
||||
/*
|
||||
* This flag is for ENGINEs who return new duplicate structures when found
|
||||
* via "ENGINE_by_id()". When an ENGINE must store state (eg. if
|
||||
* ENGINE_ctrl() commands are called in sequence as part of some stateful
|
||||
* process like key-generation setup and execution), it can set this flag -
|
||||
* then each attempt to obtain the ENGINE will result in it being copied into
|
||||
* a new structure. Normally, ENGINEs don't declare this flag so
|
||||
* ENGINE_by_id() just increments the existing ENGINE's structural reference
|
||||
* count.
|
||||
*/
|
||||
# define ENGINE_FLAGS_BY_ID_COPY (int)0x0004
|
||||
|
||||
/*
|
||||
* This flag if for an ENGINE that does not want its methods registered as
|
||||
* part of ENGINE_register_all_complete() for example if the methods are not
|
||||
* usable as default methods.
|
||||
*/
|
||||
|
||||
# define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008
|
||||
|
||||
/*
|
||||
* ENGINEs can support their own command types, and these flags are used in
|
||||
* ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input
|
||||
* each command expects. Currently only numeric and string input is
|
||||
* supported. If a control command supports none of the _NUMERIC, _STRING, or
|
||||
* _NO_INPUT options, then it is regarded as an "internal" control command -
|
||||
* and not for use in config setting situations. As such, they're not
|
||||
* available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl()
|
||||
* access. Changes to this list of 'command types' should be reflected
|
||||
* carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string().
|
||||
*/
|
||||
|
||||
/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */
|
||||
# define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001
|
||||
/*
|
||||
* accepts string input (cast from 'void*' to 'const char *', 4th parameter
|
||||
* to ENGINE_ctrl)
|
||||
*/
|
||||
# define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002
|
||||
/*
|
||||
* Indicates that the control command takes *no* input. Ie. the control
|
||||
* command is unparameterised.
|
||||
*/
|
||||
# define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004
|
||||
/*
|
||||
* Indicates that the control command is internal. This control command won't
|
||||
* be shown in any output, and is only usable through the ENGINE_ctrl_cmd()
|
||||
* function.
|
||||
*/
|
||||
# define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008
|
||||
|
||||
/*
|
||||
* NB: These 3 control commands are deprecated and should not be used.
|
||||
* ENGINEs relying on these commands should compile conditional support for
|
||||
* compatibility (eg. if these symbols are defined) but should also migrate
|
||||
* the same functionality to their own ENGINE-specific control functions that
|
||||
* can be "discovered" by calling applications. The fact these control
|
||||
* commands wouldn't be "executable" (ie. usable by text-based config)
|
||||
* doesn't change the fact that application code can find and use them
|
||||
* without requiring per-ENGINE hacking.
|
||||
*/
|
||||
|
||||
/*
|
||||
* These flags are used to tell the ctrl function what should be done. All
|
||||
* command numbers are shared between all engines, even if some don't make
|
||||
* sense to some engines. In such a case, they do nothing but return the
|
||||
* error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED.
|
||||
*/
|
||||
# define ENGINE_CTRL_SET_LOGSTREAM 1
|
||||
# define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2
|
||||
# define ENGINE_CTRL_HUP 3/* Close and reinitialise
|
||||
* any handles/connections
|
||||
* etc. */
|
||||
# define ENGINE_CTRL_SET_USER_INTERFACE 4/* Alternative to callback */
|
||||
# define ENGINE_CTRL_SET_CALLBACK_DATA 5/* User-specific data, used
|
||||
* when calling the password
|
||||
* callback and the user
|
||||
* interface */
|
||||
# define ENGINE_CTRL_LOAD_CONFIGURATION 6/* Load a configuration,
|
||||
* given a string that
|
||||
* represents a file name
|
||||
* or so */
|
||||
# define ENGINE_CTRL_LOAD_SECTION 7/* Load data from a given
|
||||
* section in the already
|
||||
* loaded configuration */
|
||||
|
||||
/*
|
||||
* These control commands allow an application to deal with an arbitrary
|
||||
* engine in a dynamic way. Warn: Negative return values indicate errors FOR
|
||||
* THESE COMMANDS because zero is used to indicate 'end-of-list'. Other
|
||||
* commands, including ENGINE-specific command types, return zero for an
|
||||
* error. An ENGINE can choose to implement these ctrl functions, and can
|
||||
* internally manage things however it chooses - it does so by setting the
|
||||
* ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise
|
||||
* the ENGINE_ctrl() code handles this on the ENGINE's behalf using the
|
||||
* cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's
|
||||
* ctrl() handler need only implement its own commands - the above "meta"
|
||||
* commands will be taken care of.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not",
|
||||
* then all the remaining control commands will return failure, so it is
|
||||
* worth checking this first if the caller is trying to "discover" the
|
||||
* engine's capabilities and doesn't want errors generated unnecessarily.
|
||||
*/
|
||||
# define ENGINE_CTRL_HAS_CTRL_FUNCTION 10
|
||||
/*
|
||||
* Returns a positive command number for the first command supported by the
|
||||
* engine. Returns zero if no ctrl commands are supported.
|
||||
*/
|
||||
# define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11
|
||||
/*
|
||||
* The 'long' argument specifies a command implemented by the engine, and the
|
||||
* return value is the next command supported, or zero if there are no more.
|
||||
*/
|
||||
# define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12
|
||||
/*
|
||||
* The 'void*' argument is a command name (cast from 'const char *'), and the
|
||||
* return value is the command that corresponds to it.
|
||||
*/
|
||||
# define ENGINE_CTRL_GET_CMD_FROM_NAME 13
|
||||
/*
|
||||
* The next two allow a command to be converted into its corresponding string
|
||||
* form. In each case, the 'long' argument supplies the command. In the
|
||||
* NAME_LEN case, the return value is the length of the command name (not
|
||||
* counting a trailing EOL). In the NAME case, the 'void*' argument must be a
|
||||
* string buffer large enough, and it will be populated with the name of the
|
||||
* command (WITH a trailing EOL).
|
||||
*/
|
||||
# define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14
|
||||
# define ENGINE_CTRL_GET_NAME_FROM_CMD 15
|
||||
/* The next two are similar but give a "short description" of a command. */
|
||||
# define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16
|
||||
# define ENGINE_CTRL_GET_DESC_FROM_CMD 17
|
||||
/*
|
||||
* With this command, the return value is the OR'd combination of
|
||||
* ENGINE_CMD_FLAG_*** values that indicate what kind of input a given
|
||||
* engine-specific ctrl command expects.
|
||||
*/
|
||||
# define ENGINE_CTRL_GET_CMD_FLAGS 18
|
||||
|
||||
/*
|
||||
* ENGINE implementations should start the numbering of their own control
|
||||
* commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc).
|
||||
*/
|
||||
# define ENGINE_CMD_BASE 200
|
||||
|
||||
/*
|
||||
* NB: These 2 nCipher "chil" control commands are deprecated, and their
|
||||
* functionality is now available through ENGINE-specific control commands
|
||||
* (exposed through the above-mentioned 'CMD'-handling). Code using these 2
|
||||
* commands should be migrated to the more general command handling before
|
||||
* these are removed.
|
||||
*/
|
||||
|
||||
/* Flags specific to the nCipher "chil" engine */
|
||||
# define ENGINE_CTRL_CHIL_SET_FORKCHECK 100
|
||||
/*
|
||||
* Depending on the value of the (long)i argument, this sets or
|
||||
* unsets the SimpleForkCheck flag in the CHIL API to enable or
|
||||
* disable checking and workarounds for applications that fork().
|
||||
*/
|
||||
# define ENGINE_CTRL_CHIL_NO_LOCKING 101
|
||||
/*
|
||||
* This prevents the initialisation function from providing mutex
|
||||
* callbacks to the nCipher library.
|
||||
*/
|
||||
|
||||
/*
|
||||
* If an ENGINE supports its own specific control commands and wishes the
|
||||
* framework to handle the above 'ENGINE_CMD_***'-manipulation commands on
|
||||
* its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN
|
||||
* entries to ENGINE_set_cmd_defns(). It should also implement a ctrl()
|
||||
* handler that supports the stated commands (ie. the "cmd_num" entries as
|
||||
* described by the array). NB: The array must be ordered in increasing order
|
||||
* of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element
|
||||
* has cmd_num set to zero and/or cmd_name set to NULL.
|
||||
*/
|
||||
typedef struct ENGINE_CMD_DEFN_st {
|
||||
unsigned int cmd_num; /* The command number */
|
||||
const char *cmd_name; /* The command name itself */
|
||||
const char *cmd_desc; /* A short description of the command */
|
||||
unsigned int cmd_flags; /* The input the command expects */
|
||||
} ENGINE_CMD_DEFN;
|
||||
|
||||
/* Generic function pointer */
|
||||
typedef int (*ENGINE_GEN_FUNC_PTR) (void);
|
||||
/* Generic function pointer taking no arguments */
|
||||
typedef int (*ENGINE_GEN_INT_FUNC_PTR) (ENGINE *);
|
||||
/* Specific control function pointer */
|
||||
typedef int (*ENGINE_CTRL_FUNC_PTR) (ENGINE *, int, long, void *,
|
||||
void (*f) (void));
|
||||
/* Generic load_key function pointer */
|
||||
typedef EVP_PKEY *(*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *,
|
||||
UI_METHOD *ui_method,
|
||||
void *callback_data);
|
||||
typedef int (*ENGINE_SSL_CLIENT_CERT_PTR) (ENGINE *, SSL *ssl,
|
||||
STACK_OF(X509_NAME) *ca_dn,
|
||||
X509 **pcert, EVP_PKEY **pkey,
|
||||
STACK_OF(X509) **pother,
|
||||
UI_METHOD *ui_method,
|
||||
void *callback_data);
|
||||
/*-
|
||||
* These callback types are for an ENGINE's handler for cipher and digest logic.
|
||||
* These handlers have these prototypes;
|
||||
* int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid);
|
||||
* int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid);
|
||||
* Looking at how to implement these handlers in the case of cipher support, if
|
||||
* the framework wants the EVP_CIPHER for 'nid', it will call;
|
||||
* foo(e, &p_evp_cipher, NULL, nid); (return zero for failure)
|
||||
* If the framework wants a list of supported 'nid's, it will call;
|
||||
* foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error)
|
||||
*/
|
||||
/*
|
||||
* Returns to a pointer to the array of supported cipher 'nid's. If the
|
||||
* second parameter is non-NULL it is set to the size of the returned array.
|
||||
*/
|
||||
typedef int (*ENGINE_CIPHERS_PTR) (ENGINE *, const EVP_CIPHER **,
|
||||
const int **, int);
|
||||
typedef int (*ENGINE_DIGESTS_PTR) (ENGINE *, const EVP_MD **, const int **,
|
||||
int);
|
||||
typedef int (*ENGINE_PKEY_METHS_PTR) (ENGINE *, EVP_PKEY_METHOD **,
|
||||
const int **, int);
|
||||
typedef int (*ENGINE_PKEY_ASN1_METHS_PTR) (ENGINE *, EVP_PKEY_ASN1_METHOD **,
|
||||
const int **, int);
|
||||
/*
|
||||
* STRUCTURE functions ... all of these functions deal with pointers to
|
||||
* ENGINE structures where the pointers have a "structural reference". This
|
||||
* means that their reference is to allowed access to the structure but it
|
||||
* does not imply that the structure is functional. To simply increment or
|
||||
* decrement the structural reference count, use ENGINE_by_id and
|
||||
* ENGINE_free. NB: This is not required when iterating using ENGINE_get_next
|
||||
* as it will automatically decrement the structural reference count of the
|
||||
* "current" ENGINE and increment the structural reference count of the
|
||||
* ENGINE it returns (unless it is NULL).
|
||||
*/
|
||||
|
||||
/* Get the first/last "ENGINE" type available. */
|
||||
ENGINE *ENGINE_get_first(void);
|
||||
ENGINE *ENGINE_get_last(void);
|
||||
/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */
|
||||
ENGINE *ENGINE_get_next(ENGINE *e);
|
||||
ENGINE *ENGINE_get_prev(ENGINE *e);
|
||||
/* Add another "ENGINE" type into the array. */
|
||||
int ENGINE_add(ENGINE *e);
|
||||
/* Remove an existing "ENGINE" type from the array. */
|
||||
int ENGINE_remove(ENGINE *e);
|
||||
/* Retrieve an engine from the list by its unique "id" value. */
|
||||
ENGINE *ENGINE_by_id(const char *id);
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define ENGINE_load_openssl() \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_OPENSSL, NULL)
|
||||
# define ENGINE_load_dynamic() \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL)
|
||||
# ifndef OPENSSL_NO_STATIC_ENGINE
|
||||
# define ENGINE_load_padlock() \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_PADLOCK, NULL)
|
||||
# define ENGINE_load_capi() \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CAPI, NULL)
|
||||
# define ENGINE_load_afalg() \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_AFALG, NULL)
|
||||
# endif
|
||||
# define ENGINE_load_cryptodev() \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CRYPTODEV, NULL)
|
||||
# define ENGINE_load_rdrand() \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_RDRAND, NULL)
|
||||
#endif
|
||||
void ENGINE_load_builtin_engines(void);
|
||||
|
||||
/*
|
||||
* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation
|
||||
* "registry" handling.
|
||||
*/
|
||||
unsigned int ENGINE_get_table_flags(void);
|
||||
void ENGINE_set_table_flags(unsigned int flags);
|
||||
|
||||
/*- Manage registration of ENGINEs per "table". For each type, there are 3
|
||||
* functions;
|
||||
* ENGINE_register_***(e) - registers the implementation from 'e' (if it has one)
|
||||
* ENGINE_unregister_***(e) - unregister the implementation from 'e'
|
||||
* ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list
|
||||
* Cleanup is automatically registered from each table when required.
|
||||
*/
|
||||
|
||||
int ENGINE_register_RSA(ENGINE *e);
|
||||
void ENGINE_unregister_RSA(ENGINE *e);
|
||||
void ENGINE_register_all_RSA(void);
|
||||
|
||||
int ENGINE_register_DSA(ENGINE *e);
|
||||
void ENGINE_unregister_DSA(ENGINE *e);
|
||||
void ENGINE_register_all_DSA(void);
|
||||
|
||||
int ENGINE_register_EC(ENGINE *e);
|
||||
void ENGINE_unregister_EC(ENGINE *e);
|
||||
void ENGINE_register_all_EC(void);
|
||||
|
||||
int ENGINE_register_DH(ENGINE *e);
|
||||
void ENGINE_unregister_DH(ENGINE *e);
|
||||
void ENGINE_register_all_DH(void);
|
||||
|
||||
int ENGINE_register_RAND(ENGINE *e);
|
||||
void ENGINE_unregister_RAND(ENGINE *e);
|
||||
void ENGINE_register_all_RAND(void);
|
||||
|
||||
int ENGINE_register_ciphers(ENGINE *e);
|
||||
void ENGINE_unregister_ciphers(ENGINE *e);
|
||||
void ENGINE_register_all_ciphers(void);
|
||||
|
||||
int ENGINE_register_digests(ENGINE *e);
|
||||
void ENGINE_unregister_digests(ENGINE *e);
|
||||
void ENGINE_register_all_digests(void);
|
||||
|
||||
int ENGINE_register_pkey_meths(ENGINE *e);
|
||||
void ENGINE_unregister_pkey_meths(ENGINE *e);
|
||||
void ENGINE_register_all_pkey_meths(void);
|
||||
|
||||
int ENGINE_register_pkey_asn1_meths(ENGINE *e);
|
||||
void ENGINE_unregister_pkey_asn1_meths(ENGINE *e);
|
||||
void ENGINE_register_all_pkey_asn1_meths(void);
|
||||
|
||||
/*
|
||||
* These functions register all support from the above categories. Note, use
|
||||
* of these functions can result in static linkage of code your application
|
||||
* may not need. If you only need a subset of functionality, consider using
|
||||
* more selective initialisation.
|
||||
*/
|
||||
int ENGINE_register_complete(ENGINE *e);
|
||||
int ENGINE_register_all_complete(void);
|
||||
|
||||
/*
|
||||
* Send parameterised control commands to the engine. The possibilities to
|
||||
* send down an integer, a pointer to data or a function pointer are
|
||||
* provided. Any of the parameters may or may not be NULL, depending on the
|
||||
* command number. In actuality, this function only requires a structural
|
||||
* (rather than functional) reference to an engine, but many control commands
|
||||
* may require the engine be functional. The caller should be aware of trying
|
||||
* commands that require an operational ENGINE, and only use functional
|
||||
* references in such situations.
|
||||
*/
|
||||
int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void));
|
||||
|
||||
/*
|
||||
* This function tests if an ENGINE-specific command is usable as a
|
||||
* "setting". Eg. in an application's config file that gets processed through
|
||||
* ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to
|
||||
* ENGINE_ctrl_cmd_string(), only ENGINE_ctrl().
|
||||
*/
|
||||
int ENGINE_cmd_is_executable(ENGINE *e, int cmd);
|
||||
|
||||
/*
|
||||
* This function works like ENGINE_ctrl() with the exception of taking a
|
||||
* command name instead of a command number, and can handle optional
|
||||
* commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation
|
||||
* on how to use the cmd_name and cmd_optional.
|
||||
*/
|
||||
int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,
|
||||
long i, void *p, void (*f) (void), int cmd_optional);
|
||||
|
||||
/*
|
||||
* This function passes a command-name and argument to an ENGINE. The
|
||||
* cmd_name is converted to a command number and the control command is
|
||||
* called using 'arg' as an argument (unless the ENGINE doesn't support such
|
||||
* a command, in which case no control command is called). The command is
|
||||
* checked for input flags, and if necessary the argument will be converted
|
||||
* to a numeric value. If cmd_optional is non-zero, then if the ENGINE
|
||||
* doesn't support the given cmd_name the return value will be success
|
||||
* anyway. This function is intended for applications to use so that users
|
||||
* (or config files) can supply engine-specific config data to the ENGINE at
|
||||
* run-time to control behaviour of specific engines. As such, it shouldn't
|
||||
* be used for calling ENGINE_ctrl() functions that return data, deal with
|
||||
* binary data, or that are otherwise supposed to be used directly through
|
||||
* ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl()
|
||||
* operation in this function will be lost - the return value is interpreted
|
||||
* as failure if the return value is zero, success otherwise, and this
|
||||
* function returns a boolean value as a result. In other words, vendors of
|
||||
* 'ENGINE'-enabled devices should write ENGINE implementations with
|
||||
* parameterisations that work in this scheme, so that compliant ENGINE-based
|
||||
* applications can work consistently with the same configuration for the
|
||||
* same ENGINE-enabled devices, across applications.
|
||||
*/
|
||||
int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
|
||||
int cmd_optional);
|
||||
|
||||
/*
|
||||
* These functions are useful for manufacturing new ENGINE structures. They
|
||||
* don't address reference counting at all - one uses them to populate an
|
||||
* ENGINE structure with personalised implementations of things prior to
|
||||
* using it directly or adding it to the builtin ENGINE list in OpenSSL.
|
||||
* These are also here so that the ENGINE structure doesn't have to be
|
||||
* exposed and break binary compatibility!
|
||||
*/
|
||||
ENGINE *ENGINE_new(void);
|
||||
int ENGINE_free(ENGINE *e);
|
||||
int ENGINE_up_ref(ENGINE *e);
|
||||
int ENGINE_set_id(ENGINE *e, const char *id);
|
||||
int ENGINE_set_name(ENGINE *e, const char *name);
|
||||
int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);
|
||||
int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);
|
||||
int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ecdsa_meth);
|
||||
int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);
|
||||
int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);
|
||||
int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f);
|
||||
int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f);
|
||||
int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f);
|
||||
int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f);
|
||||
int ENGINE_set_load_privkey_function(ENGINE *e,
|
||||
ENGINE_LOAD_KEY_PTR loadpriv_f);
|
||||
int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f);
|
||||
int ENGINE_set_load_ssl_client_cert_function(ENGINE *e,
|
||||
ENGINE_SSL_CLIENT_CERT_PTR
|
||||
loadssl_f);
|
||||
int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);
|
||||
int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);
|
||||
int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f);
|
||||
int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f);
|
||||
int ENGINE_set_flags(ENGINE *e, int flags);
|
||||
int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);
|
||||
/* These functions allow control over any per-structure ENGINE data. */
|
||||
#define ENGINE_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ENGINE, l, p, newf, dupf, freef)
|
||||
int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg);
|
||||
void *ENGINE_get_ex_data(const ENGINE *e, int idx);
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
/*
|
||||
* This function previously cleaned up anything that needs it. Auto-deinit will
|
||||
* now take care of it so it is no longer required to call this function.
|
||||
*/
|
||||
# define ENGINE_cleanup() while(0) continue
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These return values from within the ENGINE structure. These can be useful
|
||||
* with functional references as well as structural references - it depends
|
||||
* which you obtained. Using the result for functional purposes if you only
|
||||
* obtained a structural reference may be problematic!
|
||||
*/
|
||||
const char *ENGINE_get_id(const ENGINE *e);
|
||||
const char *ENGINE_get_name(const ENGINE *e);
|
||||
const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);
|
||||
const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);
|
||||
const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e);
|
||||
const DH_METHOD *ENGINE_get_DH(const ENGINE *e);
|
||||
const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);
|
||||
ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e);
|
||||
ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);
|
||||
ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e);
|
||||
ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e);
|
||||
ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e);
|
||||
ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e);
|
||||
ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE
|
||||
*e);
|
||||
ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e);
|
||||
ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e);
|
||||
ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e);
|
||||
ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e);
|
||||
const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid);
|
||||
const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);
|
||||
const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid);
|
||||
const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid);
|
||||
const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e,
|
||||
const char *str,
|
||||
int len);
|
||||
const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe,
|
||||
const char *str,
|
||||
int len);
|
||||
const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);
|
||||
int ENGINE_get_flags(const ENGINE *e);
|
||||
|
||||
/*
|
||||
* FUNCTIONAL functions. These functions deal with ENGINE structures that
|
||||
* have (or will) be initialised for use. Broadly speaking, the structural
|
||||
* functions are useful for iterating the list of available engine types,
|
||||
* creating new engine types, and other "list" operations. These functions
|
||||
* actually deal with ENGINEs that are to be used. As such these functions
|
||||
* can fail (if applicable) when particular engines are unavailable - eg. if
|
||||
* a hardware accelerator is not attached or not functioning correctly. Each
|
||||
* ENGINE has 2 reference counts; structural and functional. Every time a
|
||||
* functional reference is obtained or released, a corresponding structural
|
||||
* reference is automatically obtained or released too.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initialise a engine type for use (or up its reference count if it's
|
||||
* already in use). This will fail if the engine is not currently operational
|
||||
* and cannot initialise.
|
||||
*/
|
||||
int ENGINE_init(ENGINE *e);
|
||||
/*
|
||||
* Free a functional reference to a engine type. This does not require a
|
||||
* corresponding call to ENGINE_free as it also releases a structural
|
||||
* reference.
|
||||
*/
|
||||
int ENGINE_finish(ENGINE *e);
|
||||
|
||||
/*
|
||||
* The following functions handle keys that are stored in some secondary
|
||||
* location, handled by the engine. The storage may be on a card or
|
||||
* whatever.
|
||||
*/
|
||||
EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id,
|
||||
UI_METHOD *ui_method, void *callback_data);
|
||||
EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,
|
||||
UI_METHOD *ui_method, void *callback_data);
|
||||
int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s,
|
||||
STACK_OF(X509_NAME) *ca_dn, X509 **pcert,
|
||||
EVP_PKEY **ppkey, STACK_OF(X509) **pother,
|
||||
UI_METHOD *ui_method, void *callback_data);
|
||||
|
||||
/*
|
||||
* This returns a pointer for the current ENGINE structure that is (by
|
||||
* default) performing any RSA operations. The value returned is an
|
||||
* incremented reference, so it should be free'd (ENGINE_finish) before it is
|
||||
* discarded.
|
||||
*/
|
||||
ENGINE *ENGINE_get_default_RSA(void);
|
||||
/* Same for the other "methods" */
|
||||
ENGINE *ENGINE_get_default_DSA(void);
|
||||
ENGINE *ENGINE_get_default_EC(void);
|
||||
ENGINE *ENGINE_get_default_DH(void);
|
||||
ENGINE *ENGINE_get_default_RAND(void);
|
||||
/*
|
||||
* These functions can be used to get a functional reference to perform
|
||||
* ciphering or digesting corresponding to "nid".
|
||||
*/
|
||||
ENGINE *ENGINE_get_cipher_engine(int nid);
|
||||
ENGINE *ENGINE_get_digest_engine(int nid);
|
||||
ENGINE *ENGINE_get_pkey_meth_engine(int nid);
|
||||
ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid);
|
||||
|
||||
/*
|
||||
* This sets a new default ENGINE structure for performing RSA operations. If
|
||||
* the result is non-zero (success) then the ENGINE structure will have had
|
||||
* its reference count up'd so the caller should still free their own
|
||||
* reference 'e'.
|
||||
*/
|
||||
int ENGINE_set_default_RSA(ENGINE *e);
|
||||
int ENGINE_set_default_string(ENGINE *e, const char *def_list);
|
||||
/* Same for the other "methods" */
|
||||
int ENGINE_set_default_DSA(ENGINE *e);
|
||||
int ENGINE_set_default_EC(ENGINE *e);
|
||||
int ENGINE_set_default_DH(ENGINE *e);
|
||||
int ENGINE_set_default_RAND(ENGINE *e);
|
||||
int ENGINE_set_default_ciphers(ENGINE *e);
|
||||
int ENGINE_set_default_digests(ENGINE *e);
|
||||
int ENGINE_set_default_pkey_meths(ENGINE *e);
|
||||
int ENGINE_set_default_pkey_asn1_meths(ENGINE *e);
|
||||
|
||||
/*
|
||||
* The combination "set" - the flags are bitwise "OR"d from the
|
||||
* ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()"
|
||||
* function, this function can result in unnecessary static linkage. If your
|
||||
* application requires only specific functionality, consider using more
|
||||
* selective functions.
|
||||
*/
|
||||
int ENGINE_set_default(ENGINE *e, unsigned int flags);
|
||||
|
||||
void ENGINE_add_conf_module(void);
|
||||
|
||||
/* Deprecated functions ... */
|
||||
/* int ENGINE_clear_defaults(void); */
|
||||
|
||||
/**************************/
|
||||
/* DYNAMIC ENGINE SUPPORT */
|
||||
/**************************/
|
||||
|
||||
/* Binary/behaviour compatibility levels */
|
||||
# define OSSL_DYNAMIC_VERSION (unsigned long)0x00030000
|
||||
/*
|
||||
* Binary versions older than this are too old for us (whether we're a loader
|
||||
* or a loadee)
|
||||
*/
|
||||
# define OSSL_DYNAMIC_OLDEST (unsigned long)0x00030000
|
||||
|
||||
/*
|
||||
* When compiling an ENGINE entirely as an external shared library, loadable
|
||||
* by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns'
|
||||
* structure type provides the calling application's (or library's) error
|
||||
* functionality and memory management function pointers to the loaded
|
||||
* library. These should be used/set in the loaded library code so that the
|
||||
* loading application's 'state' will be used/changed in all operations. The
|
||||
* 'static_state' pointer allows the loaded library to know if it shares the
|
||||
* same static data as the calling application (or library), and thus whether
|
||||
* these callbacks need to be set or not.
|
||||
*/
|
||||
typedef void *(*dyn_MEM_malloc_fn) (size_t, const char *, int);
|
||||
typedef void *(*dyn_MEM_realloc_fn) (void *, size_t, const char *, int);
|
||||
typedef void (*dyn_MEM_free_fn) (void *, const char *, int);
|
||||
typedef struct st_dynamic_MEM_fns {
|
||||
dyn_MEM_malloc_fn malloc_fn;
|
||||
dyn_MEM_realloc_fn realloc_fn;
|
||||
dyn_MEM_free_fn free_fn;
|
||||
} dynamic_MEM_fns;
|
||||
/*
|
||||
* FIXME: Perhaps the memory and locking code (crypto.h) should declare and
|
||||
* use these types so we (and any other dependent code) can simplify a bit??
|
||||
*/
|
||||
/* The top-level structure */
|
||||
typedef struct st_dynamic_fns {
|
||||
void *static_state;
|
||||
dynamic_MEM_fns mem_fns;
|
||||
} dynamic_fns;
|
||||
|
||||
/*
|
||||
* The version checking function should be of this prototype. NB: The
|
||||
* ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading
|
||||
* code. If this function returns zero, it indicates a (potential) version
|
||||
* incompatibility and the loaded library doesn't believe it can proceed.
|
||||
* Otherwise, the returned value is the (latest) version supported by the
|
||||
* loading library. The loader may still decide that the loaded code's
|
||||
* version is unsatisfactory and could veto the load. The function is
|
||||
* expected to be implemented with the symbol name "v_check", and a default
|
||||
* implementation can be fully instantiated with
|
||||
* IMPLEMENT_DYNAMIC_CHECK_FN().
|
||||
*/
|
||||
typedef unsigned long (*dynamic_v_check_fn) (unsigned long ossl_version);
|
||||
# define IMPLEMENT_DYNAMIC_CHECK_FN() \
|
||||
OPENSSL_EXPORT unsigned long v_check(unsigned long v); \
|
||||
OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \
|
||||
if (v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \
|
||||
return 0; }
|
||||
|
||||
/*
|
||||
* This function is passed the ENGINE structure to initialise with its own
|
||||
* function and command settings. It should not adjust the structural or
|
||||
* functional reference counts. If this function returns zero, (a) the load
|
||||
* will be aborted, (b) the previous ENGINE state will be memcpy'd back onto
|
||||
* the structure, and (c) the shared library will be unloaded. So
|
||||
* implementations should do their own internal cleanup in failure
|
||||
* circumstances otherwise they could leak. The 'id' parameter, if non-NULL,
|
||||
* represents the ENGINE id that the loader is looking for. If this is NULL,
|
||||
* the shared library can choose to return failure or to initialise a
|
||||
* 'default' ENGINE. If non-NULL, the shared library must initialise only an
|
||||
* ENGINE matching the passed 'id'. The function is expected to be
|
||||
* implemented with the symbol name "bind_engine". A standard implementation
|
||||
* can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter
|
||||
* 'fn' is a callback function that populates the ENGINE structure and
|
||||
* returns an int value (zero for failure). 'fn' should have prototype;
|
||||
* [static] int fn(ENGINE *e, const char *id);
|
||||
*/
|
||||
typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id,
|
||||
const dynamic_fns *fns);
|
||||
# define IMPLEMENT_DYNAMIC_BIND_FN(fn) \
|
||||
OPENSSL_EXPORT \
|
||||
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \
|
||||
OPENSSL_EXPORT \
|
||||
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \
|
||||
if (ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \
|
||||
CRYPTO_set_mem_functions(fns->mem_fns.malloc_fn, \
|
||||
fns->mem_fns.realloc_fn, \
|
||||
fns->mem_fns.free_fn); \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_NO_ATEXIT, NULL); \
|
||||
skip_cbs: \
|
||||
if (!fn(e, id)) return 0; \
|
||||
return 1; }
|
||||
|
||||
/*
|
||||
* If the loading application (or library) and the loaded ENGINE library
|
||||
* share the same static data (eg. they're both dynamically linked to the
|
||||
* same libcrypto.so) we need a way to avoid trying to set system callbacks -
|
||||
* this would fail, and for the same reason that it's unnecessary to try. If
|
||||
* the loaded ENGINE has (or gets from through the loader) its own copy of
|
||||
* the libcrypto static data, we will need to set the callbacks. The easiest
|
||||
* way to detect this is to have a function that returns a pointer to some
|
||||
* static data and let the loading application and loaded ENGINE compare
|
||||
* their respective values.
|
||||
*/
|
||||
void *ENGINE_get_static_state(void);
|
||||
|
||||
# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
DEPRECATEDIN_1_1_0(void ENGINE_setup_bsd_cryptodev(void))
|
||||
# endif
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
111
3rdparty/openssl/include/openssl/engineerr.h
vendored
111
3rdparty/openssl/include/openssl/engineerr.h
vendored
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ENGINEERR_H
|
||||
# define HEADER_ENGINEERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_ENGINE_strings(void);
|
||||
|
||||
/*
|
||||
* ENGINE function codes.
|
||||
*/
|
||||
# define ENGINE_F_DIGEST_UPDATE 198
|
||||
# define ENGINE_F_DYNAMIC_CTRL 180
|
||||
# define ENGINE_F_DYNAMIC_GET_DATA_CTX 181
|
||||
# define ENGINE_F_DYNAMIC_LOAD 182
|
||||
# define ENGINE_F_DYNAMIC_SET_DATA_CTX 183
|
||||
# define ENGINE_F_ENGINE_ADD 105
|
||||
# define ENGINE_F_ENGINE_BY_ID 106
|
||||
# define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 170
|
||||
# define ENGINE_F_ENGINE_CTRL 142
|
||||
# define ENGINE_F_ENGINE_CTRL_CMD 178
|
||||
# define ENGINE_F_ENGINE_CTRL_CMD_STRING 171
|
||||
# define ENGINE_F_ENGINE_FINISH 107
|
||||
# define ENGINE_F_ENGINE_GET_CIPHER 185
|
||||
# define ENGINE_F_ENGINE_GET_DIGEST 186
|
||||
# define ENGINE_F_ENGINE_GET_FIRST 195
|
||||
# define ENGINE_F_ENGINE_GET_LAST 196
|
||||
# define ENGINE_F_ENGINE_GET_NEXT 115
|
||||
# define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH 193
|
||||
# define ENGINE_F_ENGINE_GET_PKEY_METH 192
|
||||
# define ENGINE_F_ENGINE_GET_PREV 116
|
||||
# define ENGINE_F_ENGINE_INIT 119
|
||||
# define ENGINE_F_ENGINE_LIST_ADD 120
|
||||
# define ENGINE_F_ENGINE_LIST_REMOVE 121
|
||||
# define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150
|
||||
# define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151
|
||||
# define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 194
|
||||
# define ENGINE_F_ENGINE_NEW 122
|
||||
# define ENGINE_F_ENGINE_PKEY_ASN1_FIND_STR 197
|
||||
# define ENGINE_F_ENGINE_REMOVE 123
|
||||
# define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189
|
||||
# define ENGINE_F_ENGINE_SET_ID 129
|
||||
# define ENGINE_F_ENGINE_SET_NAME 130
|
||||
# define ENGINE_F_ENGINE_TABLE_REGISTER 184
|
||||
# define ENGINE_F_ENGINE_UNLOCKED_FINISH 191
|
||||
# define ENGINE_F_ENGINE_UP_REF 190
|
||||
# define ENGINE_F_INT_CLEANUP_ITEM 199
|
||||
# define ENGINE_F_INT_CTRL_HELPER 172
|
||||
# define ENGINE_F_INT_ENGINE_CONFIGURE 188
|
||||
# define ENGINE_F_INT_ENGINE_MODULE_INIT 187
|
||||
# define ENGINE_F_OSSL_HMAC_INIT 200
|
||||
|
||||
/*
|
||||
* ENGINE reason codes.
|
||||
*/
|
||||
# define ENGINE_R_ALREADY_LOADED 100
|
||||
# define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133
|
||||
# define ENGINE_R_CMD_NOT_EXECUTABLE 134
|
||||
# define ENGINE_R_COMMAND_TAKES_INPUT 135
|
||||
# define ENGINE_R_COMMAND_TAKES_NO_INPUT 136
|
||||
# define ENGINE_R_CONFLICTING_ENGINE_ID 103
|
||||
# define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119
|
||||
# define ENGINE_R_DSO_FAILURE 104
|
||||
# define ENGINE_R_DSO_NOT_FOUND 132
|
||||
# define ENGINE_R_ENGINES_SECTION_ERROR 148
|
||||
# define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102
|
||||
# define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105
|
||||
# define ENGINE_R_ENGINE_SECTION_ERROR 149
|
||||
# define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128
|
||||
# define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129
|
||||
# define ENGINE_R_FINISH_FAILED 106
|
||||
# define ENGINE_R_ID_OR_NAME_MISSING 108
|
||||
# define ENGINE_R_INIT_FAILED 109
|
||||
# define ENGINE_R_INTERNAL_LIST_ERROR 110
|
||||
# define ENGINE_R_INVALID_ARGUMENT 143
|
||||
# define ENGINE_R_INVALID_CMD_NAME 137
|
||||
# define ENGINE_R_INVALID_CMD_NUMBER 138
|
||||
# define ENGINE_R_INVALID_INIT_VALUE 151
|
||||
# define ENGINE_R_INVALID_STRING 150
|
||||
# define ENGINE_R_NOT_INITIALISED 117
|
||||
# define ENGINE_R_NOT_LOADED 112
|
||||
# define ENGINE_R_NO_CONTROL_FUNCTION 120
|
||||
# define ENGINE_R_NO_INDEX 144
|
||||
# define ENGINE_R_NO_LOAD_FUNCTION 125
|
||||
# define ENGINE_R_NO_REFERENCE 130
|
||||
# define ENGINE_R_NO_SUCH_ENGINE 116
|
||||
# define ENGINE_R_UNIMPLEMENTED_CIPHER 146
|
||||
# define ENGINE_R_UNIMPLEMENTED_DIGEST 147
|
||||
# define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101
|
||||
# define ENGINE_R_VERSION_INCOMPATIBILITY 145
|
||||
|
||||
# endif
|
||||
#endif
|
||||
274
3rdparty/openssl/include/openssl/err.h
vendored
274
3rdparty/openssl/include/openssl/err.h
vendored
@@ -1,274 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ERR_H
|
||||
# define HEADER_ERR_H
|
||||
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/lhash.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# ifndef OPENSSL_NO_ERR
|
||||
# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e)
|
||||
# else
|
||||
# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0)
|
||||
# endif
|
||||
|
||||
# include <errno.h>
|
||||
|
||||
# define ERR_TXT_MALLOCED 0x01
|
||||
# define ERR_TXT_STRING 0x02
|
||||
|
||||
# define ERR_FLAG_MARK 0x01
|
||||
# define ERR_FLAG_CLEAR 0x02
|
||||
|
||||
# define ERR_NUM_ERRORS 16
|
||||
typedef struct err_state_st {
|
||||
int err_flags[ERR_NUM_ERRORS];
|
||||
unsigned long err_buffer[ERR_NUM_ERRORS];
|
||||
char *err_data[ERR_NUM_ERRORS];
|
||||
int err_data_flags[ERR_NUM_ERRORS];
|
||||
const char *err_file[ERR_NUM_ERRORS];
|
||||
int err_line[ERR_NUM_ERRORS];
|
||||
int top, bottom;
|
||||
} ERR_STATE;
|
||||
|
||||
/* library */
|
||||
# define ERR_LIB_NONE 1
|
||||
# define ERR_LIB_SYS 2
|
||||
# define ERR_LIB_BN 3
|
||||
# define ERR_LIB_RSA 4
|
||||
# define ERR_LIB_DH 5
|
||||
# define ERR_LIB_EVP 6
|
||||
# define ERR_LIB_BUF 7
|
||||
# define ERR_LIB_OBJ 8
|
||||
# define ERR_LIB_PEM 9
|
||||
# define ERR_LIB_DSA 10
|
||||
# define ERR_LIB_X509 11
|
||||
/* #define ERR_LIB_METH 12 */
|
||||
# define ERR_LIB_ASN1 13
|
||||
# define ERR_LIB_CONF 14
|
||||
# define ERR_LIB_CRYPTO 15
|
||||
# define ERR_LIB_EC 16
|
||||
# define ERR_LIB_SSL 20
|
||||
/* #define ERR_LIB_SSL23 21 */
|
||||
/* #define ERR_LIB_SSL2 22 */
|
||||
/* #define ERR_LIB_SSL3 23 */
|
||||
/* #define ERR_LIB_RSAREF 30 */
|
||||
/* #define ERR_LIB_PROXY 31 */
|
||||
# define ERR_LIB_BIO 32
|
||||
# define ERR_LIB_PKCS7 33
|
||||
# define ERR_LIB_X509V3 34
|
||||
# define ERR_LIB_PKCS12 35
|
||||
# define ERR_LIB_RAND 36
|
||||
# define ERR_LIB_DSO 37
|
||||
# define ERR_LIB_ENGINE 38
|
||||
# define ERR_LIB_OCSP 39
|
||||
# define ERR_LIB_UI 40
|
||||
# define ERR_LIB_COMP 41
|
||||
# define ERR_LIB_ECDSA 42
|
||||
# define ERR_LIB_ECDH 43
|
||||
# define ERR_LIB_OSSL_STORE 44
|
||||
# define ERR_LIB_FIPS 45
|
||||
# define ERR_LIB_CMS 46
|
||||
# define ERR_LIB_TS 47
|
||||
# define ERR_LIB_HMAC 48
|
||||
/* # define ERR_LIB_JPAKE 49 */
|
||||
# define ERR_LIB_CT 50
|
||||
# define ERR_LIB_ASYNC 51
|
||||
# define ERR_LIB_KDF 52
|
||||
# define ERR_LIB_SM2 53
|
||||
|
||||
# define ERR_LIB_USER 128
|
||||
|
||||
# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define OSSL_STOREerr(f,r) ERR_PUT_error(ERR_LIB_OSSL_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define SM2err(f,r) ERR_PUT_error(ERR_LIB_SM2,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
|
||||
# define ERR_PACK(l,f,r) ( \
|
||||
(((unsigned int)(l) & 0x0FF) << 24L) | \
|
||||
(((unsigned int)(f) & 0xFFF) << 12L) | \
|
||||
(((unsigned int)(r) & 0xFFF) ) )
|
||||
# define ERR_GET_LIB(l) (int)(((l) >> 24L) & 0x0FFL)
|
||||
# define ERR_GET_FUNC(l) (int)(((l) >> 12L) & 0xFFFL)
|
||||
# define ERR_GET_REASON(l) (int)( (l) & 0xFFFL)
|
||||
# define ERR_FATAL_ERROR(l) (int)( (l) & ERR_R_FATAL)
|
||||
|
||||
/* OS functions */
|
||||
# define SYS_F_FOPEN 1
|
||||
# define SYS_F_CONNECT 2
|
||||
# define SYS_F_GETSERVBYNAME 3
|
||||
# define SYS_F_SOCKET 4
|
||||
# define SYS_F_IOCTLSOCKET 5
|
||||
# define SYS_F_BIND 6
|
||||
# define SYS_F_LISTEN 7
|
||||
# define SYS_F_ACCEPT 8
|
||||
# define SYS_F_WSASTARTUP 9/* Winsock stuff */
|
||||
# define SYS_F_OPENDIR 10
|
||||
# define SYS_F_FREAD 11
|
||||
# define SYS_F_GETADDRINFO 12
|
||||
# define SYS_F_GETNAMEINFO 13
|
||||
# define SYS_F_SETSOCKOPT 14
|
||||
# define SYS_F_GETSOCKOPT 15
|
||||
# define SYS_F_GETSOCKNAME 16
|
||||
# define SYS_F_GETHOSTBYNAME 17
|
||||
# define SYS_F_FFLUSH 18
|
||||
# define SYS_F_OPEN 19
|
||||
# define SYS_F_CLOSE 20
|
||||
# define SYS_F_IOCTL 21
|
||||
# define SYS_F_STAT 22
|
||||
# define SYS_F_FCNTL 23
|
||||
# define SYS_F_FSTAT 24
|
||||
|
||||
/* reasons */
|
||||
# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */
|
||||
# define ERR_R_BN_LIB ERR_LIB_BN/* 3 */
|
||||
# define ERR_R_RSA_LIB ERR_LIB_RSA/* 4 */
|
||||
# define ERR_R_DH_LIB ERR_LIB_DH/* 5 */
|
||||
# define ERR_R_EVP_LIB ERR_LIB_EVP/* 6 */
|
||||
# define ERR_R_BUF_LIB ERR_LIB_BUF/* 7 */
|
||||
# define ERR_R_OBJ_LIB ERR_LIB_OBJ/* 8 */
|
||||
# define ERR_R_PEM_LIB ERR_LIB_PEM/* 9 */
|
||||
# define ERR_R_DSA_LIB ERR_LIB_DSA/* 10 */
|
||||
# define ERR_R_X509_LIB ERR_LIB_X509/* 11 */
|
||||
# define ERR_R_ASN1_LIB ERR_LIB_ASN1/* 13 */
|
||||
# define ERR_R_EC_LIB ERR_LIB_EC/* 16 */
|
||||
# define ERR_R_BIO_LIB ERR_LIB_BIO/* 32 */
|
||||
# define ERR_R_PKCS7_LIB ERR_LIB_PKCS7/* 33 */
|
||||
# define ERR_R_X509V3_LIB ERR_LIB_X509V3/* 34 */
|
||||
# define ERR_R_ENGINE_LIB ERR_LIB_ENGINE/* 38 */
|
||||
# define ERR_R_UI_LIB ERR_LIB_UI/* 40 */
|
||||
# define ERR_R_ECDSA_LIB ERR_LIB_ECDSA/* 42 */
|
||||
# define ERR_R_OSSL_STORE_LIB ERR_LIB_OSSL_STORE/* 44 */
|
||||
|
||||
# define ERR_R_NESTED_ASN1_ERROR 58
|
||||
# define ERR_R_MISSING_ASN1_EOS 63
|
||||
|
||||
/* fatal error */
|
||||
# define ERR_R_FATAL 64
|
||||
# define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL)
|
||||
# define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL)
|
||||
# define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL)
|
||||
# define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL)
|
||||
# define ERR_R_DISABLED (5|ERR_R_FATAL)
|
||||
# define ERR_R_INIT_FAIL (6|ERR_R_FATAL)
|
||||
# define ERR_R_PASSED_INVALID_ARGUMENT (7)
|
||||
# define ERR_R_OPERATION_FAIL (8|ERR_R_FATAL)
|
||||
|
||||
/*
|
||||
* 99 is the maximum possible ERR_R_... code, higher values are reserved for
|
||||
* the individual libraries
|
||||
*/
|
||||
|
||||
typedef struct ERR_string_data_st {
|
||||
unsigned long error;
|
||||
const char *string;
|
||||
} ERR_STRING_DATA;
|
||||
|
||||
DEFINE_LHASH_OF(ERR_STRING_DATA);
|
||||
|
||||
void ERR_put_error(int lib, int func, int reason, const char *file, int line);
|
||||
void ERR_set_error_data(char *data, int flags);
|
||||
|
||||
unsigned long ERR_get_error(void);
|
||||
unsigned long ERR_get_error_line(const char **file, int *line);
|
||||
unsigned long ERR_get_error_line_data(const char **file, int *line,
|
||||
const char **data, int *flags);
|
||||
unsigned long ERR_peek_error(void);
|
||||
unsigned long ERR_peek_error_line(const char **file, int *line);
|
||||
unsigned long ERR_peek_error_line_data(const char **file, int *line,
|
||||
const char **data, int *flags);
|
||||
unsigned long ERR_peek_last_error(void);
|
||||
unsigned long ERR_peek_last_error_line(const char **file, int *line);
|
||||
unsigned long ERR_peek_last_error_line_data(const char **file, int *line,
|
||||
const char **data, int *flags);
|
||||
void ERR_clear_error(void);
|
||||
char *ERR_error_string(unsigned long e, char *buf);
|
||||
void ERR_error_string_n(unsigned long e, char *buf, size_t len);
|
||||
const char *ERR_lib_error_string(unsigned long e);
|
||||
const char *ERR_func_error_string(unsigned long e);
|
||||
const char *ERR_reason_error_string(unsigned long e);
|
||||
void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u),
|
||||
void *u);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
void ERR_print_errors_fp(FILE *fp);
|
||||
# endif
|
||||
void ERR_print_errors(BIO *bp);
|
||||
void ERR_add_error_data(int num, ...);
|
||||
void ERR_add_error_vdata(int num, va_list args);
|
||||
int ERR_load_strings(int lib, ERR_STRING_DATA *str);
|
||||
int ERR_load_strings_const(const ERR_STRING_DATA *str);
|
||||
int ERR_unload_strings(int lib, ERR_STRING_DATA *str);
|
||||
int ERR_load_ERR_strings(void);
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define ERR_load_crypto_strings() \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL)
|
||||
# define ERR_free_strings() while(0) continue
|
||||
#endif
|
||||
|
||||
DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *))
|
||||
DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid))
|
||||
ERR_STATE *ERR_get_state(void);
|
||||
|
||||
int ERR_get_next_error_library(void);
|
||||
|
||||
int ERR_set_mark(void);
|
||||
int ERR_pop_to_mark(void);
|
||||
int ERR_clear_last_mark(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
1666
3rdparty/openssl/include/openssl/evp.h
vendored
1666
3rdparty/openssl/include/openssl/evp.h
vendored
File diff suppressed because it is too large
Load Diff
204
3rdparty/openssl/include/openssl/evperr.h
vendored
204
3rdparty/openssl/include/openssl/evperr.h
vendored
@@ -1,204 +0,0 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_EVPERR_H
|
||||
# define HEADER_EVPERR_H
|
||||
|
||||
# include <openssl/symhacks.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_EVP_strings(void);
|
||||
|
||||
/*
|
||||
* EVP function codes.
|
||||
*/
|
||||
# define EVP_F_AESNI_INIT_KEY 165
|
||||
# define EVP_F_AESNI_XTS_INIT_KEY 207
|
||||
# define EVP_F_AES_GCM_CTRL 196
|
||||
# define EVP_F_AES_INIT_KEY 133
|
||||
# define EVP_F_AES_OCB_CIPHER 169
|
||||
# define EVP_F_AES_T4_INIT_KEY 178
|
||||
# define EVP_F_AES_T4_XTS_INIT_KEY 208
|
||||
# define EVP_F_AES_WRAP_CIPHER 170
|
||||
# define EVP_F_AES_XTS_INIT_KEY 209
|
||||
# define EVP_F_ALG_MODULE_INIT 177
|
||||
# define EVP_F_ARIA_CCM_INIT_KEY 175
|
||||
# define EVP_F_ARIA_GCM_CTRL 197
|
||||
# define EVP_F_ARIA_GCM_INIT_KEY 176
|
||||
# define EVP_F_ARIA_INIT_KEY 185
|
||||
# define EVP_F_B64_NEW 198
|
||||
# define EVP_F_CAMELLIA_INIT_KEY 159
|
||||
# define EVP_F_CHACHA20_POLY1305_CTRL 182
|
||||
# define EVP_F_CMLL_T4_INIT_KEY 179
|
||||
# define EVP_F_DES_EDE3_WRAP_CIPHER 171
|
||||
# define EVP_F_DO_SIGVER_INIT 161
|
||||
# define EVP_F_ENC_NEW 199
|
||||
# define EVP_F_EVP_CIPHERINIT_EX 123
|
||||
# define EVP_F_EVP_CIPHER_ASN1_TO_PARAM 204
|
||||
# define EVP_F_EVP_CIPHER_CTX_COPY 163
|
||||
# define EVP_F_EVP_CIPHER_CTX_CTRL 124
|
||||
# define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122
|
||||
# define EVP_F_EVP_CIPHER_PARAM_TO_ASN1 205
|
||||
# define EVP_F_EVP_DECRYPTFINAL_EX 101
|
||||
# define EVP_F_EVP_DECRYPTUPDATE 166
|
||||
# define EVP_F_EVP_DIGESTFINALXOF 174
|
||||
# define EVP_F_EVP_DIGESTINIT_EX 128
|
||||
# define EVP_F_EVP_ENCRYPTDECRYPTUPDATE 219
|
||||
# define EVP_F_EVP_ENCRYPTFINAL_EX 127
|
||||
# define EVP_F_EVP_ENCRYPTUPDATE 167
|
||||
# define EVP_F_EVP_MD_CTX_COPY_EX 110
|
||||
# define EVP_F_EVP_MD_SIZE 162
|
||||
# define EVP_F_EVP_OPENINIT 102
|
||||
# define EVP_F_EVP_PBE_ALG_ADD 115
|
||||
# define EVP_F_EVP_PBE_ALG_ADD_TYPE 160
|
||||
# define EVP_F_EVP_PBE_CIPHERINIT 116
|
||||
# define EVP_F_EVP_PBE_SCRYPT 181
|
||||
# define EVP_F_EVP_PKCS82PKEY 111
|
||||
# define EVP_F_EVP_PKEY2PKCS8 113
|
||||
# define EVP_F_EVP_PKEY_ASN1_ADD0 188
|
||||
# define EVP_F_EVP_PKEY_CHECK 186
|
||||
# define EVP_F_EVP_PKEY_COPY_PARAMETERS 103
|
||||
# define EVP_F_EVP_PKEY_CTX_CTRL 137
|
||||
# define EVP_F_EVP_PKEY_CTX_CTRL_STR 150
|
||||
# define EVP_F_EVP_PKEY_CTX_DUP 156
|
||||
# define EVP_F_EVP_PKEY_CTX_MD 168
|
||||
# define EVP_F_EVP_PKEY_DECRYPT 104
|
||||
# define EVP_F_EVP_PKEY_DECRYPT_INIT 138
|
||||
# define EVP_F_EVP_PKEY_DECRYPT_OLD 151
|
||||
# define EVP_F_EVP_PKEY_DERIVE 153
|
||||
# define EVP_F_EVP_PKEY_DERIVE_INIT 154
|
||||
# define EVP_F_EVP_PKEY_DERIVE_SET_PEER 155
|
||||
# define EVP_F_EVP_PKEY_ENCRYPT 105
|
||||
# define EVP_F_EVP_PKEY_ENCRYPT_INIT 139
|
||||
# define EVP_F_EVP_PKEY_ENCRYPT_OLD 152
|
||||
# define EVP_F_EVP_PKEY_GET0_DH 119
|
||||
# define EVP_F_EVP_PKEY_GET0_DSA 120
|
||||
# define EVP_F_EVP_PKEY_GET0_EC_KEY 131
|
||||
# define EVP_F_EVP_PKEY_GET0_HMAC 183
|
||||
# define EVP_F_EVP_PKEY_GET0_POLY1305 184
|
||||
# define EVP_F_EVP_PKEY_GET0_RSA 121
|
||||
# define EVP_F_EVP_PKEY_GET0_SIPHASH 172
|
||||
# define EVP_F_EVP_PKEY_GET_RAW_PRIVATE_KEY 202
|
||||
# define EVP_F_EVP_PKEY_GET_RAW_PUBLIC_KEY 203
|
||||
# define EVP_F_EVP_PKEY_KEYGEN 146
|
||||
# define EVP_F_EVP_PKEY_KEYGEN_INIT 147
|
||||
# define EVP_F_EVP_PKEY_METH_ADD0 194
|
||||
# define EVP_F_EVP_PKEY_METH_NEW 195
|
||||
# define EVP_F_EVP_PKEY_NEW 106
|
||||
# define EVP_F_EVP_PKEY_NEW_CMAC_KEY 193
|
||||
# define EVP_F_EVP_PKEY_NEW_RAW_PRIVATE_KEY 191
|
||||
# define EVP_F_EVP_PKEY_NEW_RAW_PUBLIC_KEY 192
|
||||
# define EVP_F_EVP_PKEY_PARAMGEN 148
|
||||
# define EVP_F_EVP_PKEY_PARAMGEN_INIT 149
|
||||
# define EVP_F_EVP_PKEY_PARAM_CHECK 189
|
||||
# define EVP_F_EVP_PKEY_PUBLIC_CHECK 190
|
||||
# define EVP_F_EVP_PKEY_SET1_ENGINE 187
|
||||
# define EVP_F_EVP_PKEY_SET_ALIAS_TYPE 206
|
||||
# define EVP_F_EVP_PKEY_SIGN 140
|
||||
# define EVP_F_EVP_PKEY_SIGN_INIT 141
|
||||
# define EVP_F_EVP_PKEY_VERIFY 142
|
||||
# define EVP_F_EVP_PKEY_VERIFY_INIT 143
|
||||
# define EVP_F_EVP_PKEY_VERIFY_RECOVER 144
|
||||
# define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT 145
|
||||
# define EVP_F_EVP_SIGNFINAL 107
|
||||
# define EVP_F_EVP_VERIFYFINAL 108
|
||||
# define EVP_F_INT_CTX_NEW 157
|
||||
# define EVP_F_OK_NEW 200
|
||||
# define EVP_F_PKCS5_PBE_KEYIVGEN 117
|
||||
# define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118
|
||||
# define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN 164
|
||||
# define EVP_F_PKCS5_V2_SCRYPT_KEYIVGEN 180
|
||||
# define EVP_F_PKEY_SET_TYPE 158
|
||||
# define EVP_F_RC2_MAGIC_TO_METH 109
|
||||
# define EVP_F_RC5_CTRL 125
|
||||
# define EVP_F_R_32_12_16_INIT_KEY 242
|
||||
# define EVP_F_S390X_AES_GCM_CTRL 201
|
||||
# define EVP_F_UPDATE 173
|
||||
|
||||
/*
|
||||
* EVP reason codes.
|
||||
*/
|
||||
# define EVP_R_AES_KEY_SETUP_FAILED 143
|
||||
# define EVP_R_ARIA_KEY_SETUP_FAILED 176
|
||||
# define EVP_R_BAD_DECRYPT 100
|
||||
# define EVP_R_BAD_KEY_LENGTH 195
|
||||
# define EVP_R_BUFFER_TOO_SMALL 155
|
||||
# define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157
|
||||
# define EVP_R_CIPHER_PARAMETER_ERROR 122
|
||||
# define EVP_R_COMMAND_NOT_SUPPORTED 147
|
||||
# define EVP_R_COPY_ERROR 173
|
||||
# define EVP_R_CTRL_NOT_IMPLEMENTED 132
|
||||
# define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133
|
||||
# define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138
|
||||
# define EVP_R_DECODE_ERROR 114
|
||||
# define EVP_R_DIFFERENT_KEY_TYPES 101
|
||||
# define EVP_R_DIFFERENT_PARAMETERS 153
|
||||
# define EVP_R_ERROR_LOADING_SECTION 165
|
||||
# define EVP_R_ERROR_SETTING_FIPS_MODE 166
|
||||
# define EVP_R_EXPECTING_AN_HMAC_KEY 174
|
||||
# define EVP_R_EXPECTING_AN_RSA_KEY 127
|
||||
# define EVP_R_EXPECTING_A_DH_KEY 128
|
||||
# define EVP_R_EXPECTING_A_DSA_KEY 129
|
||||
# define EVP_R_EXPECTING_A_EC_KEY 142
|
||||
# define EVP_R_EXPECTING_A_POLY1305_KEY 164
|
||||
# define EVP_R_EXPECTING_A_SIPHASH_KEY 175
|
||||
# define EVP_R_FIPS_MODE_NOT_SUPPORTED 167
|
||||
# define EVP_R_GET_RAW_KEY_FAILED 182
|
||||
# define EVP_R_ILLEGAL_SCRYPT_PARAMETERS 171
|
||||
# define EVP_R_INITIALIZATION_ERROR 134
|
||||
# define EVP_R_INPUT_NOT_INITIALIZED 111
|
||||
# define EVP_R_INVALID_DIGEST 152
|
||||
# define EVP_R_INVALID_FIPS_MODE 168
|
||||
# define EVP_R_INVALID_IV_LENGTH 194
|
||||
# define EVP_R_INVALID_KEY 163
|
||||
# define EVP_R_INVALID_KEY_LENGTH 130
|
||||
# define EVP_R_INVALID_OPERATION 148
|
||||
# define EVP_R_KEYGEN_FAILURE 120
|
||||
# define EVP_R_KEY_SETUP_FAILED 180
|
||||
# define EVP_R_MEMORY_LIMIT_EXCEEDED 172
|
||||
# define EVP_R_MESSAGE_DIGEST_IS_NULL 159
|
||||
# define EVP_R_METHOD_NOT_SUPPORTED 144
|
||||
# define EVP_R_MISSING_PARAMETERS 103
|
||||
# define EVP_R_NOT_XOF_OR_INVALID_LENGTH 178
|
||||
# define EVP_R_NO_CIPHER_SET 131
|
||||
# define EVP_R_NO_DEFAULT_DIGEST 158
|
||||
# define EVP_R_NO_DIGEST_SET 139
|
||||
# define EVP_R_NO_KEY_SET 154
|
||||
# define EVP_R_NO_OPERATION_SET 149
|
||||
# define EVP_R_ONLY_ONESHOT_SUPPORTED 177
|
||||
# define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150
|
||||
# define EVP_R_OPERATON_NOT_INITIALIZED 151
|
||||
# define EVP_R_OUTPUT_WOULD_OVERFLOW 184
|
||||
# define EVP_R_PARTIALLY_OVERLAPPING 162
|
||||
# define EVP_R_PBKDF2_ERROR 181
|
||||
# define EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED 179
|
||||
# define EVP_R_PRIVATE_KEY_DECODE_ERROR 145
|
||||
# define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146
|
||||
# define EVP_R_PUBLIC_KEY_NOT_RSA 106
|
||||
# define EVP_R_UNKNOWN_CIPHER 160
|
||||
# define EVP_R_UNKNOWN_DIGEST 161
|
||||
# define EVP_R_UNKNOWN_OPTION 169
|
||||
# define EVP_R_UNKNOWN_PBE_ALGORITHM 121
|
||||
# define EVP_R_UNSUPPORTED_ALGORITHM 156
|
||||
# define EVP_R_UNSUPPORTED_CIPHER 107
|
||||
# define EVP_R_UNSUPPORTED_KEYLENGTH 123
|
||||
# define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124
|
||||
# define EVP_R_UNSUPPORTED_KEY_SIZE 108
|
||||
# define EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS 135
|
||||
# define EVP_R_UNSUPPORTED_PRF 125
|
||||
# define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118
|
||||
# define EVP_R_UNSUPPORTED_SALT_TYPE 126
|
||||
# define EVP_R_WRAP_MODE_NOT_ALLOWED 170
|
||||
# define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109
|
||||
# define EVP_R_XTS_DUPLICATED_KEYS 183
|
||||
|
||||
#endif
|
||||
51
3rdparty/openssl/include/openssl/hmac.h
vendored
51
3rdparty/openssl/include/openssl/hmac.h
vendored
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_HMAC_H
|
||||
# define HEADER_HMAC_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# include <openssl/evp.h>
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10200000L
|
||||
# define HMAC_MAX_MD_CBLOCK 128 /* Deprecated */
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
size_t HMAC_size(const HMAC_CTX *e);
|
||||
HMAC_CTX *HMAC_CTX_new(void);
|
||||
int HMAC_CTX_reset(HMAC_CTX *ctx);
|
||||
void HMAC_CTX_free(HMAC_CTX *ctx);
|
||||
|
||||
DEPRECATEDIN_1_1_0(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
|
||||
const EVP_MD *md))
|
||||
|
||||
/*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
|
||||
const EVP_MD *md, ENGINE *impl);
|
||||
/*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data,
|
||||
size_t len);
|
||||
/*__owur*/ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md,
|
||||
unsigned int *len);
|
||||
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
|
||||
const unsigned char *d, size_t n, unsigned char *md,
|
||||
unsigned int *md_len);
|
||||
__owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);
|
||||
|
||||
void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);
|
||||
const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user