MySQL 9.0.0
Source Code Documentation
keyring_iterator_service.h
Go to the documentation of this file.
1/* Copyright (c) 2019, 2024, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef KEYRING_ITERATOR_H
25#define KEYRING_ITERATOR_H
26
29
31
32/**
33 @ingroup group_components_services_inventory
34
35 Keyring iterator component service definition, which enables to iterate over
36 items stored within currently used keyring.
37
38 @code
39 my_service<SERVICE_TYPE(mysql_keyring_iterator)> service(
40 "mysql_keyring_iterator.mysql_server", m_reg_srv);
41
42 if (!service.is_valid()) {
43 return;
44 }
45
46 my_h_keyring_iterator iterator = nullptr;
47
48 if (service->init(&iterator)) {
49 return;
50 }
51
52 char key_id[64];
53 char user_id[64];
54
55 while (iterator != nullptr && service->get(iterator, key_id, sizeof(key_id)
56 user_id, sizeof(user_id))
57 == 0) {
58 // Do something with key and user_id values.
59 }
60
61 service->deinit(iterator);
62 @endcode
63*/
64BEGIN_SERVICE_DEFINITION(mysql_keyring_iterator)
65
66/**
67 Initialize an iterator.
68
69 @param[out] iterator Iterator pointer.
70
71 @return
72 @retval false Succeeded.
73 @retval true Failed.
74
75 @sa plugin_keyring.h
76*/
78
79/**
80 Deinitialize an iterator.
81
82 @param iterator Iterator pointer.
83
84 @return
85 @retval false Succeeded.
86 @retval true Failed.
87
88 @sa plugin_keyring.h
89*/
91
92/**
93 Fetch key info stored under key iterator and move it forward.
94
95 @param iterator Iterator pointer.
96 @param[out] key_id The buffer pointer for storing key id.
97 @param key_id_size Size of the key_id buffer.
98 @param[out] user_id The buffer pointer for storing user id. In case
99 of lack of user id, empty string is returned.
100 @param user_id_size Size of the user_id buffer.
101
102 @return
103 @retval false Succeeded.
104 @retval true Failed.
105
106 @sa plugin_keyring.h
107*/
109 (my_h_keyring_iterator iterator, char *key_id,
110 size_t key_id_size, char *user_id, size_t user_id_size));
111
112END_SERVICE_DEFINITION(mysql_keyring_iterator)
113
114#endif /* KEYRING_ITERATOR_H */
static mysql_service_status_t deinit()
Component deinitialization.
Definition: audit_api_message_emit.cc:580
static mysql_service_status_t init()
Component initialization.
Definition: audit_api_message_emit.cc:571
struct my_h_keyring_iterator_imp * my_h_keyring_iterator
Definition: keyring_iterator_service.h:30
static mysql_service_status_t get(THD **thd) noexcept
Definition: mysql_current_thread_reader_all_empty.cc:31
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:91
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:86
#define DEFINE_SERVICE_HANDLE(name)
Defines an object type that is meant for carrying handles to the implementation-specific objects used...
Definition: service.h:129
#define DECLARE_BOOL_METHOD(name, args)
Declares a method that returns bool as a part of the Service definition.
Definition: service.h:112