ReactOS 0.4.16-dev-329-g9223134
def.h
Go to the documentation of this file.
1
6/*
7 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without modification,
11 * are permitted provided that the following conditions are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * 3. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
24 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
30 * OF SUCH DAMAGE.
31 *
32 * This file is part of the lwIP TCP/IP stack.
33 *
34 * Author: Adam Dunkels <adam@sics.se>
35 *
36 */
37
48#ifndef LWIP_HDR_DEF_H
49#define LWIP_HDR_DEF_H
50
51/* arch.h might define NULL already */
52#include "lwip/arch.h"
53#include "lwip/opt.h"
54#if LWIP_PERF
55#include "arch/perf.h"
56#else /* LWIP_PERF */
57#define PERF_START /* null definition */
58#define PERF_STOP(x) /* null definition */
59#endif /* LWIP_PERF */
60
61#ifdef __cplusplus
62extern "C" {
63#endif
64
65#define LWIP_MAX(x , y) (((x) > (y)) ? (x) : (y))
66#define LWIP_MIN(x , y) (((x) < (y)) ? (x) : (y))
67
68/* Get the number of entries in an array ('x' must NOT be a pointer!) */
69#define LWIP_ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0]))
70
72#define LWIP_MAKEU32(a,b,c,d) (((u32_t)((a) & 0xff) << 24) | \
73 ((u32_t)((b) & 0xff) << 16) | \
74 ((u32_t)((c) & 0xff) << 8) | \
75 (u32_t)((d) & 0xff))
76
77#ifndef NULL
78#ifdef __cplusplus
79#define NULL 0
80#else
81#define NULL ((void *)0)
82#endif
83#endif
84
85#if BYTE_ORDER == BIG_ENDIAN
86#define lwip_htons(x) ((u16_t)(x))
87#define lwip_ntohs(x) ((u16_t)(x))
88#define lwip_htonl(x) ((u32_t)(x))
89#define lwip_ntohl(x) ((u32_t)(x))
90#define PP_HTONS(x) ((u16_t)(x))
91#define PP_NTOHS(x) ((u16_t)(x))
92#define PP_HTONL(x) ((u32_t)(x))
93#define PP_NTOHL(x) ((u32_t)(x))
94#else /* BYTE_ORDER != BIG_ENDIAN */
95#ifndef lwip_htons
97#endif
98#define lwip_ntohs(x) lwip_htons(x)
99
100#ifndef lwip_htonl
102#endif
103#define lwip_ntohl(x) lwip_htonl(x)
104
105/* These macros should be calculated by the preprocessor and are used
106 with compile-time constants only (so that there is no little-endian
107 overhead at runtime). */
108#define PP_HTONS(x) ((u16_t)((((x) & (u16_t)0x00ffU) << 8) | (((x) & (u16_t)0xff00U) >> 8)))
109#define PP_NTOHS(x) PP_HTONS(x)
110#define PP_HTONL(x) ((((x) & (u32_t)0x000000ffUL) << 24) | \
111 (((x) & (u32_t)0x0000ff00UL) << 8) | \
112 (((x) & (u32_t)0x00ff0000UL) >> 8) | \
113 (((x) & (u32_t)0xff000000UL) >> 24))
114#define PP_NTOHL(x) PP_HTONL(x)
115#endif /* BYTE_ORDER == BIG_ENDIAN */
116
117/* Provide usual function names as macros for users, but this can be turned off */
118#ifndef LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
119#define htons(x) lwip_htons(x)
120#define ntohs(x) lwip_ntohs(x)
121#define htonl(x) lwip_htonl(x)
122#define ntohl(x) lwip_ntohl(x)
123#endif
124
125/* Functions that are not available as standard implementations.
126 * In cc.h, you can #define these to implementations available on
127 * your platform to save some code bytes if you use these functions
128 * in your application, too.
129 */
130
131#ifndef lwip_itoa
132/* This can be #defined to itoa() or snprintf(result, bufsize, "%d", number) depending on your platform */
133void lwip_itoa(char* result, size_t bufsize, int number);
134#endif
135#ifndef lwip_strnicmp
136/* This can be #defined to strnicmp() or strncasecmp() depending on your platform */
137int lwip_strnicmp(const char* str1, const char* str2, size_t len);
138#endif
139#ifndef lwip_stricmp
140/* This can be #defined to stricmp() or strcasecmp() depending on your platform */
141int lwip_stricmp(const char* str1, const char* str2);
142#endif
143#ifndef lwip_strnstr
144/* This can be #defined to strnstr() depending on your platform */
145char* lwip_strnstr(const char* buffer, const char* token, size_t n);
146#endif
147#ifndef lwip_strnistr
148/* This can be #defined to strnistr() depending on your platform */
149char* lwip_strnistr(const char* buffer, const char* token, size_t n);
150#endif
151
152#ifdef __cplusplus
153}
154#endif
155
156#endif /* LWIP_HDR_DEF_H */
#define lwip_htons(x)
Definition: def.h:86
#define lwip_htonl(x)
Definition: def.h:88
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble n
Definition: glext.h:7729
GLuint buffer
Definition: glext.h:5915
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
GLenum GLsizei len
Definition: glext.h:6722
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
uint32_t u32_t
Definition: arch.h:129
uint16_t u16_t
Definition: arch.h:127
int lwip_stricmp(const char *str1, const char *str2)
Definition: def.c:151
int lwip_strnicmp(const char *str1, const char *str2, size_t len)
Definition: def.c:186
char * lwip_strnstr(const char *buffer, const char *token, size_t n)
Definition: def.c:105
char * lwip_strnistr(const char *buffer, const char *token, size_t n)
Definition: def.c:128
void lwip_itoa(char *result, size_t bufsize, int number)
Definition: def.c:222
static unsigned int number
Definition: dsound.c:1479