Dependents:   TimeZoneDemo EthernetJackTestCode MMEx_Challenge ntp_mem ... more

Committer:
segundo
Date:
Tue Nov 09 20:54:15 2010 +0000
Revision:
0:ac1725ba162c

        

Who changed what in which revision?

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