KENSv3
KAIST Educational Network System
Public Member Functions | Protected Member Functions | List of all members
E::TCPAssignment Class Reference
Inheritance diagram for E::TCPAssignment:
E::HostModule E::RoutingInfoInterface E::SystemCallInterface E::TimerModule

Public Member Functions

 TCPAssignment (Host &host)
 
virtual void initialize ()
 This function is automatically called by Host just before the simulation begins. You can override this function if needed.
 
virtual void finalize ()
 This function is automatically called by Host just after the simulation ends. You can override this function if needed.
 
- Public Member Functions inherited from E::HostModule
 HostModule (std::string name, Host &host)
 Create a HostModule. It is automatically registered to the Host. Module is registered to a System when it is created. More...
 
virtual std::string getHostModuleName () final
 
virtual std::any diagnose (std::any param)
 Host module control function.
 

Protected Member Functions

virtual void systemCallback (UUID syscallUUID, int pid, const SystemCallParameter &param) final
 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 packetArrived (std::string fromModule, Packet &&packet) final
 This function is automatically called by Host when this module receives a Packet. You must override this function to handle Packet events. When a Packet is received, you must FREE IT OR PASS IT TO OTHER HOSTMODULE. More...
 
- Protected Member Functions inherited from E::HostModule
virtual void sendPacket (std::string toModule, Packet &&packet) final
 This function transfers Packets among HostModules in the Host. Unlike Module::Message, we use fire-and-forget policy with Packets. Once you send a Packet using sendPacket, you DO NOT HAVE TO FREE THAT PACKET. More...
 
void sendPacket (std::string toModule, const Packet &packet)
 
Time getCurrentTime ()
 
Size getWireSpeed (int port_num)
 Get cost for local port (link) More...
 
size_t getPortCount ()
 Get the number of ports. More...
 
void print_log (uint64_t level, const char *format,...)
 Prints log with specified log level and format. NetworkLog::print_log prints logs specified in log level parameter. For example, if log level is set to TCP_LOG, it only prints TCP_LOG logs. If you want to print multiple log levels in NetworkLog, you can set log level with OR operation (i.e. SYSCALL_ERROR | MODULE_ERROR). More...
 
- Protected Member Functions inherited from E::SystemCallInterface
 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 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...
 
- Protected Member Functions inherited from E::TimerModule
 TimerModule (std::string name, Host &host)
 
virtual std::string getTimerModuleName () final
 
virtual UUID addTimer (std::any payload, Time timeAfter) final
 Request an alarm that rings after specified time. More...
 
virtual void cancelTimer (UUID key) final
 Cancel the timer request. More...
 

Additional Inherited Members

- Public Types inherited from E::SystemCallInterface
enum  SystemCall {
  SOCKET , CLOSE , READ , WRITE ,
  CONNECT , LISTEN , ACCEPT , BIND ,
  GETSOCKNAME , GETPEERNAME , NSLEEP , GETTIMEOFDAY
}
 
- Static Public Attributes inherited from E::SystemCallInterface
static constexpr int AF_INET = 2
 
static constexpr int IPPROTO_TCP = 6
 
static constexpr int IPPROTO_UDP = 17
 
static constexpr int max_param = 3
 

Member Function Documentation

◆ packetArrived()

void E::TCPAssignment::packetArrived ( std::string  fromModule,
Packet &&  packet 
)
finalprotectedvirtual

This function is automatically called by Host when this module receives a Packet. You must override this function to handle Packet events. When a Packet is received, you must FREE IT OR PASS IT TO OTHER HOSTMODULE.

Parameters
fromModuleName of the HostModule who sent this packet.
packetReceived packet.

Implements E::HostModule.

◆ systemCallback()

void E::TCPAssignment::systemCallback ( UUID  syscallUUID,
int  pid,
const SystemCallParameter param 
)
finalprotectedvirtual

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
syscallUUIDUnique ID for this system call request.
pidProcess who raised this system call request.
paramParameters given this system call.
See also
returnSystemCall

Implements E::SystemCallInterface.


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