My fork of the HTTPServer (working)

Dependents:   DGWWebServer LAN2

Committer:
screamer
Date:
Tue Nov 20 12:18:53 2012 +0000
Revision:
1:284f2df30cf9
Parent:
0:7a64fbb4069d
local changes

Who changed what in which revision?

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