Skip to content
Snippets Groups Projects
Commit 3e6ce19a authored by ERIK ALEXANDRE PUCCI's avatar ERIK ALEXANDRE PUCCI Committed by Danilo K. S. Yorinori
Browse files

client.c: Created check_version() to contain the Agent Version method code


The check_version() was created to contain the code of Agent Version method
call, improving modularization.

Signed-off-by: default avatarERIK ALEXANDRE PUCCI <eap08@c3sl.ufpr.br>
Acked-by: default avatarBruno Ribas <ribas@c3sl.ufpr.br>
Acked-by: default avatarJosiney de Souza <josineys@c3sl.ufpr.br>
Signed-off-by: default avatarDanilo K. S. Yorinori <danilok@c3sl.ufpr.br>
parent 9196d263
No related branches found
No related tags found
No related merge requests found
...@@ -171,6 +171,39 @@ static char *read_version_file(char *basedir) ...@@ -171,6 +171,39 @@ static char *read_version_file(char *basedir)
return version; return version;
} }
/*----------------------------------------------------------------------------
* Summary: Contact webservice server to verify client version.
* Parameters:
* soap SOAP struct
* url URL of the contacted webservice server
* clientVersion String with directory path
* Return: void
*/
void check_version(struct soap *soap, char *url, char *clientVersion)
{
char *versionFromServer;
if (soap_call_ns1__getAgentVersion(soap, url, "", &versionFromServer) !=
SOAP_OK)
{
soap_print_fault(soap, stderr);
exit(2);
}
if (DEBUG)
{
printf("Version from server: %s\n", versionFromServer);
}
/* Compare client and server versions */
if (strcmp(clientVersion, versionFromServer) != 0)
{
fprintf(stderr, "Client version out-of-date. Update client.\n");
/* Client out-of-date version */
exit(4);
}
}
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
* Summary: Contact webservice server, sending the INEP and MacAddress of the * Summary: Contact webservice server, sending the INEP and MacAddress of the
* machine. * machine.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment