asn1.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9#ifndef SQUID_SNMP_ASN1_H
10#define SQUID_SNMP_ASN1_H
11
12/*
13 * Definitions for Abstract Syntax Notation One, ASN.1
14 * As defined in ISO/IS 8824 and ISO/IS 8825
15 *
16 */
17/**********************************************************************
18 *
19 * Copyright 1997 by Carnegie Mellon University
20 *
21 * All Rights Reserved
22 *
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.
30 *
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
37 * SOFTWARE.
38 *
39 **********************************************************************/
40
41#ifndef EIGHTBIT_SUBIDS
42typedef u_int oid;
43#define MAX_SUBID 0xFFFFFFFF
44#else
45typedef u_char oid;
46#define MAX_SUBID 0xFF
47#endif
48
49#define MAX_OID_LEN 128 /* max subid's in an oid, per SNMP spec. */
50
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)
59
60#define ASN_UNIVERSAL (0x00)
61#define ASN_APPLICATION (0x40)
62#define ASN_CONTEXT (0x80)
63#define ASN_PRIVATE (0xC0)
64
65#define ASN_PRIMITIVE (0x00)
66#define ASN_CONSTRUCTOR (0x20)
67
68#define ASN_LONG_LEN (0x80)
69#define ASN_EXTENSION_ID (0x1F)
70#define ASN_BIT8 (0x80)
71
72#define IS_CONSTRUCTOR(byte) ((byte) & ASN_CONSTRUCTOR)
73#define IS_EXTENSION_ID(byte) (((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
74
75#ifdef __cplusplus
76extern "C" {
77#endif
78
79u_char *asn_build_header(u_char *, int *, u_char, int);
80u_char *asn_parse_int(u_char *, int *, u_char *, int *, int);
81u_char *asn_parse_unsigned_int(u_char *, int *, u_char *, u_int *, int);
82u_char *asn_build_int(u_char *, int *, u_char, int *, int);
83u_char *asn_build_unsigned_int(u_char *, int *, u_char, u_int *, int);
84u_char *asn_parse_string(u_char *, int *, u_char *, u_char *, int *);
85u_char *asn_build_string(u_char *, int *, u_char, u_char *, int);
86u_char *asn_parse_header(u_char *, int *, u_char *);
87u_char *asn_build_header_with_truth(u_char *, int *, u_char, int, int);
88
89u_char *asn_parse_length(u_char *, u_int *);
90u_char *asn_build_length(u_char *, int *, int, int);
91u_char *asn_parse_objid(u_char *, int *, u_char *, oid *, int *);
92u_char *asn_build_objid(u_char *, int *, u_char, oid *, int);
93u_char *asn_parse_null(u_char *, int *, u_char *);
94u_char *asn_build_null(u_char *, int *, u_char);
95
96u_char *asn_build_exception(u_char *, int *, u_char);
97
98#ifdef __cplusplus
99}
100
101#endif
102
103#endif /* SQUID_SNMP_ASN1_H */
104
u_int oid
Definition: asn1.h:42
u_char * asn_build_header(u_char *, int *, u_char, int)
Definition: asn1.c:93
u_char * asn_build_unsigned_int(u_char *, int *, u_char, u_int *, int)
Definition: asn1.c:311
u_char * asn_parse_null(u_char *, int *, u_char *)
u_char * asn_parse_unsigned_int(u_char *, int *, u_char *, u_int *, int)
Definition: asn1.c:179
u_char * asn_parse_length(u_char *, u_int *)
Definition: asn1.c:539
u_char * asn_build_objid(u_char *, int *, u_char, oid *, int)
Definition: asn1.c:723
u_char * asn_build_null(u_char *, int *, u_char)
Definition: asn1.c:803
u_char * asn_build_length(u_char *, int *, int, int)
Definition: asn1.c:570
u_char * asn_build_header_with_truth(u_char *, int *, u_char, int, int)
Definition: asn1.c:513
u_char * asn_parse_int(u_char *, int *, u_char *, int *, int)
Definition: asn1.c:114
u_char * asn_parse_objid(u_char *, int *, u_char *, oid *, int *)
Definition: asn1.c:638
u_char * asn_parse_string(u_char *, int *, u_char *, u_char *, int *)
Definition: asn1.c:387
u_char * asn_build_int(u_char *, int *, u_char, int *, int)
Definition: asn1.c:245
u_char * asn_build_exception(u_char *, int *, u_char)
Definition: asn1.c:837
u_char * asn_parse_header(u_char *, int *, u_char *)
Definition: asn1.c:470
u_char * asn_build_string(u_char *, int *, u_char, u_char *, int)
Definition: asn1.c:433

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors