client.h 2.19 KB
Newer Older
1
/* Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
 * Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
 *
 * This file is part of client
 *
 * client is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 * USA.
 */

#ifndef _CLIENT_H_
#define _CLIENT_H_

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
28
#include <getopt.h>
29 30
#include "soapH.h"
#include "Seed2SoapBinding.nsmap"
31 32 33

/* Definitions */
#define VERSIONFILE "conf/version"
34 35
#ifdef _WIN32
    #define EXEFILE "bin/client.exe"
36
    #define COLLECTDATAFILE "data/collect-data.xml"
37
    #define OS 1
38 39
#else
    #define EXEFILE "bin/client"
40
    #define COLLECTDATAFILE "../data/collect-data.xml"
41
    #define OS 0
42
#endif
43 44
#define UPDATEOPTION "update"
#define INVENTORYOPTION "inventory"
45 46
/* Network interface bind error */
#define NIC_ERROR 50
47 48
/* 5 minutes before timeout */
#define TIMEOUT 300
49 50 51 52 53 54 55 56 57 58
// Print ERROR messages
#define ERROR(fmt, args...) ( fprintf(stderr, fmt, ##args), \
                              fflush(stderr) )
// Print DEBUG messages, if DEBUGFLAG is "true"
#ifdef DEBUGFLAG
    #define DEBUG(fmt, args...) ( printf("DEBUG: "fmt"", ##args), \
                                  fflush(stdout) )
#else
    #define DEBUG(fmt, args...)
#endif
59 60

/* Functions */
61
void print_help(void);
62
int verify_parameters(int, char **, struct soap *, char **, char **);
63
static char *read_version_file(char *);
64
void print_update_link(struct soap *, char *);
65
void check_version(struct soap *, char *, char *);
66
char *read_xml_file(char *);
67
void inventory(struct soap *, char *, char *);
68 69

#endif