Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __P_SPDY_COMMON_H__
00025 #define __P_SPDY_COMMON_H__
00026
00027 #include <stdio.h>
00028 #include <stdlib.h>
00029 #include <unistd.h>
00030 #include <getopt.h>
00031 #include <limits.h>
00032 #include <string.h>
00033 #include <string>
00034 #include <vector>
00035 #include <map>
00036
00037 #include "P_Net.h"
00038 #include "ts/ts.h"
00039 #include "ts/libts.h"
00040 #include "ts/experimental.h"
00041 #include <spdylay/spdylay.h>
00042 using namespace std;
00043
00044 #define STATUS_200 "200 OK"
00045 #define STATUS_304 "304 Not Modified"
00046 #define STATUS_400 "400 Bad Request"
00047 #define STATUS_404 "404 Not Found"
00048 #define STATUS_405 "405 Method Not Allowed"
00049 #define STATUS_500 "500 Internal Server Error"
00050 #define DEFAULT_HTML "index.html"
00051 #define SPDYD_SERVER "ATS Spdylay/" SPDYLAY_VERSION
00052
00053 #define atomic_fetch_and_add(a, b) __sync_fetch_and_add(&a, b)
00054 #define atomic_fetch_and_sub(a, b) __sync_fetch_and_sub(&a, b)
00055 #define atomic_inc(a) atomic_fetch_and_add(a, 1)
00056 #define atomic_dec(a) atomic_fetch_and_sub(a, 1)
00057
00058
00059 extern spdylay_session_callbacks spdy_callbacks;
00060
00061
00062 extern uint32_t spdy_max_concurrent_streams;
00063 extern uint32_t spdy_initial_window_size;
00064 extern int32_t spdy_accept_no_activity_timeout;
00065 extern int32_t spdy_no_activity_timeout_in;
00066
00067
00068 extern RecRawStatBlock* spdy_rsb;
00069
00070 enum {
00071 SPDY_STAT_CURRENT_CLIENT_SESSION_COUNT,
00072 SPDY_STAT_CURRENT_CLIENT_STREAM_COUNT,
00073 SPDY_STAT_TOTAL_TRANSACTIONS_TIME,
00074 SPDY_STAT_TOTAL_CLIENT_CONNECTION_COUNT,
00075
00076 SPDY_N_STATS
00077 };
00078
00079
00080 class SpdyNV {
00081 public:
00082
00083 SpdyNV(TSFetchSM fetch_sm);
00084 ~SpdyNV();
00085
00086 public:
00087 const char **nv;
00088
00089 private:
00090 SpdyNV();
00091 void *mime_hdr;
00092 char status[64];
00093 char version[64];
00094 };
00095
00096 string http_date(time_t t);
00097 int spdy_config_load();
00098
00099
00100 #define SPDY_INCREMENT_THREAD_DYN_STAT(_s, _t) \
00101 RecIncrRawStat(spdy_rsb, _t, (int) _s, 1);
00102
00103 #define SPDY_DECREMENT_THREAD_DYN_STAT(_s, _t) \
00104 RecIncrRawStat(spdy_rsb, _t, (int) _s, -1);
00105
00106 #define SPDY_SUM_THREAD_DYN_STAT(_s, _t, _v) \
00107 RecIncrRawStat(spdy_rsb, _t, (int) _s, _v);
00108
00109 #endif