collect-parser.h 2.29 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
 * Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
 *
 * This file is part of collect-agent
 *
 * collect-agent 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 _H_COLLECT_PARSER_H_
#define _H_COLLECT_PARSER_H_

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
#include <libxml/encoding.h>
#include <libxml/xmlwriter.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MY_ENCODING "UTF-8"
#define STR_INI_SIZE 200

/* Error Flags */
#define MEM_ALLOC 1
#define CMD_RESULT 2
#define PERM_DENIED_CMD 4
#define ARGS 8
#define CREATE_XML_DOC 16
#define SAVE_XML_FILE 32
#define PARSE_COLLECT 64
#define DEBUG_ALL 127 /* Enables debug of all flags */
#define NO_DEBUG 0 /* Disables debug of all flags */
49 50 51
/* Print ERROR messages */
#define ERROR(fmt, args...) ( fprintf(stderr, fmt, ##args), \
                              fflush(stderr) )
52 53 54 55 56 57 58

/* Variable that stores the status of collect-parser running */
static char statusRunning = 0;

/*---------------------------------------------------------------------------*/

int generateXML(const char *, const char *);
59
int setErrorFlag(const char);
60
int unsetErrorFlag(const char);
61
int printErrorMsgs(const char);
62 63 64 65 66 67
static int allocString(char **, const int);
static int concatString(char **, const char *, const char *);
static char *nodeName(char *);
static char *attribData(const char *);
static int execCommand(const char *, char **);
static int parserXml(const char *, xmlTextWriterPtr *);
68

69
#endif