/* ** -- HEADER PROLOG -- ***********************************************
 
//  Ultimedia System Facilities  COPYRIGHT (C) IBM Corporation 1993,1994
           LICENSED MATERIAL-PROGRAM PROPERTY OF IBM
                                                      *** Keyword *** '%n'
  'FZZMCAPI.H'
 
  Author: Neil Morehouse
                                                      *** Keyword *** '%l'
  Checked Out By:      '***_NOBODY_***'
 
  DESCRIPTION:  CPM API Header File
  -----------
 
 ** -- HEADER PROLOG END -- ******************************************* */
 
/* All USF/400 structures are aligned on 1 byte boundaries.  This pragma */
/*   specifies this alignment. */
#pragma pack(1)
 
#define FZZM_LEN_RID            11  /* length of characters in Request ID (RID) */
#define FZZM_LEN_PGM_ID         21  /* length of program id used to identify 3rd */
                                    /* party apps registration */
#define FZZM_LEN_LOCATION        8  /* Maximum length of pszLocation parm on
                                               fzzmInitializeUSFComm()
                                               fzzmQueryOriginatingLocation()
                                              Maximum length of pszRtnValue on
                                               fzzmRtvUSFCommInfo() if FZZM_COMMINFO_LOCATION
                                               information is requested */
#define FZZM_LEN_USER           10  /* Maximum length of pszRtnValue parm on */
                                    /*   fzzmRtvUSFCommInfo() if FZZM_COMMINFO_USER */
                                    /*   information is requested */
#define FZZM_LEN_DRIVE           1  /* Maximum length of pszRtnValue parm on */
                                    /*   fzzmRtvUSFCommInfo() if FZZM_COMMINFO_DRIVE */
                                    /*   information is requested */
#define FZZM_LEN_NETWORK_ID      8  /* Maximum length of pszRtnValue parm on */
                                    /*   fzzmRtvUSFCommInfo() if FZZM_COMMINFO_NETWORK_ID */
                                    /*   information is requested */
#define FZZM_LEN_LOCAL_LU        8  /* Maximum length of pszRtnValue parm on */
                                    /*   fzzmRtvUSFCommInfo() if FZZM_COMMINFO_LOCAL_LU */
                                    /*   information is requested */
 
#define FZZM_LEN_NAMED_ASYNC_ID 20  /* length of named async id: fzzmRtvNamedAsyncId */
 
#define FZZM_INDEFINITE_WAIT -1  /* indefinite wait time for */
                                 /*   fzzmProcessSync() */
                                 /*   fzzmRtvData() */
                                 /*   fzzmRtvNamedAsyncID() */
 
#define FZZM_COMMINFO_USER              1  /* User name signed on router */
#define FZZM_COMMINFO_DRIVE             2  /* Shared folders drive letter used for */
                                           /*   USF Repo location */
#define FZZM_COMMINFO_LOCATION          3  /* AS/400 system name connected with */
#define FZZM_COMMINFO_LOCAL_LU          4  /* Local Logical Unit (LU) name used for  */
                                           /*   connection to AS/400 */
#define FZZM_COMMINFO_LOCAL_NETWORK_ID  5  /* Local Network ID which the Local LU */
                                           /*   resides as part of */
 
/* Self Defining Data Stream (SDDS) packet header struct     */
/*   Used for the first FZZM_LEN_SDDS_HEADER bytes in each   */
/*   SDDS packet (for use with FZZM_SDDS data version/type)  */
typedef struct _FZZMSDDSHEADER
{
   ULONG  ulLL;                         /* Size of this packet       */
   USHORT usFormat;                     /* Format of SDDS data       */
   USHORT usCodePoint;                  /* User defined packet ID    */
   CHAR   achData[1];                   /* Beginning of packet data  */
} FZZMSDDSHEADER, FAR *PFZZMSDDSHEADER;
 
/* Length of the SDDS Header struct */
#define FZZM_LEN_SDDS_HEADER (sizeof(FZZMSDDSHEADER) - sizeof(CHAR))
 
#define FZZM_RAW_DATA      0L  /* Data version/type (raw data, no conversions) */
#define FZZM_SDDS          1L  /* Data version/type (Self Defining Data Stream, */
                               /*   tagged data with possible conversions) */
 
#define FZZM_DATA_FORMAT_RAW     0x0000  /* no conversion                  */
#define FZZM_DATA_FORMAT_CHAR    0x0001  /* char data EBCDIC <--> ASCII    */
#define FZZM_DATA_FORMAT_SHORT   0x0002  /* byte swapped (2 byte integers) */
#define FZZM_DATA_FORMAT_LONG    0x0003  /* byte swapped (4 byte integers) */
 
/* Request Processing flag values "usProcFlag" field name */
#define FZZM_AS400_REQUEST           1  /* AS/400 request with data to be processed */
#define FZZM_REQUEST_TERMINATION     2  /* CPM is requesting termination reqires */
                                        /*   a response of */
                                        /*      FALSE = continue termination */
                                        /*      TRUE  = stop termination */
#define FZZM_TERMINATING             3  /* CPM is terminating please shutdown */
 
 
/* definitions identifying the type of data returned in the second parameter */
/*  of the message resulting from fzzmProcessAsync() API Call.               */
#define FZZM_ASYNC_DATA              0  /* Data being returned from the       */
                                        /* fzzmProcessAsync() API call.  The  */
                                        /* second parameter on the message    */
                                        /* will be PFZZMASYNCRETURN           */
#define FZZM_ASYNC_ERROR             1  /* An error occurred while processing */
                                        /* the fzzmProcessAsync() API call.   */
                                        /* The second parameter on the message*/
                                        /* will be PFZZMASYNCRETURNERROR      */
 
typedef struct _FZZMRID
{
  UCHAR auchRequestID[FZZM_LEN_RID];
} FZZMRID, FAR * PFZZMRID;
 
typedef ULONG FZZMCONV;
typedef FZZMCONV FAR * PFZZMCONV;
 
 
/* struct returned to a window handle specified as a parm in an */
/*   async fzzmInitializeUSFComm() call */
/*   memory is shared memory that should be freed using DosFreeMem() */
typedef struct _FZZMINITUSFCOMMRTN
{
  USHORT   usReturnCode;
  FZZMCONV convID;
} FZZMINITUSFCOMMRTN, FAR * PFZZMINITUSFCOMMRTN;
 
 
typedef struct _FZZMPROCSYNC
{
   USHORT   usSize;     /* Size of this structure version dependent */
   FZZMCONV convID;     /* USF/400 conversation ID */
   CHAR     szPgmID[FZZM_LEN_PGM_ID+1]; /* 3rd party program ID AS/400 (NULL terminated) */
                                        /*  program name: "library/program" */
   ULONG    ulFuncID;   /* 3rd party user area */
   ULONG    ulVersion;  /* identifies version/type of data */
                        /*   valid values : FZZM_RAW_DATA */
                        /*                  FZZM_SDDS */
   PVOID    pReqBuffer; /* Request data buffer */
   ULONG    ulReqLen;   /* Request data buffer length */
   LONG     lWait;      /* Amount of time to wait for return data */
} FZZMPROCSYNC, FAR * PFZZMPROCSYNC;
 
typedef struct _FZZMPROCSYNCRTN
{
   USHORT   usSize;       /* Size of this structure version dependent */
   FZZMRID  ridRequestID; /* Request ID assigned to this request */
   ULONG    ulStatus;     /* Status returned by the requested application */
   ULONG    ulVersion;    /* Identifies version/type of data returned */
                          /*   valid values : FZZM_RAW_DATA */
                          /*                  FZZM_SDDS */
   PVOID    pRetBuffer;   /* Return data buffer allocated by CPM */
   ULONG    ulRetLen;     /* Return data buffer length */
} FZZMPROCSYNCRTN, FAR  * PFZZMPROCSYNCRTN;
 
typedef struct _FZZMPROCASYNC
{
   USHORT   usSize;     /* Size of this structure version dependent */
   FZZMCONV convID;     /* USF/400 conversation ID */
   CHAR     szPgmID[FZZM_LEN_PGM_ID+1]; /* 3rd party program ID AS/400 (NULL terminated) */
                                        /*  program name: "library/program" */
   ULONG    ulFuncID;   /* 3rd party user area */
   ULONG    ulVersion;  /* identifies version/type of data */
                        /*   valid values : FZZM_RAW_DATA */
                        /*                  FZZM_SDDS */
   PVOID    pReqBuffer; /* Request data buffer */
   ULONG    ulReqLen;   /* Request data buffer length */
   HWND     hwndMsgWnd; /* handle to the window where the return data  */
                        /*  will be posted when received */
   USHORT   usMsgID;    /* msg id to be sent to the window receiving the */
                        /*  data returned asynchronously */
                        /*  NOTE: this ID can not conflict with OS/2 PM  */
                        /*  or Windows system defined Msg IDs. */
                        /*  (in OS/2 must be > WM_USER). */
} FZZMPROCASYNC, FAR * PFZZMPROCASYNC;
 
/* struct returned to Windows registered to receive async data from a        */
/*   previous fzzmProcAsyncRequest() API call.                               */
/*   The memory is shared memory that should be freed using DosFreeMem() in  */
/*   OS/2 and GlobalFreePtr() in Windows                                     */
/* NOTE:  A pointer to this struct is passed as the second with the msg      */
/*        posted when the first parameter is set to FZZM_ASYNC_DATA.         */
typedef struct _FZZMASYNCRETURN
{
   FZZMRID  ridRequestID; /* Request ID assigned to this request */
   ULONG    ulStatus;     /* Status returned by the requested application */
   ULONG    ulVersion;    /* Identifies version/type of data returned */
                          /*   valid values : FZZM_RAW_DATA */
                          /*                  FZZM_SDDS */
   PBYTE    pRetBuffer;   /* Return data buffer allocated by CPM */
   ULONG    ulRetLen;     /* Return data buffer length */
} FZZMASYNCRETURN, FAR * PFZZMASYNCRETURN;
 
/* struct returned to Windows registered to receive async data from a        */
/*   previous fzzmProcAsyncRequest() API call when an error has occurred.    */
/*   The memory is shared memory that should be freed using DosFreeMem() in  */
/*   OS/2 and GlobalFreePtr() in Windows                                     */
/* NOTE:  A pointer to this struct is passed as the second with the msg      */
/*        posted when the first parameter is set to FZZM_ASYNC_ERROR.        */
typedef struct _FZZMASYNCRETURNERROR
{
  USHORT    usReturnCode;   /* return code from fzzmProcAsyncRequest() API call. */
  char      chReserved[25]; /* reserved field */
} FZZMASYNCRETURNERROR, FAR * PFZZMASYNCRETURNERROR;
 
typedef struct _FZZMRETURNDATA
{
   USHORT   usSize;     /* Size of this structure version dependent */
   PFZZMRID pridUSFRID; /* pointer to Request ID delivered on Request */
   ULONG    ulStatus;   /* User defined status returned to the */
                        /*   requesting application */
   ULONG    ulVersion;  /* identifies version/type of return data */
                        /*   valid values : FZZM_RAW_DATA */
                        /*                  FZZM_SDDS */
   PVOID    pRetBuffer; /* Return data buffer */
   ULONG    ulRetLen;   /* Return data buffer length */
} FZZMRETURNDATA, FAR * PFZZMRETURNDATA;
 
typedef struct _FZZMRTVDATA
{
   USHORT   usSize;     /* Size of this structure version dependent */
   PFZZMRID pridUSFRID; /* pointer to Request ID delivered on Request */
   LONG     lWait;      /* Amount of time to wait for return data */
} FZZMRTVDATA, FAR * PFZZMRTVDATA;
 
typedef struct _FZZMRTVDATARTN
{
   USHORT   usSize;     /* Size of this structure version dependent */
   ULONG    ulStatus;   /* User defined status returned to the */
                        /*   requesting application */
   ULONG    ulVersion;  /* identifies version/type of return data */
                        /*   valid values : FZZM_RAW_DATA */
                        /*                  FZZM_SDDS */
   PVOID    pRetBuffer; /* Return data buffer */
   ULONG    ulRetLen;   /* Return data buffer length */
} FZZMRTVDATARTN, FAR * PFZZMRTVDATARTN;
 
/* struct returned to Windows registered as USF/400 tools vendor routers */
/*   response to requests returned as results from fzzmRegisterRequestProcWnd() */
/*   memory is shared memory that should be freed using DosFreeMem() in OS/2 and */
/*   use GlobalFreePtr() in Windows */
typedef struct _FZZMREQUEST
{
   USHORT   usProcFlag;   /* processing request flag indicating what */
                          /* type of request this is */
 
   FZZMRID  ridRequestID; /* Request ID assigned to this request */
   CHAR     szPgmID[FZZM_LEN_PGM_ID+1]; /* 3rd party program ID PWS (NULL terminated) */
   ULONG    ulFuncID;     /* 3rd party user area */
   ULONG    ulVersion;    /* Identifies version/type of data returned */
                          /*   valid values : FZZM_RAW_DATA */
                          /*                  FZZM_SDDS */
   PVOID    pReqBuffer;   /* Request data buffer allocated by CPM */
   ULONG    ulReqLen;     /* Request data buffer length */
} FZZMREQUEST, FAR * PFZZMREQUEST;
 
USHORT USFENTRY fzzmInitializeUSFComm(PSZ       pszLocation,
                                      HWND      hwndMsgWnd,
                                      USHORT    usMsgID,
                                      long      lReserved,
                                      PFZZMCONV pconvID);
 
USHORT USFENTRY fzzmStopUSFComm(FZZMCONV convID,
                                LONG     lReserved);
 
USHORT USFENTRY fzzmProcessSync(PFZZMPROCSYNC    pFZZMProcSync,
                                PFZZMPROCSYNCRTN pFZZMProcSyncRtn);
 
USHORT USFENTRY fzzmProcessAsync(PFZZMPROCASYNC pFZZMProcAsync,
                                 PFZZMRID       pridRequestID);
 
USHORT USFENTRY fzzmReturnData(PFZZMRETURNDATA pFZZMReturnData);
 
USHORT USFENTRY fzzmRtvData(PFZZMRTVDATA    pFZZMRtvData,
                            PFZZMRTVDATARTN pFZZMRtvDataRtn);
 
USHORT USFENTRY fzzmClearData(PFZZMRID pridRequestID);
 
USHORT USFENTRY fzzmQryOriginatingLocation(PFZZMRID pridRequestID,
                                           PSZ      pszLocation);
 
USHORT USFENTRY  fzzmRtvUSFCommInfo(FZZMCONV  convID,
                                    USHORT    usRtvInfoID,
                                    PVOID     pRtvInfoRtn);
 
USHORT USFENTRY fzzmAbortProcessAsync(PFZZMRID pridRequestID,
                                      HWND     hwndMsgWnd);
 
USHORT USFENTRY fzzmRtvNamedAsyncID(PSZ      pszAsyncIDName,
                                    LONG     lWait,
                                    PFZZMRID pridRequestID);
 
USHORT USFENTRY fzzmRegisterRequestProcWnd(PSZ    pszPgmID,
                                           HWND   hwndRouterWnd,
                                           USHORT usMsgID);
 
USHORT USFENTRY fzzmUnRegisterRequestProcWnd(PSZ pszPgmID);
 
/* Return the structure alignment to the default setting */
#pragma pack()
 
