Version of http://mbed.org/cookbook/NetServicesTribute with setting set the same for LPC2368

Dependents:   UDPSocketExample 24LCxx_I2CApp WeatherPlatform_pachube HvZServerLib ... more

Committer:
simon
Date:
Tue Nov 23 14:15:36 2010 +0000
Revision:
0:350011bf8be7
Experimental version for testing UDP

Who changed what in which revision?

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