73 <<
" :: Duration " << request.
time <<
" Cycles" << std::endl;
84 <<
" request complete. Opening for new request."
~WebServer()
Destructor. Logs server closure.
Definition web_server.h:59
void handle_request(Request request)
Assigns a new request to the server and begins processing.
Definition web_server.h:67
WebServer(int num_webserver, std::ostream &output_stream=std::cout)
Constructs a WebServer with a unique identifier and output stream.
Definition web_server.h:51
std::ostream & output_stream
Output stream for logging server activity.
Definition web_server.h:24
int num_webserver
Unique identifier for the web server instance.
Definition web_server.h:29
Request current
The current request being processed by the server.
Definition web_server.h:34
int processed_time
Number of cycles spent processing the current request.
Definition web_server.h:44
void pass_time()
Advances the server's processing by one cycle. Marks idle if done.
Definition web_server.h:79
bool is_idle
Indicates whether the server is idle and ready for a new request.
Definition web_server.h:39
Definition of the Request struct for representing network requests.
Represents a network request with source and destination IPs and a processing time.
Definition request.h:17
int time
Number of cycles required to process the request.
Definition request.h:31
std::string ip_out
Destination IP address of the request.
Definition request.h:26
std::string ip_in
Source IP address of the request.
Definition request.h:21