/****************************************************************************
 *
 *	Copyright (C) 1992-2001 Micro Focus International Ltd.
 *
 *	All rights reserved.  Unpublished, all rights reserved under
 *	copyright law and international treaty.  Use of a copyright notice
 *	is precautionary only and does not imply publication or disclosure.
 *	This software contains confidential information and trade secrets of
 *	Micro Focus Ltd. and no part of this program or publication may be
 *	reproduced, transmitted, transcribed, stored in a retrieval system,
 *	or translated into any language or computer language, in any form
 *	or by any means, electronic, mechanical, magnetic, optical, chemical,
 *	manual or otherwise, without the prior written permission of:
 *
 *	Micro Focus Ltd,
 *	Speen Court, 7 Oxford Road, Newbury, Berkshire, RG14 1PB, UK.
 *	(01635) 32646
 *
 *	RESTRICTED RIGHTS LEGEND
 *	Use, duplication, or disclosure by the Government is subject to
 *	restrictions as set forth in subparagraph (c)(1)(ii) of the Rights
 *	in Technical Data and Computer Software clause at DFARS 52.227-7013
 *	or subparagraphs (c)(1) and (2) of Commercial Computer Software -
 *	Restricted Rights at 48 CFR 52.227-19, as applicable.  Contact
 *	Micro Focus Incorporated, 2465 East Bayshore Road, Palo Alto,
 *	California 94303.
 *
 *	CCI Common source files starting at vcs version 3.1
 *
 *	@(#)cci.h    $Revision: 4.42 $	
 *
 *	$Modtime:   Sep 24 2003 15:15:06  $
 *
 ****************************************************************************/

/** Start of source module cci.h **/

/*
 * 	header file for CCI interfacing C module needing support for ANSI
 *	style prototyping and K&R style function pointer tables.
 *
 *  This version of cci.h includes details of driving CCI using SSL 
 *  cryptography. This functionality is only available when using 
 *  CCITCP (CCITC32.DLL on Windows 32-bit) and may not be available
 *  at all in some countries. An attempt to issue SSL type operations
 *  via the CCI_option interface will result in an operation unsupported
 *  error when SSL is not available.
 *  
 *
 *	eg. Microsoft C version5.1 upwards, BSD4.4 upwards, and SVR4 upwards.
 *	and some UNIX (K&R style)
 *	written by SPE 10/9/92 onwards
 *
 *      $Log: cci.h,v $
 *      Revision 4.42  2007/01/23 17:10:52  spe
 *      Basic portation tweaks.
 *
 *      Revision 4.41  2007/01/19 11:31:08  spe
 *      RPI 1059441  Add support for session and serverhandle timeouts.
 *      Add support for CCI_Option and NET_Oprion to SMEM builds
 *
 *      Revision 4.40  2007/01/08 17:58:49  spe
 *      Define optrions for setting function timeouts on a session by session basis.
 *
 *      Revision 4.39  2006/09/27 11:20:39  spe
 *      More updates for RPI 543060 and RPI 543061-
 *      Again: Add "Enable All" option for daignostic output.
 *      This time remember to "save" chanbges before committing file - doh!
 *
 *      Revision 4.38  2006/09/27 11:10:50  spe
 *      More updates for RPI 543060 and RPI 543061-
 *      Add "Enable All" option for daignostic output.
 *
 *      Revision 4.37  2006/09/27 10:58:40  spe
 *      More updates for RPI 543060 and RPI 543061-
 *      Enable global settings of display options so that applications don't have to be
 *      re-coded to use pre-registration connection creation coding method in order to
 *      find out where failures are occurring.
 *
 *      Some of the options in cci.h have changed so that these are now visible to
 *      callers not using pre-registration.
 *
 *      ToDo: Add cci.ini options to avoid the use of any programatic changes when
 *      enabling these options.
 *
 *      Revision 4.36  2006/08/18 13:55:15  spe
 *      Missed a connection display option from the public definitions.
 *
 *      Revision 4.35  2006/06/16 16:04:02  spe
 *      Add a CCI_Options description for CCI_OPT_SHUTDOWN_SERVER
 *
 *      Revision 4.34  2006/01/24 18:55:04  mww
 *      Merged from NX5-branch
 *
 *      Revision 4.33.2.1  2005/11/22 14:44:37  mww
 *      Win64 portation changes:
 *      - Insert #error directives where appropriate.
 *      - Update copyrights.
 *      - Many changes to types, casts, etc for 64-bit correctness.
 *      - Some new casts to suppress inappropriate compiler diagnostics.
 *      - cciinfo.c and ccitc64.def added for Win64 builds.
 *      - Some changes to conditional compilation for Win64; not always the same
 *      as Win32.
 *
 *      Revision 4.33  2005/11/04 15:31:21  spe
 *      Update to generic size definition
 *
 *      Revision 4.32  2005/10/24 23:01:07  mww
 *      Avoid redefining mf_ types if pc_rts.h is included
 *
 *      Revision 4.31  2005/06/16 09:39:05  hps
 *      #ifdef WIN32 -> #if defined(WIN32) || defined(WIN64)
 *
 *      Revision 4.30  2005/04/22 15:07:24  spe
 *      Add CCI_OPT_SSL_ALLOW_DATE_MISSMATCH and
 *      CCI_OPT_SSL_MIN_KEY_LENGTH option definitions.
 *
 *      Revision 4.29  2005/03/04 11:28:44  spe
 *      Match ccifrnt.c packing usage.
 *
 *      Revision 4.28  2005/02/24 11:56:23  spe
 *      Match SIGNATURE definition packing with that of ccifrnt.c
 *
 *      Revision 4.27  2005/02/02 11:57:27  spe
 *      CCITCP_v04_a_2_Feb_2005 snapshot
 *
 *      Revision 4.26  2005/01/31 16:48:21  kvm
 *      KVM: TEST
 *
 *      Revision 4.25  2005/01/31 16:46:55  kvm
 *      KVM: TEST
 *
 *      Revision 4.24  2005/01/28 16:48:15  spe
 *      Add some error reporting details.
 *
 *      Revision 4.23  2004/12/17 15:59:36  spe
 *      More tweaks to acceptable CCI_Config pre-registration elements.
 *
 *      Revision 4.22  2004/12/09 09:39:55  spe
 *      Corect missing mf_uns32 and mf_s32 when no mf_types.h is available.
 *
 *      Revision 4.21  2004/12/07 15:49:16  spe
 *      Tweaks to naming suggested by Mike.
 *
 *      Revision 4.20  2004/12/06 15:42:45  spe
 *      Fix some parsing problems and implement first part of support for
 *      using CCI_Options to specify lower level adress parameters.
 *
 *      Revision 4.19  2004/12/03 17:10:41  spe
 *      no message
 *
 *      Revision 4.18  2004/12/03 11:29:40  spe
 *      Add more options controlling endpoint creation
 *
 *      Revision 4.17  2004/11/23 17:47:17  spe
 *      Changes to OPT_SERVER_PARMS and OPT_CLIENT_PARMS to
 *      enable node and port pre-registration both in SSL and non-SSL biulds.
 *      Input now works, actual internal extraction and use still require more work.
 *
 *      Revision 4.16  2004/11/16 17:55:39  spe
 *      Still not quite parsing correctly, but getting very close now. Checking in for preservation.
 *
 *      Revision 4.14  2004/10/21 14:01:46  spe
 *      Synch SSL initial support
 *
 * 
 *    Rev 4.12   Sep 24 2003 15:20:46   SPE
 * Expose cci_list and cci_sem interfaces to 
 * external (non-CCI) usage. Update cci.h to allow C++ access
 * to CCI.
 * 
 *    Rev 4.11   04 Sep 2003 22:00:12   mww
 * CLOSE_NEGOTIATE feature (currently Windows only)
 * 
 *    Rev 4.10   Oct 17 2002 11:49:04   SPE
 * Protect against possible multiple definitions of some cbl types on 
 * some Unix platforms.
 * 
 *    Rev 4.9   Oct 15 2002 10:01:18   SPE
 * Add CCISMEM (Shared memory) WIN32 modules definition
 * Correct UNIX inclusion defining cblxxxx types.
 * 
 *    Rev 4.8   Sep 27 2002 17:16:06   SPE
 * Use new style UNIX typedefs for mf_os_size and mf_os_ssize
 * 
 *    Rev 4.7   Sep 27 2002 11:06:04   SPE
 * define mf_os_ssize and mf_os_size for 32-bt platforms
 * as the RTS header files dom't have this in any more.
 * 
 *    Rev 4.6   Jul 15 2002 16:18:58   SPE
 * Re-work UNIX #pragma code to use the include files
 * instead.
 * 
 *    Rev 4.5   Jul 03 2002 15:08:48   SPE
 * Add support for interface version 4 entry points
 * 
 *    Rev 4.4.1.2   16 May 2002 23:32:16   mww
 * Add support for CCI-OPTION verb.
 * 
 *    Rev 4.4.1.0   25 Feb 2002 21:08:42   mww
 * Branch for new verb work: extended geterror, etc
 * 
 *    Rev 4.4   Aug 23 2001 12:26:44   SPE
 * Update copyright to Micro Focus International Ltd 
 * from MERANT.
 * 
 *    Rev 4.3   04 Sep 2000 17:03:28   spe
 * Alter packing pragma definition to always be used on 
 * UNIX systems not built with ALIGN1, this will force the 
 * correct pragma for each system to be found and used
 * by the port team on each new build.
 * 
 * 
 *    Rev 4.2   04 Feb 2000 16:46:52   spe
 * SOLARIS #pragma added to prevent 114 errors in the CCI entry point.
 * 
 *    Rev 4.1   08 Dec 1999 16:43:28   spe
 * Use 64bit compatible prototypes
 * 
 *    Rev 3.9   22 Apr 1999 10:59:52   spe
 * Correct possible re-definition of the mf_types hosted mf_XXXNN types.
 * 
 *    Rev 3.8   01 Apr 1999 10:31:34   jad
 * Fixed data types on Query and Wait functions for WIN32
 * 
 *    Rev 3.7   27 Jan 1999 11:58:18   spe
 * Correct second definition of CCI_Resumeclient which
 * used mf_os_size for Async instead of mf_os_ssize.
 * 
 *    Rev 3.6   02 Dec 1998 11:51:08   spe
 * Correct WIN32 erroneous re-definition of CALLBACK
 * 
 *    Rev 3.5   10 Jul 1998 15:20:40   spe
 * Clear up another few definition issues discovered by the UNIX
 * compilers
 * 
 *    Rev 3.4   17 Jun 1998 14:50:24   spe
 * Update for UNIX compilations using all pointer interface.
 * The JMPTAB definitions differed from the real definitions
 * for most of the entry points, Microsoft compilers didn't care.
 *
 */

#ifndef CCI_H
#define CCI_H

/* expected definitions

 * #define UNIX		UNIX (all)
 * #define WIN32	Windows_NT/Windows 95/Windows 98
 * #define WIN64	Windows XP and later using x64 or IA64
 * #define PROTO	Force ANSI prototyping
 * #define RETTYPE	Standard system return value type
 * #define SOLARIS2 Sun UNIX system running the SPARC chipset, use with -DUNIX.

 */

#ifdef IPX
#define    CCI_Closeclient    CCI_IPX_Closeclient
#define    CCI_Closeserver    CCI_IPX_Closeserver
#define    CCI_Connect	      CCI_IPX_Connect
#define    CCI_Geterror       CCI_IPX_Geterror
#define    CCI_Hangup	      CCI_IPX_Hangup
#define    CCI_Initclient     CCI_IPX_Initclient
#define    CCI_Initserver     CCI_IPX_Initserver
#define    CCI_Query	      CCI_IPX_Query
#define    CCI_Receive	      CCI_IPX_Receive
#define    CCI_Receiveall     CCI_IPX_Receiveall
#define    CCI_Resumeclient   CCI_IPX_Resumeclient
#define    CCI_Resumeserver   CCI_IPX_Resumeserver
#define    CCI_Send           CCI_IPX_Send
#define    CCI_Suspendclient  CCI_IPX_Suspendclient
#define    CCI_Suspendserver  CCI_IPX_Suspendserver
#define    CCI_Transact       CCI_IPX_Transact
#define    CCI_Wait           CCI_IPX_Wait
#define    CCI_Trace	      CCI_IPX_Trace
#define    CCI_Timeout	      CCI_IPX_Timeout
#endif

#ifdef TCP
#define    CCI_Closeclient    CCI_TCP_Closeclient
#define    CCI_Closeserver    CCI_TCP_Closeserver
#define    CCI_Connect	      CCI_TCP_Connect
#define    CCI_Geterror       CCI_TCP_Geterror
#define    CCI_Hangup	      CCI_TCP_Hangup
#define    CCI_Initclient     CCI_TCP_Initclient
#define    CCI_Initserver     CCI_TCP_Initserver
#define    CCI_Query	      CCI_TCP_Query
#define    CCI_Receive	      CCI_TCP_Receive
#define    CCI_Receiveall     CCI_TCP_Receiveall
#define    CCI_Resumeclient   CCI_TCP_Resumeclient
#define    CCI_Resumeserver   CCI_TCP_Resumeserver
#define    CCI_Send           CCI_TCP_Send
#define    CCI_Suspendclient  CCI_TCP_Suspendclient
#define    CCI_Suspendserver  CCI_TCP_Suspendserver
#define    CCI_Transact       CCI_TCP_Transact
#define    CCI_Wait           CCI_TCP_Wait
#define    CCI_Trace          CCI_TCP_Trace
#define    CCI_Timeout	      CCI_TCP_Timeout
#define    CCI_GeterrorEx     CCI_TCP_GeterrorEx
#define    CCI_Option	      CCI_TCP_Option
#endif

#ifdef ASYNC
#define    CCI_Closeclient    CCI_ASYNC_Closeclient
#define    CCI_Closeserver    CCI_ASYNC_Closeserver
#define    CCI_Connect	      CCI_ASYNC_Connect
#define    CCI_Geterror       CCI_ASYNC_Geterror
#define    CCI_Hangup	      CCI_ASYNC_Hangup
#define    CCI_Initclient     CCI_ASYNC_Initclient
#define    CCI_Initserver     CCI_ASYNC_Initserver
#define    CCI_Query	      CCI_ASYNC_Query
#define    CCI_Receive	      CCI_ASYNC_Receive
#define    CCI_Receiveall     CCI_ASYNC_Receiveall
#define    CCI_Resumeclient   CCI_ASYNC_Resumeclient
#define    CCI_Resumeserver   CCI_ASYNC_Resumeserver
#define    CCI_Send           CCI_ASYNC_Send
#define    CCI_Suspendclient  CCI_ASYNC_Suspendclient
#define    CCI_Suspendserver  CCI_ASYNC_Suspendserver
#define    CCI_Transact       CCI_ASYNC_Transact
#define    CCI_Wait           CCI_ASYNC_Wait
#define    CCI_Trace	      CCI_ASYNC_Trace
#define    CCI_Timeout	      CCI_ASYNC_Timeout
#endif

#ifdef NAMP
#define    CCI_Closeclient    CCI_NAMP_Closeclient
#define    CCI_Closeserver    CCI_NAMP_Closeserver
#define    CCI_Connect	      CCI_NAMP_Connect
#define    CCI_Geterror       CCI_NAMP_Geterror
#define    CCI_Hangup	      CCI_NAMP_Hangup
#define    CCI_Initclient     CCI_NAMP_Initclient
#define    CCI_Initserver     CCI_NAMP_Initserver
#define    CCI_Query	      CCI_NAMP_Query
#define    CCI_Receive	      CCI_NAMP_Receive
#define    CCI_Receiveall     CCI_NAMP_Receiveall
#define    CCI_Resumeclient   CCI_NAMP_Resumeclient
#define    CCI_Resumeserver   CCI_NAMP_Resumeserver
#define    CCI_Send	          CCI_NAMP_Send
#define    CCI_Suspendclient  CCI_NAMP_Suspendclient
#define    CCI_Suspendserver  CCI_NAMP_Suspendserver
#define    CCI_Transact       CCI_NAMP_Transact
#define    CCI_Wait           CCI_NAMP_Wait
#define    CCI_Trace	      CCI_NAMP_Trace
#define    CCI_Timeout	      CCI_NAMP_Timeout
#endif

#ifdef NAMPU
#define    CCI_Closeclient    CCI_NAMPU_Closeclient
#define    CCI_Closeserver    CCI_NAMPU_Closeserver
#define    CCI_Connect	      CCI_NAMPU_Connect
#define    CCI_Geterror       CCI_NAMPU_Geterror
#define    CCI_Hangup	      CCI_NAMPU_Hangup
#define    CCI_Initclient     CCI_NAMPU_Initclient
#define    CCI_Initserver     CCI_NAMPU_Initserver
#define    CCI_Query	      CCI_NAMPU_Query
#define    CCI_Receive	      CCI_NAMPU_Receive
#define    CCI_Receiveall     CCI_NAMPU_Receiveall
#define    CCI_Resumeclient   CCI_NAMPU_Resumeclient
#define    CCI_Resumeserver   CCI_NAMPU_Resumeserver
#define    CCI_Send           CCI_NAMPU_Send
#define    CCI_Suspendclient  CCI_NAMPU_Suspendclient
#define    CCI_Suspendserver  CCI_NAMPU_Suspendserver
#define    CCI_Transact       CCI_NAMPU_Transact
#define    CCI_Wait           CCI_NAMPU_Wait
#define    CCI_Trace	      CCI_NAMPU_Trace
#define    CCI_Timeout	      CCI_NAMPU_Timeout
#define    CCI_GeterrorEx     CCI_NAMPU_GeterrorEx
#define    CCI_Option	      CCI_NAMPU_Option
#endif

#ifdef NETB
#define    CCI_Closeclient    CCI_NETB_Closeclient
#define    CCI_Closeserver    CCI_NETB_Closeserver
#define    CCI_Connect	      CCI_NETB_Connect
#define    CCI_Geterror       CCI_NETB_Geterror
#define    CCI_Hangup	      CCI_NETB_Hangup
#define    CCI_Initclient     CCI_NETB_Initclient
#define    CCI_Initserver     CCI_NETB_Initserver
#define    CCI_Query	      CCI_NETB_Query
#define    CCI_Receive	      CCI_NETB_Receive
#define    CCI_Receiveall     CCI_NETB_Receiveall
#define    CCI_Resumeclient   CCI_NETB_Resumeclient
#define    CCI_Resumeserver   CCI_NETB_Resumeserver
#define    CCI_Send           CCI_NETB_Send
#define    CCI_Suspendclient  CCI_NETB_Suspendclient
#define    CCI_Suspendserver  CCI_NETB_Suspendserver
#define    CCI_Transact       CCI_NETB_Transact
#define    CCI_Wait           CCI_NETB_Wait
#define    CCI_Trace	      CCI_NETB_Trace
#define    CCI_Timeout	      CCI_NETB_Timeout
#endif

#ifdef APPC
#define    CCI_Closeclient    CCI_APPC_Closeclient
#define    CCI_Closeserver    CCI_APPC_Closeserver
#define    CCI_Connect	      CCI_APPC_Connect
#define    CCI_Geterror       CCI_APPC_Geterror
#define    CCI_Hangup	      CCI_APPC_Hangup
#define    CCI_Initclient     CCI_APPC_Initclient
#define    CCI_Initserver     CCI_APPC_Initserver
#define    CCI_Query	      CCI_APPC_Query
#define    CCI_Receive	      CCI_APPC_Receive
#define    CCI_Receiveall     CCI_APPC_Receiveall
#define    CCI_Resumeclient   CCI_APPC_Resumeclient
#define    CCI_Resumeserver   CCI_APPC_Resumeserver
#define    CCI_Send           CCI_APPC_Send
#define    CCI_Suspendclient  CCI_APPC_Suspendclient
#define    CCI_Suspendserver  CCI_APPC_Suspendserver
#define    CCI_Transact       CCI_APPC_Transact
#define    CCI_Wait           CCI_APPC_Wait
#define    CCI_Trace	      CCI_APPC_Trace
#define    CCI_Timeout	      CCI_APPC_Timeout
#endif

#ifdef LU2
#define    CCI_Closeclient    CCI_LU2_Closeclient
#define    CCI_Closeserver    CCI_LU2_Closeserver
#define    CCI_Connect	      CCI_LU2_Connect
#define    CCI_Geterror       CCI_LU2_Geterror
#define    CCI_Hangup	      CCI_LU2_Hangup
#define    CCI_Initclient     CCI_LU2_Initclient
#define    CCI_Initserver     CCI_LU2_Initserver
#define    CCI_Query	      CCI_LU2_Query
#define    CCI_Receive	      CCI_LU2_Receive
#define    CCI_Receiveall     CCI_LU2_Receiveall
#define    CCI_Resumeclient   CCI_LU2_Resumeclient
#define    CCI_Resumeserver   CCI_LU2_Resumeserver
#define    CCI_Send           CCI_LU2_Send
#define    CCI_Suspendclient  CCI_LU2_Suspendclient
#define    CCI_Suspendserver  CCI_LU2_Suspendserver
#define    CCI_Transact       CCI_LU2_Transact
#define    CCI_Wait           CCI_LU2_Wait
#define    CCI_Trace	      CCI_LU2_Trace
#define    CCI_Timeout	      CCI_LU2_Timeout
#endif

#ifdef SMEM
#define    CCI_Closeclient    CCI_SMEM_Closeclient
#define    CCI_Closeserver    CCI_SMEM_Closeserver
#define    CCI_Connect	      CCI_SMEM_Connect
#define    CCI_Geterror       CCI_SMEM_Geterror
#define    CCI_Hangup	      CCI_SMEM_Hangup
#define    CCI_Initclient     CCI_SMEM_Initclient
#define    CCI_Initserver     CCI_SMEM_Initserver
#define    CCI_Query	      CCI_SMEM_Query
#define    CCI_Receive	      CCI_SMEM_Receive
#define    CCI_Receiveall     CCI_SMEM_Receiveall
#define    CCI_Resumeclient   CCI_SMEM_Resumeclient
#define    CCI_Resumeserver   CCI_SMEM_Resumeserver
#define    CCI_Send           CCI_SMEM_Send
#define    CCI_Suspendclient  CCI_SMEM_Suspendclient
#define    CCI_Suspendserver  CCI_SMEM_Suspendserver
#define    CCI_Transact       CCI_SMEM_Transact
#define    CCI_Wait           CCI_SMEM_Wait
#define    CCI_Trace	      CCI_SMEM_Trace
#define    CCI_Timeout	      CCI_SMEM_Timeout
#define    CCI_GeterrorEx     CCI_SMEM_GeterrorEx
#define    CCI_Option	      CCI_SMEM_Option
#endif

/****************************************************************************
    Linkage for external variables will be C naming mode, even if we're being
    compiled by a C++ compiler.
****************************************************************************/
#ifndef MF_EXTERNC
# if defined( __cplusplus ) 
#  define MF_EXTERNC extern "C"
# else
#  define MF_EXTERNC
# endif
#endif

/* specify special system call conventions */
#if defined(WIN32) || defined(WIN64)
#   include <windows.h>
#   include <windowsx.h>
#endif

/* no special call convention specified, use system default */
#ifndef CCICALLTYPE
#   define CCICALLTYPE	 
#endif

/* no special return type specified, use default */
#ifndef RETTYPE
#   define RETTYPE int
#endif

#ifndef CALLBACK
# if defined(WIN) || defined(WIN32) || defined(WIN64)
    /* Windows specific call convention */
#   define CALLBACK CALLBACK
# else
    /* no special type for call-back functions, use system default */
#   define CALLBACK
# endif
#endif

#ifdef UNIX
#include "mf_types.h" /* standard Micro Focus type definitions
				   used to enhance portability, this file is shipped 
				   with OCDS,and SX products from Micro Focus */

#include "cbltypes.h"		/* new style Micro Focus type definitions */
#ifndef _GP_TYPES           /* protect against possible multiple definitions */
typedef cbl_os_size_t  mf_os_size;
typedef cbl_os_ssize_t mf_os_ssize;
#endif

#else
  /* only create types if mf_types.h and pc_rts.h have not been included */
# if !defined MF_TYPES && !defined PC_TYPES_H
typedef unsigned char  mf_uns8;
typedef unsigned short mf_uns16;
typedef unsigned long  mf_uns32;
typedef size_t         mf_os_size;
typedef char           mf_s8;
typedef short          mf_s16;
typedef long           mf_s32;
typedef long           mf_os_ssize;
# endif
#endif


#if defined(PROTO) || defined(__STDC__)
#include "ccipack1.h"                                                 
/*****************************************************************************/
/*     Structure for ANSI CCI routines jump table                            */
/*****************************************************************************/
struct JMPTAB
{
    RETTYPE (CCICALLTYPE *JMP_Initserver)	(char *,
 					 mf_os_size *,
 					 mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Closeserver)	(mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Initclient)	(char *,
 					 char *,
 					 mf_os_size *,
 					 mf_os_ssize *,
 					 mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Closeclient)	(mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Hangup)	(mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Send)	(mf_os_size *,
 					 char *,
 					 mf_os_size *,
 					 mf_os_ssize *,
 					 mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Receive)	(mf_os_size *,
 					 char *,
 					 mf_os_size *,
 					 mf_os_size *,
 					 mf_os_ssize *,
 					 mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Receiveall)	(mf_os_size *,
 					 mf_os_size *,
 					 char *,
 					 mf_os_size *,
 					 mf_os_size *,
 					 mf_os_ssize *,
 					 mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Transact)	(mf_os_size *,
 					 char *,
 					 mf_os_size *,
 					 mf_os_size *,
 					 mf_os_size *,
 					 mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Connect)	(mf_os_size *,
 					 mf_os_size *,
 					 mf_os_ssize *,
 					 mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Wait)	(mf_os_ssize *);

    RETTYPE (CCICALLTYPE *JMP_Query) 	(mf_os_ssize *);
 
    RETTYPE (CCICALLTYPE *JMP_Resumeclient)(mf_os_size *,
 					 mf_os_ssize *,
 					 mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Suspendclient) (mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Resumeserver)(mf_os_size *,
 					 mf_os_ssize *,
 					 mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Suspendserver) (mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Geterror)	(char *,
 					 mf_os_size *,
 					 mf_os_size *);
 
    RETTYPE (CCICALLTYPE *JMP_Trace)	(mf_os_size *,
					 char *,
					 mf_os_size *);
    RETTYPE (CCICALLTYPE *JMP_Timeout)	(mf_os_size *,
					 mf_os_size *);
    RETTYPE (CCICALLTYPE *JMP_GeterrorEx) (void *,             /* MWW 4.21.1 */
                                        char *,
                                        mf_os_size *,
                                        mf_os_size *,
                                        mf_os_size *,
                                        mf_os_size *);
    RETTYPE (CCICALLTYPE *JMP_Option) (void *,             /* MWW 4.21.1 */
                                        mf_os_size *,
                                        mf_os_size *,
                                        void *,
                                        mf_os_size *,
                                        mf_os_size *);
};
 
/*****************************************************************************/
/*     Structure for ANSI CCI signature block                                */
/*****************************************************************************/
struct SIGNATURE
{
    unsigned char   CCIsign[6];
    unsigned char   CCItype[8];
    unsigned char   CCIversn[6];
    struct  JMPTAB *CCItabptr;
};
#include "ccipackn.h"                                                 
                                                          


/*****************************************************************************/
/*     Entry point definitions                                               */
/*     Entry point function prototypes                                       */
/*****************************************************************************/

#if defined(WIN32) && !defined(WIN64)

/* define the real entry points used in 32-bit CCI modules */
MF_EXTERNC RETTYPE CCICALLTYPE CCINP32(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCINU32(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCIIX32(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCINB32(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCIAP32(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCITC32(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCIL232(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCIDE32(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCIAS32(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCISM32(struct SIGNATURE *);

/* re-define existing entry points so you don't have to change code */
#define CCINAMP  	CCINP32
#define CCINAMPU	CCINU32
#define CCIIPX		CCIIX32
#define CCINETB		CCINB32
#define CCIAPPC		CCIAP32
#define CCITCP		CCITC32
#define CCILU2		CCIL232
#define CCIDDE		CCIDE32
#define CCIASYNC	CCIAS32
#define CCISMEM 	CCISM32

#else

/* define CCI entry points 16-bit and UNIX 32-bit */
MF_EXTERNC RETTYPE CCICALLTYPE CCINAMP(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCINAMPU(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCIIPX(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCINETB(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCIAPPC(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCITCP(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCILU2(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCIDDE(struct SIGNATURE *);
MF_EXTERNC RETTYPE CCICALLTYPE CCIASYNC(struct SIGNATURE *);

#endif


MF_EXTERNC RETTYPE CCICALLTYPE CCI_Closeclient    	(mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Closeserver    	(mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Connect        	(mf_os_size *,
                    			mf_os_size *,
                    			mf_os_ssize *,
		    			mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Geterror       	(char *,
                    			mf_os_size *,
                    			mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Hangup         	(mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Initclient     	(char *,
                    			char *,
                    			mf_os_size *,
                    			mf_os_ssize *,
                    			mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Initserver     	(char *,
                    			mf_os_size *,
                    			mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Query          	(mf_os_ssize *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Receive         (mf_os_size *,
                                        char *,
                                        mf_os_size *,
                                        mf_os_size *,
                                        mf_os_ssize *,
                                        mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Receiveall      (mf_os_size *,
                                        mf_os_size *,
                                        char *,
                                        mf_os_size *,
                                        mf_os_size *,
                                        mf_os_ssize *,
					mf_os_size *);

MF_EXTERNC RETTYPE CCICALLTYPE CCI_Resumeclient    (mf_os_size *,
					mf_os_ssize *,
					mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Resumeserver    (mf_os_size *,
					mf_os_ssize *,
					mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Send            (mf_os_size *,
                              		char *,
                              		mf_os_size *,
                              		mf_os_ssize *,
                              		mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Suspendclient  (mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Suspendserver  (mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Transact       (mf_os_size *,
                                        char *,
                                        mf_os_size *,
                                        mf_os_size *,
                                        mf_os_size *,
                                        mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Wait           (mf_os_ssize *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Timeout	       (mf_os_size *,
                                        mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_GeterrorEx     (void *,
                                        char *,
                                        mf_os_size *,
                                        mf_os_size *,
                                        mf_os_size *,
                                        mf_os_size *);
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Option         (void *,
                                        mf_os_size *,
                                        mf_os_size *,
                                        void *,
                                        mf_os_size *,
                                        mf_os_size *);
 
#else /* NON-ANSI type definitions from here downwards */

/*****************************************************************************/
/*     Entry point definitions                                               */
/*****************************************************************************/

#if defined(WIN32) && !defined(WIN64)

/* define the real entry points used in 32-bit CCI modules */
MF_EXTERNC RETTYPE CCICALLTYPE CCINU32();
MF_EXTERNC RETTYPE CCICALLTYPE CCIIX32();
MF_EXTERNC RETTYPE CCICALLTYPE CCINB32();
MF_EXTERNC RETTYPE CCICALLTYPE CCIAP32();
MF_EXTERNC RETTYPE CCICALLTYPE CCITC32();
MF_EXTERNC RETTYPE CCICALLTYPE CCIL232();
MF_EXTERNC RETTYPE CCICALLTYPE CCIDE32();
MF_EXTERNC RETTYPE CCICALLTYPE CCIAS32();
MF_EXTERNC RETTYPE CCICALLTYPE CCISM32();

/* re-define existing entry points so you don't have to change code */
#define CCINAMP  	CCINP32
#define CCINAMPU	CCINU32
#define CCIIPX		CCIIX32
#define CCINETB		CCINB32
#define CCIAPPC		CCIAP32
#define CCITCP		CCITC32
#define CCILU2		CCIL232
#define CCIDDE		CCIDE32
#define CCIASYNC	CCIAS32
#define CCISMEM	    CCISM32

#else

/* define CCI entry points all 16-bit and UNIX (TCP & NAMPU only) products */
MF_EXTERNC RETTYPE CCICALLTYPE CCINAMP();
MF_EXTERNC RETTYPE CCICALLTYPE CCINAMPU();
MF_EXTERNC RETTYPE CCICALLTYPE CCIIPX();
MF_EXTERNC RETTYPE CCICALLTYPE CCINETB();
MF_EXTERNC RETTYPE CCICALLTYPE CCIAPPC();
MF_EXTERNC RETTYPE CCICALLTYPE CCITCP();
MF_EXTERNC RETTYPE CCICALLTYPE CCILU2();
MF_EXTERNC RETTYPE CCICALLTYPE CCIDDE();
MF_EXTERNC RETTYPE CCICALLTYPE CCIASYNC();
MF_EXTERNC RETTYPE CCICALLTYPE CCISMEM();

#endif


MF_EXTERNC RETTYPE CCICALLTYPE CCI_Closeclient();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Closeserver();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Connect();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Geterror();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Hangup();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Initclient();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Initserver();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Query();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Receive();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Receiveall();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Resumeclient();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Resumeserver();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Send();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Suspendclient();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Suspendserver();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Transact();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Wait();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Timeout();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_GeterrorEx();
MF_EXTERNC RETTYPE CCICALLTYPE CCI_Option();
 
/* pack the following structures down to single byte level to match ccifrnt.c*/
#include "ccipack1.h"                                            

/*****************************************************************************/
/*     Structure for NON-ANSI CCI routines function pointer table            */
/*****************************************************************************/
struct JMPTAB 
{
    RETTYPE (CCICALLTYPE *JMP_Initserver)();
    RETTYPE (CCICALLTYPE *JMP_Closeserver)();
    RETTYPE (CCICALLTYPE *JMP_Initclient)();
    RETTYPE (CCICALLTYPE *JMP_Closeclient)();
    RETTYPE (CCICALLTYPE *JMP_Hangup)();
    RETTYPE (CCICALLTYPE *JMP_Send)();
    RETTYPE (CCICALLTYPE *JMP_Receive)();
    RETTYPE (CCICALLTYPE *JMP_Receiveall)();
    RETTYPE (CCICALLTYPE *JMP_Transact)();
    RETTYPE (CCICALLTYPE *JMP_Connect)();
    RETTYPE (CCICALLTYPE *JMP_Wait)();
    RETTYPE (CCICALLTYPE *JMP_Query)();
    RETTYPE (CCICALLTYPE *JMP_Resumeclient)();
    RETTYPE (CCICALLTYPE *JMP_Suspendclient)();
    RETTYPE (CCICALLTYPE *JMP_Resumeserver)();
    RETTYPE (CCICALLTYPE *JMP_Suspendserver)();
    RETTYPE (CCICALLTYPE *JMP_Geterror)();
    RETTYPE (CCICALLTYPE *JMP_Trace)();
    RETTYPE (CCICALLTYPE *JMP_Timeout)();
    RETTYPE (CCICALLTYPE *JMP_GeterrorEx)();
    RETTYPE (CCICALLTYPE *JMP_Option)();
};

/*****************************************************************************/
/*     Structure for ANSI CCI signature block				     */
/*****************************************************************************/
struct SIGNATURE
{
    unsigned char   CCIsign[6];
    unsigned char   CCItype[8];
    unsigned char   CCIversn[6];
    struct  JMPTAB *CCItabptr;
};
#endif

/* use default packing from here onwards */
#include "ccipackn.h"                   


/*****************************************************************************/
/*     Definitions and Option structures for CCI-Option                      */
/*     THESE MUST MATCH THE DEFINITIONS IN cci_enum.h!                       */
/*****************************************************************************/

/* Options Definitions :- Options that affect session or server handles */
#define CCI_OPT_SHUTDOWN_SERVER    1 /* Shut down this server so it can't */
                                     /* receive new conversations, but don't */
                                     /* kill existing sessions (as           */
                                     /* closeserver does). */
#define CCI_OPT_ALLOW_RECEIVEANY   2
#define CCI_OPT_CLOSE_NEGOTIATE    3

/* CCI_OPT_HANDLE_TIMEOUT Sets the timeout period to be used by all CCI 
functions using the handle.

If the handle is a server handles, all new child sessions created after this 
option setting is performed will inherit the new value.
                                        
Values are tenths of seconds.

Value of zero "0" means use the global setting again.

The settings created using this option override those set globally
using CCI_Timeout, pre-registration options or CCI_OPT_HANDLE_TIMEOUT.

If being used on a server handle this value will take precedence over the 
global timeoutsetting, but not over settings within a specific child 
session handle.

i.e A Receiveall call will check the serverhandle timeout setting, and use
it if present. If not it will use the global setting.  A Receive call will 
check the session then the parent serverhandle (if it exists) then the 
global setting and will use the first value that it finds.

Also see CCI_OPT_GLOBAL_TIMEOUT below */

#define CCI_OPT_HANDLE_TIMEOUT     4 

/* OPTIONS from 100 to 200 do not require that handle be a valid incoming param*/
/* CCI_OPTION_SET equates to CCI_OPTION_DO within the FFAILURE options group */
/* Toggle switches in this section use mf_os_size flags.                     */                  
#define CCI_OPT_NOHND_MIN          100 /* Marker: start of no-handle-required*
                                        * range.                             */
#define CCI_OPT_FFAILURE_ACTIVE    100 /* Data is  mf_os_size,0="off",1="on".*/
#define CCI_OPT_FFAILURE_LOCATION  101 /* Data is a char* holding the        *
                                        * directory and/or log filename.     *
                                        * When using CCI_OPTION_GET the      *
                                        * incoming datalen holds the maximum *
                                        * size of the path to be returned in *
                                        * *data.                             */
#define CCI_OPT_PARAM_CHECK        102 /* Toggle CCI handle checking where   *
                                        * Data is mf_os_size,0="off",1="on". */
#define CCI_OPT_GLOBAL_TIMEOUT     103 /* Set the global timeout period to be 
                                          used by all CCI sessions in this 
                                          application memory space. 
                                          
                                          Values are tenths of seconds.

                                          Specific settings created using 
                                            CCI_OPT_HANDLE_TIMEOUT 
                                          override thie global setting. */
#define CCI_OPT_SERVER_PARMS       123 /* Get/Set of basic options to map to a pubname to pass to Initserver */
#define CCI_OPT_CLIENT_PARMS       124 /* Get/Set of basic options to map to a pubname to pass to Initclient */
#define CCI_OPT_SSL_SERVER         125 /* Get/Set of options including SSL info, to map to a pubname to pass to Initserver */
#define CCI_OPT_SSL_CLIENT         126 /* Get/Set of options including SSL info, to map to a pubname to pass to Initclient */

/* the following expect that "*data" is an mf_s32, unless otherwise noted */

#define CCI_OPT_SSL_MIN_KEY_LENGTH              130 /* allows negotiation of keys of at least this length */
#define CCI_OPT_SSL_MAX_KEY_LENGTH              131 /* allows negotiation of keys up to this length and no more */
#define CCI_OPT_SSL_ALLOW_NULL_CIPHER           132 /* allows simple connections */
#define CCI_OPT_SSL_ALLOW_CN_IP_MISSMATCH       133 /* check/don't-check for destination IP address against Common Name as stated in the Peer Cert: default to ON. */
#define CCI_OPT_SSL_CHECK_CERT_REVOCATION       134 /* check/don't-check for certificate revocation in the revocation list held by the issuing server, MS defaults to OFF, so do we */
#define CCI_OPT_SSL_CHECK_CERT_PUBLISHERS_REVOCATION 135  /* check for certificate revocation with the cerficate publishers revocation list MS defaults to ON, so do we */
#define CCI_OPT_SSL_USE_OCSP                    136 /* use online OCSP server to check certificate veracity */
#define CCI_OPT_SSL_USE_SSL2                    137 /* USE SSL v2.0 protocols, default to ON */
#define CCI_OPT_SSL_USE_SSL3                    138 /* USE SSL v3.0 protocols, default to ON */
#define CCI_OPT_SSL_USE_TLS1                    139 /* USE TLS v1.n (SSL v3.1) protocols, default to ON */
#define CCI_OPT_SSL_RESERVED0                   140 /* Internal diagnostic option */
#define CCI_OPT_SSL_PEER_CERT                   141 /* "*data" is an x509v3 structure, Generic read/field flag for examining peer certificates, see tchandle.h for extended options */
#define CCI_OPT_SSL_CERT                        142 /* "*data" is an x509v3 structure, Generic read/field flag for examining local certificates, see tchandle.h for extended options */
#define CCI_OPT_SSL_CHAIN_CERTS                 143 /* enable certificate chaining for local services checks */
#define CCI_OPT_SSL_CERT_CHAIN_ADD              144 /* "*data" is an x509v3 structure, add certificate to chain for a given service */
#define CCI_OPT_SSL_CERT_CHAIN_REMOVE           145 /* "*data" is an x509v3 structure, remove certificate from chain for a given service */
#define CCI_OPT_SSL_CERTFILE_LOCATION           146 /* set directory containing certificate files */
#define CCI_OPT_SSL_REQUIRE_CLIENT_CERT         147 /* Servers can set this to only allow certificated clients to connect */
#define CCI_OPT_SSL_OCSP_SERVER                 148 /* "*data" is an NULL terminated string naming an OCSP server location or type to use */
#define CCI_OPT_SSL_ALLOW_DATE_MISSMATCH        149 /* Allow out of date certificates. Acceptable range is given in "data". 0 is zero tolerance. */
#define CCI_OPT_SSL_ALLOW_CIPHERS               150 /* Apply cipher usage matrix defined in tchandle.h */
    /*
              #define  SSL_cipher_all      -1
              #define  SSL_cipher_blowfish 1
              #define  SSL_cipher_cast     2
              #define  SSL_cipher_des(3)   4
              #define  SSL_cipher_idea     8
              #define  SSL_cipher_rc2      16
              #define  SSL_cipher_rc4      32
              #define  SSL_cipher_rc5      64
     */
#define CCI_OPT_SSL_VISUALLY_REPORT_INVALID_CERTS       160 /* Console application only: if available display which certificate checks have failed, and why */
#define CCI_OPT_SSL_VISUALLY_DISPLAY_CIPHER             161 /* Console application only: display selected cipher information. */
#define CCI_OPT_SSL_VISUALLY_DISPLAY_CERT               162 /* Display the peer certificate to a pop-up or the console */
#define CCI_OPT_SSL_VISUALLY_DISPLAY_CONNECTION_DETAILS 163 /* Display connection stages as they are performed */
#define CCI_OPT_SSL_ENABLE_ALL_VISUAL_OUTPUT            169 /* switch on all diagnostic display options */

#define CCI_OPT_SSL_RESERVED1                   175 /* Internal diagnostic option */
#define CCI_OPT_SSL_RESERVED2                   176 /* Internal diagnostic option */
#define CCI_OPT_SSL_RESERVED3                   177 /* Internal diagnostic option */
                                                    /* The next set of options use a settings data structure defined 
                                                       in tchandle.h that is passed as the *Data area */

/* CCI OPTIONS and SSL publicname and machinename usage - special notes:
                                       
 * When using CCI_OPT_SERVER_PARMS or CCI_OPT_CLIENT_PARMS a unique Storage ID 
   string is returned into "CCI_info.RetName" if the call is successful, and 
   if "data" is large enough to hold the value.  This Storage ID is a null 
   terminated string.
   
   Present this ID as the "ServerName" to CCI_Initsever or CCI_Initclient 
   as relevant, or as the first element of "data" to CCI_Options when altering 
   the selection values. The format of the string will be "MFNAME:<IDTag>:" in 
   all these cases.

 * Options for the use of the client or server parameter flags are as follows:-

   "datalen" 
   
     ENTRY: The numeric length of the string in "data" including the terminator.

   "data" 
   
     ENTRY: A NULL terminated string format consisting of one or more of the following
        elements:-

        MFNAME:<name of server, or Storage ID if not initial call>,
        MFPORT:<TCP/IP port of listening server>,
        MFNODE:<TCP/IP node name (or dotted decimal address) of server>,
        MFCONN:SSL:<CArootfile>:<certfile>:<certpass>:<keyfile>:<keypass>
        SSL:sub-list of <OptionName:<value>> 

     EXIT: A NULL terminated string consisting of the following elements:-
        
        MFNAME:<Storage ID>

 * SSL sub-options

   If "handle" is valid these are applied to the existing session or server
   handle where relevant.

   The SSL sub-list consists of the complete SSL options definition names, less
   "CCI_OPT_SSL_". So "CCI_OPT_SSL_CERTFILE_LOCATION" becomes "CERTFILE_LOCATION"

  e.g. "SSL:CERTFILE_LOCATION:file location string,USE_SSL2:1, USE_SSL3:1"

   notice that the switch parameters are the text representation of the same switch
   parameter if it had been passed as an option definition in the other section of the 
   CCI_Option interface.

 * CCI_OPT_SSL_SERVER AND CCI_OPT_SSL_CLIENT act upon defined SSL 
   initialisation strings to create a new SSL config as follows:-
   
   "data" is a pointer to the following stucture, "datalen" is the length of 
   the structure in bytes...

  NOTE regarding CCI_SSL_info content: 
  
  All "char *" entries are pointers to null terminated strings.

  All parameters passed with NULL content will be ignored.
  
  Filenames and directory names support standard long and/or spacey naming 
  conventions providing the delimiter '"' is used to encapsulate spaces.

  To support existing CCI syntax Publicname and Machinename can be null OR
  space terminated. 

  The following file type definitions are used to tell CCI which type of file
is being used to pass certificate details to the CCI SSL layers. */

#define  CCISSL_FILE_PEM 0    /* .PEM - possibly more than one cert' */
#define  CCISSL_FILE_DER 1    /* .DER - single cert' only */
#define  CCISSL_FILE_P7  2    /* .P7x - PKCS#7 encrypted cert file, pos' more than one cert */
#define  CCISSL_FILE_RSA 3    /* .RSA - RSA special file type */
#define  CCISSL_FILE_DSA 4    /* .DSA - DSA special file type */
#define  CCISSL_FILE_RAW 5    /* .RAW - plain data */
#define  CCISSL_FILE_RESV 6   /* reserved for future use. */
#define  CCISSL_FILE_X509MEM 10  /* X509V3 structured memory pointer in named
                                 string location instead of file or directory
                                 name string pointer. */

/* x509v3 Extension Names

  Extensions to the x509v3 certificate structure are usually used to hold specialised
  descriptive data regarding the object being certified. 

  Normal TCP services are secured using DNS Fully Qualified Domain Names (FQDN)
  or IP addreses held in dotted decimal number form.

  Other options for extension types exist. 

  For future reference the following definitions describe the most common 
  formats, at this release only the GEN_DNS variant is supported with wildcards
  all other formats must be a perfect match with no wildcards... */

#define  GEN_OTHERNAME 0
#define  GEN_EMAIL     1
#define  GEN_DNS       2
#define  GEN_X400      3
#define  GEN_DIRNAME   4
#define  GEN_EDIPARTY  5
#define  GEN_URI       6
#define  GEN_IPADD     7
#define  GEN_RID       8

/* all extension types other than GEN_DNS must present a length to be used to 
delimit checking in the CERTn_String_len field or no check will be performed */

/* Verification callback reason code definitions */

#define  X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2
            /* unable to get issuer certificate
               the issuer certificate could not be found: this occurs if the 
               issuer certificate of an untrusted certificate cannot be found*/
#define  X509_V_ERR_UNABLE_TO_GET_CRL 3 
            /* unable to get certificate CRL
               the CRL of a certificate could not be found. Unused. */
#define  X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 
            /* unable to decrypt certificate's signature
               the certificate signature could not be decrypted. This means 
               that the actual signature value could not be determined rather
               than it not matching the expected value, this is only 
               meaningful for RSA keys. */
#define  X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 
            /* unable to decrypt CRL's signature
               the CRL signature could not be decrypted: this means that the 
               actual signature value could not be determined rather than it 
               not matching the expected value. Unused. */
#define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 
            /* unable to decode issuer public key 
               the public key in the certificate SubjectPublicKeyInfo could 
               not be read. */
#define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 
            /* certificate signature failure
               the signature of the certificate is invalid. */
#define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 
            /* CRL signature failure
               the signature of the certificate is invalid. Unused. */
#define X509_V_ERR_CERT_NOT_YET_VALID  9
            /* certificate is not yet valid
               the certificate is not yet valid: the notBefore date is after 
               the current time. 
               See option SSL_CERT_OOD_OK  */
#define X509_V_ERR_CERT_HAS_EXPIRED 10 
            /* certificate has expired
               the certificate has expired: that is the notAfter date is 
               before the current time.
               See option SSL_CERT_OOD_OK  */
#define X509_V_ERR_CRL_NOT_YET_VALID 11 
            /* CRL is not yet valid
               the CRL is not yet valid. Unused. 
               See option SSL_CERT_OOD_OK  */
#define X509_V_ERR_CRL_HAS_EXPIRED 12
            /* CRL has expired
               the CRL has expired. Unused. 
              See option SSL_CERT_OOD_OK  */
#define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 
            /* format error in certificate's notBefore field
               the certificate notBefore field contains an invalid time. */
#define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 
            /* format error in certificate's notAfter field
               the certificate notAfter field contains an invalid time. */
#define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 
            /* format error in CRL's lastUpdate field
               the CRL lastUpdate field contains an invalid time. Unused. */
#define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 
            /* format error in CRL's nextUpdate field
               the CRL nextUpdate field contains an invalid time. Unused. */
#define X509_V_ERR_OUT_OF_MEM 17
            /* out of memory
               an error occurred trying to allocate memory. This should 
               never happen. */
#define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 
            /* self signed certificate
               the passed certificate is self signed and the same certificate 
               cannot be found in the list of trusted certificates. */
#define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19
            /* self signed certificate in certificate chain
               the certificate chain could be built up using the untrusted 
               certificates but the root could not be found locally. */
#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 
            /* unable to get local issuer certificate
               the issuer certificate of a locally looked up certificate 
               could not be found. This normally means the list of trusted 
               certificates is not complete. */
#define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21
            /* unable to verify the first certificate
               no signatures could be verified because the chain contains 
               only one certificate and it is not self signed. */
#define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 
            /* certificate chain too long
               the certificate chain length is greater than the supplied 
               maximum depth. Unused. */
#define X509_V_ERR_CERT_REVOKED 23
            /* certificate revoked
               the certificate has been revoked. Unused. */
#define X509_V_ERR_INVALID_CA 24
            /* invalid CA certificate
               a CA certificate is invalid. Either it is not a CA or its 
               extensions are not consistent with the supplied purpose. */
#define X509_V_ERR_PATH_LENGTH_EXCEEDED 25
            /* path length constraint exceeded
               the basicConstraints pathlength parameter has been exceeded. */
#define X509_V_ERR_INVALID_PURPOSE 26
            /* unsupported certificate purpose
               the supplied certificate cannot be used for the specified 
               purpose. */
#define X509_V_ERR_CERT_UNTRUSTED 27
            /* certificate not trusted
               the root CA is not marked as trusted for the specified purpose*/
#define X509_V_ERR_CERT_REJECTED 28
            /* certificate rejected
               the root CA is marked to reject the specified purpose. */
#define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29
            /* subject issuer mismatch
               the current candidate issuer certificate was rejected because 
               its subject name did not match the issuer name of the current 
               certificate. 
               Only displayed when the -issuer_checks option is set. */
#define X509_V_ERR_AKID_SKID_MISMATCH 30
            /* authority and subject key identifier mismatch
               the current candidate issuer certificate was rejected because 
               its subject key identifier was present and did not match the 
               authority key identifier current certificate. 
               Only displayed when the -issuer_checks option is set. */
#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31
            /* authority and issuer serial number mismatch 
               the current candidate issuer certificate was rejected because 
               its issuer name and serial number was present and did not 
               match the authority key identifier of the current certificate. 
               Only displayed when the -issuer_checks option is set. */
#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32
            /* key usage does not include certificate signing:
               the current candidate issuer certificate was rejected because
               its keyUsage extension does not permit certificate signing.*/
#define X509_V_ERR_APPLICATION_VERIFICATION 50
            /* application verification failure: an application specific 
               error. Unused */
/* End of verification callback reason codes */

  typedef struct CCI_CONFIG_info
  {
    mf_uns32 Version;    /*  This version is 0, if pre-aligned add 1000 to structure version. */
#define OPT_VERSION_BASIC       0
#define OPT_VERSION_BASIC_C     1000
    char * RetName;      /*  Location of 80 char buffer in which to return "MFNAME:<IDnum>" if OK */
    mf_os_size CCIErr;   /*  CCI error value resultant from action */
    mf_os_size ExtError; /*  Detailed Error describing "Error" cause */
    mf_os_size IntErr;   /* Internal error; if known */
    mf_os_size SysErr;   /*  System error - if available */
    mf_os_size ErrorLoc; /*  Location of error detection - if available. */
    char * ErrText;      /*  User allocated are that can be used to hold error messages
                             associated with ExtError. After failing call this will
                             contain a null terminated string describing the error
                             at the lowest level of information available. */
    mf_os_size ErrTextLen; /*  In: Maximum size available for message in "ErrText" */
                         /*  Out: Length of text in ErrText if any present else zero */
    char * Publicname;   /*  This must be a unique ID, pass this string in 
                             the "Publicname" parameter to Initclient or 
                             Initserver later to allow CCI to pickup and use
                             these details. MAX 128 chars  */
    char * Machinename;  /*  Server's listening node location. MAX 128 chars  */

    /* NOTE: elements found below this point override elements that may be included
             in Publicname and/or Machinename. */
    mf_uns32 ConnType;   /* Endpoint type, one of the following definitions */
#    define OPT_CONN_TYPE_CCI     0 /* Normal CCI with CCI headers */
#    define OPT_CONN_TYPE_RAWIP   1 /* Raw TCP/IP (,MFDIRECT) flows. */
                       /* the following are only available if SSL is enabled */
#    define OPT_CONN_TYPE_CCI_SSL 3 /* Normal CCI protected by SSL - see SSL type */
#    define OPT_CONN_TYPE_RAW_SSL 4 /* RAW TCP/IP protected by SSL - see SSL type */

    void * NodeAddr;     /*  listening address, if required. see NodeAddrType for description. */
    mf_s32 NodeAddrType; /*  Address of local or remote endpoint determined by context
                           i.e. CLIENT (remote) or SERVER (local). Overrides content of 
                           Publicname or Machinename above. */
#    define OPT_ADDR_TYPE_RAWIP4  1 /* network byte order node address IPV4 4 bytes */
#    define OPT_ADDR_TYPE_RAWIP6  2 /* network byte order node address IPV6 16 bytes */
#    define OPT_ADDR_TYPE_DNS     3 /* Null terminated network DNS or Dotted Decimal format name */
#    define OPT_ADDR_TYPE_CCINODE 4 /* CCI format "MFNODE:[address]" Null terminated string */

    void * Port;         /*   CCITCP only, Pointer to IP "port" value. */
    mf_s32 PortType;     /*   CCITCP only, describes "Port" content. */
#    define OPT_PORT_TYPE_NUMERIC    1 /* Ptr to machine byte order numeric value 2 bytes */
#    define OPT_PORT_TYPE_CCISTRING  2 /* Ptr to CCI format either a 
                                           "MFPORT:[port_number or alias name]" 
                                       or 
                                            "[port number or alias name]"
                                       null terminated string e.g. 
                                           "MFPORT:mfcobol" or "mfcobol" or "633" */

     /* NOTE: structure "basic" CCI structure version "0" above here. 
     If using the following entries set structure version to SSL. */
#    define OPT_VERSION_SSL    1
#    define OPT_VERSION_SSL_C  1001
    char * CArootfile;   /* Client Required; Server Optional;
                            CA root authentification certificate location. These
                            certs will be used to verify authenticity of peer
                            certificates. This can be a directory with 
                            multiple certs to handle a variety of connections, 
                            or this can be a single file.*/
    mf_uns32 CArootfileType; /* Client Required; Server Optional;
                           Valid types are PEM, DER, P7. */
    char * Certfile;     /*  Server Required; Client Optional;
                            Location of identifying certificate file for this
                            endpoint. */
    mf_uns32 CertfileType; /* Server Required; Client Optional;
                           Valid types are PEM, DER, P7, RSA. RAW (extremely 
                           rare).
                           If Certfile is a memory pointer to an X5909 structure add 10, 
                            e.g. memory ptr to X509 in PEM format == 10. 
                            e.g  memory ptr to plain X509v3 structure == 14 */
    mf_s32 CertfileLen;   /* Length of item at *Certfile if memory-based structure
                             otherwise zero */
    char * Certpass;      /* Password for Certfile if required (rare) MAX 128 chars */
    char * Keyfile;       /* Servers Only; Location of key-file relating to Certfile. */
    mf_uns32 KeyfileType; /* Servers Only; see definitions above.
                            Valid types are PEM, DER, P7, RSA. DSA, 
                             RAW (extremely rare) and reserved.
                            If Keyfile is a memory pointer to an structure add 
                            10. Supported structures are DSA, RSA, EVP */
    char * Keypass;       /* Ptr to NULL terminated password string allowing 
                            access to *Keyfile content. MAX 128 chars */
    mf_uns32 Verify_Depth; /* Client Required; Server Optional
                            Maximum number of certificate levels to check, 
                            1 == root only. If the peer certificate doesn't 
                            have as many levels as specified then only those 
                            present will be checked - this is not a failure 
                            mode. */
    mf_uns32 Verify_Peer; /* Server Optional: clients always demand and verify server certificates */
#    define SSL_NO_VERIFY         0 /* Don't verify peer certificates. */
#    define SSL_VERIFY_IF_PRESENT 1 /* Always verify if peer presents certificates.*/
#    define SSL_VERIFY_ALWAYS     2 /* Insist that peer presents certificates and 
                                       fail connections otherwise. */
    mf_uns32  display_options;
#    define SSL_DISPLAY_CIPHER           1 /* CCI_OPT_SSL_VISUALLY_DISPLAY_CIPHER option, true/false, default FALSE */
#    define SSL_DISPLAY_CERT             2 /* Not Currently supported - part of a series of options. */
#    define SSL_DISPLAY_CERT_FAIL_REPORT 4 /* VISUALLY_REPORT_INVALID_CERTS option, true enables reporting */
#    define SSL_DISPLAY_CONNECTION_DETAILS 8 /* visually report connection stages as they are made */
#    define SSL_DISPLAYS_ON     0xffffffff;/* switch on all displays */
/**
NOTES concerning display_options:
   Display options only affect console applications, that is to say those
   started from a command line.

   Display_options equivalents can be set globally outside of the 
   pre-registration methods. Global settings apply to all handles and
   connections created within CCI after the global option has been set.

   If a global setting is made any pre-registration display_option content will 
   override the global settings for the life of the handle being created.

   See the general Options above with "VISUALLY" embedded within them listed
   above which apply outside of specific handles.

   e.g. CCI_OPT_SSL_VISUALLY_REPORT_INVALID_CERTS
 
   In this example we enable displays from CCI indicating certificate checks
   have failed and, if it can be determined from the SSL provider, why the
   failure occurred. This option is the equivalent of using 
   SSL_DISPLAY_CERT_FAIL_REPORT in the pre-registration structure. 
 **/

    mf_uns32  cert_checks;    /* binary mask of certificate checking options */
#    define SSL_CERT_OOD_OK           1 /* Peer CERT out of date range OK */
#    define SSL_CERT_CRL_OOD_OK       2 /* CA  CRL out of date range OK */
#    define SSL_CERT_INVAL_PURPOSE_OK 4 /* Peer CERT isn't a server identifier type cert*/
#    define SSL_CERT_INVAL_KEY_SIGN_OK 8 /* ignore error that key usage doesn't include cert signing */
#    define SSL_CERT_CN_IP_MISS_OK    16 /* allow Common Name and IP address to not match certificate host */
#    define SSL_CERT_FORCE_REVOKE_CHECK 32 /* check server certificate publishers revocation list */
#    define SSL_CERT_FORCE_PUB_REVOKE_CHECK 64 /* check certificate publishers own cert revocation list */
#    define SSL_CERT_NULL_CIPHER_OK   128 /* allow connections using NULL ciphers - silly option is you ask me SPE! */

    char  *DHkeyfile512;   /* ADH 512bit params file name */
    char  *DHkeyfile1024;  /* ADH 1024bit params file name */

    char * OCSPServer;    /* Location of certificate verification server to use
                            if required - format to be decided. */

    /* more than one certificate extension can be presented for verification. 
    If the String_Len value is greater than zero that extension name will be 
    checked. All checks must pass for trust in the peer to be established. */

    mf_s32 CERTX1_type;    /* Optional, 
                              Describes the type of the extension being checked.
                              See "x509v3 Extension Names" above. */
    char * CERTX1_String;    /* Optional,
                              Ptr to NULL terminated string for GEN_DNS, or 
                              other data structure otherwise.
                              NULL if unused.
                              Optional, paired with CERTX1_Ext_Name below,
                              String or structure to be checked against 
                              X509v3 extension field named in 
                              CERTX1_Ext_Name.*/
    mf_s32 CERTX1_String_Len; /* Optional,
                              Zero if unused.
                              If this extension is not of type GEN_DNS this 
                              field contains the length of the structure 
                              being pointed to by CERTX1_String. */
    char * CERTX1_Ext_Name;   /* Optional,
                              Ptr to NULL terminated string.
                              NULL if unused.                              
                              Paired with CERTX1_String above,
                              Short string name describing X509v3 extension field.
                              Content of certificate extension field must match 
                              item located at CERTX1_String if peer verification 
                              will succeed. */

    mf_s32 CERTX2_type;       /* see CERTX1_type. */
    char * CERTX2_String;     /* see CERTX1_String;  */
    mf_s32 CERTX2_String_Len; /* see CERTX1_String_Len */
    char * CERTX2_Ext_Name;   /* see CERTX1_Ext_Name;*/

    mf_s32 CERTX3_type;       /* see CERTX1_type. */
    char * CERTX3_String;     /* see CERTX1_String;  */
    mf_s32 CERTX3_String_Len; /* see CERTX1_String_Len */
    char * CERTX3_Ext_Name;   /* see CERTX1_Ext_Name;*/

    mf_s32 CERTX4_type;       /* see CERTX1_type. */
    char * CERTX4_String;     /* see CERTX1_String;  */
    mf_s32 CERTX4_String_Len; /* see CERTX1_String_Len */
    char * CERTX4_Ext_Name;   /* see CERTX1_Ext_Name;*/

    mf_s32 (*verify_callback)(int ok,              /* status if no action taken */
                          int reason,              /* reason for failure */
                          char *fail_attr,         /* attribute that failed checking */
                          char *comparative_attr); /* epected value. */

  /* NOTE structure version "1" above here. If using the following entries set 
     structure version to "2" or higher. */
#    define OPT_VERSION_XTND1    2
#    define OPT_VERSION_XTND1_C  1002
    mf_os_size CCI_Timeout; /* Timeout value to be used on calls using this server 
                            or client once the InitXXXX has been called.
                            This Handle-based timeout takes precedence over
                            the global timeout set using CCI-Timeout().
                            InitXXXX calls will honour this timeout if possible but
                            InitXXXX calls may apply their own protocol specific
                            timeouts if required. These protocol specific overrides are 
                            documented in the InitXXXX Api documentation as and when 
                            they occur.
                            Units are 1/10ths of seconds */
  } CCI_CONFIG_info;


/* Option actions */
/* These don't overlap with the options themselves to make it easier to detect
   swapped parameters. */
#define CCI_OPTION_SET       1001
#define CCI_OPTION_GET       1002
#define CCI_OPTION_DO        1003
#define CCI_OPTION_REMOVE    1004      /* de-register stored options, pass Storage ID or CCI_SSL_info as relevant */


#endif /* CCI_H */
/** End of source module cci.h **/
