412 Project 3
Loading...
Searching...
No Matches
Request Struct Reference

The Request struct represents a network request with incoming and outgoing IPs, a time duration for processing, and (optionally) a job type. More...

#include <Request.h>

Public Member Functions

 Request ()
 Constructs a new Request object.
 
 Request (std::string ip_in, std::string ip_out, int time, char job_type)
 
std::string create_ip ()
 Generates a random IP address in the format XXX.XXX.XXX.XXX.
 

Public Attributes

std::string ip_in
 The incoming IP address of the request.
 
std::string ip_out
 The outgoing IP address of the request.
 
int time
 The time required to process the request in clock cycles.
 

Detailed Description

The Request struct represents a network request with incoming and outgoing IPs, a time duration for processing, and (optionally) a job type.

This struct is used by the LoadBalancer to queue and assign tasks to WebServers.

Constructor & Destructor Documentation

◆ Request()

Request::Request ( )

Constructs a new Request object.

Generates random incoming (ip_in) and outgoing (ip_out) IP addresses and assigns a random time (between 1 and 100) for processing the request.

Member Function Documentation

◆ create_ip()

std::string Request::create_ip ( )

Generates a random IP address in the format XXX.XXX.XXX.XXX.

Each segment of the IP address is a randomly generated integer between 0 and 255.

Returns
std::string A randomly generated IP address.

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