Arion 1.0.2-alpha
A high-performance C++ framework for emulating executable binaries.
 
Loading...
Searching...
No Matches
arion::ArionGroup Class Reference

Group of Arion instances that run together. This allows IPC as well as sandboxing between groups. More...

#include <arion.hpp>

Inheritance diagram for arion::ArionGroup:

Public Member Functions

size_t count_arion_instances ()
 
std::map< pid_t, std::shared_ptr< Arion > > get_arion_instances ()
 
bool has_arion_instance (pid_t pid)
 
std::shared_ptr< Arionget_arion_instance (pid_t pid)
 
void add_arion_instance (std::shared_ptr< Arion > arion, std::optional< pid_t > pid=std::nullopt, std::optional< pid_t > pgid=std::nullopt)
 
void remove_arion_instance (pid_t pid)
 
void run ()
 
void stop ()
 
void stop_curr ()
 
pid_t get_curr_pid ()
 
void set_curr_pid (pid_t pid)
 
pid_t get_next_pid ()
 
void set_next_pid (pid_t pid)
 

Private Attributes

bool trigger_stop
 True when emulation of the group should be stopped.
 
pid_t next_pid = ARION_PROCESS_PID
 
pid_t curr_pid = ARION_PROCESS_PID
 PID of the Arion instance currently running in the group.
 
std::map< pid_t, std::shared_ptr< Arion > > instances
 List of Arion instances associated with this group.
 

Detailed Description

Group of Arion instances that run together. This allows IPC as well as sandboxing between groups.

Member Function Documentation

◆ add_arion_instance()

void arion::ArionGroup::add_arion_instance ( std::shared_ptr< Arion arion,
std::optional< pid_t >  pid = std::nullopt,
std::optional< pid_t >  pgid = std::nullopt 
)

Inserts an Arion instance in this group.

Parameters
[in]arionThe Arion instance.
[in]pidThe PID for this instance (optional, nullable).
[in]pgidThe PGID for this instance (optional, nullable). Set to the PID value if not specified.

◆ count_arion_instances()

size_t arion::ArionGroup::count_arion_instances ( )

Returns the amount of Arion instances associated with this group.

Returns
The amount.

◆ get_arion_instance()

std::shared_ptr< Arion > arion::ArionGroup::get_arion_instance ( pid_t  pid)

Provides the Arion instance in this group associated with the given PID.

Parameters
[in]pidThe PID.
Returns
The Arion instance.

◆ get_arion_instances()

std::map< pid_t, std::shared_ptr< Arion > > arion::ArionGroup::get_arion_instances ( )

Provides the map of all Arion instances associated with this group, with their respective PID being the keys.

Returns
The map.

◆ get_curr_pid()

pid_t arion::ArionGroup::get_curr_pid ( )

Provides PID of running Arion instance in this group.

Returns
The PID.

◆ get_next_pid()

pid_t arion::ArionGroup::get_next_pid ( )

Provides the next PID to be associated with an Arion instance, in case none is provided when inserting it in the group.

Returns
The PID.

◆ has_arion_instance()

bool arion::ArionGroup::has_arion_instance ( pid_t  pid)

Checks whether a given PID is associated with an Arion instance in this group or not.

Parameters
[in]pidThe PID to check for.
Returns
True if the PID was found, false otherwise.

◆ remove_arion_instance()

void arion::ArionGroup::remove_arion_instance ( pid_t  pid)

Removes an Arion instance from this group, given its PID.

Parameters
[in]pidThe PID associated with the Arion instance to remove.

◆ run()

void arion::ArionGroup::run ( )

Starts emulation of the group. Each Arion instance is given some execution time before switching to the next one.

◆ set_curr_pid()

void arion::ArionGroup::set_curr_pid ( pid_t  pid)

Define which Arion instance should be currently run in the group, given its PID.

Parameters
[in]pidThe PID.

◆ set_next_pid()

void arion::ArionGroup::set_next_pid ( pid_t  pid)

Defines the next PID to be associated with an Arion instance, in case none is provided when inserting it in the group.

Parameters
[in]pidThe PID.

◆ stop()

void arion::ArionGroup::stop ( )

Stops emulation of the whole group.

◆ stop_curr()

void arion::ArionGroup::stop_curr ( )

Stops emulation of the running Arion instance in this group.

Member Data Documentation

◆ curr_pid

pid_t arion::ArionGroup::curr_pid = ARION_PROCESS_PID
private

PID of the Arion instance currently running in the group.

◆ instances

std::map<pid_t, std::shared_ptr<Arion> > arion::ArionGroup::instances
private

List of Arion instances associated with this group.

◆ next_pid

pid_t arion::ArionGroup::next_pid = ARION_PROCESS_PID
private

Next PID to be associated with an Arion instance, in case none is provided when inserting it in the group.

◆ trigger_stop

bool arion::ArionGroup::trigger_stop
private

True when emulation of the group should be stopped.


The documentation for this class was generated from the following file: