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

#include <socket_manager.hpp>

Public Member Functions

 SocketManager (std::weak_ptr< Arion > arion)
 
void add_socket_entry (int target_fd, std::shared_ptr< ARION_SOCKET > socket)
 
bool has_socket_entry (int target_fd)
 
void rm_socket_entry (int target_fd)
 
std::shared_ptr< ARION_SOCKETget_arion_socket (int target_fd)
 

Static Public Member Functions

static std::unique_ptr< SocketManagerinitialize (std::weak_ptr< Arion > arion)
 

Public Attributes

std::map< int, std::shared_ptr< ARION_SOCKET > > sockets
 A map identifying a socket given its UNIX file descriptor.
 

Private Attributes

std::weak_ptr< Arionarion
 The Arion instance associated to this instance.
 

Detailed Description

This class handles socket-related operations. It maintains a mapping of file descriptors to their respective ARION_SOCKET instances.

Constructor & Destructor Documentation

◆ SocketManager()

arion::SocketManager::SocketManager ( std::weak_ptr< Arion arion)
inline

Builder for SocketManager instances.

Parameters
[in]arionThe Arion instance associated to this instance.

Member Function Documentation

◆ add_socket_entry()

void arion::SocketManager::add_socket_entry ( int  target_fd,
std::shared_ptr< ARION_SOCKET socket 
)

Inserts a new socket to the "sockets" vector.

Parameters
[in]target_fdThe UNIX file descriptor for the new socket, in the emulation context.
[in]socketThe new socket to be inserted.

◆ get_arion_socket()

std::shared_ptr< ARION_SOCKET > arion::SocketManager::get_arion_socket ( int  target_fd)

Retrieves an ARION_SOCKET instance from a UNIX file descriptor from the emulation context.

Parameters
[in]target_fdThe UNIX file descriptor.
Returns
The retrieved ARION_SOCKET.

◆ has_socket_entry()

bool arion::SocketManager::has_socket_entry ( int  target_fd)

Checks whether the "sockets" vector contains a given file descriptor.

Parameters
[in]target_fdThe UNIX socket descriptor.
Returns
True if the "sockets" vector contains the file descriptor.

◆ initialize()

static std::unique_ptr< SocketManager > arion::SocketManager::initialize ( std::weak_ptr< Arion arion)
static

Instanciates and initializes new SocketManager objects with some parameters.

Parameters
[in]arionThe Arion instance used for emulation.
Returns
A new SocketManager instance.

◆ rm_socket_entry()

void arion::SocketManager::rm_socket_entry ( int  target_fd)

Removes a file entry from the "sockets" vector.

Parameters
[in]target_fdThe UNIX file descriptor of the socket to be removed.

Member Data Documentation

◆ arion

std::weak_ptr<Arion> arion::SocketManager::arion
private

The Arion instance associated to this instance.

◆ sockets

std::map<int, std::shared_ptr<ARION_SOCKET> > arion::SocketManager::sockets

A map identifying a socket given its UNIX file descriptor.


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