GNU libmicrohttpd  0.9.29
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
internal.h
Go to the documentation of this file.
1 /*
2  This file is part of libmicrospdy
3  Copyright (C) 2012 Andrey Uzunov
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
25 #ifndef INTERNAL_H_H
26 #define INTERNAL_H_H
27 
28 #include "platform.h"
29 #include "microspdy.h"
30 
35 #define SPDYF_BUFFER_SIZE 8192
36 
41 #define SPDYF_INITIAL_WINDOW_SIZE 65536
42 
49 #define SPDYF_NUM_SENT_FRAMES_AT_ONCE 10
50 
51 
56 
57 
61 extern void *spdyf_panic_cls;
62 
63 
69 #define SPDYF_PANIC(msg) \
70  spdyf_panic (spdyf_panic_cls, __FILE__, __LINE__, msg)
71 
72 
79 #define SPDYF_ASSERT(expr, msg) \
80  if(!(expr)){\
81  SPDYF_PANIC(msg);\
82  abort();\
83  }
84 
85 
92 #if HAVE_BIG_ENDIAN
93 #define HTON24(n) n
94 #else
95 #define HTON24(n) (((((uint32_t)(n) & 0xFF)) << 16)\
96  | (((uint32_t)(n) & 0xFF00))\
97  | ((((uint32_t)(n) & 0xFF0000)) >> 16))
98 #endif
99 
100 
107 #if HAVE_BIG_ENDIAN
108 #define NTOH24(n) n
109 #else
110 #define NTOH24(n) (((((uint32_t)(n) & 0xFF)) << 16)\
111  | (((uint32_t)(n) & 0xFF00))\
112  | ((((uint32_t)(n) & 0xFF0000)) >> 16))
113 #endif
114 
115 
122 #if HAVE_BIG_ENDIAN
123 #define NTOH31(n) n
124 #else
125 #define NTOH31(n) (((((uint32_t)(n) & 0x7F)) << 24) | \
126  ((((uint32_t)(n) & 0xFF00)) << 8) | \
127  ((((uint32_t)(n) & 0xFF0000)) >> 8) | \
128  ((((uint32_t)(n) & 0xFF000000)) >> 24))
129 #endif
130 
131 
138 #if HAVE_BIG_ENDIAN
139 #define HTON31(n) n
140 #else
141 #define HTON31(n) (((((uint32_t)(n) & 0xFF)) << 24) | \
142  ((((uint32_t)(n) & 0xFF00)) << 8) | \
143  ((((uint32_t)(n) & 0xFF0000)) >> 8) | \
144  ((((uint32_t)(n) & 0x7F000000)) >> 24))
145 #endif
146 
147 
154 #define SPDYF_DEBUG(fmt, ...) do { \
155  fprintf (stdout, "%s\n%u: ",__FILE__, __LINE__);\
156  fprintf(stdout,fmt,##__VA_ARGS__);\
157  fprintf(stdout,"\n");\
158  fflush(stdout); } while (0)
159 
160 
167 #define SPDYF_PRINT_STREAM(strm, size) do { \
168  int ___i;\
169  for(___i=0;___i<size;___i++){\
170  fprintf(stdout,"%x ",*((uint8_t *) strm + ___i));\
171  fflush(stdout);\
172  }\
173  fprintf(stdout,"\n");\
174  } while (0)
175 
176 
182 #define SPDYF_SIGINT(msg) do { \
183  fprintf(stdout,"%i : %s\n", __LINE__,__FILE__);\
184  fprintf(stdout,msg);\
185  fprintf(stdout,"\n");\
186  fflush(stdout);\
187  raise(SIGINT); } while (0)
188 
189 
195 unsigned long long
197 
198 #endif
SPDY_PanicCallback spdyf_panic
Definition: daemon.c:58
public interface to libmicrospdy
void(* SPDY_PanicCallback)(void *cls, const char *file, unsigned int line, const char *reason)
Definition: microspdy.h:587
platform-specific includes for libmicrohttpd
unsigned long long SPDYF_monotonic_time(void)
Definition: internal.c:30
void * spdyf_panic_cls
Definition: daemon.c:64