/* *********************************************************************
 * *	                                                               *
 * *          Definitions for Sigmet's Private Library                 *
 * *                                                                   *
 * *********************************************************************
 * File: include/private_lib.h
 *
 *           COPYRIGHT (c) 2003, 2004, 2006, 2007, 2010 BY
 *            VAISALA INC., WESTFORD MASSACHUSETTS, U.S.A.
 * 
 * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
 * ONLY  IN  ACCORDANCE WITH  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
 * INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE  OR  ANY OTHER
 * COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
 * OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
 * TRANSFERED.
 */
#define SIGMET_PRIVATE_LIB_H 1

#ifdef __cplusplus
extern "C" {
#endif

/* Possible License ID numbers */
#define LIC_IRIS_FEATS_HOST_ID  (1)   /* IRIS Features licenses */
#define LIC_706PRODS_HOST_ID    (2)   /* 7.06 IRIS Product licenses */
#define LIC_IRIS_PRODS_HOST_ID  (3)   /* IRIS Product licenses */
#define LIC_CANADAPRODS_HOST_ID (4)   /* Canadian IRIS Product licenses*/
#define LIC_RDA_FEATS_HOST_ID   (5)   /* RDA Features licenses */
#define LIC_IRIS_FEATS_RVP_ID   (6)   /* IRIS Features, RVP locked */
#define LIC_IRIS_PRODS_RVP_ID   (7)   /* IRIS Products, RVP locked */
#define LIC_RDA_FEATS_RVP_ID    (8)   /* RDA Features, RVP locked */


/* Possible License Groups */
    enum license_group
    {
        LIC_GROUP_IRIS_FEATURES,
        LIC_GROUP_IRIS_PRODUCTS,
        LIC_GROUP_RDA_FEATURES,
    };

  /* List here the specific bits in the IRIS Features license */
#define LBIT_FEATS_INGEST          (0x00001)  /* Ingest Process */
#define LBIT_FEATS_NORDRAD         (0x04000)  /* NORDRAD1 Process */
#define LBIT_FEATS_RIBBUILD        (0x08000)  /* Ribbon Builder Process */
#define LBIT_FEATS_WEBSERVER       (0x10000)  /* Web server Process */
#define LBIT_FEATS_HYDROCLASS      (0x20000)  /* HydroClass in reingest */
#define LBIT_FEATS_UALF_RELAY      (0x40000)  /* Lightning input relay */
#define LBIT_FEATS_3D              (0x80000)  /* IRIS 3D View */

#define NUM_706_PRODUCTS   (28)    /* Number of products defined in 7.06 */

  /* List here the specific bits in the RDA Features license */
#define LBIT_RDAFEATS_TSARCHIVE  (0x0001)  /* The TS archive program */
#define LBIT_RDAFEATS_DUAL_POL   (0x0002)  /* RVP8/9 Dual polarization */
#define LBIT_RDAFEATS_SHIPBOARD  (0x0004)  /* RCP8   Shipboard stabilization */
#define LBIT_RDAFEATS_HYDROCLASS (0x0008)  /* RVP8/9 HydroClass calculation */

uint32_t iLBitOfProduct		/* File: license.c */
( uint32_t iPType_a );

uint32_t iLicense706FromCurrent	/* File: license.c */
( uint32_t iCurrentBits_a );

uint32_t iLicenseCurrentFrom706	/* File: license.c */
( uint32_t i706Bits_a );

/* Possible returns from license unlocking functions
 */
#define LICENSE_OK          (0)
#define LICENSE_EXPIRED     (1)
#define LICENSE_BAD_DATE    (2)
#define LICENSE_CANADA_LOC  (3)
#define LICENSE_INVALID     (4)
#define LICENSE_MISSING     (5)

uint8_t isLicenseIdInGroup
( int32_t iId_a,
  enum license_group Group_a );

uint16_t iLicenseUnlock
(volatile const char slicense_a[32], 
 struct ymds_time *pExpireYmds_a,     /* Expiration date, only if OK */
 enum license_group Group_a,          /* The license group you want */
 int32_t *pId_a,                      /* ID found */
 volatile const char sitename_a[16],
 uint32_t *pBits_a);

#ifdef SIGMET_SETUP_H
uint16_t iLicenseUnlockFeatures	/* File: license.c */
  (volatile const struct license_setup *pLSetup_a,
   struct ymds_time *ExpireYmds_a,  /* Year set to YEAR_MOST_RECENT if permanent */
   uint32_t *ibits_a);
#endif  /* #ifdef SIGMET_SETUP_H */

#ifdef SIGMET_SETUP_H
uint16_t iLicenseUnlockProduct	/* File: license.c */
  (volatile const struct license_setup *pLSetup_a,
   struct ymds_time *ExpireYmds_a, /* Year set to YEAR_MOST_RECENT if permanent */
   uint32_t *ibits_a,
   uint8_t *lCanada_a );             /* True if any of the licenses are for Canada */
#endif  /* #ifdef SIGMET_SETUP_H */

#ifdef SIGMET_SETUP_H
  uint16_t iLicenseUnlockRda         /* File: license.c */
  (volatile const struct license_setup *pLSetup_a,
   struct ymds_time *pExpireYmds_a,      /* Year set to YEAR_MOST_RECENT if permanent */
   uint32_t *pBits_a);                      /* Bits to return */
#endif  /* #ifdef SIGMET_SETUP_H */

#ifdef SIGMET_SETUP_H
uint16_t lLicensedToRun		/* File: license.c */
  (volatile const struct license_setup *pLSetup_a,
   int32_t ibit_a);
#endif  /* #ifdef SIGMET_SETUP_H */

char *slicense_crc		/* File: license.c */
  ( char *string_a );

/* Returns the hardware address associated with the specified interface.
 */
  const char *sHardwareAddress(const char* sinterface_a, /* File: license.c */
			       char *sBuffer_a,
			       size_t size_a );

char *smachine_code		/* File: license.c */
(volatile const char sitename_a[16],
 const char* shardware_address_a);

  const char *sRvp900Address( char* sbuffer_a, size_t size_a );  /* File: rvp_ifdr.c */

#ifdef __cplusplus
}
#endif
