/* Copyright (C) 1994 - 2001 by Telelogic AB.
Copyright (C) 1991, 1992, 1993, 1994 by Telelogic Malmoe AB.
Copyright (C) 1990, 1991, 1999 by Telesoft Europe AB.
This Program is owned by Telelogic and is protected by national
copyright laws and international copyright treaties. Telelogic
grants you the right to use this Program on one computer or in
one local computer network at any one time.
Under this License you may only modify the source code for the purpose
of adapting it to your environment. You must reproduce and include
any copyright and trademark notices on all copies of the source code.
You may not use, copy, merge, modify or transfer the Program except as
provided in this License.
Telelogic does not warrant that the Program will meet your
requirements or that the operation of the Program will be
uninterrupted and error free. You are solely responsible that the
selection of the Program and the modification of the source code
will achieve your intended result and that the results are actually
obtained. */

#ifndef __cucf_er_h
#define __cucf_er_h

/* AZA: To remove CHECK THIS */
/*#ifndef CODER_ERBUF_SIZE
  #define CODER_ERBUF_SIZE 0x1000
  #endif*/

enum {
  er_NoRule        = 0x0000,
/*er_Basic         = 0x0001,*/
/*er_Canonical     = 0x0002,*/
  er_Indefinite    = 0x0004,
  er_Definite      = 0x0008,
  er_NoEndPad      = 0x0010,
  er_Unaligned     = 0x0020,
  er_Aligned       = 0x0040,
  er_UER           = 0x0080,
  er_BER           = 0x0100,
/*er_CER           = 0x0200,*/
/*er_DER           = 0x0400,*/
  er_PER           = 0x0800
};

#if defined(CODER_ER_DEFAULT_PER) && !defined(CODER_REMOVE_PER)
#define CUCF_ER_DEFAULT (er_PER | CUCF_PER_VARIANT)
#elif defined(CODER_ER_DEFAULT_UER) && defined(CODER_USE_UER)
#define CUCF_ER_DEFAULT er_UER
#elif !defined(CODER_REMOVE_BER)
#define CUCF_ER_DEFAULT (er_BER | CUCF_BER_LENGTH)
#else /* no rule */
#define CUCF_ER_DEFAULT er_NoRule
#endif

#if !defined(CODER_REMOVE_BER)

#if defined(CODER_BER_DEFINITE)
#define CUCF_BER_LENGTH er_Definite
#else /* CODER_BER_INDEFINITE */
#define CUCF_BER_LENGTH er_Indefinite
#endif

#endif /* CODER_REMOVE_BER */

#if !defined(CODER_REMOVE_PER)

#if defined(CODER_PER_NO_ENDPAD)
#define CUCF_PER_VARIANT er_NoEndPad
#elif defined(CODER_PER_ALIGNED)
#define CUCF_PER_VARIANT er_Aligned
#else /* CODER_PER_UNALIGNED */
#define CUCF_PER_VARIANT er_Unaligned
#endif

#endif /* CODER_REMOVE_PER */



#ifdef CODER_VMS_SDT
#include "er/ascii/ascii.h"
#endif
#include "er/ber/ber.h"
#include "er/per/per.h"
#ifdef CODER_USE_UER
#include "uer.h"
#endif



#define ASN1_ENCODE(c, type, val) ASN1Encode(c, type, val)
#define ASN1_DECODE(c, type, val) ASN1Decode(c, type, val)

void ERSetRule(tCoder* Coder, unsigned long Rule);
unsigned long ERGetRule(tCoder* Coder);

extern int ASN1Encode(tCoder* Coder, tASN1TypeInfo* Type, void* Val);
extern int ASN1Decode(tCoder* Coder, tASN1TypeInfo* Type, void* Val);

#endif /* __cucf_er_h */
