Embedded WebSockets Experiment

Dependencies:   mbed MD5

Committer:
nandgate
Date:
Tue Jul 26 05:30:53 2011 +0000
Revision:
0:6dee052a3fa4

        

Who changed what in which revision?

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