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