mbed Phone Platform

Dependencies:   ulaw mbed ConfigFile

Committer:
okini3939
Date:
Sun Dec 26 15:49:07 2010 +0000
Revision:
1:0f82c574096f

        

Who changed what in which revision?

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