00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00025 #ifndef INTERNAL_H_H
00026 #define INTERNAL_H_H
00027
00028 #include "platform.h"
00029 #include "microspdy.h"
00030
00035 #define SPDYF_BUFFER_SIZE 8192
00036
00041 #define SPDYF_INITIAL_WINDOW_SIZE 65536
00042
00049 #define SPDYF_NUM_SENT_FRAMES_AT_ONCE 10
00050
00051
00055 extern SPDY_PanicCallback spdyf_panic;
00056
00057
00061 extern void *spdyf_panic_cls;
00062
00063
00069 #define SPDYF_PANIC(msg) \
00070 spdyf_panic (spdyf_panic_cls, __FILE__, __LINE__, msg)
00071
00072
00079 #define SPDYF_ASSERT(expr, msg) \
00080 if(!(expr)){\
00081 SPDYF_PANIC(msg);\
00082 abort();\
00083 }
00084
00085
00092 #if HAVE_BIG_ENDIAN
00093 #define HTON24(n) n
00094 #else
00095 #define HTON24(n) (((((uint32_t)(n) & 0xFF)) << 16)\
00096 | (((uint32_t)(n) & 0xFF00))\
00097 | ((((uint32_t)(n) & 0xFF0000)) >> 16))
00098 #endif
00099
00100
00107 #if HAVE_BIG_ENDIAN
00108 #define NTOH24(n) n
00109 #else
00110 #define NTOH24(n) (((((uint32_t)(n) & 0xFF)) << 16)\
00111 | (((uint32_t)(n) & 0xFF00))\
00112 | ((((uint32_t)(n) & 0xFF0000)) >> 16))
00113 #endif
00114
00115
00122 #if HAVE_BIG_ENDIAN
00123 #define NTOH31(n) n
00124 #else
00125 #define NTOH31(n) (((((uint32_t)(n) & 0x7F)) << 24) | \
00126 ((((uint32_t)(n) & 0xFF00)) << 8) | \
00127 ((((uint32_t)(n) & 0xFF0000)) >> 8) | \
00128 ((((uint32_t)(n) & 0xFF000000)) >> 24))
00129 #endif
00130
00131
00138 #if HAVE_BIG_ENDIAN
00139 #define HTON31(n) n
00140 #else
00141 #define HTON31(n) (((((uint32_t)(n) & 0xFF)) << 24) | \
00142 ((((uint32_t)(n) & 0xFF00)) << 8) | \
00143 ((((uint32_t)(n) & 0xFF0000)) >> 8) | \
00144 ((((uint32_t)(n) & 0x7F000000)) >> 24))
00145 #endif
00146
00147
00154 #define SPDYF_DEBUG(fmt, ...) do { \
00155 fprintf (stdout, "%s\n%u: ",__FILE__, __LINE__);\
00156 fprintf(stdout,fmt,##__VA_ARGS__);\
00157 fprintf(stdout,"\n");\
00158 fflush(stdout); } while (0)
00159
00160
00167 #define SPDYF_PRINT_STREAM(strm, size) do { \
00168 int ___i;\
00169 for(___i=0;___i<size;___i++){\
00170 fprintf(stdout,"%x ",*((uint8_t *) strm + ___i));\
00171 fflush(stdout);\
00172 }\
00173 fprintf(stdout,"\n");\
00174 } while (0)
00175
00176
00182 #define SPDYF_SIGINT(msg) do { \
00183 fprintf(stdout,"%i : %s\n", __LINE__,__FILE__);\
00184 fprintf(stdout,msg);\
00185 fprintf(stdout,"\n");\
00186 fflush(stdout);\
00187 raise(SIGINT); } while (0)
00188
00189
00195 unsigned long long
00196 SPDYF_monotonic_time(void);
00197
00198 #endif