NetTribute library with debug turned on in FShandler Donatien Garner -> Segundo Equipo -> this version

Committer:
hexley
Date:
Fri Nov 19 01:54:45 2010 +0000
Revision:
0:281d6ff68967

        

Who changed what in which revision?

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