MySQL 8.3.0
Source Code Documentation
sql_event_tracking_to_audit_event_mapping.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 2023, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef SQL_SQL_EVENT_TRACKING_TO_AUDIT_EVENT_MAPPING_H
24#define SQL_SQL_EVENT_TRACKING_TO_AUDIT_EVENT_MAPPING_H
25
26#include <array>
27#include <string>
28#include <unordered_map>
29
30#include "mysql/plugin_audit.h"
31
32extern const char *plugin_event_names[];
33extern const char *event_tracking_names[];
34
35/**
36 Event tracking classes
37 If a new event tracking class is introduced,
38 this class should be kept in sync.
39*/
42 COMMAND,
44 GENERAL,
46 MESSAGE,
47 PARSE,
48 QUERY,
50 STARTUP,
53 /* Add entry above this */
54 LAST
55};
56
57struct EnumHash {
58 template <typename T>
59 std::size_t operator()(T t) const {
60 return static_cast<std::size_t>(t);
61 }
62};
63
65 public:
67 if (unlikely(instance == nullptr))
68 instance = new (std::nothrow)
70 return instance;
71 }
72
73 static void remove_instance() { delete instance; }
74
78 delete;
82 delete;
83
85
86 unsigned long plugin_sub_event(unsigned long subevent) { return subevent; }
87
89 Event_tracking_class event_tracking_class);
90
92
93 private:
95 std::array<mysql_event_class_t,
96 static_cast<size_t>(Event_tracking_class::LAST)>
99};
100
101#endif // !SQL_SQL_EVENT_TRACKING_TO_AUDIT_EVENT_MAPPING_H
Definition: sql_event_tracking_to_audit_event_mapping.h:64
unsigned long plugin_sub_event(unsigned long subevent)
Definition: sql_event_tracking_to_audit_event_mapping.h:86
Singleton_event_tracking_service_to_plugin_mapping()
Definition: sql_event_tracking_to_audit_event_mapping.cc:61
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:91
~Singleton_event_tracking_service_to_plugin_mapping()
Definition: sql_event_tracking_to_audit_event_mapping.h:84
void operator=(const Singleton_event_tracking_service_to_plugin_mapping &)=delete
static void remove_instance()
Definition: sql_event_tracking_to_audit_event_mapping.h:73
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:66
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:97
static Singleton_event_tracking_service_to_plugin_mapping * instance
Definition: sql_event_tracking_to_audit_event_mapping.h:98
constexpr bool unlikely(bool expr)
Definition: my_compiler.h:57
mysql_event_class_t
Audit event classes.
Definition: plugin_audit.h:49
const char * plugin_event_names[]
Definition: sql_event_tracking_to_audit_event_mapping.cc:28
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:40
const char * event_tracking_names[]
Definition: sql_event_tracking_to_audit_event_mapping.cc:43
Definition: sql_event_tracking_to_audit_event_mapping.h:57
std::size_t operator()(T t) const
Definition: sql_event_tracking_to_audit_event_mapping.h:59