]>
Commit | Line | Data |
---|---|---|
b5638623 | 1 | #ifndef SQUID_SNMP_ASN1_H |
2 | #define SQUID_SNMP_ASN1_H | |
d60c11be | 3 | |
e1f7507e AJ |
4 | #include "config.h" |
5 | ||
8bde32ea | 6 | /* |
7 | * Definitions for Abstract Syntax Notation One, ASN.1 | |
8 | * As defined in ISO/IS 8824 and ISO/IS 8825 | |
9 | * | |
8bde32ea | 10 | */ |
d60c11be | 11 | /********************************************************************** |
12 | * | |
13 | * Copyright 1997 by Carnegie Mellon University | |
c5dd4956 | 14 | * |
d60c11be | 15 | * All Rights Reserved |
c5dd4956 | 16 | * |
d60c11be | 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. | |
c5dd4956 | 24 | * |
d60c11be | 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. | |
c5dd4956 | 32 | * |
262a0e14 | 33 | * $Id$ |
c5dd4956 | 34 | * |
d60c11be | 35 | **********************************************************************/ |
8bde32ea | 36 | |
37 | #ifndef EIGHTBIT_SUBIDS | |
e1f7507e | 38 | typedef u_int8_t oid; |
8bde32ea | 39 | #define MAX_SUBID 0xFFFFFFFF |
40 | #else | |
43d4303e | 41 | typedef u_char oid; |
8bde32ea | 42 | #define MAX_SUBID 0xFF |
43 | #endif | |
44 | ||
d60c11be | 45 | #define MAX_OID_LEN 128 /* max subid's in an oid, per SNMP spec. */ |
8bde32ea | 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 | ||
d60c11be | 71 | #ifdef __cplusplus |
c5dd4956 AJ |
72 | extern "C" |
73 | { | |
d60c11be | 74 | #endif |
8bde32ea | 75 | |
43d4303e | 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); | |
d60c11be | 85 | |
43d4303e | 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); | |
d60c11be | 92 | |
7274dc31 | 93 | #if 0 |
43d4303e | 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); | |
d60c11be | 96 | |
7274dc31 | 97 | #endif |
43d4303e | 98 | u_char *asn_build_exception(u_char *, int *, u_char); |
d60c11be | 99 | |
100 | #ifdef __cplusplus | |
101 | } | |
f7640449 | 102 | |
468ae12b | 103 | #endif |
b5638623 | 104 | |
105 | #endif /* SQUID_SNMP_ASN1_H */ |