User | Revision | Line number | New contents of line |
mbed714 |
0:d616ece2d859
|
1
|
/**
|
mbed714 |
0:d616ece2d859
|
2
|
* @file
|
mbed714 |
0:d616ece2d859
|
3
|
* Abstract Syntax Notation One (ISO 8824, 8825) codec.
|
mbed714 |
0:d616ece2d859
|
4
|
*/
|
mbed714 |
0:d616ece2d859
|
5
|
|
mbed714 |
0:d616ece2d859
|
6
|
/*
|
mbed714 |
0:d616ece2d859
|
7
|
* Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
|
mbed714 |
0:d616ece2d859
|
8
|
* All rights reserved.
|
mbed714 |
0:d616ece2d859
|
9
|
*
|
mbed714 |
0:d616ece2d859
|
10
|
* Redistribution and use in source and binary forms, with or without modification,
|
mbed714 |
0:d616ece2d859
|
11
|
* are permitted provided that the following conditions are met:
|
mbed714 |
0:d616ece2d859
|
12
|
*
|
mbed714 |
0:d616ece2d859
|
13
|
* 1. Redistributions of source code must retain the above copyright notice,
|
mbed714 |
0:d616ece2d859
|
14
|
* this list of conditions and the following disclaimer.
|
mbed714 |
0:d616ece2d859
|
15
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
mbed714 |
0:d616ece2d859
|
16
|
* this list of conditions and the following disclaimer in the documentation
|
mbed714 |
0:d616ece2d859
|
17
|
* and/or other materials provided with the distribution.
|
mbed714 |
0:d616ece2d859
|
18
|
* 3. The name of the author may not be used to endorse or promote products
|
mbed714 |
0:d616ece2d859
|
19
|
* derived from this software without specific prior written permission.
|
mbed714 |
0:d616ece2d859
|
20
|
*
|
mbed714 |
0:d616ece2d859
|
21
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
mbed714 |
0:d616ece2d859
|
22
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
mbed714 |
0:d616ece2d859
|
23
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
mbed714 |
0:d616ece2d859
|
24
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
mbed714 |
0:d616ece2d859
|
25
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
mbed714 |
0:d616ece2d859
|
26
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
mbed714 |
0:d616ece2d859
|
27
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
mbed714 |
0:d616ece2d859
|
28
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
mbed714 |
0:d616ece2d859
|
29
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
mbed714 |
0:d616ece2d859
|
30
|
* OF SUCH DAMAGE.
|
mbed714 |
0:d616ece2d859
|
31
|
*
|
mbed714 |
0:d616ece2d859
|
32
|
* Author: Christiaan Simons <christiaan.simons@axon.tv>
|
mbed714 |
0:d616ece2d859
|
33
|
*/
|
mbed714 |
0:d616ece2d859
|
34
|
|
mbed714 |
0:d616ece2d859
|
35
|
#ifndef __LWIP_SNMP_ASN1_H__
|
mbed714 |
0:d616ece2d859
|
36
|
#define __LWIP_SNMP_ASN1_H__
|
mbed714 |
0:d616ece2d859
|
37
|
|
mbed714 |
0:d616ece2d859
|
38
|
#include "lwip/opt.h"
|
mbed714 |
0:d616ece2d859
|
39
|
#include "lwip/err.h"
|
mbed714 |
0:d616ece2d859
|
40
|
#include "lwip/pbuf.h"
|
mbed714 |
0:d616ece2d859
|
41
|
#include "lwip/snmp.h"
|
mbed714 |
0:d616ece2d859
|
42
|
|
mbed714 |
0:d616ece2d859
|
43
|
#if LWIP_SNMP
|
mbed714 |
0:d616ece2d859
|
44
|
|
mbed714 |
0:d616ece2d859
|
45
|
#ifdef __cplusplus
|
mbed714 |
0:d616ece2d859
|
46
|
extern "C" {
|
mbed714 |
0:d616ece2d859
|
47
|
#endif
|
mbed714 |
0:d616ece2d859
|
48
|
|
mbed714 |
0:d616ece2d859
|
49
|
#define SNMP_ASN1_UNIV (0) /* (!0x80 | !0x40) */
|
mbed714 |
0:d616ece2d859
|
50
|
#define SNMP_ASN1_APPLIC (0x40) /* (!0x80 | 0x40) */
|
mbed714 |
0:d616ece2d859
|
51
|
#define SNMP_ASN1_CONTXT (0x80) /* ( 0x80 | !0x40) */
|
mbed714 |
0:d616ece2d859
|
52
|
|
mbed714 |
0:d616ece2d859
|
53
|
#define SNMP_ASN1_CONSTR (0x20) /* ( 0x20) */
|
mbed714 |
0:d616ece2d859
|
54
|
#define SNMP_ASN1_PRIMIT (0) /* (!0x20) */
|
mbed714 |
0:d616ece2d859
|
55
|
|
mbed714 |
0:d616ece2d859
|
56
|
/* universal tags */
|
mbed714 |
0:d616ece2d859
|
57
|
#define SNMP_ASN1_INTEG 2
|
mbed714 |
0:d616ece2d859
|
58
|
#define SNMP_ASN1_OC_STR 4
|
mbed714 |
0:d616ece2d859
|
59
|
#define SNMP_ASN1_NUL 5
|
mbed714 |
0:d616ece2d859
|
60
|
#define SNMP_ASN1_OBJ_ID 6
|
mbed714 |
0:d616ece2d859
|
61
|
#define SNMP_ASN1_SEQ 16
|
mbed714 |
0:d616ece2d859
|
62
|
|
mbed714 |
0:d616ece2d859
|
63
|
/* application specific (SNMP) tags */
|
mbed714 |
0:d616ece2d859
|
64
|
#define SNMP_ASN1_IPADDR 0 /* octet string size(4) */
|
mbed714 |
0:d616ece2d859
|
65
|
#define SNMP_ASN1_COUNTER 1 /* u32_t */
|
mbed714 |
0:d616ece2d859
|
66
|
#define SNMP_ASN1_GAUGE 2 /* u32_t */
|
mbed714 |
0:d616ece2d859
|
67
|
#define SNMP_ASN1_TIMETICKS 3 /* u32_t */
|
mbed714 |
0:d616ece2d859
|
68
|
#define SNMP_ASN1_OPAQUE 4 /* octet string */
|
mbed714 |
0:d616ece2d859
|
69
|
|
mbed714 |
0:d616ece2d859
|
70
|
/* context specific (SNMP) tags */
|
mbed714 |
0:d616ece2d859
|
71
|
#define SNMP_ASN1_PDU_GET_REQ 0
|
mbed714 |
0:d616ece2d859
|
72
|
#define SNMP_ASN1_PDU_GET_NEXT_REQ 1
|
mbed714 |
0:d616ece2d859
|
73
|
#define SNMP_ASN1_PDU_GET_RESP 2
|
mbed714 |
0:d616ece2d859
|
74
|
#define SNMP_ASN1_PDU_SET_REQ 3
|
mbed714 |
0:d616ece2d859
|
75
|
#define SNMP_ASN1_PDU_TRAP 4
|
mbed714 |
0:d616ece2d859
|
76
|
|
mbed714 |
0:d616ece2d859
|
77
|
err_t snmp_asn1_dec_type(struct pbuf *p, u16_t ofs, u8_t *type);
|
mbed714 |
0:d616ece2d859
|
78
|
err_t snmp_asn1_dec_length(struct pbuf *p, u16_t ofs, u8_t *octets_used, u16_t *length);
|
mbed714 |
0:d616ece2d859
|
79
|
err_t snmp_asn1_dec_u32t(struct pbuf *p, u16_t ofs, u16_t len, u32_t *value);
|
mbed714 |
0:d616ece2d859
|
80
|
err_t snmp_asn1_dec_s32t(struct pbuf *p, u16_t ofs, u16_t len, s32_t *value);
|
mbed714 |
0:d616ece2d859
|
81
|
err_t snmp_asn1_dec_oid(struct pbuf *p, u16_t ofs, u16_t len, struct snmp_obj_id *oid);
|
mbed714 |
0:d616ece2d859
|
82
|
err_t snmp_asn1_dec_raw(struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw);
|
mbed714 |
0:d616ece2d859
|
83
|
|
mbed714 |
0:d616ece2d859
|
84
|
void snmp_asn1_enc_length_cnt(u16_t length, u8_t *octets_needed);
|
mbed714 |
0:d616ece2d859
|
85
|
void snmp_asn1_enc_u32t_cnt(u32_t value, u16_t *octets_needed);
|
mbed714 |
0:d616ece2d859
|
86
|
void snmp_asn1_enc_s32t_cnt(s32_t value, u16_t *octets_needed);
|
mbed714 |
0:d616ece2d859
|
87
|
void snmp_asn1_enc_oid_cnt(u8_t ident_len, s32_t *ident, u16_t *octets_needed);
|
mbed714 |
0:d616ece2d859
|
88
|
err_t snmp_asn1_enc_type(struct pbuf *p, u16_t ofs, u8_t type);
|
mbed714 |
0:d616ece2d859
|
89
|
err_t snmp_asn1_enc_length(struct pbuf *p, u16_t ofs, u16_t length);
|
mbed714 |
0:d616ece2d859
|
90
|
err_t snmp_asn1_enc_u32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, u32_t value);
|
mbed714 |
0:d616ece2d859
|
91
|
err_t snmp_asn1_enc_s32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, s32_t value);
|
mbed714 |
0:d616ece2d859
|
92
|
err_t snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident);
|
mbed714 |
0:d616ece2d859
|
93
|
err_t snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u16_t raw_len, u8_t *raw);
|
mbed714 |
0:d616ece2d859
|
94
|
|
mbed714 |
0:d616ece2d859
|
95
|
#ifdef __cplusplus
|
mbed714 |
0:d616ece2d859
|
96
|
}
|
mbed714 |
0:d616ece2d859
|
97
|
#endif
|
mbed714 |
0:d616ece2d859
|
98
|
|
mbed714 |
0:d616ece2d859
|
99
|
#endif /* LWIP_SNMP */
|
mbed714 |
0:d616ece2d859
|
100
|
|
mbed714 |
0:d616ece2d859
|
101
|
#endif /* __LWIP_SNMP_ASN1_H__ */
|