MIDAS
|
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <algorithm>
#include <thread>
#include <deque>
#include <mutex>
#include <condition_variable>
#include <atomic>
#include "midas.h"
#include "msystem.h"
#include "mxml.h"
#include "odbxx.h"
#include "mstrlcpy.h"
#include "mgd.h"
#include "history.h"
#include "mjsonrpc.h"
#include "mvodb.h"
Go to the source code of this file.
Classes | |
class | Attachment |
struct | MimetypeTableEntry |
class | RequestTrace |
class | RequestTraceBuf |
class | Return |
class | Param |
struct | search_data |
struct | CGIF_LABEL |
struct | CGIF_BAR |
struct | HistoryData |
struct | HistVar |
struct | HistPlot |
struct | Cookies |
struct | AuthEntry |
class | Auth |
Macros | |
#define | DEFAULT_REFRESH 60 |
#define | OBSOLETE 1 |
#define | MAX_GROUPS 32 |
#define | MAX_VARS 100 |
#define | HTTP_ENCODING "UTF-8" |
#define | WEB_BUFFER_SIZE (6*1024*1024) |
#define | MAX_PARAM 500 |
#define | PARAM_LENGTH 256 |
#define | TEXT_SIZE 50000 |
#define | LN10 2.302585094 |
#define | LOG2 0.301029996 |
#define | LOG5 0.698970005 |
#define | ALLOC(t, n) (t*)calloc(sizeof(t),(n)) |
#define | DELETE(x) if (x) { free(x); (x)=NULL; } |
#define | DELETEA(x, n) if (x) { for (int i=0; i<(n); i++) { free((x)[i]); (x)[i]=NULL; }; DELETE(x); } |
#define | STRDUP(x) strdup(x) |
#define | READ_HISTORY_DATA 0x1 |
#define | READ_HISTORY_RUNMARKER 0x2 |
#define | READ_HISTORY_LAST_WRITTEN 0x4 |
#define | RESPONSE_SENT 1 |
#define | RESPONSE_QUEUED 2 |
#define | RESPONSE_501 3 |
Variables | |
static std::mutex | gMutex |
static MVOdb * | gOdb = NULL |
static BOOL | elog_mode = FALSE |
static BOOL | history_mode = FALSE |
static BOOL | verbose = FALSE |
const char * | mname [] |
static const char | default_type_list [20][NAME_LENGTH] |
static const char | default_system_list [20][NAME_LENGTH] |
const MimetypeTableEntry | gMimetypeTable [] |
static MVOdb * | gMimeTypesOdb = NULL |
const unsigned char | favicon_png [] |
const unsigned char | favicon_ico [] |
static int | http_trace = 0 |
static RequestTraceBuf * | gTraceBuf = NULL |
static const char * | cgif_label_str [] |
static const char * | cgif_bar_str [] |
static bool | gDoSetupHistoryWatch = true |
static bool | gDoReloadHistory = false |
static MidasHistoryInterface * | gMh = NULL |
static HNDLE | gMhkey = 0 |
std::atomic_bool | _abort {false} |
static std::vector< std::string > | gAllowedHosts |
static bool | verbose_mg = false |
static bool | trace_mg = false |
static bool | trace_mg_recv = false |
static bool | trace_mg_send = false |
static bool | trace_mg_verbose = false |
static Auth * | gAuthMg = NULL |
#define DEFAULT_REFRESH 60 |
Definition at line 39 of file mhttpd.cxx.
Definition at line 8245 of file mhttpd.cxx.
#define DELETEA | ( | x, | |
n | |||
) | if (x) { for (int i=0; i<(n); i++) { free((x)[i]); (x)[i]=NULL; }; DELETE(x); } |
Definition at line 8246 of file mhttpd.cxx.
#define HTTP_ENCODING "UTF-8" |
Definition at line 213 of file mhttpd.cxx.
#define LN10 2.302585094 |
Definition at line 7638 of file mhttpd.cxx.
#define LOG2 0.301029996 |
Definition at line 7639 of file mhttpd.cxx.
#define LOG5 0.698970005 |
Definition at line 7640 of file mhttpd.cxx.
#define MAX_GROUPS 32 |
Definition at line 52 of file mhttpd.cxx.
#define MAX_PARAM 500 |
Definition at line 697 of file mhttpd.cxx.
#define MAX_VARS 100 |
Definition at line 53 of file mhttpd.cxx.
#define OBSOLETE 1 |
Definition at line 45 of file mhttpd.cxx.
#define PARAM_LENGTH 256 |
Definition at line 698 of file mhttpd.cxx.
#define READ_HISTORY_DATA 0x1 |
Definition at line 8330 of file mhttpd.cxx.
#define READ_HISTORY_LAST_WRITTEN 0x4 |
Definition at line 8332 of file mhttpd.cxx.
#define READ_HISTORY_RUNMARKER 0x2 |
Definition at line 8331 of file mhttpd.cxx.
#define RESPONSE_501 3 |
Definition at line 14272 of file mhttpd.cxx.
#define RESPONSE_QUEUED 2 |
Definition at line 14271 of file mhttpd.cxx.
#define RESPONSE_SENT 1 |
Definition at line 14270 of file mhttpd.cxx.
Definition at line 8247 of file mhttpd.cxx.
#define TEXT_SIZE 50000 |
Definition at line 699 of file mhttpd.cxx.
#define WEB_BUFFER_SIZE (6*1024*1024) |
Definition at line 511 of file mhttpd.cxx.
std::string add_custom_path | ( | const std::string & | filename | ) |
Definition at line 3575 of file mhttpd.cxx.
Definition at line 9790 of file mhttpd.cxx.
Definition at line 16227 of file mhttpd.cxx.
Definition at line 10387 of file mhttpd.cxx.
|
static |
Definition at line 13909 of file mhttpd.cxx.
Definition at line 1883 of file mhttpd.cxx.
Definition at line 13405 of file mhttpd.cxx.
BOOL check_web_password | ( | Return * | r, |
HNDLE | hDB, | ||
const char * | dec_path, | ||
const char * | password, | ||
const char * | redir | ||
) |
Definition at line 6746 of file mhttpd.cxx.
Definition at line 10043 of file mhttpd.cxx.
Definition at line 10048 of file mhttpd.cxx.
Definition at line 9985 of file mhttpd.cxx.
Definition at line 10053 of file mhttpd.cxx.
void decode_cookies | ( | Cookies * | c, |
const http_message * | msg | ||
) |
Definition at line 14223 of file mhttpd.cxx.
void decode_get | ( | Return * | rr, |
char * | string, | ||
const Cookies * | c, | ||
const char * | url, | ||
const char * | query_string, | ||
RequestTrace * | t | ||
) |
Definition at line 13211 of file mhttpd.cxx.
void decode_post | ( | Return * | rr, |
const char * | header, | ||
const char * | string, | ||
const char * | boundary, | ||
int | length, | ||
const Cookies * | c, | ||
const char * | url, | ||
RequestTrace * | t | ||
) |
Definition at line 13249 of file mhttpd.cxx.
Definition at line 13186 of file mhttpd.cxx.
Definition at line 10491 of file mhttpd.cxx.
Definition at line 4325 of file mhttpd.cxx.
Definition at line 4019 of file mhttpd.cxx.
Definition at line 4144 of file mhttpd.cxx.
Definition at line 3502 of file mhttpd.cxx.
void export_hist | ( | MVOdb * | odb, |
Return * | r, | ||
const char * | group, | ||
const char * | panel, | ||
time_t | endtime, | ||
int | scale, | ||
int | index, | ||
int | labels | ||
) |
Definition at line 11035 of file mhttpd.cxx.
|
static |
Definition at line 14171 of file mhttpd.cxx.
Definition at line 13688 of file mhttpd.cxx.
|
static |
Definition at line 14158 of file mhttpd.cxx.
char * find_odb_tag | ( | char * | p, |
char * | path, | ||
char * | format, | ||
int * | edit, | ||
char * | type, | ||
char * | pwd, | ||
char * | tail | ||
) |
Definition at line 3096 of file mhttpd.cxx.
Definition at line 2137 of file mhttpd.cxx.
void generate_hist_graph | ( | MVOdb * | odb, |
Return * | rr, | ||
const char * | hgroup, | ||
const char * | hpanel, | ||
char * | buffer, | ||
int * | buffer_size, | ||
int | width, | ||
int | height, | ||
time_t | xendtime, | ||
int | scale, | ||
int | index, | ||
int | labels, | ||
const char * | bgcolor, | ||
const char * | fgcolor, | ||
const char * | gridcolor | ||
) |
Definition at line 8614 of file mhttpd.cxx.
Definition at line 1135 of file mhttpd.cxx.
int get_hist_last_written | ( | MVOdb * | odb, |
const char * | group, | ||
const char * | panel, | ||
time_t | endtime, | ||
int | index, | ||
int | want_all, | ||
time_t * | plastwritten | ||
) |
Definition at line 8531 of file mhttpd.cxx.
|
static |
Definition at line 8167 of file mhttpd.cxx.
Definition at line 16200 of file mhttpd.cxx.
std::vector< std::string > get_resource_paths | ( | ) |
Definition at line 991 of file mhttpd.cxx.
Definition at line 181 of file mhttpd.cxx.
Definition at line 376 of file mhttpd.cxx.
|
static |
Definition at line 14274 of file mhttpd.cxx.
|
static |
Definition at line 14744 of file mhttpd.cxx.
Definition at line 14189 of file mhttpd.cxx.
|
static |
Definition at line 14817 of file mhttpd.cxx.
|
static |
Definition at line 15096 of file mhttpd.cxx.
|
static |
Definition at line 15026 of file mhttpd.cxx.
|
static |
Definition at line 14900 of file mhttpd.cxx.
void haxis | ( | gdImagePtr | im, |
gdFont * | font, | ||
int | col, | ||
int | gcol, | ||
int | x1, | ||
int | y1, | ||
int | width, | ||
int | minor, | ||
int | major, | ||
int | text, | ||
int | label, | ||
int | grid, | ||
double | xmin, | ||
double | xmax | ||
) |
Definition at line 7642 of file mhttpd.cxx.
Definition at line 8155 of file mhttpd.cxx.
void init_elog_odb | ( | ) |
Definition at line 1981 of file mhttpd.cxx.
Definition at line 1892 of file mhttpd.cxx.
Definition at line 1933 of file mhttpd.cxx.
void interprete | ( | Param * | p, |
Return * | r, | ||
Attachment * | a, | ||
const Cookies * | c, | ||
const char * | dec_path, | ||
RequestTrace * | t | ||
) |
Definition at line 12267 of file mhttpd.cxx.
Definition at line 2534 of file mhttpd.cxx.
Definition at line 4454 of file mhttpd.cxx.
|
static |
Definition at line 10205 of file mhttpd.cxx.
Definition at line 10310 of file mhttpd.cxx.
void Lock | ( | RequestTrace * | t | ) |
Definition at line 12253 of file mhttpd.cxx.
Definition at line 16235 of file mhttpd.cxx.
Definition at line 836 of file mhttpd.cxx.
Definition at line 9755 of file mhttpd.cxx.
|
static |
Definition at line 10126 of file mhttpd.cxx.
Definition at line 10152 of file mhttpd.cxx.
Definition at line 1031 of file mhttpd.cxx.
Definition at line 4379 of file mhttpd.cxx.
Definition at line 10116 of file mhttpd.cxx.
int read_history | ( | const HistPlot & | hp, |
int | index, | ||
int | flags, | ||
time_t | tstart, | ||
time_t | tend, | ||
time_t | scale, | ||
HistoryData * | data | ||
) |
Definition at line 8366 of file mhttpd.cxx.
Definition at line 13813 of file mhttpd.cxx.
Definition at line 1409 of file mhttpd.cxx.
Definition at line 1446 of file mhttpd.cxx.
Definition at line 1433 of file mhttpd.cxx.
|
static |
Definition at line 10415 of file mhttpd.cxx.
Definition at line 203 of file mhttpd.cxx.
Definition at line 1459 of file mhttpd.cxx.
Definition at line 7760 of file mhttpd.cxx.
Definition at line 1212 of file mhttpd.cxx.
Definition at line 1166 of file mhttpd.cxx.
Definition at line 12201 of file mhttpd.cxx.
Definition at line 1231 of file mhttpd.cxx.
INT sendmail | ( | const char * | from_host, |
const char * | smtp_host, | ||
const char * | from, | ||
const char * | to, | ||
const char * | subject, | ||
const char * | text | ||
) |
Definition at line 1255 of file mhttpd.cxx.
Definition at line 16213 of file mhttpd.cxx.
Definition at line 5664 of file mhttpd.cxx.
Definition at line 3614 of file mhttpd.cxx.
Definition at line 3677 of file mhttpd.cxx.
Definition at line 5430 of file mhttpd.cxx.
Definition at line 2486 of file mhttpd.cxx.
Definition at line 2562 of file mhttpd.cxx.
Definition at line 1841 of file mhttpd.cxx.
Definition at line 1856 of file mhttpd.cxx.
Definition at line 7577 of file mhttpd.cxx.
void show_header | ( | Return * | r, |
const char * | title, | ||
const char * | method, | ||
const char * | path, | ||
int | refresh | ||
) |
Definition at line 1781 of file mhttpd.cxx.
Definition at line 1542 of file mhttpd.cxx.
void show_hist_config_page | ( | MVOdb * | odb, |
Param * | p, | ||
Return * | r, | ||
const char * | hgroup, | ||
const char * | hpanel | ||
) |
Definition at line 10529 of file mhttpd.cxx.
void show_hist_page | ( | MVOdb * | odb, |
Param * | p, | ||
Return * | r, | ||
const char * | dec_path, | ||
char * | buffer, | ||
int * | buffer_size, | ||
int | refresh | ||
) |
Definition at line 11274 of file mhttpd.cxx.
Definition at line 1869 of file mhttpd.cxx.
Definition at line 6803 of file mhttpd.cxx.
void show_odb_tag | ( | Param * | pp, |
Return * | r, | ||
const char * | path, | ||
const char * | keypath1, | ||
const char * | format, | ||
int | n_var, | ||
int | edit, | ||
char * | type, | ||
char * | pwd, | ||
char * | tail | ||
) |
Definition at line 3280 of file mhttpd.cxx.
Definition at line 6712 of file mhttpd.cxx.
Definition at line 9801 of file mhttpd.cxx.
Definition at line 7443 of file mhttpd.cxx.
Definition at line 1829 of file mhttpd.cxx.
Definition at line 10508 of file mhttpd.cxx.
|
static |
Definition at line 10161 of file mhttpd.cxx.
Definition at line 4438 of file mhttpd.cxx.
Definition at line 2022 of file mhttpd.cxx.
Definition at line 2050 of file mhttpd.cxx.
Definition at line 2081 of file mhttpd.cxx.
Definition at line 2106 of file mhttpd.cxx.
Definition at line 8127 of file mhttpd.cxx.
Definition at line 341 of file mhttpd.cxx.
void submit_elog | ( | MVOdb * | odb, |
Param * | pp, | ||
Return * | r, | ||
Attachment * | a | ||
) |
Definition at line 2251 of file mhttpd.cxx.
void taxis | ( | gdImagePtr | im, |
gdFont * | font, | ||
int | col, | ||
int | gcol, | ||
int | x1, | ||
int | y1, | ||
int | width, | ||
int | xr, | ||
int | minor, | ||
int | major, | ||
int | text, | ||
int | label, | ||
int | grid, | ||
double | xmin, | ||
double | xmax | ||
) |
Definition at line 7795 of file mhttpd.cxx.
Definition at line 8102 of file mhttpd.cxx.
std::string time_to_string | ( | time_t | t | ) |
Definition at line 8143 of file mhttpd.cxx.
Definition at line 57 of file mhttpd.cxx.
int try_file_mg | ( | const char * | try_dir, |
const char * | filename, | ||
std::string & | path, | ||
FILE ** | fpp, | ||
bool | trace | ||
) |
Definition at line 13655 of file mhttpd.cxx.
void Unlock | ( | RequestTrace * | t | ) |
Definition at line 12259 of file mhttpd.cxx.
Definition at line 882 of file mhttpd.cxx.
Definition at line 843 of file mhttpd.cxx.
Definition at line 921 of file mhttpd.cxx.
Definition at line 957 of file mhttpd.cxx.
int vaxis | ( | gdImagePtr | im, |
gdFont * | font, | ||
int | col, | ||
int | gcol, | ||
int | x1, | ||
int | y1, | ||
int | width, | ||
int | minor, | ||
int | major, | ||
int | text, | ||
int | label, | ||
int | grid, | ||
double | ymin, | ||
double | ymax, | ||
BOOL | logaxis | ||
) |
Definition at line 7916 of file mhttpd.cxx.
|
static |
Definition at line 10088 of file mhttpd.cxx.
Definition at line 10072 of file mhttpd.cxx.
Definition at line 13792 of file mhttpd.cxx.
|
static |
Definition at line 13803 of file mhttpd.cxx.
|
static |
Definition at line 13771 of file mhttpd.cxx.
std::atomic_bool _abort {false} |
Definition at line 13467 of file mhttpd.cxx.
Definition at line 3473 of file mhttpd.cxx.
Definition at line 3433 of file mhttpd.cxx.
|
static |
Definition at line 116 of file mhttpd.cxx.
|
static |
Definition at line 101 of file mhttpd.cxx.
Definition at line 94 of file mhttpd.cxx.
Definition at line 282 of file mhttpd.cxx.
Definition at line 217 of file mhttpd.cxx.
|
static |
Definition at line 13479 of file mhttpd.cxx.
Definition at line 13769 of file mhttpd.cxx.
Definition at line 8153 of file mhttpd.cxx.
Definition at line 8152 of file mhttpd.cxx.
|
static |
Definition at line 8162 of file mhttpd.cxx.
|
static |
Definition at line 8163 of file mhttpd.cxx.
Definition at line 179 of file mhttpd.cxx.
const MimetypeTableEntry gMimetypeTable[] |
Definition at line 130 of file mhttpd.cxx.
|
static |
Definition at line 47 of file mhttpd.cxx.
Definition at line 48 of file mhttpd.cxx.
|
static |
Definition at line 506 of file mhttpd.cxx.
Definition at line 95 of file mhttpd.cxx.
|
static |
Definition at line 435 of file mhttpd.cxx.
Definition at line 13721 of file mhttpd.cxx.
Definition at line 13722 of file mhttpd.cxx.
Definition at line 13723 of file mhttpd.cxx.
Definition at line 13724 of file mhttpd.cxx.
Definition at line 96 of file mhttpd.cxx.
Definition at line 13720 of file mhttpd.cxx.