Trial code integration web page update with analogue data and ntp support

Dependencies:   NTPClient_NetServices mbed

Committer:
pmr1
Date:
Fri Aug 06 17:57:45 2010 +0000
Revision:
0:8cc2035bebfc

        

Who changed what in which revision?

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