LwIP with PPP & Ethernet integration

Dependents:   NetworkingCoreLib

This is the mbed port of the LwIP stack: http://savannah.nongnu.org/projects/lwip/

It includes contributed content from NXP's port for LPCxxxx devices: http://www.lpcware.com/content/project/lightweight-ip-lwip-networking-stack

Licence

LwIP is licenced under the BSD licence:

Copyright (c) 2001-2004 Swedish Institute of Computer Science. 
All rights reserved. 
Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met: 
1. Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer. 
2. Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation 
and/or other materials provided with the distribution. 
3. The name of the author may not be used to endorse or promote products 
derived from this software without specific prior written permission. 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.
Committer:
donatien
Date:
Fri May 25 08:56:35 2012 +0000
Revision:
2:1a87f74b8e3b
Parent:
0:8e01dca41002
Removed compilation of EMAC driver when using PPP

Who changed what in which revision?

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