#ifndef _GLOBALS_H_
#define _GLOBALS_H_

#include <sys/socket.h>
#include <net/if.h>

#define CHAIN_NAME_LEN 32
#define BITRATE_LEN 32
#define PATH_LEN 64
#define RESULT_LEN 512
#define NUM_LEN 32

#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif

struct GLOBALS {
  char extInterfaceName[IFNAMSIZ]; // The name of the external interface, picked up from the
                                   // command line
  char intInterfaceName[IFNAMSIZ]; // The name of the internal interface, picked from command line
  char extIpAddress[16];
  char intIpAddress[16];

  // All vars below are read from /usr/local/etc/upnpd.conf in main.c
  int debug;  // 1 - print debug messages to syslog
               // 0 - no debug messages
  char ipnat[PATH_LEN];  // The full name and path of the ipnat executable, used in pmlist.c
  char upstreamBitrate[BITRATE_LEN];  // The upstream bitrate reported by the daemon
  char downstreamBitrate[BITRATE_LEN]; // The downstream bitrate reported by the daemon
  long int duration;    // 0 - no duration
                          // >0 - duration in seconds
                          // <0 - expiration time 
  char descDocName[PATH_LEN];
  char xmlPath[PATH_LEN];
};

typedef struct GLOBALS* globals_p;
extern struct GLOBALS g_vars;

#define CONF_FILE "/usr/local/etc/upnpd.conf"
#define MAX_CONFIG_LINE 256
#define DEFAULT_DURATION 0
#define DEFAULT_UPSTREAM_BITRATE "0"
#define DEFAULT_DOWNSTREAM_BITRATE "0"
#define DESC_DOC_DEFAULT "gatedesc.xml"
#define XML_PATH_DEFAULT "/usr/local/etc/linuxigd"

#endif // _GLOBALS_H_


syntax highlighted by Code2HTML, v. 0.9.1