If you want to handle system call events of the Host, you should inherit this class. This class provides file descriptor management, and blocking behavior of system calls.
More...
#include <E_Host.hpp>
|
enum | SystemCall {
SOCKET
, CLOSE
, READ
, WRITE
,
CONNECT
, LISTEN
, ACCEPT
, BIND
,
GETSOCKNAME
, GETPEERNAME
, NSLEEP
, GETTIMEOFDAY
} |
|
|
static constexpr int | AF_INET = 2 |
|
static constexpr int | IPPROTO_TCP = 6 |
|
static constexpr int | IPPROTO_UDP = 17 |
|
static constexpr int | max_param = 3 |
|
|
| SystemCallInterface (int domain, int protocol, Host &host) |
| Multiple SystemCallInterface may be installed to a Host. They are distinguished by their Domain and Protocol. The interface is automatically registered to the Host when created. More...
|
|
virtual void | systemCallback (UUID syscallUUID, int pid, const SystemCallParameter ¶m)=0 |
| When a system call is invoked by an application, this callback function is automatically called. To handle system call events, override this function. More...
|
|
virtual void | returnSystemCall (UUID syscallUUID, int val) final |
| Unblocks a blocked system call with return value. More...
|
|
virtual int | createFileDescriptor (int processID) final |
| Create a file descriptor for a certain process. The created file descriptor is automatically bound to the domain and protocol of this module. Proper system call request using this file descriptor will be passed to the SystemCallInterface which created the file descriptor. More...
|
|
virtual void | removeFileDescriptor (int processID, int fd) final |
| Close a file descriptor. Closed file descriptor becomes invalid and loses connection between this SystemCallInterface. Any system call request on invalid file descriptor will fail. More...
|
|
If you want to handle system call events of the Host, you should inherit this class. This class provides file descriptor management, and blocking behavior of system calls.
◆ SystemCallInterface()
E::SystemCallInterface::SystemCallInterface |
( |
int |
domain, |
|
|
int |
protocol, |
|
|
Host & |
host |
|
) |
| |
|
protected |
Multiple SystemCallInterface may be installed to a Host. They are distinguished by their Domain and Protocol. The interface is automatically registered to the Host when created.
- Parameters
-
domain | Address domain (e.g. AF_INET). |
protocol | Protocl to use (e.g. IPPROTO_TCP). |
host | Host to be registered. |
◆ createFileDescriptor()
int E::SystemCallInterface::createFileDescriptor |
( |
int |
processID | ) |
|
|
finalprotectedvirtual |
Create a file descriptor for a certain process. The created file descriptor is automatically bound to the domain and protocol of this module. Proper system call request using this file descriptor will be passed to the SystemCallInterface which created the file descriptor.
- Parameters
-
processID | Create a file descriptor for this process. |
- Returns
- Created file descriptor.
- Note
- You cannot override this function.
◆ removeFileDescriptor()
void E::SystemCallInterface::removeFileDescriptor |
( |
int |
processID, |
|
|
int |
fd |
|
) |
| |
|
finalprotectedvirtual |
Close a file descriptor. Closed file descriptor becomes invalid and loses connection between this SystemCallInterface. Any system call request on invalid file descriptor will fail.
- Parameters
-
processID | PID of the file descriptor owner. |
fd | File descriptor to be closed. |
- Note
- You cannot override this function.
◆ returnSystemCall()
void E::SystemCallInterface::returnSystemCall |
( |
UUID |
syscallUUID, |
|
|
int |
val |
|
) |
| |
|
finalprotectedvirtual |
Unblocks a blocked system call with return value.
- Parameters
-
syscallUUID | Unique ID for the system call to be unblocked. |
val | return value of the system call. |
- Note
- You cannot override this function.
- See also
- returnSystemCall
◆ systemCallback()
virtual void E::SystemCallInterface::systemCallback |
( |
UUID |
syscallUUID, |
|
|
int |
pid, |
|
|
const SystemCallParameter & |
param |
|
) |
| |
|
protectedpure virtual |
When a system call is invoked by an application, this callback function is automatically called. To handle system call events, override this function.
- Note
- IMPORTANT: Every system call automatically blocks the caller application. Every system call should be unblocked manually. For simple non-blocking functions, just call the unblocking utility at the end of the handler.
- Parameters
-
syscallUUID | Unique ID for this system call request. |
pid | Process who raised this system call request. |
param | Parameters given this system call. |
- See also
- returnSystemCall
Implemented in E::TCPAssignment.
The documentation for this class was generated from the following files:
- include/E/Networking/E_Host.hpp
- src/Networking/E_Host.cpp