17 return std::to_string(rand() % 256) +
"." +
18 std::to_string(rand() % 256) +
"." +
19 std::to_string(rand() % 256) +
"." +
20 std::to_string(rand() % 256);
26 int time = minTime + (rand() % (maxTime - minTime + 1));
27 char jobType = (rand() % 2 == 0) ?
'P' :
'S';
Defines the Request struct representing a network request in the load balancer simulation.
Represents a single network request with source/destination IPs, processing time, and job type.
static std::string generateRandomIP()
Generates a random IP address string in dotted-decimal format.
int time
Processing time in clock cycles.
static Request generateRandom(int minTime, int maxTime)
Generates a random Request with random IPs and a random processing time.
Request(std::string ipIn, std::string ipOut, int time, char jobType)
Constructs a Request with the given parameters.
std::string ipIn
Source IP address of the request.
char jobType
Job type: 'P' for processing, 'S' for streaming.
std::string ipOut
Destination IP address for the response.