libintrovirt v0.57.4
IntroVirt introspection library
Loading...
Searching...
No Matches
Event.hh
Go to the documentation of this file.
1/*
2 * Copyright 2021 Assured Information Security, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
25
26#include <introvirt/core/fwd.hh>
27#include <introvirt/util/json/json.hh>
28
29#include <cstdint>
30#include <functional>
31#include <ostream>
32#include <string>
33
34namespace introvirt {
35
36enum class OS { Unknown, Windows, Linux };
37
38class EventImpl;
39
43class Event {
44 public:
50 virtual Vcpu& vcpu() = 0;
51
55 virtual const Vcpu& vcpu() const = 0;
56
62 virtual Domain& domain() = 0;
63
69 virtual const Domain& domain() const = 0;
70
76 virtual EventType type() const = 0;
77
86 virtual SystemCallEvent& syscall() = 0;
87
91 virtual const SystemCallEvent& syscall() const = 0;
92
99 virtual ControlRegisterEvent& cr() = 0;
100
104 virtual const ControlRegisterEvent& cr() const = 0;
105
112 virtual MsrAccessEvent& msr() = 0;
113
117 virtual const MsrAccessEvent& msr() const = 0;
118
125 virtual ExceptionEvent& exception() = 0;
126
130 virtual const ExceptionEvent& exception() const = 0;
131
146
150 virtual const MemAccessEvent& mem_access() const = 0;
151
161
165 virtual const EventTaskInformation& task() const = 0;
166
170 virtual OS os_type() const = 0;
171
176 virtual Json::Value json() const = 0;
177
181 virtual uint64_t id() const = 0;
182
188 virtual EventImpl& impl() = 0;
189
193 virtual ~Event() = default;
194};
195
196const std::string& to_string(OS);
197std::ostream& operator<<(std::ostream&, OS);
198
199} // namespace introvirt
Control register read/write event interface.
Definition ControlRegisterEvent.hh:27
A class representing a single Domain.
Definition Domain.hh:44
An interface for event process information.
Definition EventTaskInformation.hh:28
Interface class for hypervisor events.
Definition Event.hh:43
virtual const ControlRegisterEvent & cr() const =0
Get control register access event information.
virtual SystemCallEvent & syscall()=0
Get system call event information.
virtual OS os_type() const =0
virtual ~Event()=default
Destroy the instance.
virtual MemAccessEvent & mem_access()=0
Get memory access event information.
virtual uint64_t id() const =0
Get the unique identifier for this event.
virtual Domain & domain()=0
Get the Domain that the event is for.
virtual const SystemCallEvent & syscall() const =0
Get system call event information.
virtual const Domain & domain() const =0
Get the Domain that the event is for.
virtual const ExceptionEvent & exception() const =0
Get x86 exception event information.
virtual MsrAccessEvent & msr()=0
Get MSR access event information.
virtual const EventTaskInformation & task() const =0
Get the task information.
virtual EventImpl & impl()=0
Used internally.
virtual ExceptionEvent & exception()=0
Get x86 exception event information.
virtual Json::Value json() const =0
Serialize the event into JSON.
virtual EventTaskInformation & task()=0
Get the task information.
virtual EventType type() const =0
Get the type of event.
virtual ControlRegisterEvent & cr()=0
Get control register access event information.
virtual const MemAccessEvent & mem_access() const =0
Get memory access event information.
virtual const Vcpu & vcpu() const =0
Get the Vcpu that triggered the event.
virtual const MsrAccessEvent & msr() const =0
Get MSR access event information.
virtual Vcpu & vcpu()=0
Get the Vcpu that triggered the event.
Interface for x86 exception events.
Definition ExceptionEvent.hh:27
Interface for intercepting memory accesses.
Definition MemAccessEvent.hh:29
Interface for MSR read/write events.
Definition MsrAccessEvent.hh:27
Interface for system call events.
Definition SystemCallEvent.hh:46
A class representing a single virtual processor.
Definition Vcpu.hh:33
Core IntroVirt classes.
Definition Cr0.hh:20
const std::string & to_string(OS)
EventType
Enum describing a hypervisor event.
Definition EventType.hh:29
std::ostream & operator<<(std::ostream &, OS)
OS
Definition Event.hh:36