ProjetoBB

Dependencies:   F7_Ethernet WebSocketClient mbed mcp3008

Fork of Nucleo_F746ZG_Ethernet by Dieter Graef

Committer:
DieterGraef
Date:
Sat Jun 18 10:49:12 2016 +0000
Revision:
0:f9b6112278fe
Ethernet for the NUCLEO STM32F746 Board Testprogram uses DHCP and NTP to set the clock

Who changed what in which revision?

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