Stripped down version of Segundos NetService library (http://mbed.org/users/segundo/libraries/NetServices ). I have removed all NetServices, and all functions which had been disabled. Use this version when you need only pure TCP or UDP functions - this library compiles faster.

Dependencies:   lwip lwip-sys

Dependents:   christmasLights device_server pop3demo device_server_udp ... more

Committer:
hlipka
Date:
Mon Jan 10 21:03:11 2011 +0000
Revision:
0:8b387bed54c2
initial version

Who changed what in which revision?

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