| 1 |
/* Copyright (c) 2021, 2026, Oracle and/or its affiliates. |
| 2 |
|
| 3 |
This program is free software; you can redistribute it and/or modify |
| 4 |
it under the terms of the GNU General Public License, version 2.0, |
| 5 |
as published by the Free Software Foundation. |
| 6 |
|
| 7 |
This program is designed to work with certain software (including |
| 8 |
but not limited to OpenSSL) that is licensed under separate terms, |
| 9 |
as designated in a particular file or component or in included license |
| 10 |
documentation. The authors of MySQL hereby grant you an additional |
| 11 |
permission to link the program and your derivative works with the |
| 12 |
separately licensed software that they have either included with |
| 13 |
the program or referenced in the documentation. |
| 14 |
|
| 15 |
This program is distributed in the hope that it will be useful, |
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 |
GNU General Public License, version 2.0, for more details. |
| 19 |
|
| 20 |
You should have received a copy of the GNU General Public License |
| 21 |
along with this program; if not, write to the Free Software |
| 22 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
| 23 |
|
| 24 |
#ifndef KEYRING_METADATA_QUERY_SERVICE_IMPL_INCLUDED |
| 25 |
#define KEYRING_METADATA_QUERY_SERVICE_IMPL_INCLUDED |
| 26 |
|
| 27 |
#include <mysql/components/component_implementation.h> |
| 28 |
#include <mysql/components/service_implementation.h> |
| 29 |
|
| 30 |
#include <mysql/components/services/keyring_metadata_query.h> |
| 31 |
|
| 32 |
namespace keyring_common { |
| 33 |
namespace service_definition { |
| 34 |
|
| 35 |
class Keyring_metadata_query_service_impl { |
| 36 |
public: |
| 37 |
/** Returns status of the keyring component */ |
| 38 |
static DEFINE_BOOL_METHOD(is_initialized, ()); |
| 39 |
/** |
| 40 |
Initialize metadata iterator |
| 41 |
|
| 42 |
@param [out] metadata_iterator Metadata iterator handle |
| 43 |
|
| 44 |
@returns Status of iterator initialization |
| 45 |
@retval false Success |
| 46 |
@retval true Failure |
| 47 |
*/ |
| 48 |
static DEFINE_BOOL_METHOD(init, (my_h_keyring_component_metadata_iterator * |
| 49 |
metadata_iterator)); |
| 50 |
|
| 51 |
/** |
| 52 |
Deinitialize metadata iterator |
| 53 |
|
| 54 |
@param [in, out] metadata_iterator Metadata iterator handle |
| 55 |
|
| 56 |
@returns Status of iterator deinitialization |
| 57 |
@retval false Success |
| 58 |
@retval true Failure |
| 59 |
*/ |
| 60 |
static DEFINE_BOOL_METHOD( |
| 61 |
deinit, (my_h_keyring_component_metadata_iterator metadata_iterator)); |
| 62 |
|
| 63 |
/** |
| 64 |
Check validity of iterator |
| 65 |
|
| 66 |
@param [in] metadata_iterator Metadata iterator handle |
| 67 |
|
| 68 |
@returns Validity of the the iterator |
| 69 |
@retval true Iterator valid |
| 70 |
@retval false Iterator invalid |
| 71 |
*/ |
| 72 |
static DEFINE_BOOL_METHOD( |
| 73 |
is_valid, (my_h_keyring_component_metadata_iterator metadata_iterator)); |
| 74 |
|
| 75 |
/** |
| 76 |
Move iterator forward |
| 77 |
|
| 78 |
@param [in, out] metadata_iterator Metadata iterator handle |
| 79 |
|
| 80 |
@returns Status of operation |
| 81 |
@retval false Success |
| 82 |
@retval true Failure |
| 83 |
*/ |
| 84 |
static DEFINE_BOOL_METHOD( |
| 85 |
next, (my_h_keyring_component_metadata_iterator metadata_iterator)); |
| 86 |
|
| 87 |
/** |
| 88 |
Get length information about metadata key and value |
| 89 |
|
| 90 |
@param [in] metadata_iterator Metadata iterator handle |
| 91 |
@param [out] key_buffer_length Length of the key buffer |
| 92 |
@param [out] value_buffer_length Length of the value buffer |
| 93 |
|
| 94 |
@returns Get length information about key and value |
| 95 |
@retval false Success check out parameters |
| 96 |
@retval true Failure |
| 97 |
*/ |
| 98 |
static DEFINE_BOOL_METHOD( |
| 99 |
get_length, (my_h_keyring_component_metadata_iterator metadata_iterator, |
| 100 |
size_t *key_buffer_length, size_t *value_buffer_length)); |
| 101 |
|
| 102 |
/** |
| 103 |
Get name and value of metadata at current position |
| 104 |
|
| 105 |
@param [in] metadata_iterator Metadata iterator handle |
| 106 |
@param [out] key_buffer Output buffer for key |
| 107 |
@param [in] key_buffer_length Length of key buffer |
| 108 |
@param [out] value_buffer Output buffer for value |
| 109 |
@param [in] value_buffer_length Length of value buffer |
| 110 |
|
| 111 |
@returns Status of fetch operation |
| 112 |
@retval false Success |
| 113 |
@retval true Failure |
| 114 |
*/ |
| 115 |
static DEFINE_BOOL_METHOD( |
| 116 |
get, (my_h_keyring_component_metadata_iterator metadata_iterator, |
| 117 |
char *key_buffer, size_t key_buffer_length, char *value_buffer, |
| 118 |
size_t value_buffer_length)); |
| 119 |
}; |
| 120 |
|
| 121 |
} // namespace service_definition |
| 122 |
} // namespace keyring_common |
| 123 |
|
| 124 |
#define KEYRING_COMPONENT_STATUS_IMPLEMENTOR(component_name) \ |
| 125 |
BEGIN_SERVICE_IMPLEMENTATION(component_name, keyring_component_status) \ |
| 126 |
keyring_common::service_definition::Keyring_metadata_query_service_impl:: \ |
| 127 |
is_initialized \ |
| 128 |
END_SERVICE_IMPLEMENTATION() |
| 129 |
|
| 130 |
#define KEYRING_COMPONENT_METADATA_QUERY_IMPLEMENTOR(component_name) \ |
| 131 |
BEGIN_SERVICE_IMPLEMENTATION(component_name, \ |
| 132 |
keyring_component_metadata_query) \ |
| 133 |
keyring_common::service_definition::Keyring_metadata_query_service_impl:: \ |
| 134 |
init, \ |
| 135 |
keyring_common::service_definition:: \ |
| 136 |
Keyring_metadata_query_service_impl::deinit, \ |
| 137 |
keyring_common::service_definition:: \ |
| 138 |
Keyring_metadata_query_service_impl::is_valid, \ |
| 139 |
keyring_common::service_definition:: \ |
| 140 |
Keyring_metadata_query_service_impl::next, \ |
| 141 |
keyring_common::service_definition:: \ |
| 142 |
Keyring_metadata_query_service_impl::get_length, \ |
| 143 |
keyring_common::service_definition:: \ |
| 144 |
Keyring_metadata_query_service_impl::get \ |
| 145 |
END_SERVICE_IMPLEMENTATION() |
| 146 |
|
| 147 |
#endif // KEYRING_METADATA_QUERY_SERVICE_IMPL_INCLUDED |