// $Id: pdinrs_distribution_config.h,v 1.1.1.1 2005/01/10 18:47:02 pdi Exp $
/******************************************************************************
 Copyright 1998-2022 Stonie R. Cooper, Licensed under the auspices of GPLv3,
 See top-level copyright disclaimer (COPYRIGHT) and license (LICENSE)
 File:   pdinrs_distribution_config.h
 Author: Stonie R. Cooper
         stonie.cooper@planetarydata.com                                           
 Revision Record:                                                           
         Rewritten: 20050114 by Stonie R. Cooper
                  - created file     
        Revision: 19981004.2122UTC by Stonie R. Cooper
                  - renamed file                                       
*****************************************************************************

*****************************************************************************
 This header file defines the configuration structures for the NRS.
*****************************************************************************
*/

#ifndef PDINRS_DISTRIBUTION_CONFIG_H
#define PDINRS_DISTRIBUTION_CONFIG_H

// include file listing - PDI derivated                                

#include <pdinrs.h>
#include <pdinrs_grib2.h>

#define WMO_FLAG           0
#define PIL_FLAG           1
#define NTH_FLAG           2

typedef enum {MAIN, BUFFER, DISTRIBUTION, PRODUCTS, ACTION, UNK} modetype;

enum viaType {OWFILE,APPFILE,SOCKETOW,SOCKETAPP};

typedef struct
{
  int                 via;
  unsigned int   socketRetries;
  char                destination[(MAXLINESIZE-2)];
} ActionStruc;

typedef struct
{
  unsigned char       wmo_pil;
  unsigned char       ccb_on;
  unsigned char       save_encrypted;
  unsigned char       uncompress;
  unsigned int   socketRetryMax;
  regex_t             preg;
  char                regExpression[(MAXLINESIZE-2)];
  char                label[(MAXLINESIZE-2)];
  int            numActions;
  ActionStruc         action[MAX_NUM_ACTIONS];
} ProductType;

typedef struct 
{
  char                bufferFile[(MAXLINESIZE-2)];
  int                 socketTimeout;
  log_type            distributionLog;
  log_type            distributionErrorLog;
  log_type            retransmitLog;
  char                lostProductExec[(MAXLINESIZE-2)];
  unsigned int   numProducts;
  char                grib2defDir[(MAXLINESIZE-2)];
  ProductType         Products[MAX_NUM_PRODUCTS];
} ProductConfigType;

int pdinrs_distribution_config(const char *file, ProductConfigType *productConfig, const char *label);

#endif
