]> git.ipfire.org Git - thirdparty/squid.git/blob - include/asn1.h
*** empty log message ***
[thirdparty/squid.git] / include / asn1.h
1 #ifndef _SNMP_ASN1_H_
2 #define _SNMP_ASN1_H_
3
4 /*
5 * Definitions for Abstract Syntax Notation One, ASN.1
6 * As defined in ISO/IS 8824 and ISO/IS 8825
7 *
8 */
9 /**********************************************************************
10 *
11 * Copyright 1997 by Carnegie Mellon University
12 *
13 * All Rights Reserved
14 *
15 * Permission to use, copy, modify, and distribute this software and its
16 * documentation for any purpose and without fee is hereby granted,
17 * provided that the above copyright notice appear in all copies and that
18 * both that copyright notice and this permission notice appear in
19 * supporting documentation, and that the name of CMU not be
20 * used in advertising or publicity pertaining to distribution of the
21 * software without specific, written prior permission.
22 *
23 * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
24 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
25 * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
26 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
27 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
28 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
29 * SOFTWARE.
30 *
31 * $Id: asn1.h,v 1.7 1998/02/22 11:51:06 kostas Exp $
32 *
33 **********************************************************************/
34
35 #ifndef EIGHTBIT_SUBIDS
36 typedef u_int oid;
37 #define MAX_SUBID 0xFFFFFFFF
38 #else
39 typedef u_char oid;
40 #define MAX_SUBID 0xFF
41 #endif
42
43 #define MAX_OID_LEN 128 /* max subid's in an oid, per SNMP spec. */
44
45 #define ASN_BOOLEAN (0x01)
46 #define ASN_INTEGER (0x02)
47 #define ASN_BIT_STR (0x03)
48 #define ASN_OCTET_STR (0x04)
49 #define ASN_NULL (0x05)
50 #define ASN_OBJECT_ID (0x06)
51 #define ASN_SEQUENCE (0x10)
52 #define ASN_SET (0x11)
53
54 #define ASN_UNIVERSAL (0x00)
55 #define ASN_APPLICATION (0x40)
56 #define ASN_CONTEXT (0x80)
57 #define ASN_PRIVATE (0xC0)
58
59 #define ASN_PRIMITIVE (0x00)
60 #define ASN_CONSTRUCTOR (0x20)
61
62 #define ASN_LONG_LEN (0x80)
63 #define ASN_EXTENSION_ID (0x1F)
64 #define ASN_BIT8 (0x80)
65
66 #define IS_CONSTRUCTOR(byte) ((byte) & ASN_CONSTRUCTOR)
67 #define IS_EXTENSION_ID(byte) (((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
68
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72
73 u_char *asn_build_header(u_char *, int *, u_char, int);
74 u_char *asn_parse_int(u_char *, int *, u_char *, int *, int);
75 u_char *asn_parse_unsigned_int(u_char *, int *, u_char *, u_int *, int);
76 u_char *asn_build_int(u_char *, int *, u_char, int *, int);
77 u_char *asn_build_unsigned_int(u_char *, int *, u_char, u_int *, int);
78 u_char *asn_parse_string(u_char *, int *, u_char *, u_char *, int *);
79 u_char *asn_build_string(u_char *, int *, u_char, u_char *, int);
80 u_char *asn_parse_header(u_char *, int *, u_char *);
81 u_char *asn_build_header_with_truth(u_char *, int *, u_char, int, int);
82
83 u_char *asn_parse_length(u_char *, u_int *);
84 u_char *asn_build_length(u_char *, int *, int, int);
85 u_char *asn_parse_objid(u_char *, int *, u_char *, oid *, int *);
86 u_char *asn_build_objid(u_char *, int *, u_char, oid *, int);
87 u_char *asn_parse_null(u_char *, int *, u_char *);
88 u_char *asn_build_null(u_char *, int *, u_char);
89
90 u_char *asn_parse_bitstring(u_char *, int *, u_char *, u_char *, int *);
91 u_char *asn_build_bitstring(u_char *, int *, u_char, u_char *, int);
92
93 u_char *asn_build_exception(u_char *, int *, u_char);
94
95 #ifdef __cplusplus
96 }
97 #endif
98
99 #endif /* _SNMP_ASN1_H_ */