/**INC+***********************************************************************/
/* Header:    winappc.h                                                      */
/*                                                                           */
/* Purpose:   Defines types and macros used by the APPC API                  */
/*                                                                           */
/* Dependencies:                                                             */
/*                                                                           */
/* Invocation:                                                               */
/*            #include <winappc.h>                                           */
/*                                                                           */
/*                                                                           */
/* Copyright Notice:                                                         */
/*               (C) COPYRIGHT IBM CORP. 1996 - PROGRAM PROPERTY OF IBM      */
/*               ALL RIGHTS RESERVED                                         */
/*                                                                           */
/* $Revision::   1.11                  $$Modtime::   18 Feb 1998 12:57:52   $*/
/**INC-***********************************************************************/

/*****************************************************************************/
/* If winappc.h not already included then define APPC_C_INCLUDED to avoid it */
/* being included again                                                      */
/*****************************************************************************/
#ifndef APPC_C_INCLUDED
#define APPC_C_INCLUDED

/*****************************************************************************/
/* Include common return code and parmeter definitions                       */
/*****************************************************************************/
#include <winrc.h>
#include <winparms.h>

/*****************************************************************************/
/* Define this header file to be C if this is included by a C++ source file  */
/*****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif

/*****************************************************************************/
/* For Win32 environment:                                                    */
/* -  ensure correct packing                                                 */
/* -  remove references to far                                               */
/* -  set WINSNA                                                             */
/*****************************************************************************/
#pragma pack(4)
#define far
#define WINSNA

/*****************************************************************************/
/* Macros for type conversion                                                */
/*****************************************************************************/
#define APPC_LO_UC(w)    ((unsigned char)(((unsigned short)(w)) & 0xFF))
#define APPC_HI_UC(w)    ((unsigned char)(((unsigned short)(w) >> 8) & 0xff))
#define APPC_MAKUS(l, h) (((unsigned short)(l)) | ((unsigned short)(h)) << 8)
#define APPC_MAKUL(l, h) ((unsigned long)(((unsigned short)(l)) | \
                                 ((unsigned long)((unsigned short)(h))) << 16))
#define APPC_LO_US(l)   ((unsigned short)(((unsigned long)(l)) & 0xFFFF))
#define APPC_HI_US(l)   ((unsigned short)(((unsigned long)(l) >> 16) & 0xffff))

/*****************************************************************************/
/* Intel environment flipping macros                                         */
/*****************************************************************************/
#ifndef SWAP2
#define SWAP2(s) (unsigned short)((((s)>>8)&0xFF)|((s)<<8))
#endif

#ifndef SWAP4
#define SWAP4(l)        (unsigned long)((((l) >> 24) & 0xFF) |\
                        ((((l) & 0xFF0000) >> 8) & 0xFF00) | (((l) & 0xFF00)\
                        << 8) | ((l) << 24))
#endif
#define APPC_FLIPI(X) SWAP2(X)
#define APPC_FLIPL(X) SWAP4(X)

/*****************************************************************************/
/* Operation codes                                                           */
/*****************************************************************************/
#define AP_TP_STARTED                   0x0014
#define AP_RECEIVE_ALLOCATE             0x0016
#define AP_RECEIVE_ALLOCATE_MULTIPLE    0x0101
#define AP_TP_ENDED                     0x0013

#define AP_CNOS                         0x0015
#define AP_DISPLAY                      0x001B

#define AP_M_ALLOCATE                   0x0001
#define AP_M_CONFIRM                    0x0003
#define AP_M_CONFIRMED                  0x0004
#define AP_M_DEALLOCATE                 0x0005
#define AP_M_FLUSH                      0x0006
#define AP_M_GET_ATTRIBUTES             0x0007
#define AP_M_PREPARE_TO_RECEIVE         0x000A
#define AP_M_RECEIVE_AND_POST           0x000D
#define AP_M_RECEIVE_AND_WAIT           0x000B
#define AP_M_RECEIVE_EXPEDITED_DATA     0x0009
#define AP_M_RECEIVE_IMMEDIATE          0x000C
#define AP_M_REQUEST_TO_SEND            0x000E
#define AP_M_SEND_CONVERSATION          0x0018
#define AP_M_SEND_DATA                  0x000F
#define AP_M_SEND_ERROR                 0x0010
#define AP_M_SEND_EXPEDITED_DATA        0x0011
#define AP_M_TEST_RTS                   0x0012
#define AP_M_TEST_RTS_AND_POST          0x0081

#define AP_B_ALLOCATE                   0x0001
#define AP_B_CONFIRM                    0x0003
#define AP_B_CONFIRMED                  0x0004
#define AP_B_DEALLOCATE                 0x0005
#define AP_B_FLUSH                      0x0006
#define AP_B_GET_ATTRIBUTES             0x0007
#define AP_B_PREPARE_TO_RECEIVE         0x000A
#define AP_B_RECEIVE_AND_POST           0x000D
#define AP_B_RECEIVE_AND_WAIT           0x000B
#define AP_B_RECEIVE_EXPEDITED_DATA     0x0009
#define AP_B_RECEIVE_IMMEDIATE          0x000C
#define AP_B_REQUEST_TO_SEND            0x000E
#define AP_B_SEND_CONVERSATION          0x0018
#define AP_B_SEND_DATA                  0x000F
#define AP_B_SEND_ERROR                 0x0010
#define AP_B_SEND_EXPEDITED_DATA        0x0011
#define AP_B_TEST_RTS                   0x0012
#define AP_B_TEST_RTS_AND_POST          0x0081

#define AP_GET_TP_PROPERTIES            0x0017
#define AP_SET_TP_PROPERTIES            0x007E
#define AP_GET_LU_STATUS                0x007F
#define AP_GET_TYPE                     0x0008
#define AP_IMPLIED_FORGET               0x0080

#define AP_CREATE_PASSWORD_SUBSTITUTE   0x0105

#define AP_REGISTER_EVENT               0x2066
#define AP_UNREGISTER_EVENT             0x2067
#define AP_EVENT_INDICATION             0x2068

/*****************************************************************************/
/* Verb parameter values for APPC                                            */
/* (common verb parameter values are in winparms.h)                          */
/*****************************************************************************/

#define AP_INDEPENDENT_LU               0x00
#define AP_SYSTEM_LIMIT                 0x00

/*****************************************************************************/
/* conversation states                                                       */
/*****************************************************************************/
#define AP_RESET_STATE                  0x00
#define AP_SEND_STATE                   0x01
#define AP_RECEIVE_STATE                0x02
#define AP_CONFIRM_STATE                0x03
#define AP_CONFIRM_SEND_STATE           0x04
#define AP_CONFIRM_DEALL_STATE          0x05
#define AP_PEND_POST_STATE              0x06
#define AP_PEND_DEALL_STATE             0x07
#define AP_END_CONV_STATE               0x08
#define AP_SEND_PENDING_STATE           0x09

/*****************************************************************************/
/* full-duplex conversation states                                           */
/*   also AP_RESET_STATE (0)                                                 */
/*****************************************************************************/
#define AP_SEND_RECEIVE_STATE           0x01
#define AP_SEND_ONLY_STATE              0x02
#define AP_RECEIVE_ONLY_STATE           0x03

/*****************************************************************************/
/* dealloc_type and ptr_type                                                 */
/*****************************************************************************/
#define AP_SYNC_LEVEL                   0x00
#define AP_FLUSH                        0x01
#define AP_CONFIRM_TYPE                 0x0B

/*****************************************************************************/
/* ptr_type                                                                  */
/*****************************************************************************/
#define AP_P_TO_R_CONFIRM               0x02

/*****************************************************************************/
/* dealloc_type                                                              */
/*****************************************************************************/
#define AP_ABEND                        0x05
#define AP_ABEND_PROG                   0x02
#define AP_ABEND_SVC                    0x03
#define AP_ABEND_TIMER                  0x04

#define AP_TP_NOT_AVAIL_RETRY           0x06
#define AP_TP_NOT_AVAIL_NO_RETRY        0x07
#define AP_TPN_NOT_RECOGNIZED           0x08
#define AP_PIP_DATA_NOT_ALLOWED         0x09
#define AP_PIP_DATA_INCORRECT           0x0A
#define AP_RESOURCE_FAILURE_NO_RETRY    0x0C
#define AP_CONV_TYPE_MISMATCH           0x0D
#define AP_SYNC_LVL_NOT_SUPPORTED       0x0E
#define AP_SECURITY_PARAMS_INVALID      0x0F
#define AP_ATTACH_ERROR                 0xFF

/*****************************************************************************/
/* fill                                                                      */
/*****************************************************************************/
#define AP_BUFFER                       0x00
#define AP_LL                           0x01

/*****************************************************************************/
/* Other flags for the opext field of APPC verbs                             */
/*****************************************************************************/
#define AP_NON_BLOCKING                 0x02
#define AP_OPERATION_INCOMPLETE_FLAG    0x40

/*****************************************************************************/
/* Reserved wait_object values                                               */
/* wait objects are used for non-blocking verbs, supplied in secondary_rc    */
/* field                                                                     */
/*****************************************************************************/
#define AP_BLOCKING_WAIT_OBJECT         0x00000000L
#define AP_NULL_WAIT_OBJECT             0xFFFFFFFFL

/*****************************************************************************/
/* LULU verification protocol defined/in use                                 */
/*****************************************************************************/
#define AP_EITHER_PROTOCOL              0x00
#define AP_BASIC_PROTOCOL               0x01
#define AP_ENHANCED_PROTOCOL            0x02

/*****************************************************************************/
/* ptr_locks                                                                 */
/*****************************************************************************/
#define AP_SHORT                        0x00
#define AP_LONG                         0x01

/*****************************************************************************/
/* err_type                                                                  */
/*****************************************************************************/
#define AP_PROG                         0x00
#define AP_SVC                          0x01
#define AP_BACKOUT_NO_RESYNC            0x02
#define AP_BACKOUT_RESYNC               0x03

/*****************************************************************************/
/* rtn_ctl                                                                   */
/*****************************************************************************/
#define AP_WHEN_SESSION_ALLOCATED       0x00
#define AP_IMMEDIATE                    0x01
#define AP_WHEN_EXPEDITED_DATA_RECEIVED 0x00
#define AP_WHEN_SESSION_FREE            0x02
#define AP_WHEN_CONWINNER_ALLOC         0x03
#define AP_WHEN_CONWINNER_ALLOCATED     0x03
#define AP_WHEN_CONV_GROUP_ALLOC        0x04
#define AP_WHEN_CONV_GROUP_ALLOCATED    0x04
#define AP_WHEN_CONLOSER_ALLOC          0x05

/*****************************************************************************/
/* end_type                                                                  */
/*****************************************************************************/
#define AP_SOFT                         0x00
#define AP_HARD                         0x01
#define AP_CANCEL                       0x8A

/*****************************************************************************/
/* data_type                                                                 */
/*****************************************************************************/
#define AP_APPLICATION                  0x00
#define AP_USER_CONTROL_DATA            0x01
#define AP_PS_HEADER                    0x02
#define AP_BASIC_DATA                   0x03

/*****************************************************************************/
/* err_dir                                                                   */
/*****************************************************************************/
#define AP_RCV_DIR_ERROR                0x00
#define AP_SEND_DIR_ERROR               0x01

/*****************************************************************************/
/* what_rcvd                                                                 */
/*****************************************************************************/
#define AP_DATA                         0x0100
#define AP_DATA_COMPLETE                0x0200
#define AP_DATA_INCOMPLETE              0x0400
#define AP_SEND                         0x0001
#define AP_CONFIRM_WHAT_RECEIVED        0x0002
#define AP_CONFIRM_SEND                 0x0003
#define AP_CONFIRM_DEALLOCATE           0x0004
#define AP_USER_CONTROL_DATA_COMPLETE   0x0800
#define AP_USER_CONTROL_DATA_INCMP      0x1000
#define AP_PS_HEADER_COMPLETE           0x2000
#define AP_PS_HEADER_INCOMPLETE         0x4000
#define AP_DATA_SEND                    0x0101
#define AP_DATA_CONFIRM                 0x0102
#define AP_DATA_CONFIRM_SEND            0x0103
#define AP_DATA_CONFIRM_DEALLOCATE      0x0104
#define AP_DATA_COMPLETE_SEND           0x0201
#define AP_DATA_COMPLETE_CONFIRM        0x0202
#define AP_DATA_COMPLETE_CONFIRM_SEND   0x0203
#define AP_DATA_COMPLETE_CONFIRM_DEALL  0x0204
#define AP_UC_DATA_COMPLETE_SEND        0x0801
#define AP_UC_DATA_COMPLETE_CONFIRM     0x0802
#define AP_UC_DATA_COMPLETE_CNFM_SEND   0x0803
#define AP_UC_DATA_COMPLETE_CNFM_DEALL  0x0804
#define AP_PS_HDR_COMPLETE_SEND         0x2001
#define AP_PS_HDR_COMPLETE_CONFIRM      0x2002
#define AP_PS_HDR_COMPLETE_CNFM_SEND    0x2003
#define AP_PS_HDR_COMPLETE_CNFM_DEALL   0x2004

/*****************************************************************************/
/* reason for implied forget indication                                      */
/*****************************************************************************/
#define AP_DATA_FLOW                    0x00
#define AP_UNBIND                       0x01
#define AP_FAILURE                      0x02

/*****************************************************************************/
/* Opcodes for APPC event indications, used as bit masks, so valid values    */
/* are 1, 2, 4, 8 etc                                                        */
/*****************************************************************************/
#define AP_RECEIVED_DATA                0x0001

/*****************************************************************************/
/* masks for accessing data and status portions of what_rcvd                 */
/*****************************************************************************/
#define AP_DATA_INDICATOR               0xFF00
#define AP_STATUS_INDICATOR             0x00FF

/*****************************************************************************/
/* Conversation style                                                        */
/*****************************************************************************/
#define AP_TWO_WAY_ALTERNATE            0x00
#define AP_TWO_WAY_SIMULTANEOUS         0x01

/*****************************************************************************/
/* formats - for verb format field                                           */
/*****************************************************************************/
#define AP_FORMAT0 (unsigned char)0
#define AP_FORMAT1 (unsigned char)1


#ifndef APPN_DONT_INC_VCBS

/*****************************************************************************/
/* VCB structures                                                            */
/*****************************************************************************/

/**STRUCT+********************************************************************/
/* Structure: APPC_HDR                                                       */
/*                                                                           */
/* Description: Common APPC vcb header                                       */
/*****************************************************************************/

typedef struct appc_hdr
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
} APPC_HDR;

/**STRUCT-********************************************************************/

#ifdef SYNCPOINT_SUPPORTED
/*****************************************************************************/
/* Implied Forget Handler Callback                                           */
/* This function may be passed in on the Dellocate Verb                      */
/*****************************************************************************/

typedef void (WINAPI *DEALLOCATE_CALLBACK)(APPC_HDR *vcb,
                                           unsigned char tpid[],
                                           unsigned long convid,
                                           unsigned short type,
                                           void *corr);
#endif

/**STRUCT+********************************************************************/
/* Structure: TP_STARTED                                                     */
/*                                                                           */
/* Description: TP_STARTED verb control block                                */
/*****************************************************************************/

typedef struct tp_started
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   lu_alias[8];
  unsigned char   tp_id[8];
  unsigned char   tp_name[64];
} TP_STARTED;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: RECEIVE_ALLOCATE                                               */
/*                                                                           */
/* Description: RECEIVE_ALLOCATE verb control block                          */
/*****************************************************************************/

typedef struct receive_allocate
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_name[64];
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   sync_level;
  unsigned char   conv_type;
  unsigned char   user_id[10];
  unsigned char   lu_alias[8];
  unsigned char   plu_alias[8];
  unsigned char   mode_name[8];
  unsigned char   reserv3[2];
  unsigned long   conv_group_id;
  unsigned char   fqplu_name[17];
  unsigned char   pip_incoming;
  unsigned char   conversation_style;
  unsigned char   reserv4[3];
#ifdef WINAPPC_FORMAT_1
  unsigned char   password[10];
  unsigned char   reserv5[2];
  unsigned char   dload_id[8];
#endif
} RECEIVE_ALLOCATE;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: TP_ENDED                                                       */
/*                                                                           */
/* Description: TP_ENDED verb control block                                  */
/*****************************************************************************/

typedef struct tp_ended
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned char   type;
} TP_ENDED;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: MC_ALLOCATE                                                    */
/*                                                                           */
/* Description: MC_ALLOCATE verb control block                               */
/*****************************************************************************/

typedef struct mc_allocate
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   reserv3;
  unsigned char   sync_level;
  unsigned char   reserv4[2];
  unsigned char   rtn_ctl;
  unsigned char   conversation_style;
  unsigned long   conv_group_id;
  unsigned long   sense_data;
  unsigned char   plu_alias[8];
  unsigned char   mode_name[8];
  unsigned char   tp_name[64];
  unsigned char   security;
  unsigned char   reserv6[11];
  unsigned char   pwd[10];
  unsigned char   user_id[10];
  unsigned short  pip_dlen;
  unsigned char   *pip_dptr;
  unsigned char   reserv6a;
  unsigned char   fqplu_name[17];
  unsigned char   reserv7[8];
} MC_ALLOCATE;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: MC_CONFIRM                                                     */
/*                                                                           */
/* Description: MC_CONFIRM verb control block                                */
/*****************************************************************************/

typedef struct mc_confirm
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   rts_rcvd;
#ifdef WINAPPC_FORMAT_1
  unsigned char   expd_data_rcvd;
#endif
} MC_CONFIRM;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: MC_CONFIRMED                                                   */
/*                                                                           */
/* Description: MC_CONFIRMED verb control block                              */
/*****************************************************************************/

typedef struct mc_confirmed
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
} MC_CONFIRMED;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: MC_DEALLOCATE                                                  */
/*                                                                           */
/* Description: MC_DEALLOCATE verb control block                             */
/*****************************************************************************/

typedef struct mc_deallocate
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
#ifdef WINAPPC_FORMAT_1
  unsigned char   expd_data_rcvd;
#else
  unsigned char   reserv3;
#endif
  unsigned char   dealloc_type;
  unsigned char   reserv4[2];
  unsigned char   reserv5[4];
#ifdef WINAPPC_FORMAT_1
  /***************************************************************************/
  /* If format field set to 1 and syncpoint callback NOT required then       */
  /* these fields must be set to null (0x00)                                 */
  /***************************************************************************/
#ifdef SYNCPOINT_SUPPORTED
  DEALLOCATE_CALLBACK  callback;
  void *          correlator;
  unsigned char   reserv6[4];
#else
  unsigned char   reserv6[12];
#endif
#endif
} MC_DEALLOCATE;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: MC_FLUSH                                                       */
/*                                                                           */
/* Description: MC_FLUSH verb control block                                  */
/*****************************************************************************/

typedef struct mc_flush
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
} MC_FLUSH;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: MC_GET_ATTRIBUTES                                              */
/*                                                                           */
/* Description: MC_GET_ATTRIBUTES verb control block                         */
/*****************************************************************************/

typedef struct mc_get_attributes
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   reserv3;
  unsigned char   sync_level;
  unsigned char   mode_name[8];
  unsigned char   net_name[8];
  unsigned char   lu_name[8];
  unsigned char   lu_alias[8];
  unsigned char   plu_alias[8];
  unsigned char   plu_un_name[8];
  unsigned char   reserv4[2];
  unsigned char   fqplu_name[17];
  unsigned char   reserv5;
  unsigned char   user_id[10];
  unsigned long   conv_group_id;
  unsigned char   conv_corr_len;
  unsigned char   conv_corr[8];
  unsigned char   reserv6[13];
#ifdef WINAPPC_FORMAT_1
#ifdef SYNCPOINT_SUPPORTED
  unsigned char   luw_id[26];
  unsigned char   sess_id[8];
#else
  unsigned char   reserv7[34];
#endif
#endif
} MC_GET_ATTRIBUTES;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: MC_PREPARE_TO_RECEIVE                                          */
/*                                                                           */
/* Description: MC_PREPARE_TO_RECEIVE verb control block                     */
/*****************************************************************************/

typedef struct mc_prepare_to_receive
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   ptr_type;
  unsigned char   locks;
} MC_PREPARE_TO_RECEIVE;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: MC_RECEIVE_AND_POST                                            */
/*                                                                           */
/* Description: MC_RECEIVE_AND_POST verb control block                       */
/*****************************************************************************/

typedef struct mc_receive_and_post
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned short  what_rcvd;
  unsigned char   rtn_status;
  unsigned char   reserv4;
  unsigned char   rts_rcvd;
  unsigned char   expd_data_rcvd;
  unsigned short  max_len;
  unsigned short  dlen;
  unsigned char   *dptr;
  unsigned char   *sema;
  unsigned char   reserv6;
} MC_RECEIVE_AND_POST;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: MC_RECEIVE_AND_WAIT                                            */
/*                                                                           */
/* Description: MC_RECEIVE_AND_WAIT verb control block                       */
/*****************************************************************************/

typedef struct mc_receive_and_wait
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned short  what_rcvd;
  unsigned char   rtn_status;
  unsigned char   reserv4;
  unsigned char   rts_rcvd;
  unsigned char   expd_data_rcvd;
  unsigned short  max_len;
  unsigned short  dlen;
  unsigned char   *dptr;
  unsigned char   reserv6[5];
} MC_RECEIVE_AND_WAIT;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: MC_RECEIVE_IMMEDIATE                                           */
/*                                                                           */
/* Description: MC_RECEIVE_IMMEDIATE verb control block                      */
/*****************************************************************************/

typedef struct mc_receive_immediate
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned short  what_rcvd;
  unsigned char   rtn_status;
  unsigned char   reserv4;
  unsigned char   rts_rcvd;
  unsigned char   expd_data_rcvd;
  unsigned short  max_len;
  unsigned short  dlen;
  unsigned char   *dptr;
  unsigned char   reserv6[5];
} MC_RECEIVE_IMMEDIATE;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: MC_REQUEST_TO_SEND                                             */
/*                                                                           */
/* Description: MC_REQUEST_TO_SEND verb control block                        */
/*****************************************************************************/

typedef struct mc_request_to_send
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
} MC_REQUEST_TO_SEND;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: MC_SEND_CONVERSATION                                           */
/*                                                                           */
/* Description: MC_SEND_CONVERSATION verb control block                      */
/*****************************************************************************/

typedef struct mc_send_conversation
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned char   reserv3[8];
  unsigned char   rtn_ctl;
  unsigned char   reserv4;
  unsigned long   conv_group_id;
  unsigned long   sense_data;
  unsigned char   plu_alias[8];
  unsigned char   mode_name[8];
  unsigned char   tp_name[64];
  unsigned char   security;
  unsigned char   reserv6[11];
  unsigned char   pwd[10];
  unsigned char   user_id[10];
  unsigned short  pip_dlen;
  unsigned char   *pip_dptr;
  unsigned char   reserv6a;
  unsigned char   fqplu_name[17];
  unsigned char   reserv7[8];
  unsigned short  dlen;
  unsigned char   *dptr;
} MC_SEND_CONVERSATION;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: MC_SEND_DATA                                                   */
/*                                                                           */
/* Description: MC_SEND_DATA verb control block                              */
/*****************************************************************************/

typedef struct mc_send_data
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   rts_rcvd;
#ifdef WINAPPC_FORMAT_1
  unsigned char   expd_data_rcvd;
#else
  unsigned char   data_type;
#endif
  unsigned short  dlen;
  unsigned char   *dptr;
  unsigned char   type;
#ifdef WINAPPC_FORMAT_1
  unsigned char   data_type;
#else
  unsigned char   reserved4;
#endif
} MC_SEND_DATA;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: MC_SEND_ERROR                                                  */
/*                                                                           */
/* Description: MC_SEND_ERROR verb control block                             */
/*****************************************************************************/

typedef struct mc_send_error
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   rts_rcvd;
  unsigned char   err_type;
  unsigned char   err_dir;
  unsigned char   expd_data_rcvd;
  unsigned char   reserv5[2];
  unsigned char   reserv6[4];
} MC_SEND_ERROR;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: MC_TEST_RTS                                                    */
/*                                                                           */
/* Description: MC_TEST_RTS verb control block                               */
/*****************************************************************************/

typedef struct mc_test_rts
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   reserv3;
} MC_TEST_RTS;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: MC_TEST_RTS_AND_POST                                           */
/*                                                                           */
/* Description: MC_TEST_RTS_AND_POST verb control block                      */
/*****************************************************************************/

typedef struct mc_test_rts_and_post
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   reserv3;
  unsigned long   sema;
} MC_TEST_RTS_AND_POST;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: MC_SEND_EXPEDITED_DATA                                         */
/*                                                                           */
/* Description: MC_SEND_EXPEDITED_DATA verb control block                    */
/*****************************************************************************/

typedef struct mc_send_expedited_data
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   rts_rcvd;
  unsigned char   expd_data_rcvd;


  unsigned short  dlen;
  unsigned char  *dptr;
  unsigned char   reserv4[2];
} MC_SEND_EXPEDITED_DATA;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: MC_RECEIVE_EXPEDITED_DATA                                      */
/*                                                                           */
/* Description: MC_RECEIVE_EXPEDITED_DATA verb control block                 */
/*****************************************************************************/

typedef struct mc_receive_expedited_data
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   return_control;
  unsigned char   reserv1[3];
  unsigned char   rts_rcvd;
  unsigned char   expd_data_rcvd;
  unsigned short  max_len;
  unsigned short  dlen;
  unsigned char  *dptr;
} MC_RECEIVE_EXPEDITED_DATA;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: ALLOCATE                                                       */
/*                                                                           */
/* Description: ALLOCATE verb control block                                  */
/*****************************************************************************/

typedef struct allocate
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   conv_type;
  unsigned char   sync_level;
  unsigned char   reserv3[2];
  unsigned char   rtn_ctl;
  unsigned char   conversation_style;
  unsigned long   conv_group_id;
  unsigned long   sense_data;
  unsigned char   plu_alias[8];
  unsigned char   mode_name[8];
  unsigned char   tp_name[64];
  unsigned char   security;
  unsigned char   reserv5[11];
  unsigned char   pwd[10];
  unsigned char   user_id[10];
  unsigned short  pip_dlen;
  unsigned char   *pip_dptr;
  unsigned char   reserv5a;
  unsigned char   fqplu_name[17];
  unsigned char   reserv6[8];
} ALLOCATE;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: CONFIRM                                                        */
/*                                                                           */
/* Description: CONFIRM verb control block                                   */
/*****************************************************************************/

typedef struct confirm
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   rts_rcvd;
#ifdef WINAPPC_FORMAT_1
  unsigned char   expd_data_rcvd;
#endif
} CONFIRM;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: CONFIRMED                                                      */
/*                                                                           */
/* Description: CONFIRMED verb control block                                 */
/*****************************************************************************/

typedef struct confirmed
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
} CONFIRMED;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: DEALLOCATE                                                     */
/*                                                                           */
/* Description: DEALLOCATE verb control block                                */
/*****************************************************************************/

typedef struct deallocate
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
#ifdef WINAPPC_FORMAT_1
  unsigned char   expd_data_rcvd;
#else
  unsigned char   reserv3;
#endif
  unsigned char   dealloc_type;
  unsigned short  log_dlen;
  unsigned char   *log_dptr;
#ifdef WINAPPC_FORMAT_1
  /***************************************************************************/
  /* If format field set to 1 and syncpoint callback NOT required then       */
  /* these fields must be set to null (0x00)                                 */
  /***************************************************************************/
#ifdef SYNCPOINT_SUPPORTED
  DEALLOCATE_CALLBACK  callback;
  void *          correlator;
  unsigned char   reserv4[4];
#else
  unsigned char   reserv4[12];
#endif
#endif
} DEALLOCATE;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: FLUSH                                                          */
/*                                                                           */
/* Description: FLUSH verb control block                                     */
/*****************************************************************************/

typedef struct flush
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
} FLUSH;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: GET_ATTRIBUTES                                                 */
/*                                                                           */
/* Description: GET_ATTRIBUTES verb control block                            */
/*****************************************************************************/

typedef struct get_attributes
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   reserv3;
  unsigned char   sync_level;
  unsigned char   mode_name[8];
  unsigned char   net_name[8];
  unsigned char   lu_name[8];
  unsigned char   lu_alias[8];
  unsigned char   plu_alias[8];
  unsigned char   plu_un_name[8];
  unsigned char   reserv4[2];
  unsigned char   fqplu_name[17];
  unsigned char   reserv5;
  unsigned char   user_id[10];
  unsigned long   conv_group_id;
  unsigned char   conv_corr_len;
  unsigned char   conv_corr[8];
  unsigned char   reserv6[13];
#ifdef WINAPPC_FORMAT_1
#ifdef SYNCPOINT_SUPPORTED
  unsigned char   luw_id[26];
  unsigned char   sess_id[8];
#else
  unsigned char   reserv7[34];
#endif
#endif
} GET_ATTRIBUTES;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: PREPARE_TO_RECEIVE                                             */
/*                                                                           */
/* Description: PREPARE_TO_RECEIVE verbtrol block                            */
/*****************************************************************************/

typedef struct prepare_to_receive
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   ptr_type;
  unsigned char   locks;
} PREPARE_TO_RECEIVE;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: RECEIVE_AND_POST                                               */
/*                                                                           */
/* Description: RECEIVE_AND_POST verb control block                          */
/*****************************************************************************/

typedef struct receive_and_post
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned short  what_rcvd;
  unsigned char   rtn_status;
  unsigned char   fill;
  unsigned char   rts_rcvd;
  unsigned char   expd_data_rcvd;
  unsigned short  max_len;
  unsigned short  dlen;
  unsigned char   *dptr;
  unsigned char   *sema;
  unsigned char   reserv5;
} RECEIVE_AND_POST;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: RECEIVE_AND_WAIT                                               */
/*                                                                           */
/* Description: RECEIVE_AND_WAIT verb control block                          */
/*****************************************************************************/

typedef struct receive_and_wait
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned short  what_rcvd;
  unsigned char   rtn_status;
  unsigned char   fill;
  unsigned char   rts_rcvd;
  unsigned char   expd_data_rcvd;
  unsigned short  max_len;
  unsigned short  dlen;
  unsigned char   *dptr;
  unsigned char   reserv5[5];
} RECEIVE_AND_WAIT;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: RECEIVE_IMMEDIATE                                              */
/*                                                                           */
/* Description: RECEIVE_IMMEDIATE verb control block                         */
/*****************************************************************************/

typedef struct receive_immediate
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned short  what_rcvd;
  unsigned char   rtn_status;
  unsigned char   fill;
  unsigned char   rts_rcvd;
  unsigned char   expd_data_rcvd;
  unsigned short  max_len;
  unsigned short  dlen;
  unsigned char   *dptr;
  unsigned char   reserv5[5];
} RECEIVE_IMMEDIATE;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: REQUEST_TO_SEND                                                */
/*                                                                           */
/* Description: REQUEST_TO_SEND verb control block                           */
/*****************************************************************************/

typedef struct request_to_send
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
} REQUEST_TO_SEND;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: SEND_CONVERSATION                                              */
/*                                                                           */
/* Description: SEND_CONVERSATION verb control block                         */
/*****************************************************************************/

typedef struct send_conversation
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned char   reserv3[8];
  unsigned char   rtn_ctl;
  unsigned char   reserv4;
  unsigned long   conv_group_id;
  unsigned long   sense_data;
  unsigned char   plu_alias[8];
  unsigned char   mode_name[8];
  unsigned char   tp_name[64];
  unsigned char   security;
  unsigned char   reserv5[11];
  unsigned char   pwd[10];
  unsigned char   user_id[10];
  unsigned short  pip_dlen;
  unsigned char   *pip_dptr;
  unsigned char   reserv5a;
  unsigned char   fqplu_name[17];
  unsigned char   reserv6[8];
  unsigned short  dlen;
  unsigned char   *dptr;
} SEND_CONVERSATION;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: SEND_DATA                                                      */
/*                                                                           */
/* Description: SEND_DATA verb control block                                 */
/*****************************************************************************/

typedef struct send_data
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   rts_rcvd;
  unsigned char   expd_data_rcvd;
  unsigned short  dlen;
  unsigned char   *dptr;
  unsigned char   type;
  unsigned char   reserv4;
} SEND_DATA;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: SEND_ERROR                                                     */
/*                                                                           */
/* Description: SEND_ERROR verb control block                                */
/*****************************************************************************/

typedef struct send_error
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   rts_rcvd;
  unsigned char   err_type;
  unsigned char   err_dir;
  unsigned char   expd_data_rcvd;
  unsigned short  log_dlen;
  unsigned char   *log_dptr;
} SEND_ERROR;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: TEST_RTS                                                       */
/*                                                                           */
/* Description:    TEST_RTS verb control block                               */
/*****************************************************************************/

typedef struct test_rts
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   reserv3;
} TEST_RTS;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: TEST_RTS_AND_POST                                              */
/*                                                                           */
/* Description:    TEST_RTS_AND_POST verb control block                      */
/*****************************************************************************/

typedef struct test_rts_and_post
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   reserv3;
  unsigned long   sema;
} TEST_RTS_AND_POST;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: LUW_ID_OVERLAY                                                 */
/*                                                                           */
/* Description: Identifier for Logical Unit of Work                          */
/*****************************************************************************/

typedef struct luw_id_overlay
{
  unsigned char   fqlu_name_len;
  unsigned char   fqlu_name[17];
  unsigned char   instance[6];
  unsigned char   sequence[2];
} LUW_ID_OVERLAY;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: GET_TP_PROPERTIES                                              */
/*                                                                           */
/* Description: GET_TP_PROPERTIES verb control block                         */
/*****************************************************************************/

typedef struct get_tp_properties
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned char   tp_name[64];
  unsigned char   lu_alias[8];
  unsigned char   luw_id[26];
  unsigned char   fqlu_name[17];
  unsigned char   reserv3[10];
  unsigned char   user_id[10];
#ifdef WINAPPC_FORMAT_1
#ifdef SYNCPOINT_SUPPORTED
  unsigned char   prot_luw_id[26];
#endif
#endif
} GET_TP_PROPERTIES;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: GET_TYPE                                                       */
/*                                                                           */
/* Description: GET_TYPE verb control block                                  */
/*****************************************************************************/

typedef struct get_type
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   conv_type;
#ifdef WINAPPC_FORMAT_1
  unsigned char   conv_style;
#endif
} GET_TYPE;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: GET_LU_STATUS                                                  */
/*                                                                           */
/* Description: GET_LU_STATUS verb control block                             */
/*****************************************************************************/

typedef struct get_lu_status
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned char   plu_alias[8];
  unsigned short  active_sess;
  unsigned char   zero_sess;
  unsigned char   reserv3[7];
} GET_LU_STATUS;

/**STRUCT-********************************************************************/

#ifdef SYNCPOINT_SUPPORTED
/**STRUCT+********************************************************************/
/* Structure: IMPLIED_FORGET                                                 */
/*                                                                           */
/* Description: Implied forget notification                                  */
/*****************************************************************************/

typedef struct implied_forget
{
  unsigned short  opcode;
  unsigned char   reserv2;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   reason;
} IMPLIED_FORGET;

/**STRUCT-********************************************************************/
#endif

/**STRUCT+********************************************************************/
/* Structure: SET_TP_PROPERTIES                                              */
/*                                                                           */
/* Description: SET_TP_PROPERTIES verb control block                         */
/*****************************************************************************/

typedef struct set_tp_properties
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned char   set_prot_id;
  unsigned char   new_prot_id;
  unsigned char   prot_id[26];
  unsigned char   set_unprot_id;
  unsigned char   new_unprot_id;
  unsigned char   unprot_id[26];
  unsigned char   set_user_id;
  unsigned char   set_password;
  unsigned char   user_id[10];
  unsigned char   new_password[10];
} SET_TP_PROPERTIES;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: TP_NAME_ENTRY                                                  */
/*                                                                           */
/* Description: TP_NAME_ENTRY control block, part of the TP_NAME_LIST CB,    */
/*              a part of the RECEIVE_ALLOCATE_MULTIPLE verb control block.  */
/*****************************************************************************/

typedef struct tp_name_entry
{
  unsigned long   tp_name_length;
  unsigned char   reserv1[4];
  unsigned char   tp_name;
} TP_NAME_ENTRY;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: TP_NAME_LIST                                                   */
/*                                                                           */
/* Description: TP_NAME_LIST control block, part of the                      */
/*              RECEIVE_ALLOCATE_MULTIPLE verb control block.                */
/*****************************************************************************/

typedef struct tp_name_list
{
  unsigned long   num_entries;
  TP_NAME_ENTRY   tp_name_entry;
} TP_NAME_LIST;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: RECEIVE_ALLOCATE_MULTIPLE                                      */
/*                                                                           */
/* Description: RECEIVE_ALLOCATE_MULTIPLE verb control block                 */
/*****************************************************************************/

typedef struct receive_allocate_multiple
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 1      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_name[64];
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   sync_level;
  unsigned char   conv_type;
  unsigned char   user_id[10];
  unsigned char   lu_alias[8];
  unsigned char   plu_alias[8];
  unsigned char   mode_name[8];
  unsigned char   reserv3[2];
  unsigned long   conv_group_id;
  unsigned char   fqplu_name[17];
  unsigned char   pip_incoming;
  unsigned char   conversation_style;
  unsigned char   reserv4[3];
  unsigned char   password[10];
  unsigned char   reserv5[2];
  unsigned char   reserv6[8];
  unsigned char   reserv7[8];
  TP_NAME_LIST   *tp_name_list;
  unsigned long   tp_name_list_len;
} RECEIVE_ALLOCATE_MULTIPLE;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: SEND_EXPEDITED_DATA                                            */
/*                                                                           */
/* Description: SEND_EXPEDITED_DATA verb control block                       */
/*****************************************************************************/

typedef struct send_expedited_data
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   rts_rcvd;
  unsigned char   expd_data_rcvd;
  unsigned short  dlen;
  unsigned char  *dptr;
  unsigned char   reserv4[2];
} SEND_EXPEDITED_DATA;

/**STRUCT-********************************************************************/


/**STRUCT+********************************************************************/
/* Structure: RECEIVE_EXPEDITED_DATA                                         */
/*                                                                           */
/* Description: RECEIVE_EXPEDITED_DATA verb control block                    */
/*****************************************************************************/

typedef struct receive_expedited_data
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned char   return_control;
  unsigned char   reserv1[3];
  unsigned char   rts_rcvd;
  unsigned char   expd_data_rcvd;
  unsigned short  max_len;
  unsigned short  dlen;
  unsigned char  *dptr;
} RECEIVE_EXPEDITED_DATA;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: REGISTER_EVENT                                                 */
/*                                                                           */
/* Description: REGISTER_EVENT verb control block                            */
/*****************************************************************************/

typedef struct register_event
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned long   event_types;
  unsigned long   event_correlator;
} REGISTER_EVENT;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: UNREGISTER_EVENT                                               */
/*                                                                           */
/* Description: UNREGISTER_EVENT verb control block                          */
/*****************************************************************************/

typedef struct unregister_event
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned long   event_types;
} UNREGISTER_EVENT;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: EVENT_INDICATION                                               */
/*                                                                           */
/* Description: EVENT_INDICATION verb control block                          */
/*****************************************************************************/

typedef struct event_indication
{
  unsigned short  opcode;
  unsigned char   reserv2;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   tp_id[8];
  unsigned long   conv_id;
  unsigned long   event_type;
  unsigned long   event_correlator;
  unsigned char   event_data[128];
} EVENT_INDICATION;

/**STRUCT-********************************************************************/

/**STRUCT+********************************************************************/
/* Structure: CREATE_PASSWORD_SUBSTITUTE                                     */
/*                                                                           */
/* Description: CREATE_PASSWORD_SUBSTITUTE verb control block                */
/*****************************************************************************/

typedef struct create_password_substitute
{
  unsigned short  opcode;
  unsigned char   opext;
  unsigned char   format;                        /* current format is 0      */
  unsigned short  primary_rc;
  unsigned long   secondary_rc;
  unsigned char   lu_alias[8];
  unsigned long   conv_group_id;
  unsigned char   user_id[10];
  unsigned char   pw[10];
  unsigned char   seq_no[8];
  unsigned char   pw_sub[10];
  unsigned char   pw_verifier[10];
} CREATE_PASSWORD_SUBSTITUTE;

/**STRUCT-********************************************************************/

#endif /* !APPN_DONT_INC_VCBS */


/**STRUCT+********************************************************************/
/* Structure: CNOS                                                           */
/*                                                                           */
/* Description: CNOS verb control block                                      */
/*****************************************************************************/

typedef struct cnos
{
  unsigned short opcode;
  unsigned char  reserv2[2];
  unsigned short primary_rc;
  unsigned long  secondary_rc;
  unsigned char  key[8];
  unsigned char  lu_alias[8];
  unsigned char  plu_alias[8];
  unsigned char  fqplu_name[17];
  unsigned char  reserv3;
  unsigned char  mode_name[8];
  unsigned int   mode_name_select:1;
  unsigned int   set_negotiable:1;
  unsigned int   reserv4:6;
  unsigned int   reserv5:8;
  unsigned short plu_mode_sess_lim;
  unsigned short min_conwinners_source;
  unsigned short min_conwinners_target;
  unsigned short auto_act;
  unsigned int   drain_target:1;
  unsigned int   drain_source:1;
  unsigned int   responsible:1;
  unsigned int   reserv6:5;
  unsigned int   reserv7:8;
} CNOS;

/**STRUCT-********************************************************************/


/*****************************************************************************/
/* Windows APPC Extension Return Codes                                       */
/*****************************************************************************/
#define WAPPCALREADY         0xF000   /* An async call is already outstanding*/
#define WAPPCINVALID         0xF001   /* Async Task Id is invalid            */
#define WAPPCCANCEL          0xF002   /* Blocking call was cancelled         */
#define WAPPCSYSNOTREADY     0xF003   /* Underlying subsystem not started    */
#define WAPPCVERNOTSUPPORTED 0xF004   /* Application version not supported   */

/*****************************************************************************/
/* WinAPPCStartup DATA structure                                             */
/*****************************************************************************/
#define WAPPCDESCRIPTION_LEN    127
typedef struct tagWAPPCDATA
{
  WORD    wVersion;
  char    szDescription[WAPPCDESCRIPTION_LEN+1];
} WAPPCDATA, * PWAPPCDATA, * LPWAPPCDATA;

/*****************************************************************************/
/* API function prototypes                                                   */
/*****************************************************************************/
extern void    WINAPI APPC(long);
extern void    WINAPI APPC_C(long);
extern HANDLE  WINAPI WinAsyncAPPC(HWND, long);
extern HANDLE  WINAPI WinAsyncAPPCEx(HANDLE, long);
extern BOOL    WINAPI WinAPPCCleanup(void);
extern BOOL    WINAPI WinAPPCIsBlocking(void);
extern int     WINAPI WinAPPCCancelAsyncRequest( HANDLE );
extern BOOL    WINAPI WinAPPCCancelBlockingCall(void);
extern int     WINAPI WinAPPCStartup(WORD, LPWAPPCDATA);
extern FARPROC WINAPI WinAPPCSetBlockingHook(FARPROC);
extern BOOL    WINAPI WinAPPCUnhookBlockingHook(void);
extern int     WINAPI GetAppcReturnCode(struct appc_hdr *,
                                        UINT,
                                        unsigned char *);

#define WIN_APPC_ASYNC_COMPLETE_MESSAGE "WinAsyncAPPC"

/*****************************************************************************/
/*                                                                           */
/* HANDLE WINAPI GetAppcConfig(HANDLE hWnd, LPSTR pLocalLu, LPSTR pMode,     */
/*                             LPINT pNumRemLu, INT iMaxRemLu, LPSTR pRemLu, */
/*                             LPINT pAsyncRetCode)                          */
/*                                                                           */
/* This function is not supported.                                           */
/*                                                                           */
/* If a valid set of parameters is specified it returns                      */
/* APPC_CFG_SUCCESS_NO_DEFAULT_REMOTE and puts a null terminator in the      */
/* first byte of the RemLu buffer.                                           */
/*                                                                           */
/* If an invalid set of input parameters is specified the appropriate        */
/* return code is returned.                                                  */
/*                                                                           */
/*****************************************************************************/
extern HANDLE  WINAPI GetAppcConfig(HANDLE,
                                    LPSTR,
                                    LPSTR,
                                    LPINT,
                                    INT,
                                    LPSTR,
                                    LPINT);

/*****************************************************************************/
/* Completion message name                                                   */
/*****************************************************************************/
#define WIN_APPC_CFG_COMPLETION_MSG "WinAppcCfg"

/*****************************************************************************/
/* Test values                                                               */
/*****************************************************************************/
#define APPC_CFG_SUCCESS                       0x1000
#define APPC_CFG_ERROR                         0x2000
#define APPC_CFG_PENDING                       0xFFFF

/*****************************************************************************/
/* Retcodes                                                                  */
/*****************************************************************************/
#define APPC_CFG_SUCCESS_NO_DEFAULT_REMOTE     (APPC_CFG_SUCCESS + 1)
#define APPC_CFG_SUCCESS_DEFAULT_REMOTE        (APPC_CFG_SUCCESS + 2)
#define APPC_CFG_ERROR_NO_DEFAULT_LOCAL_LU     (APPC_CFG_ERROR + 1)
#define APPC_CFG_ERROR_BAD_LOCAL_LU            (APPC_CFG_ERROR + 2)
#define APPC_CFG_ERROR_GENERAL_FAILURE         (APPC_CFG_ERROR + 3)
#define APPC_CFG_ERROR_INVALID_HWND            (APPC_CFG_ERROR + 4)
#define APPC_CFG_ERROR_BAD_POINTER             (APPC_CFG_ERROR + 5)
#define APPC_CFG_ERROR_TOO_MANY_REQUESTS       (APPC_CFG_ERROR + 6)
#define APPC_CFG_ERROR_NO_APPC_INIT            (APPC_CFG_ERROR + 7)
#define APPC_CFG_ERROR_UNCLEAR_COMPLETION_MODE (APPC_CFG_ERROR + 8)

/*****************************************************************************/
/* Restore original packing mode                                             */
/*****************************************************************************/
#pragma pack()

/*****************************************************************************/
/* Define this header file to be C if this is included by a C++ source file  */
/*****************************************************************************/
#ifdef __cplusplus
}
#endif

/*****************************************************************************/
/* End ifndef APPC_C_INCLUDED                                                */
/*****************************************************************************/
#endif

/* winappc.h */
