Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of lwip by
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 #if LWIP_SNMP 00044 00045 #ifdef __cplusplus 00046 extern "C" { 00047 #endif 00048 00049 #define SNMP_ASN1_UNIV (0) /* (!0x80 | !0x40) */ 00050 #define SNMP_ASN1_APPLIC (0x40) /* (!0x80 | 0x40) */ 00051 #define SNMP_ASN1_CONTXT (0x80) /* ( 0x80 | !0x40) */ 00052 00053 #define SNMP_ASN1_CONSTR (0x20) /* ( 0x20) */ 00054 #define SNMP_ASN1_PRIMIT (0) /* (!0x20) */ 00055 00056 /* universal tags */ 00057 #define SNMP_ASN1_INTEG 2 00058 #define SNMP_ASN1_OC_STR 4 00059 #define SNMP_ASN1_NUL 5 00060 #define SNMP_ASN1_OBJ_ID 6 00061 #define SNMP_ASN1_SEQ 16 00062 00063 /* application specific (SNMP) tags */ 00064 #define SNMP_ASN1_IPADDR 0 /* octet string size(4) */ 00065 #define SNMP_ASN1_COUNTER 1 /* u32_t */ 00066 #define SNMP_ASN1_GAUGE 2 /* u32_t */ 00067 #define SNMP_ASN1_TIMETICKS 3 /* u32_t */ 00068 #define SNMP_ASN1_OPAQUE 4 /* octet string */ 00069 00070 /* context specific (SNMP) tags */ 00071 #define SNMP_ASN1_PDU_GET_REQ 0 00072 #define SNMP_ASN1_PDU_GET_NEXT_REQ 1 00073 #define SNMP_ASN1_PDU_GET_RESP 2 00074 #define SNMP_ASN1_PDU_SET_REQ 3 00075 #define SNMP_ASN1_PDU_TRAP 4 00076 00077 err_t snmp_asn1_dec_type(struct pbuf *p, u16_t ofs, u8_t *type); 00078 err_t snmp_asn1_dec_length(struct pbuf *p, u16_t ofs, u8_t *octets_used, u16_t *length); 00079 err_t snmp_asn1_dec_u32t(struct pbuf *p, u16_t ofs, u16_t len, u32_t *value); 00080 err_t snmp_asn1_dec_s32t(struct pbuf *p, u16_t ofs, u16_t len, s32_t *value); 00081 err_t snmp_asn1_dec_oid(struct pbuf *p, u16_t ofs, u16_t len, struct snmp_obj_id *oid); 00082 err_t snmp_asn1_dec_raw(struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw); 00083 00084 void snmp_asn1_enc_length_cnt(u16_t length, u8_t *octets_needed); 00085 void snmp_asn1_enc_u32t_cnt(u32_t value, u16_t *octets_needed); 00086 void snmp_asn1_enc_s32t_cnt(s32_t value, u16_t *octets_needed); 00087 void snmp_asn1_enc_oid_cnt(u8_t ident_len, s32_t *ident, u16_t *octets_needed); 00088 err_t snmp_asn1_enc_type(struct pbuf *p, u16_t ofs, u8_t type); 00089 err_t snmp_asn1_enc_length(struct pbuf *p, u16_t ofs, u16_t length); 00090 err_t snmp_asn1_enc_u32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, u32_t value); 00091 err_t snmp_asn1_enc_s32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, s32_t value); 00092 err_t snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident); 00093 err_t snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u16_t raw_len, u8_t *raw); 00094 00095 #ifdef __cplusplus 00096 } 00097 #endif 00098 00099 #endif /* LWIP_SNMP */ 00100 00101 #endif /* __LWIP_SNMP_ASN1_H__ */
Generated on Tue Jul 12 2022 11:29:37 by
