/*****************************************************************/
/**                                                             **/
/**             (C) Copyright 1992 the Regents of the           **/
/**        University of California.  All Rights Reserved.      **/
/**                                                             **/
/**        This work was produced under the sponsorship of      **/
/**         the U.S. Department of Energy.  The Government      **/
/**                retains certain rights therein.              **/
/**                                                             **/
/**                         Written by                          **/
/**         Distributed Programming Environments Project        **/
/**           Computer Software and Networking Division,        **/
/**                   Livermore Computer Center,                **/
/**            Lawrence Livermore National Laboratory           **/
/**                                                             **/
/*****************************************************************/

// sccsid: @(#)asn1.h	1.4 10/20/92 08:35:47  LLNL 

#ifndef ASN_H
#define ASN_H

#include "list.h"
#include <stdio.h>

class Asn_1: public link

{
public:
   int cl;		// class (0-3)
   int form;		// form (0=primitive, 1=constructed)
   int tag;		// 30 bits

   int length;		// length (-1 if indefinite)
   int definite;	// TRUE is definite, FALSE is indefinite
   
   list *values;
			// values (either of Byte or Asn_1)
   
   Asn_1()
   {
      len_encoded = -1;
      len_header = -1;
   }
   ~Asn_1()
   {}


	// output the encoded form of this type

   void output(FILE *);


	// return the definite encoded length of this value

   int definite_length()
   { return (encoded_length()); }

private:
   int len_encoded,len_header;

	// return the encoded length of this value
   int encoded_length();

	// return the encoded length of this header
   int header_length();   
};

class Byte: public link

{
public:
   int value;

   Byte(unsigned char b)
   { value = b; }
   ~Byte()
   {}
};

#endif
