ProjetoBB
Dependencies: F7_Ethernet WebSocketClient mbed mcp3008
Fork of Nucleo_F746ZG_Ethernet by
F7_Ethernet/lwip/include/ipv4/lwip/inet_chksum.h@0:f9b6112278fe, 2016-06-18 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
DieterGraef | 0:f9b6112278fe | 1 | /* |
DieterGraef | 0:f9b6112278fe | 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. |
DieterGraef | 0:f9b6112278fe | 3 | * All rights reserved. |
DieterGraef | 0:f9b6112278fe | 4 | * |
DieterGraef | 0:f9b6112278fe | 5 | * Redistribution and use in source and binary forms, with or without modification, |
DieterGraef | 0:f9b6112278fe | 6 | * are permitted provided that the following conditions are met: |
DieterGraef | 0:f9b6112278fe | 7 | * |
DieterGraef | 0:f9b6112278fe | 8 | * 1. Redistributions of source code must retain the above copyright notice, |
DieterGraef | 0:f9b6112278fe | 9 | * this list of conditions and the following disclaimer. |
DieterGraef | 0:f9b6112278fe | 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
DieterGraef | 0:f9b6112278fe | 11 | * this list of conditions and the following disclaimer in the documentation |
DieterGraef | 0:f9b6112278fe | 12 | * and/or other materials provided with the distribution. |
DieterGraef | 0:f9b6112278fe | 13 | * 3. The name of the author may not be used to endorse or promote products |
DieterGraef | 0:f9b6112278fe | 14 | * derived from this software without specific prior written permission. |
DieterGraef | 0:f9b6112278fe | 15 | * |
DieterGraef | 0:f9b6112278fe | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
DieterGraef | 0:f9b6112278fe | 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
DieterGraef | 0:f9b6112278fe | 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
DieterGraef | 0:f9b6112278fe | 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
DieterGraef | 0:f9b6112278fe | 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
DieterGraef | 0:f9b6112278fe | 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
DieterGraef | 0:f9b6112278fe | 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
DieterGraef | 0:f9b6112278fe | 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
DieterGraef | 0:f9b6112278fe | 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
DieterGraef | 0:f9b6112278fe | 25 | * OF SUCH DAMAGE. |
DieterGraef | 0:f9b6112278fe | 26 | * |
DieterGraef | 0:f9b6112278fe | 27 | * This file is part of the lwIP TCP/IP stack. |
DieterGraef | 0:f9b6112278fe | 28 | * |
DieterGraef | 0:f9b6112278fe | 29 | * Author: Adam Dunkels <adam@sics.se> |
DieterGraef | 0:f9b6112278fe | 30 | * |
DieterGraef | 0:f9b6112278fe | 31 | */ |
DieterGraef | 0:f9b6112278fe | 32 | #ifndef __LWIP_INET_CHKSUM_H__ |
DieterGraef | 0:f9b6112278fe | 33 | #define __LWIP_INET_CHKSUM_H__ |
DieterGraef | 0:f9b6112278fe | 34 | |
DieterGraef | 0:f9b6112278fe | 35 | #include "lwip/opt.h" |
DieterGraef | 0:f9b6112278fe | 36 | |
DieterGraef | 0:f9b6112278fe | 37 | #include "lwip/pbuf.h" |
DieterGraef | 0:f9b6112278fe | 38 | #include "lwip/ip_addr.h" |
DieterGraef | 0:f9b6112278fe | 39 | |
DieterGraef | 0:f9b6112278fe | 40 | /** Swap the bytes in an u16_t: much like htons() for little-endian */ |
DieterGraef | 0:f9b6112278fe | 41 | #ifndef SWAP_BYTES_IN_WORD |
DieterGraef | 0:f9b6112278fe | 42 | #if LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN) |
DieterGraef | 0:f9b6112278fe | 43 | /* little endian and PLATFORM_BYTESWAP defined */ |
DieterGraef | 0:f9b6112278fe | 44 | #define SWAP_BYTES_IN_WORD(w) LWIP_PLATFORM_HTONS(w) |
DieterGraef | 0:f9b6112278fe | 45 | #else /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN) */ |
DieterGraef | 0:f9b6112278fe | 46 | /* can't use htons on big endian (or PLATFORM_BYTESWAP not defined)... */ |
DieterGraef | 0:f9b6112278fe | 47 | #define SWAP_BYTES_IN_WORD(w) (((w) & 0xff) << 8) | (((w) & 0xff00) >> 8) |
DieterGraef | 0:f9b6112278fe | 48 | #endif /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN)*/ |
DieterGraef | 0:f9b6112278fe | 49 | #endif /* SWAP_BYTES_IN_WORD */ |
DieterGraef | 0:f9b6112278fe | 50 | |
DieterGraef | 0:f9b6112278fe | 51 | /** Split an u32_t in two u16_ts and add them up */ |
DieterGraef | 0:f9b6112278fe | 52 | #ifndef FOLD_U32T |
DieterGraef | 0:f9b6112278fe | 53 | #define FOLD_U32T(u) (((u) >> 16) + ((u) & 0x0000ffffUL)) |
DieterGraef | 0:f9b6112278fe | 54 | #endif |
DieterGraef | 0:f9b6112278fe | 55 | |
DieterGraef | 0:f9b6112278fe | 56 | #if LWIP_CHECKSUM_ON_COPY |
DieterGraef | 0:f9b6112278fe | 57 | /** Function-like macro: same as MEMCPY but returns the checksum of copied data |
DieterGraef | 0:f9b6112278fe | 58 | as u16_t */ |
DieterGraef | 0:f9b6112278fe | 59 | #ifndef LWIP_CHKSUM_COPY |
DieterGraef | 0:f9b6112278fe | 60 | #define LWIP_CHKSUM_COPY(dst, src, len) lwip_chksum_copy(dst, src, len) |
DieterGraef | 0:f9b6112278fe | 61 | #ifndef LWIP_CHKSUM_COPY_ALGORITHM |
DieterGraef | 0:f9b6112278fe | 62 | #define LWIP_CHKSUM_COPY_ALGORITHM 1 |
DieterGraef | 0:f9b6112278fe | 63 | #endif /* LWIP_CHKSUM_COPY_ALGORITHM */ |
DieterGraef | 0:f9b6112278fe | 64 | #endif /* LWIP_CHKSUM_COPY */ |
DieterGraef | 0:f9b6112278fe | 65 | #else /* LWIP_CHECKSUM_ON_COPY */ |
DieterGraef | 0:f9b6112278fe | 66 | #define LWIP_CHKSUM_COPY_ALGORITHM 0 |
DieterGraef | 0:f9b6112278fe | 67 | #endif /* LWIP_CHECKSUM_ON_COPY */ |
DieterGraef | 0:f9b6112278fe | 68 | |
DieterGraef | 0:f9b6112278fe | 69 | #ifdef __cplusplus |
DieterGraef | 0:f9b6112278fe | 70 | extern "C" { |
DieterGraef | 0:f9b6112278fe | 71 | #endif |
DieterGraef | 0:f9b6112278fe | 72 | |
DieterGraef | 0:f9b6112278fe | 73 | u16_t inet_chksum(void *dataptr, u16_t len); |
DieterGraef | 0:f9b6112278fe | 74 | u16_t inet_chksum_pbuf(struct pbuf *p); |
DieterGraef | 0:f9b6112278fe | 75 | u16_t inet_chksum_pseudo(struct pbuf *p, |
DieterGraef | 0:f9b6112278fe | 76 | ip_addr_t *src, ip_addr_t *dest, |
DieterGraef | 0:f9b6112278fe | 77 | u8_t proto, u16_t proto_len); |
DieterGraef | 0:f9b6112278fe | 78 | u16_t inet_chksum_pseudo_partial(struct pbuf *p, |
DieterGraef | 0:f9b6112278fe | 79 | ip_addr_t *src, ip_addr_t *dest, |
DieterGraef | 0:f9b6112278fe | 80 | u8_t proto, u16_t proto_len, u16_t chksum_len); |
DieterGraef | 0:f9b6112278fe | 81 | #if LWIP_CHKSUM_COPY_ALGORITHM |
DieterGraef | 0:f9b6112278fe | 82 | u16_t lwip_chksum_copy(void *dst, const void *src, u16_t len); |
DieterGraef | 0:f9b6112278fe | 83 | #endif /* LWIP_CHKSUM_COPY_ALGORITHM */ |
DieterGraef | 0:f9b6112278fe | 84 | |
DieterGraef | 0:f9b6112278fe | 85 | #ifdef __cplusplus |
DieterGraef | 0:f9b6112278fe | 86 | } |
DieterGraef | 0:f9b6112278fe | 87 | #endif |
DieterGraef | 0:f9b6112278fe | 88 | |
DieterGraef | 0:f9b6112278fe | 89 | #endif /* __LWIP_INET_H__ */ |
DieterGraef | 0:f9b6112278fe | 90 |