The code launching SurpriseServer and its
main loop code is located in files src/server/surpriseserver.c
and
src/server/server.c
. First, the command-line arguments are processed and
passed appropriate parameters to the function launch_server()
located in src/server/server.c
. This function starts listening on a port
if demanded and starts the server main loop. It waits for input and
serves the client's demands (description of underlying language
can be found in section
Description of Text Protocol API). The client's demands are served as follows:
get_resources()
and printing the structure struct resources
returned by this function.
get_rootdirs()
and printing the requested
information about partition returned by this function.
struct final
,
calling function commit
in check-only mode and printing out the structure and the messages returned by the function.
struct final
,
calling function commit
in modification mode and printing out the structure and the messages returned by the function.
If an error occurs the function prints out error message(s) and starts waiting for the client's next demand.