/***********************************************************************
Abstract
net.h - NET interface definitions for users.

(C) Copyright AU-System Communication AB 1994.

Change activity
1996-03-18      ARG  Pragma nomemberalignment added
1994-01-24 1.00 BBN  Initial version by Björn Brodin

Description

***********************************************************************/
#include "apitypes.h"

#ifdef IRIX
#pragma pack 1
#endif
#ifdef VMS
#pragma nomember_alignment
#endif


/*---------------------------------------------------------------------
*	Returncodes
*---------------------------------------------------------------------*/

/*---------------------------------------------------------------------
*	Function prototypes
*---------------------------------------------------------------------*/
extern	INT32   NetOpenClient(INT16 port, char *pInetAdr,INT32 *piStatus);
#ifdef VMS
extern  INT32   NetOpenServer(void);
#endif
extern  void   NetReadBuff(INT32 Sockh,char *pBuff,INT32 iSize,INT32 *piStatus);
extern  void   NetWriteBuff( INT32 Sockh, char *pBuff, INT32 iSize,INT32 *piStatus );
extern  void   NetValidateAccess(INT32 Sockh,char *pAccessCtrl,INT32 *piStatus);
extern  void   NetGetFile(INT32 Sockh,char *pLocalFileStr,INT32 *piStatus);
extern  void   NetPutFile(INT32 Sockh,char *pLocalFile,INT32 *piStatus);
extern  void   NetSendReqData(INT32 Sockh,
                               char *pParDataReqBuff,
                               INT32 iSendSize,INT32 *piStatus);
extern  void   NetClose(INT32 Sockh);
extern  void   NetWriteInt(INT32 Sockh,INT32 iSendINT,INT32 *piRc);
extern  void   NetReadInt(INT32 Sockh,INT32 *piValue,INT32 *piRc);
extern  INT32  NetWaitStatus( INT32 Sockh,INT32 iRecSize,
                              char *pchAviStatusBuff);
                              


/*---------------------------------------------------------------------
*	Macros
*---------------------------------------------------------------------*/
/*   TCPIP GATES                 */
#define GATE_GET_PROD     2900
#define GATE_STORE_PROD   2901
#define GATE_SEARCH_PROD  2902
#define GATE_SUBSCR_AVI   2903


#ifdef VMS
#define _POSIX_SOURCE 
#endif

#define PEEK_DELAY_TIME    1
#define MAX_WAIT_ACK       5
#define MAX_READ_BUFF_TIME 10

#define ACCESS_VALIDATED   OK      /* Return value defined in HOST */

#define SHORT_STAT  1   /* used when single integer status   */
#define AVI_STAT    2   /* used when AviStatus struct status */


#define CHECK_NOT_EMPTY  TRUE
#define NO_CHECK         FALSE
 
/*---------------------------------------------------------------------
*      Common structures	
*---------------------------------------------------------------------*/
/*
struct SearchCritStruc
  {
  unsigned char bName;
  unsigned char bTime;
  unsigned char bArea;
  unsigned char bResolution;   
  };  
*/
struct  ParDataReqStruc
  {
  INT32 iMaxLen;
  INT32 iUsedLen;
  char ParDataStr[MAX_PAR_DATA_STR];   
  };

struct  ParDataRespStruc
  {
  INT32 Rc;  
  INT32 iMaxLen;
  INT32 iUsedLen;
  char ParDataStr[MAX_PAR_DATA_RESP_STR];   
  };


struct  ReceiverIdStruc
  {
  INT32 iMaxLen;
  INT32 iUsedLen;
  char Text[MAX_RECEIVERID_SIZE];   
  };

struct  FileNameStruc
  {
  INT32 iMaxLen;
  INT32 iUsedLen;
  char Text[MAX_FILE_NAME_SIZE];   
  };

struct AccessCtrlStruc
  {
  INT32           iMaxLen;
  INT32           iLen;
  char          Text[MAX_ACCESSCTRL_SIZE];  
  };

struct AreaNameStruc
  {
  INT32           iMaxLen;
  INT32           iLen;
  char          Text[MAX_AREANAME_SIZE];  
  };

struct NodeNameStruc
  {
  INT32           iMaxLen;
  INT32           iLen;
  char          Text[MAX_NODENAME_SIZE];  
  };

struct VsiNameStruc
  {
  INT32           iMaxLen;
  INT32           iLen;
  char          Text[MAX_VSINAME_SIZE];  
  };

#define DURATION_STR_LEN 10
#define HIGHT_STR_LEN 10

struct NetProdDescrStruc
  {
  unsigned char bProd;
  char          cTimeStr[24];
  char          cArea[MAX_AREANAME_SIZE];
  char          cResolution[6];
  union SpecDataUni
    {
    struct ForeignStruc
      {
      char cComment[MAX_COMMENT_SIZE];  
      }Foreign;    
    struct GeoMapStruc
      {
      unsigned char bMapType;
      unsigned char bMapGraphic;  
      }GeoMap;
    struct RrStatusStruc
      {
      char cStatusNode[MAX_NODENAME_SIZE];  
      }RrStatus;    
    struct RrTypesStruc
      {
      unsigned char bRrMode;
      unsigned char Filler;  
      union uRr
        {
        struct RrCappiStruc
          {    
          char cHeight[HIGHT_STR_LEN];
          }RrCappi;    
        struct RrHMIStruc
          {    
          unsigned char bHmiWall;
          }RrHmi;
        struct RrVSIStruc
          {    
          unsigned char bVsiWall;
          char cStartLat[POS_SIZE];
          char cStartLong[POS_SIZE];
          char cEndLat[POS_SIZE];
          char cEndLong[POS_SIZE];
          char  cVsiName[MAX_VSINAME_SIZE];  
          }RrVsi;    
        struct DurationStruc
          {
          char  cDays[DURATION_STR_LEN];
          char  cSecs[DURATION_STR_LEN];    
          }Duration;  
        }uRr;
      }RrType; /*   struct RrTypesStruc  */
    }uData; 
  }; 
  
struct NetAviStruc        
  {
  char cNodeName[MAX_NODENAME_SIZE];  
  struct NetProdDescrStruc NetProdDescr;  
  };

struct AviStatus
   {
   INT32 iStatus;
   struct NetProdDescrStruc ProdDescr;  
   };
  

