]> git.ipfire.org Git - thirdparty/squid.git/blame - include/asn1.h
Boilerplate: update copyright on compat/ library sources
[thirdparty/squid.git] / include / asn1.h
CommitLineData
b5638623 1#ifndef SQUID_SNMP_ASN1_H
2#define SQUID_SNMP_ASN1_H
d60c11be 3
8bde32ea 4/*
5 * Definitions for Abstract Syntax Notation One, ASN.1
6 * As defined in ISO/IS 8824 and ISO/IS 8825
7 *
8bde32ea 8 */
d60c11be 9/**********************************************************************
10 *
11 * Copyright 1997 by Carnegie Mellon University
c5dd4956 12 *
d60c11be 13 * All Rights Reserved
c5dd4956 14 *
d60c11be 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.
c5dd4956 22 *
d60c11be 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.
c5dd4956 30 *
d60c11be 31 **********************************************************************/
8bde32ea 32
33#ifndef EIGHTBIT_SUBIDS
88c4e50c 34typedef u_int oid;
8bde32ea 35#define MAX_SUBID 0xFFFFFFFF
36#else
43d4303e 37typedef u_char oid;
8bde32ea 38#define MAX_SUBID 0xFF
39#endif
40
d60c11be 41#define MAX_OID_LEN 128 /* max subid's in an oid, per SNMP spec. */
8bde32ea 42
43#define ASN_BOOLEAN (0x01)
44#define ASN_INTEGER (0x02)
45#define ASN_BIT_STR (0x03)
46#define ASN_OCTET_STR (0x04)
47#define ASN_NULL (0x05)
48#define ASN_OBJECT_ID (0x06)
49#define ASN_SEQUENCE (0x10)
50#define ASN_SET (0x11)
51
52#define ASN_UNIVERSAL (0x00)
53#define ASN_APPLICATION (0x40)
54#define ASN_CONTEXT (0x80)
55#define ASN_PRIVATE (0xC0)
56
57#define ASN_PRIMITIVE (0x00)
58#define ASN_CONSTRUCTOR (0x20)
59
60#define ASN_LONG_LEN (0x80)
61#define ASN_EXTENSION_ID (0x1F)
62#define ASN_BIT8 (0x80)
63
64#define IS_CONSTRUCTOR(byte) ((byte) & ASN_CONSTRUCTOR)
65#define IS_EXTENSION_ID(byte) (((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
66
d60c11be 67#ifdef __cplusplus
e1381638 68extern "C" {
d60c11be 69#endif
8bde32ea 70
43d4303e 71 u_char *asn_build_header(u_char *, int *, u_char, int);
72 u_char *asn_parse_int(u_char *, int *, u_char *, int *, int);
73 u_char *asn_parse_unsigned_int(u_char *, int *, u_char *, u_int *, int);
74 u_char *asn_build_int(u_char *, int *, u_char, int *, int);
75 u_char *asn_build_unsigned_int(u_char *, int *, u_char, u_int *, int);
76 u_char *asn_parse_string(u_char *, int *, u_char *, u_char *, int *);
77 u_char *asn_build_string(u_char *, int *, u_char, u_char *, int);
78 u_char *asn_parse_header(u_char *, int *, u_char *);
79 u_char *asn_build_header_with_truth(u_char *, int *, u_char, int, int);
d60c11be 80
43d4303e 81 u_char *asn_parse_length(u_char *, u_int *);
82 u_char *asn_build_length(u_char *, int *, int, int);
83 u_char *asn_parse_objid(u_char *, int *, u_char *, oid *, int *);
84 u_char *asn_build_objid(u_char *, int *, u_char, oid *, int);
85 u_char *asn_parse_null(u_char *, int *, u_char *);
86 u_char *asn_build_null(u_char *, int *, u_char);
d60c11be 87
7274dc31 88#if 0
43d4303e 89 u_char *asn_parse_bitstring(u_char *, int *, u_char *, u_char *, int *);
90 u_char *asn_build_bitstring(u_char *, int *, u_char, u_char *, int);
d60c11be 91
7274dc31 92#endif
43d4303e 93 u_char *asn_build_exception(u_char *, int *, u_char);
d60c11be 94
95#ifdef __cplusplus
96}
f7640449 97
468ae12b 98#endif
b5638623 99
100#endif /* SQUID_SNMP_ASN1_H */