/*
 *------------------------------------------------------------------
 *
 * $Source: /achilles/u1/jis/gw/cgw/statd/src/RCS/statd.h,v $
 * $Revision: 1.1 $
 * $Date: 87/06/04 17:26:13 $
 * $State: Exp $
 * $Author: jon $
 * $Locker: jon $
 *
 * $Log:	statd.h,v $
 * Revision 1.1  87/06/04  17:26:13  jon
 * Initial revision
 * 
 * 
 * 
 *------------------------------------------------------------------
 */

#define CONFIG_FILE "statd.conf"

#define MAX_GATEWAYS 50

/* time between requests (seconds) if no response is received */
#define REQUEST_INTERVAL 15

/* max numbers of requests to send before giving up for this poll */
#define MAX_REQUESTS 10

#define GWSTAT_PORT htons(25321)  /* this doesn't belong here ... */

#include <sys/time.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>

/* internal state ... */

typedef struct _gateway_info_ {
  char *name;                /* name from config file or command line */
  char *primary_name;        /* name from namesever */
  struct sockaddr_in sin;    /* address */
  int log_fd;                /* put received data in here */
  int request_packets_sent;  /* n requests packets sent since last reply */
  int need_reply;            /* quick check */
  struct timeval last_time;  /* last time we received a status packet */
} gateway_info;

  
/* this comes before each record ... */

typedef struct _gw_status_header {
  char version[8];
  struct timeval time_received;
  int length_of_data; /* for convience (not including this header) */
  int mbz[5];
} gw_status_header;

#define GW_STAT_HEADER_VERSION_1 "gwst001\0"
#define GW_STAT_HEADER_VERSION "gwst001\0"
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
