]>
git.ipfire.org Git - thirdparty/squid.git/blob - include/asn1.h
2 * Copyright (C) 1996-2019 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_SNMP_ASN1_H
10 #define SQUID_SNMP_ASN1_H
13 * Definitions for Abstract Syntax Notation One, ASN.1
14 * As defined in ISO/IS 8824 and ISO/IS 8825
17 /**********************************************************************
19 * Copyright 1997 by Carnegie Mellon University
23 * Permission to use, copy, modify, and distribute this software and its
24 * documentation for any purpose and without fee is hereby granted,
25 * provided that the above copyright notice appear in all copies and that
26 * both that copyright notice and this permission notice appear in
27 * supporting documentation, and that the name of CMU not be
28 * used in advertising or publicity pertaining to distribution of the
29 * software without specific, written prior permission.
31 * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
32 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
33 * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
34 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
35 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
36 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
39 **********************************************************************/
41 #ifndef EIGHTBIT_SUBIDS
43 #define MAX_SUBID 0xFFFFFFFF
46 #define MAX_SUBID 0xFF
49 #define MAX_OID_LEN 128 /* max subid's in an oid, per SNMP spec. */
51 #define ASN_BOOLEAN (0x01)
52 #define ASN_INTEGER (0x02)
53 #define ASN_BIT_STR (0x03)
54 #define ASN_OCTET_STR (0x04)
55 #define ASN_NULL (0x05)
56 #define ASN_OBJECT_ID (0x06)
57 #define ASN_SEQUENCE (0x10)
58 #define ASN_SET (0x11)
60 #define ASN_UNIVERSAL (0x00)
61 #define ASN_APPLICATION (0x40)
62 #define ASN_CONTEXT (0x80)
63 #define ASN_PRIVATE (0xC0)
65 #define ASN_PRIMITIVE (0x00)
66 #define ASN_CONSTRUCTOR (0x20)
68 #define ASN_LONG_LEN (0x80)
69 #define ASN_EXTENSION_ID (0x1F)
70 #define ASN_BIT8 (0x80)
72 #define IS_CONSTRUCTOR(byte) ((byte) & ASN_CONSTRUCTOR)
73 #define IS_EXTENSION_ID(byte) (((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
79 u_char
*asn_build_header(u_char
*, int *, u_char
, int);
80 u_char
*asn_parse_int(u_char
*, int *, u_char
*, int *, int);
81 u_char
*asn_parse_unsigned_int(u_char
*, int *, u_char
*, u_int
*, int);
82 u_char
*asn_build_int(u_char
*, int *, u_char
, int *, int);
83 u_char
*asn_build_unsigned_int(u_char
*, int *, u_char
, u_int
*, int);
84 u_char
*asn_parse_string(u_char
*, int *, u_char
*, u_char
*, int *);
85 u_char
*asn_build_string(u_char
*, int *, u_char
, u_char
*, int);
86 u_char
*asn_parse_header(u_char
*, int *, u_char
*);
87 u_char
*asn_build_header_with_truth(u_char
*, int *, u_char
, int, int);
89 u_char
*asn_parse_length(u_char
*, u_int
*);
90 u_char
*asn_build_length(u_char
*, int *, int, int);
91 u_char
*asn_parse_objid(u_char
*, int *, u_char
*, oid
*, int *);
92 u_char
*asn_build_objid(u_char
*, int *, u_char
, oid
*, int);
93 u_char
*asn_parse_null(u_char
*, int *, u_char
*);
94 u_char
*asn_build_null(u_char
*, int *, u_char
);
97 u_char
*asn_parse_bitstring(u_char
*, int *, u_char
*, u_char
*, int *);
98 u_char
*asn_build_bitstring(u_char
*, int *, u_char
, u_char
*, int);
101 u_char
*asn_build_exception(u_char
*, int *, u_char
);
108 #endif /* SQUID_SNMP_ASN1_H */