summaryrefslogtreecommitdiff
path: root/asn1.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-12-05 07:50:01 +0000
committerGuy Harris <guy@alum.mit.edu>1999-12-05 07:50:01 +0000
commitaf8888e47cfcfe43c71fc1a7123b01c5628dd90d (patch)
treeec3ea60203734cafe84efcd55c3f0a84756e4722 /asn1.h
parent272505c22009e6f673d385641fe1d3309dcd820f (diff)
downloadwireshark-af8888e47cfcfe43c71fc1a7123b01c5628dd90d.tar.gz
Check in the ASN.1 code for reference purposes, although the SNMP
dissector doesn't use it yet - Nathan Neulinger might use it for a Kerberos 5 dissector, and it might be of use for other dissectors as well. svn path=/trunk/; revision=1215
Diffstat (limited to 'asn1.h')
-rw-r--r--asn1.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/asn1.h b/asn1.h
new file mode 100644
index 0000000000..8881452210
--- /dev/null
+++ b/asn1.h
@@ -0,0 +1,109 @@
+/* asn1.h
+ * Definitions for ASN.1 BER dissection
+ *
+ * $Id: asn1.h,v 1.1 1999/12/05 07:47:46 guy Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@zing.org>
+ *
+ * Based on "g_asn1.h" from:
+ *
+ * GXSNMP -- An snmp mangament application
+ * Copyright (C) 1998 Gregory McLean & Jochen Friedrich
+ * Beholder RMON ethernet network monitor,Copyright (C) 1993 DNPAP group
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+#ifndef __ASN1_H__
+#define __ASN1_H__
+
+#define ASN1_UNI 0 /* Universal */
+#define ASN1_APL 1 /* Application */
+#define ASN1_CTX 2 /* Context */
+#define ASN1_PRV 3 /* Private */
+
+ /* Tag */
+#define ASN1_EOC 0 /* End Of Contents */
+#define ASN1_BOL 1 /* Boolean */
+#define ASN1_INT 2 /* Integer */
+#define ASN1_BTS 3 /* Bit String */
+#define ASN1_OTS 4 /* Octet String */
+#define ASN1_NUL 5 /* Null */
+#define ASN1_OJI 6 /* Object Identifier */
+#define ASN1_OJD 7 /* Object Description */
+#define ASN1_EXT 8 /* External */
+#define ASN1_SEQ 16 /* Sequence */
+#define ASN1_SET 17 /* Set */
+#define ASN1_NUMSTR 18 /* Numerical String */
+#define ASN1_PRNSTR 19 /* Printable String */
+#define ASN1_TEXSTR 20 /* Teletext String */
+#define ASN1_VIDSTR 21 /* Video String */
+#define ASN1_IA5STR 22 /* IA5 String */
+#define ASN1_UNITIM 23 /* Universal Time */
+#define ASN1_GENTIM 24 /* General Time */
+#define ASN1_GRASTR 25 /* Graphical String */
+#define ASN1_VISSTR 26 /* Visible String */
+#define ASN1_GENSTR 27 /* General String */
+
+ /* Primitive / Constructed */
+#define ASN1_PRI 0 /* Primitive */
+#define ASN1_CON 1 /* Constructed */
+
+#define ASN1_ERR_NOERROR 0 /* no error */
+#define ASN1_ERR_EMPTY 1 /* ran out of data */
+#define ASN1_ERR_EOC_MISMATCH 2
+#define ASN1_ERR_WRONG_TYPE 3 /* type not right */
+#define ASN1_ERR_LENGTH_NOT_DEFINITE 4 /* length should be definite */
+#define ASN1_ERR_LENGTH_MISMATCH 5
+#define ASN1_ERR_WRONG_LENGTH_FOR_TYPE 6 /* length wrong for type */
+
+typedef struct _ASN1_SCK ASN1_SCK;
+
+struct _ASN1_SCK
+{ /* ASN1 socket */
+ const guchar *pointer; /* Octet just encoded or to be decoded */
+ const guchar *begin; /* First octet */
+ const guchar *end; /* Octet after last octet */
+};
+
+void asn1_open (ASN1_SCK *asn1, const guchar *buf, guint len);
+void asn1_close (ASN1_SCK *asn1, const guchar **buf, guint *len);
+int asn1_octet_decode (ASN1_SCK *asn1, guchar *ch);
+int asn1_tag_decode (ASN1_SCK *asn1, guint *tag);
+int asn1_id_decode (ASN1_SCK *asn1, guint *cls, guint *con, guint *tag);
+int asn1_length_decode (ASN1_SCK *asn1, gboolean *def, guint *len);
+int asn1_header_decode(ASN1_SCK *asn1, guint *cls, guint *con, guint *tag,
+ gboolean *defp, guint *lenp);
+int asn1_eoc (ASN1_SCK *asn1, const guchar *eoc);
+int asn1_eoc_decode (ASN1_SCK *asn1, const guchar *eoc);
+int asn1_null_decode (ASN1_SCK *asn1, int enc_len);
+int asn1_bool_decode (ASN1_SCK *asn1, int enc_len, gboolean *bool);
+int asn1_int32_value_decode (ASN1_SCK *asn1, int enc_len, gint32 *integer);
+int asn1_int32_decode (ASN1_SCK *asn1, gint32 *integer, guint *nbytes);
+int asn1_uint32_value_decode (ASN1_SCK *asn1, int enc_len, guint *integer);
+int asn1_uint32_decode (ASN1_SCK *asn1, guint32 *integer, guint *nbytes);
+int asn1_bits_decode (ASN1_SCK *asn1, const guchar *eoc, guchar **bits,
+ guint *len, guchar *unused);
+int asn1_octet_string_value_decode (ASN1_SCK *asn1, int enc_len,
+ guchar **octets);
+int asn1_octet_string_decode (ASN1_SCK *asn1, guchar **octets, guint *str_len,
+ guint *nbytes);
+int asn1_subid_decode (ASN1_SCK *asn1, guint32 *subid);
+int asn1_oid_value_decode (ASN1_SCK *asn1, int enc_len, guint32 **oid,
+ guint *len);
+int asn1_oid_decode ( ASN1_SCK *asn1, guint32 **oid, guint *len, guint *nbytes);
+int asn1_sequence_decode ( ASN1_SCK *asn1, guint *seq_len, guint *nbytes);
+#endif