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