"Fossies" - the Fresh Open Source Software Archive

Member "HTTPing-2.9/gen.h" (29 Oct 2022, 1112 Bytes) of package /linux/www/HTTPing-2.9.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 "gen.h" see the Fossies "Dox" file reference documentation.

    1 /* Released under AGPL v3 with exception for the OpenSSL library. See license.txt */
    2 
    3 #ifndef __GEN_H__
    4 #define __GEN_H__
    5 
    6 #define RC_OK       0
    7 #define RC_SHORTREAD    -1
    8 #define RC_SHORTWRITE   -1
    9 #define RC_TIMEOUT  -2
   10 #define RC_CTRLC    -3
   11 #define RC_INVAL    -4
   12 
   13 #define RECV_BUFFER_SIZE (128 * 1024)
   14 
   15 #define SPAM_FILE "/tmp/httping.dat"
   16 
   17 #define MAX_SHOW_SUPPRESSION 3
   18 
   19 #ifdef NO_SSL
   20     #define SSL void
   21     #define SSL_CTX void
   22     #define BIO void
   23 #endif
   24 
   25 #define PI (4 * atan(1.0))
   26 #define MY_DOUBLE_INF   999999999999999.9
   27 
   28 #ifdef TCP_TFO
   29     #ifndef MSG_FASTOPEN
   30         #define MSG_FASTOPEN    0x20000000
   31     #endif
   32 
   33     #ifndef TCP_FASTOPEN
   34         #define TCP_FASTOPEN    23
   35     #endif
   36     #ifndef TCPI_OPT_SYN_DATA
   37         #define TCPI_OPT_SYN_DATA   32
   38     #endif
   39 #endif
   40 
   41 #define min(x, y) ((x) < (y) ? (x) : (y))
   42 #define max(x, y) ((x) > (y) ? (x) : (y))
   43 
   44 typedef struct
   45 {
   46     double cur, min, avg, max, sd;
   47     int n;
   48     char valid, cur_valid;
   49 } stats_t;
   50 
   51 int enc_b64(char *source, int source_lenght, char *target);
   52 
   53 void init_statst(stats_t *data);
   54 void update_statst(stats_t *data, double in);
   55 void reset_statst_cur(stats_t *data);
   56 double calc_sd(stats_t *in);
   57 
   58 #endif