Free (GPLv2) TCP/IP stack developed by TASS Belgium

Dependents:   lpc1768-picotcp-demo ZeroMQ_PicoTCP_Publisher_demo TCPSocket_HelloWorld_PicoTCP Pico_TCP_UDP_Test ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pico_constants.h Source File

pico_constants.h

00001 /*********************************************************************
00002    PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
00003    See LICENSE and COPYING for usage.
00004 
00005  *********************************************************************/
00006 #ifndef INCLUDE_PICO_CONST
00007 #define INCLUDE_PICO_CONST
00008 /* Included from pico_config.h */
00009 
00010 /** Non-endian dependant constants */
00011 #define PICO_SIZE_IP4    4
00012 #define PICO_SIZE_IP6   16
00013 #define PICO_SIZE_ETH    6
00014 #define PICO_SIZE_TRANS  8
00015 
00016 /** Endian-dependant constants **/
00017 typedef uint64_t pico_time;
00018 extern volatile uint64_t pico_tick;
00019 
00020 
00021 /*** *** *** *** *** *** ***
00022  ***     ARP CONFIG      ***
00023  *** *** *** *** *** *** ***/
00024 
00025 #include "pico_addressing.h"
00026 
00027 /* Maximum amount of accepted ARP requests per burst interval */
00028 #define PICO_ARP_MAX_RATE 1
00029 /* Duration of the burst interval in milliseconds */
00030 #define PICO_ARP_INTERVAL 1000
00031 
00032 /* Add well-known host numbers here. (bigendian constants only beyond this point) */
00033 #define PICO_IP4_ANY (0x00000000U)
00034 #define PICO_IP4_BCAST (0xffffffffU)
00035 
00036 /* defined in modules/pico_ipv6.c */
00037 #ifdef PICO_SUPPORT_IPV6
00038 extern const uint8_t PICO_IPV6_ANY[PICO_SIZE_IP6];
00039 #endif
00040 
00041 static inline uint32_t pico_hash(const void *buf, uint32_t size)
00042 {
00043     uint32_t hash = 5381;
00044     uint32_t i;
00045     const uint8_t *ptr = (const uint8_t *)buf;
00046     for(i = 0; i < size; i++)
00047         hash = ((hash << 5) + hash) + ptr[i]; /* hash * 33 + char */
00048     return hash;
00049 }
00050 
00051 /* Debug */
00052 /* #define PICO_SUPPORT_DEBUG_MEMORY */
00053 /* #define PICO_SUPPORT_DEBUG_TOOLS */
00054 #endif