A version of LWIP, provided for backwards compatibility.
Dependents: AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more
snmp_asn1.h
00001 /** 00002 * @file 00003 * Abstract Syntax Notation One (ISO 8824, 8825) codec. 00004 */ 00005 00006 /* 00007 * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands. 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without modification, 00011 * are permitted provided that the following conditions are met: 00012 * 00013 * 1. Redistributions of source code must retain the above copyright notice, 00014 * this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 3. The name of the author may not be used to endorse or promote products 00019 * derived from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00022 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00024 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00025 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00026 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00029 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00030 * OF SUCH DAMAGE. 00031 * 00032 * Author: Christiaan Simons <christiaan.simons@axon.tv> 00033 */ 00034 00035 #ifndef __LWIP_SNMP_ASN1_H__ 00036 #define __LWIP_SNMP_ASN1_H__ 00037 00038 #include "lwip/opt.h" 00039 #include "lwip/err.h" 00040 #include "lwip/pbuf.h" 00041 #include "lwip/snmp.h" 00042 00043 #ifdef __cplusplus 00044 extern "C" { 00045 #endif 00046 00047 #define SNMP_ASN1_UNIV (!0x80 | !0x40) 00048 #define SNMP_ASN1_APPLIC (!0x80 | 0x40) 00049 #define SNMP_ASN1_CONTXT ( 0x80 | !0x40) 00050 00051 #define SNMP_ASN1_CONSTR (0x20) 00052 #define SNMP_ASN1_PRIMIT (!0x20) 00053 00054 /* universal tags */ 00055 #define SNMP_ASN1_INTEG 2 00056 #define SNMP_ASN1_OC_STR 4 00057 #define SNMP_ASN1_NUL 5 00058 #define SNMP_ASN1_OBJ_ID 6 00059 #define SNMP_ASN1_SEQ 16 00060 00061 /* application specific (SNMP) tags */ 00062 #define SNMP_ASN1_IPADDR 0 /* octet string size(4) */ 00063 #define SNMP_ASN1_COUNTER 1 /* u32_t */ 00064 #define SNMP_ASN1_GAUGE 2 /* u32_t */ 00065 #define SNMP_ASN1_TIMETICKS 3 /* u32_t */ 00066 #define SNMP_ASN1_OPAQUE 4 /* octet string */ 00067 00068 /* context specific (SNMP) tags */ 00069 #define SNMP_ASN1_PDU_GET_REQ 0 00070 #define SNMP_ASN1_PDU_GET_NEXT_REQ 1 00071 #define SNMP_ASN1_PDU_GET_RESP 2 00072 #define SNMP_ASN1_PDU_SET_REQ 3 00073 #define SNMP_ASN1_PDU_TRAP 4 00074 00075 err_t snmp_asn1_dec_type(struct pbuf *p, u16_t ofs, u8_t *type); 00076 err_t snmp_asn1_dec_length(struct pbuf *p, u16_t ofs, u8_t *octets_used, u16_t *length); 00077 err_t snmp_asn1_dec_u32t(struct pbuf *p, u16_t ofs, u16_t len, u32_t *value); 00078 err_t snmp_asn1_dec_s32t(struct pbuf *p, u16_t ofs, u16_t len, s32_t *value); 00079 err_t snmp_asn1_dec_oid(struct pbuf *p, u16_t ofs, u16_t len, struct snmp_obj_id *oid); 00080 err_t snmp_asn1_dec_raw(struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw); 00081 00082 void snmp_asn1_enc_length_cnt(u16_t length, u8_t *octets_needed); 00083 void snmp_asn1_enc_u32t_cnt(u32_t value, u16_t *octets_needed); 00084 void snmp_asn1_enc_s32t_cnt(s32_t value, u16_t *octets_needed); 00085 void snmp_asn1_enc_oid_cnt(u8_t ident_len, s32_t *ident, u16_t *octets_needed); 00086 err_t snmp_asn1_enc_type(struct pbuf *p, u16_t ofs, u8_t type); 00087 err_t snmp_asn1_enc_length(struct pbuf *p, u16_t ofs, u16_t length); 00088 err_t snmp_asn1_enc_u32t(struct pbuf *p, u16_t ofs, u8_t octets_needed, u32_t value); 00089 err_t snmp_asn1_enc_s32t(struct pbuf *p, u16_t ofs, u8_t octets_needed, s32_t value); 00090 err_t snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident); 00091 err_t snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u8_t raw_len, u8_t *raw); 00092 00093 #ifdef __cplusplus 00094 } 00095 #endif 00096 00097 #endif /* __LWIP_SNMP_ASN1_H__ */
Generated on Tue Jul 12 2022 16:06:23 by 1.7.2