/* ** @(#) ber.h - (for RDP) ASN.1 BER definitions ** @(#) $Id: ber.h,v 1.6 2003/12/04 11:31:42 lucio Exp $ */ /* ** ================================================================== ** ** $Logfile:$ ** $RCSfile: ber.h,v $ ** $Revision: 1.6 $ ** $Date: 2003/12/04 11:31:42 $ ** $Author: lucio $ ** ** ================================================================== ** ** $Log: ber.h,v $ ** Revision 1.6 2003/12/04 11:31:42 lucio ** Streamlined - specially OID management ** ** Revision 1.5 2003/11/30 19:01:58 lucio ** Advanced - plenty to go still, of course. ** ** Revision 1.4 2003/11/27 18:37:11 lucio ** Checkpoint - some progress with DNs ** ** Revision 1.3 2003/11/25 08:53:26 lucio ** On return from home ** ** Revision 1.2 2003/11/24 17:43:54 lucio ** Checkpoint after some progress ** ** Revision 1.1.1.1 2003/11/10 10:34:00 lucio ** ASN.1 developments. ** ** ================================================================== */ #define BERSZ (256) #define BER_TAG_BOOLEAN (1) #define BER_FALSE (0) #define BER_TRUE (0xFF) #define BER_TAG_INTEGER (2) #define BER_TAG_BITSTRING (3) #define BER_TAG_OCTETSTRING (4) #define BER_TAG_NULL (5) #define BER_TAG_OBJECTID (6) #define BER_TAG_OBJDESC (7) #define BER_TAG_EXTERN (8) #define BER_TAG_INSTANCEOF (8) #define BER_TAG_REAL (9) #define BER_TAG_ENUM (10) #define BER_TAG_SEQUENCE (16) #define BER_TAG_SEQUENCEOF (16) #define BER_TAG_SET (17) #define BER_TAG_SETOF (17) #define BER_TAG_PRINTABLESTRING (19) typedef struct berObj BerObj; struct berObj { int tag, len, size; uchar *buf; BerObj *next, *down, *id; }; #pragma varargck type "I" BerObj * #pragma varargck type "O" BerObj * #pragma varargck type "T" BerObj * int ber_seal (BerObj *); // object creation BerObj *ber_simple (int tag, uchar *s, int len); BerObj *ber_int2 (int); BerObj *ber_int4 (long); BerObj *ber_intarb (char *s, int len); BerObj *ber_bool (int); BerObj *ber_ostr (uchar *, int); // length is octets BerObj *ber_bstr (uchar *, int); // length is bits BerObj *ber_objid (char *); // NUL terminated, period delimited BerObj *ber_init (int); BerObj *ber_attach (BerObj *, BerObj *); // object composition BerObj *ber_parse (uchar *s, uchar *se); // object deconstruction // utilities void ber_print (BerObj *, int); void ber_objs (BerObj *, int); void ber_free (BerObj *); // formatting functions int ber_fmtint (Fmt *); // integers // %I int ber_fmtoid (Fmt *); // OIDs // %O int ber_fmtdate (Fmt *); // Validity dates // %T