Skip to content
Snippets Groups Projects
Commit 8ce899b0 authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci Committed by Danilo K. S. Yorinori
Browse files

client.c: Created print_update_link() to get and print the update link


print_update_link() calls the server to get the link needed by the collect
agent to update, printing the link to the standard output.

Signed-off-by: default avatarErik Alexandre Pucci <eap08@c3sl.ufpr.br>
Acked-by: default avatarDiego Giovane Pasqualin <dgp06@c3sl.ufpr.br>
Signed-off-by: default avatarDanilo K. S. Yorinori <danilok@c3sl.ufpr.br>
parent 6af0d042
Branches
Tags
No related merge requests found
......@@ -35,6 +35,7 @@
* 7) Server returned an empty version string
* 8) Server returned an invalid version string
* 9) Server did not find the version file
* 10) Server returned an empty update link
*/
int main(int argc, char **argv)
{
......@@ -183,6 +184,41 @@ static char *read_version_file(char *basedir)
return version;
}
/*----------------------------------------------------------------------------
* Summary: Contact webservice server to receive the update link.
* Parameters:
* soap SOAP struct
* url URL of the contacted webservice server
* Return: void
*/
void print_update_link(struct soap *soap, char *url)
{
char *updateLink;
if (soap_call_ns1__getUpdateLink(soap, url, "", &updateLink) != SOAP_OK)
{
soap_print_fault(soap, stderr);
exit(2);
}
/* Get update link from response */
if (DEBUG)
{
printf("UpdateLink: %s\n", updateLink);
}
/* Verify received update link and print appropriate messages */
if (updateLink == NULL)
{
fprintf(stderr, "Get update link error (server returned NULL).\n");
/* Server returned an empty update link */
exit(10);
}
/* Print to stdout the update link string */
fprintf(stdout, "%s\n", updateLink);
}
/*----------------------------------------------------------------------------
* Summary: Contact webservice server to verify client version.
* Parameters:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment