MySQL 8.0.31
Source Code Documentation
keyring_iterator_service.h
Go to the documentation of this file.
1/* Copyright (c) 2019, 2022, 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 also distributed 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 included with MySQL.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License, version 2.0, for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef KEYRING_ITERATOR_H
24#define KEYRING_ITERATOR_H
25
28
30
31/**
32 @ingroup group_components_services_inventory
33
34 Keyring iterator component service definition, which enables to iterate over
35 items stored within currently used keyring.
36
37 @code
38 my_service<SERVICE_TYPE(mysql_keyring_iterator)> service(
39 "mysql_keyring_iterator.mysql_server", m_reg_srv);
40
41 if (!service.is_valid()) {
42 return;
43 }
44
45 my_h_keyring_iterator iterator = nullptr;
46
47 if (service->init(&iterator)) {
48 return;
49 }
50
51 char key_id[64];
52 char user_id[64];
53
54 while (iterator != nullptr && service->get(iterator, key_id, sizeof(key_id)
55 user_id, sizeof(user_id))
56 == 0) {
57 // Do something with key and user_id values.
58 }
59
60 service->deinit(iterator);
61 @endcode
62*/
63BEGIN_SERVICE_DEFINITION(mysql_keyring_iterator)
64
65/**
66 Initialize an iterator.
67
68 @param[out] iterator Iterator pointer.
69
70 @return
71 @retval false Succeeded.
72 @retval true Failed.
73
74 @sa plugin_keyring.h
75*/
77
78/**
79 Deinitialize an iterator.
80
81 @param iterator Iterator pointer.
82
83 @return
84 @retval false Succeeded.
85 @retval true Failed.
86
87 @sa plugin_keyring.h
88*/
90
91/**
92 Fetch key info stored under key iterator and move it forward.
93
94 @param iterator Iterator pointer.
95 @param[out] key_id The buffer pointer for storing key id.
96 @param key_id_size Size of the key_id buffer.
97 @param[out] user_id The buffer pointer for storing user id. In case
98 of lack of user id, empty string is returned.
99 @param user_id_size Size of the user_id buffer.
100
101 @return
102 @retval false Succeeded.
103 @retval true Failed.
104
105 @sa plugin_keyring.h
106*/
108 (my_h_keyring_iterator iterator, char *key_id,
109 size_t key_id_size, char *user_id, size_t user_id_size));
110
111END_SERVICE_DEFINITION(mysql_keyring_iterator)
112
113#endif /* KEYRING_ITERATOR_H */
static mysql_service_status_t deinit()
Component deinitialization.
Definition: audit_api_message_emit.cc:579
static mysql_service_status_t init()
Component initialization.
Definition: audit_api_message_emit.cc:570
struct my_h_keyring_iterator_imp * my_h_keyring_iterator
Definition: keyring_iterator_service.h:29
static mysql_service_status_t get(reference_caching_cache cache, unsigned service_name_index, const my_h_service **refs) noexcept
Definition: component.cc:113
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:90
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:85
#define DEFINE_SERVICE_HANDLE(name)
Defines an object type that is meant for carrying handles to the implementation-specific objects used...
Definition: service.h:128
#define DECLARE_BOOL_METHOD(name, args)
Declares a method that returns bool as a part of the Service definition.
Definition: service.h:111