#ifndef TMMANIFEST_H    /** Multi-include protection.   <FILENAME>_H */
#define TMMANIFEST_H


/*****************************************************************************/
/* Copyright (c) 2008 NXP B.V.                                               */
/*                                                                           */
/* This program 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, using version 2 of the License.             */
/*                                                                           */
/* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307       */
/* USA.                                                                      */
/*                                                                           */
/*****************************************************************************/
/**
    @file   tmmanifest.h
    @brief  TMMANIFEST functions.

@b  Application: tmmanifest

*//*

Rev Date        Author      Comments
--------------------------------------------------------------------------------
  1 20080520    batelaan    Initial
--------------------------------------------------------------------------------
    For consistency and standardisation retain the Section Separators.
*/


/*******************
* INCLUDE FILES    *
********************/

#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <dirent.h>
#include <sys/stat.h>
#include <obstack.h>

/**************************************************************************
* EXPORTED MACROS                          PH_STBTEMPLATE_<_WORD>+        *
***************************************************************************/

#define DEBUGPRINT(fmt, ...) {                   \
        if (opt_debug) { \
            fprintf(stderr, fmt, ## __VA_ARGS__);        \
        } \
    } while (0)

#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free

/*********************************************************************
* EXPORTED TYPEDEFS                      [p]tmmanifest_<Word>+_t  *
**********************************************************************/

typedef enum tmmanifest_FileType {
    tmmanifest_FileType_App,
    tmmanifest_FileType_Firmware,
    tmmanifest_FileType_Kmodule,
    tmmanifest_FileType_Lib,
    tmmanifest_FileType_Count
} tmmanifest_FileType_t;

typedef struct tmmanifest_BuildInfo {
    const char *productversion;
    const char *user;
    const char *host;
    const char *date;
    const char *time;
} tmmanifest_BuildInfo_t;

typedef struct tmmanifest_FileInfo {
    struct tmmanifest_FileInfo *next;
    const char * name;
    const char * path;
    size_t size;
    tmmanifest_BuildInfo_t *buildInfo;
} tmmanifest_FileInfo_t;

/**************************************************************************
* EXPORTED DATA                     g[k|p|kp|pk|kpk]tmmanifest_<Word>+ *
***************************************************************************/

extern char *pgm_name;
extern char *opt_field;
extern char opt_sep;
extern bool opt_recurse;
extern bool opt_xml;
extern bool opt_modinfo;
extern bool opt_debug;

extern struct obstack gtmmanifest_Obstack;
extern const char *gtmmanifest_FileType_Names[tmmanifest_FileType_Count];
extern const char *gtmmanifest_FileType_Names[tmmanifest_FileType_Count];
extern tmmanifest_FileInfo_t* gtmmanifest_FileInfo[tmmanifest_FileType_Count];
extern unsigned int gtmmanifest_FileInfoCount[tmmanifest_FileType_Count];

/****************************************************************************
* EXPORTED FUNCTION PROTOTYPES                    tmmanifest[_<Word>+]   *
*****************************************************************************/

#ifdef __cplusplus
extern "C"
{
#endif

/******************************************************************************/

extern char* file_basename(const char *path);

extern tmmanifest_BuildInfo_t * tmmanifest_AllocBuildInfo(
    const char *productversion,
    const char *user,
    const char *host,
    const char *date,
    const char *time);

extern tmmanifest_FileInfo_t * tmmanifest_AllocFileInfo(
    const char *name,
    const char *path,
    tmmanifest_BuildInfo_t *buildInfo);

extern const char *indent_string(unsigned int level);

extern int modinfo_extract(
    const char *path,
    tmmanifest_FileInfo_t **ppManifestInfo);

extern int modinfo_init(void);

/******************************************************************************/
/******************************************************************************/
/******************************************************************************/
/******************************************************************************/

/******************************************************************************/
#ifdef __cplusplus
}
#endif

#endif /* TMMANIFEST_H      Do not add any thing below this line */
