This library is stripped down version of NetServices library. HTTP server and client function is NOT supported.

Dependents:   imu-daq-eth

Committer:
idinor
Date:
Wed Jul 20 11:45:39 2011 +0000
Revision:
0:dcf3c92487ca

        

Who changed what in which revision?

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