sister
Loading...
Searching...
No Matches
Functions
request.h File Reference

Header for the request-handling module. More...

#include <stdio.h>

Go to the source code of this file.

Functions

int initRequestHandler (void)
 Initializes the request-handling module.
 
void handleRequest (FILE *rx, FILE *tx)
 Handles requests coming from a client.
 

Detailed Description

Header for the request-handling module.

Function Documentation

◆ handleRequest()

void handleRequest ( FILE *  rx,
FILE *  tx 
)

Handles requests coming from a client.

This function does the actual work of communicating with the client. It should be called from the connection-handling module.

Parameters
rxClient-connection stream opened for reading.
txClient-connection stream opened for writing.
Note
This function may also be called by a connection-handling module which does not create a separate process for each request. Therefore, it should not terminate the current process on failure. Furthermore, it is the caller's responsibility to close rx and tx after this function has returned.

◆ initRequestHandler()

int initRequestHandler ( void  )

Initializes the request-handling module.

Note
This function must be invoked after cmdlineInit().
Returns
0 on success, -1 if the command-line arguments are invalid. If a non-recoverable error occurs during initialization (e.g. a failed memory allocation), the function does not return, but instead prints a meaningful error message and terminates the process.