diff --git a/src/client.c b/src/client.c index 5016cbf1627d12d5575197a7bbc5410a6059d02b..d932a4cf98c90f802d08ec623377427f032c2ed0 100644 --- a/src/client.c +++ b/src/client.c @@ -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: