BadVPN – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /** |
2 | * @file cc.h |
||
3 | * @author Ambroz Bizjak <ambrop7@gmail.com> |
||
4 | * |
||
5 | * @section LICENSE |
||
6 | * |
||
7 | * Redistribution and use in source and binary forms, with or without |
||
8 | * modification, are permitted provided that the following conditions are met: |
||
9 | * 1. Redistributions of source code must retain the above copyright |
||
10 | * notice, this list of conditions and the following disclaimer. |
||
11 | * 2. Redistributions in binary form must reproduce the above copyright |
||
12 | * notice, this list of conditions and the following disclaimer in the |
||
13 | * documentation and/or other materials provided with the distribution. |
||
14 | * 3. Neither the name of the author nor the |
||
15 | * names of its contributors may be used to endorse or promote products |
||
16 | * derived from this software without specific prior written permission. |
||
17 | * |
||
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
||
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
||
22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
28 | */ |
||
29 | |||
30 | #ifndef LWIP_CUSTOM_CC_H |
||
31 | #define LWIP_CUSTOM_CC_H |
||
32 | |||
33 | #include <stdlib.h> |
||
34 | #include <stdio.h> |
||
35 | #include <errno.h> |
||
36 | #include <stdint.h> |
||
37 | |||
38 | #include <misc/debug.h> |
||
39 | #include <misc/byteorder.h> |
||
40 | #include <misc/packed.h> |
||
41 | #include <misc/print_macros.h> |
||
42 | #include <misc/byteorder.h> |
||
43 | #include <base/BLog.h> |
||
44 | |||
45 | #define PACK_STRUCT_BEGIN B_START_PACKED |
||
46 | #define PACK_STRUCT_END B_END_PACKED |
||
47 | #define PACK_STRUCT_STRUCT B_PACKED |
||
48 | |||
49 | #define LWIP_PLATFORM_DIAG(x) { if (BLog_WouldLog(BLOG_CHANNEL_lwip, BLOG_INFO)) { BLog_Begin(); BLog_Append x; BLog_Finish(BLOG_CHANNEL_lwip, BLOG_INFO); } } |
||
50 | #define LWIP_PLATFORM_ASSERT(x) { fprintf(stderr, "%s: lwip assertion failure: %s\n", __FUNCTION__, (x)); abort(); } |
||
51 | |||
52 | #define lwip_htons(x) hton16(x) |
||
53 | #define lwip_htonl(x) hton32(x) |
||
54 | |||
55 | #define LWIP_RAND() ( \ |
||
56 | (((uint32_t)(rand() & 0xFF)) << 24) | \ |
||
57 | (((uint32_t)(rand() & 0xFF)) << 16) | \ |
||
58 | (((uint32_t)(rand() & 0xFF)) << 8) | \ |
||
59 | (((uint32_t)(rand() & 0xFF)) << 0) \ |
||
60 | ) |
||
61 | |||
62 | // for BYTE_ORDER |
||
63 | #if defined(BADVPN_USE_WINAPI) && !defined(_MSC_VER) |
||
64 | #include <sys/param.h> |
||
65 | #elif defined(BADVPN_LINUX) |
||
66 | #include <endian.h> |
||
67 | #elif defined(BADVPN_FREEBSD) |
||
68 | #include <machine/endian.h> |
||
69 | #else |
||
70 | #define LITTLE_ENDIAN 1234 |
||
71 | #define BIG_ENDIAN 4321 |
||
72 | #if defined(BADVPN_LITTLE_ENDIAN) |
||
73 | #define BYTE_ORDER LITTLE_ENDIAN |
||
74 | #else |
||
75 | #define BYTE_ORDER BIG_ENDIAN |
||
76 | #endif |
||
77 | #endif |
||
78 | |||
79 | #endif |