"Fossies" - the Fresh Open Source Software Archive

Member "wrk-4.2.0/src/wrk.h" (7 Feb 2021, 1159 Bytes) of package /linux/www/wrk-4.2.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "wrk.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 4.0.2_vs_4.1.0.

    1 #ifndef WRK_H
    2 #define WRK_H
    3 
    4 #include "config.h"
    5 #include <pthread.h>
    6 #include <inttypes.h>
    7 #include <sys/types.h>
    8 #include <netdb.h>
    9 #include <sys/socket.h>
   10 
   11 #include <openssl/ssl.h>
   12 #include <openssl/err.h>
   13 #include <lua.h>
   14 
   15 #include "stats.h"
   16 #include "ae.h"
   17 #include "http_parser.h"
   18 
   19 #define RECVBUF  8192
   20 
   21 #define MAX_THREAD_RATE_S   10000000
   22 #define SOCKET_TIMEOUT_MS   2000
   23 #define RECORD_INTERVAL_MS  100
   24 
   25 extern const char *VERSION;
   26 
   27 typedef struct {
   28     pthread_t thread;
   29     aeEventLoop *loop;
   30     struct addrinfo *addr;
   31     uint64_t connections;
   32     uint64_t complete;
   33     uint64_t requests;
   34     uint64_t bytes;
   35     uint64_t start;
   36     lua_State *L;
   37     errors errors;
   38     struct connection *cs;
   39 } thread;
   40 
   41 typedef struct {
   42     char  *buffer;
   43     size_t length;
   44     char  *cursor;
   45 } buffer;
   46 
   47 typedef struct connection {
   48     thread *thread;
   49     http_parser parser;
   50     enum {
   51         FIELD, VALUE
   52     } state;
   53     int fd;
   54     SSL *ssl;
   55     bool delayed;
   56     uint64_t start;
   57     char *request;
   58     size_t length;
   59     size_t written;
   60     uint64_t pending;
   61     buffer headers;
   62     buffer body;
   63     char buf[RECVBUF];
   64 } connection;
   65 
   66 #endif /* WRK_H */