MySQL 8.4.0
Source Code Documentation
sql_event_tracking_to_audit_event_mapping.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 2024, 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 SQL_SQL_EVENT_TRACKING_TO_AUDIT_EVENT_MAPPING_H
25#define SQL_SQL_EVENT_TRACKING_TO_AUDIT_EVENT_MAPPING_H
26
27#include <array>
28#include <string>
29#include <unordered_map>
30
31#include "mysql/plugin_audit.h"
32
33extern const char *plugin_event_names[];
34extern const char *event_tracking_names[];
35
36/**
37 Event tracking classes
38 If a new event tracking class is introduced,
39 this class should be kept in sync.
40*/
43 COMMAND,
45 GENERAL,
47 MESSAGE,
48 PARSE,
49 QUERY,
51 STARTUP,
54 /* Add entry above this */
55 LAST
56};
57
58struct EnumHash {
59 template <typename T>
60 std::size_t operator()(T t) const {
61 return static_cast<std::size_t>(t);
62 }
63};
64
66 public:
68 if (unlikely(instance == nullptr))
69 instance = new (std::nothrow)
71 return instance;
72 }
73
74 static void remove_instance() { delete instance; }
75
79 delete;
83 delete;
84
86
87 unsigned long plugin_sub_event(unsigned long subevent) { return subevent; }
88
90 Event_tracking_class event_tracking_class);
91
93
94 private:
96 std::array<mysql_event_class_t,
97 static_cast<size_t>(Event_tracking_class::LAST)>
100};
101
102#endif // !SQL_SQL_EVENT_TRACKING_TO_AUDIT_EVENT_MAPPING_H
Definition: sql_event_tracking_to_audit_event_mapping.h:65
unsigned long plugin_sub_event(unsigned long subevent)
Definition: sql_event_tracking_to_audit_event_mapping.h:87
Singleton_event_tracking_service_to_plugin_mapping()
Definition: sql_event_tracking_to_audit_event_mapping.cc:62
const std::string event_tracking_names(Event_tracking_class)
Singleton_event_tracking_service_to_plugin_mapping(const Singleton_event_tracking_service_to_plugin_mapping &)=delete
mysql_event_class_t plugin_event_class(Event_tracking_class event_tracking_class)
Definition: sql_event_tracking_to_audit_event_mapping.cc:92
~Singleton_event_tracking_service_to_plugin_mapping()
Definition: sql_event_tracking_to_audit_event_mapping.h:85
void operator=(const Singleton_event_tracking_service_to_plugin_mapping &)=delete
static void remove_instance()
Definition: sql_event_tracking_to_audit_event_mapping.h:74
void operator=(Singleton_event_tracking_service_to_plugin_mapping &&)=delete
Singleton_event_tracking_service_to_plugin_mapping(Singleton_event_tracking_service_to_plugin_mapping &&)=delete
static Singleton_event_tracking_service_to_plugin_mapping * create_instance()
Definition: sql_event_tracking_to_audit_event_mapping.h:67
std::array< mysql_event_class_t, static_cast< size_t >(Event_tracking_class::LAST)> event_tracking_to_plugin_event_map_
Definition: sql_event_tracking_to_audit_event_mapping.h:98
static Singleton_event_tracking_service_to_plugin_mapping * instance
Definition: sql_event_tracking_to_audit_event_mapping.h:99
constexpr bool unlikely(bool expr)
Definition: my_compiler.h:58
mysql_event_class_t
Audit event classes.
Definition: plugin_audit.h:50
const char * plugin_event_names[]
Definition: sql_event_tracking_to_audit_event_mapping.cc:29
Event_tracking_class
Event tracking classes If a new event tracking class is introduced, this class should be kept in sync...
Definition: sql_event_tracking_to_audit_event_mapping.h:41
const char * event_tracking_names[]
Definition: sql_event_tracking_to_audit_event_mapping.cc:44
Definition: sql_event_tracking_to_audit_event_mapping.h:58
std::size_t operator()(T t) const
Definition: sql_event_tracking_to_audit_event_mapping.h:60