This library is deprecated.

Dependents:   HTTPClientStreamingExample HTTPClientExample HTTPServerExample HTTPServerHelloWorld ... more

Committer:
donatien
Date:
Thu Aug 05 15:09:22 2010 +0000
Revision:
5:bc7df6da7589
Parent:
0:422060928e37

        

Who changed what in which revision?

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