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 | 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 Auth * | gAuthMg = NULL |
#define DEFAULT_REFRESH 60 |
Definition at line 39 of file mhttpd.cxx.
Definition at line 8235 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 8236 of file mhttpd.cxx.
#define HTTP_ENCODING "UTF-8" |
Definition at line 211 of file mhttpd.cxx.
#define LN10 2.302585094 |
Definition at line 7628 of file mhttpd.cxx.
#define LOG2 0.301029996 |
Definition at line 7629 of file mhttpd.cxx.
#define LOG5 0.698970005 |
Definition at line 7630 of file mhttpd.cxx.
#define MAX_GROUPS 32 |
Definition at line 50 of file mhttpd.cxx.
#define MAX_PARAM 500 |
Definition at line 695 of file mhttpd.cxx.
#define MAX_VARS 100 |
Definition at line 51 of file mhttpd.cxx.
#define PARAM_LENGTH 256 |
Definition at line 696 of file mhttpd.cxx.
#define READ_HISTORY_DATA 0x1 |
Definition at line 8320 of file mhttpd.cxx.
#define READ_HISTORY_LAST_WRITTEN 0x4 |
Definition at line 8322 of file mhttpd.cxx.
#define READ_HISTORY_RUNMARKER 0x2 |
Definition at line 8321 of file mhttpd.cxx.
#define RESPONSE_501 3 |
Definition at line 14255 of file mhttpd.cxx.
#define RESPONSE_QUEUED 2 |
Definition at line 14254 of file mhttpd.cxx.
#define RESPONSE_SENT 1 |
Definition at line 14253 of file mhttpd.cxx.
Definition at line 8237 of file mhttpd.cxx.
#define TEXT_SIZE 50000 |
Definition at line 697 of file mhttpd.cxx.
#define WEB_BUFFER_SIZE (6*1024*1024) |
Definition at line 509 of file mhttpd.cxx.
std::string add_custom_path | ( | const std::string & | filename | ) |
Definition at line 3570 of file mhttpd.cxx.
Definition at line 9780 of file mhttpd.cxx.
Definition at line 16202 of file mhttpd.cxx.
Definition at line 10377 of file mhttpd.cxx.
|
static |
Definition at line 13892 of file mhttpd.cxx.
Definition at line 1881 of file mhttpd.cxx.
Definition at line 13389 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 6736 of file mhttpd.cxx.
Definition at line 10033 of file mhttpd.cxx.
Definition at line 10038 of file mhttpd.cxx.
Definition at line 9975 of file mhttpd.cxx.
Definition at line 10043 of file mhttpd.cxx.
void decode_cookies | ( | Cookies * | c, |
const http_message * | msg | ||
) |
Definition at line 14206 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 13195 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 13233 of file mhttpd.cxx.
Definition at line 13171 of file mhttpd.cxx.
Definition at line 10481 of file mhttpd.cxx.
Definition at line 4318 of file mhttpd.cxx.
Definition at line 4014 of file mhttpd.cxx.
Definition at line 4139 of file mhttpd.cxx.
Definition at line 3497 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 11025 of file mhttpd.cxx.
|
static |
Definition at line 14154 of file mhttpd.cxx.
Definition at line 13672 of file mhttpd.cxx.
|
static |
Definition at line 14141 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 3091 of file mhttpd.cxx.
Definition at line 2134 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 8604 of file mhttpd.cxx.
Definition at line 1133 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 8521 of file mhttpd.cxx.
|
static |
Definition at line 8157 of file mhttpd.cxx.
Definition at line 16175 of file mhttpd.cxx.
std::vector< std::string > get_resource_paths | ( | ) |
Definition at line 989 of file mhttpd.cxx.
Definition at line 179 of file mhttpd.cxx.
Definition at line 374 of file mhttpd.cxx.
|
static |
Definition at line 14257 of file mhttpd.cxx.
|
static |
Definition at line 14724 of file mhttpd.cxx.
Definition at line 14172 of file mhttpd.cxx.
|
static |
Definition at line 14797 of file mhttpd.cxx.
|
static |
Definition at line 15071 of file mhttpd.cxx.
|
static |
Definition at line 15001 of file mhttpd.cxx.
|
static |
Definition at line 14880 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 7632 of file mhttpd.cxx.
Definition at line 8145 of file mhttpd.cxx.
void init_elog_odb | ( | ) |
Definition at line 1978 of file mhttpd.cxx.
Definition at line 1890 of file mhttpd.cxx.
Definition at line 1930 of file mhttpd.cxx.
void interprete | ( | Param * | p, |
Return * | r, | ||
Attachment * | a, | ||
const Cookies * | c, | ||
const char * | dec_path, | ||
RequestTrace * | t | ||
) |
Definition at line 12254 of file mhttpd.cxx.
Definition at line 2531 of file mhttpd.cxx.
Definition at line 4443 of file mhttpd.cxx.
|
static |
Definition at line 10195 of file mhttpd.cxx.
Definition at line 10300 of file mhttpd.cxx.
void Lock | ( | RequestTrace * | t | ) |
Definition at line 12240 of file mhttpd.cxx.
Definition at line 16210 of file mhttpd.cxx.
Definition at line 834 of file mhttpd.cxx.
Definition at line 9745 of file mhttpd.cxx.
|
static |
Definition at line 10116 of file mhttpd.cxx.
Definition at line 10142 of file mhttpd.cxx.
Definition at line 1029 of file mhttpd.cxx.
Definition at line 4368 of file mhttpd.cxx.
Definition at line 10106 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 8356 of file mhttpd.cxx.
Definition at line 13796 of file mhttpd.cxx.
Definition at line 1407 of file mhttpd.cxx.
Definition at line 1444 of file mhttpd.cxx.
Definition at line 1431 of file mhttpd.cxx.
|
static |
Definition at line 10405 of file mhttpd.cxx.
Definition at line 201 of file mhttpd.cxx.
Definition at line 1457 of file mhttpd.cxx.
Definition at line 7750 of file mhttpd.cxx.
Definition at line 1210 of file mhttpd.cxx.
Definition at line 1164 of file mhttpd.cxx.
Definition at line 12188 of file mhttpd.cxx.
Definition at line 1229 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 1253 of file mhttpd.cxx.
Definition at line 16188 of file mhttpd.cxx.
Definition at line 5653 of file mhttpd.cxx.
Definition at line 3609 of file mhttpd.cxx.
Definition at line 3672 of file mhttpd.cxx.
Definition at line 5419 of file mhttpd.cxx.
Definition at line 2483 of file mhttpd.cxx.
Definition at line 2558 of file mhttpd.cxx.
Definition at line 1839 of file mhttpd.cxx.
Definition at line 1854 of file mhttpd.cxx.
Definition at line 7567 of file mhttpd.cxx.
void show_header | ( | Return * | r, |
const char * | title, | ||
const char * | method, | ||
const char * | path, | ||
int | refresh | ||
) |
Definition at line 1779 of file mhttpd.cxx.
Definition at line 1540 of file mhttpd.cxx.
void show_hist_config_page | ( | MVOdb * | odb, |
Param * | p, | ||
Return * | r, | ||
const char * | hgroup, | ||
const char * | hpanel | ||
) |
Definition at line 10519 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 11262 of file mhttpd.cxx.
Definition at line 1867 of file mhttpd.cxx.
Definition at line 6793 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 3275 of file mhttpd.cxx.
Definition at line 6702 of file mhttpd.cxx.
Definition at line 9791 of file mhttpd.cxx.
Definition at line 7433 of file mhttpd.cxx.
Definition at line 1827 of file mhttpd.cxx.
Definition at line 10498 of file mhttpd.cxx.
|
static |
Definition at line 10151 of file mhttpd.cxx.
Definition at line 4427 of file mhttpd.cxx.
Definition at line 2019 of file mhttpd.cxx.
Definition at line 2047 of file mhttpd.cxx.
Definition at line 2078 of file mhttpd.cxx.
Definition at line 2103 of file mhttpd.cxx.
Definition at line 8117 of file mhttpd.cxx.
Definition at line 339 of file mhttpd.cxx.
void submit_elog | ( | MVOdb * | odb, |
Param * | pp, | ||
Return * | r, | ||
Attachment * | a | ||
) |
Definition at line 2248 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 7785 of file mhttpd.cxx.
Definition at line 8092 of file mhttpd.cxx.
std::string time_to_string | ( | time_t | t | ) |
Definition at line 8133 of file mhttpd.cxx.
Definition at line 55 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 13639 of file mhttpd.cxx.
void Unlock | ( | RequestTrace * | t | ) |
Definition at line 12246 of file mhttpd.cxx.
Definition at line 880 of file mhttpd.cxx.
Definition at line 841 of file mhttpd.cxx.
Definition at line 919 of file mhttpd.cxx.
Definition at line 955 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 7906 of file mhttpd.cxx.
|
static |
Definition at line 10078 of file mhttpd.cxx.
Definition at line 10062 of file mhttpd.cxx.
Definition at line 13775 of file mhttpd.cxx.
|
static |
Definition at line 13786 of file mhttpd.cxx.
|
static |
Definition at line 13754 of file mhttpd.cxx.
std::atomic_bool _abort {false} |
Definition at line 13451 of file mhttpd.cxx.
Definition at line 3468 of file mhttpd.cxx.
Definition at line 3428 of file mhttpd.cxx.
|
static |
Definition at line 114 of file mhttpd.cxx.
|
static |
Definition at line 99 of file mhttpd.cxx.
Definition at line 92 of file mhttpd.cxx.
Definition at line 280 of file mhttpd.cxx.
Definition at line 215 of file mhttpd.cxx.
|
static |
Definition at line 13463 of file mhttpd.cxx.
Definition at line 13752 of file mhttpd.cxx.
Definition at line 8143 of file mhttpd.cxx.
Definition at line 8142 of file mhttpd.cxx.
|
static |
Definition at line 8152 of file mhttpd.cxx.
|
static |
Definition at line 8153 of file mhttpd.cxx.
Definition at line 177 of file mhttpd.cxx.
const MimetypeTableEntry gMimetypeTable[] |
Definition at line 128 of file mhttpd.cxx.
|
static |
Definition at line 45 of file mhttpd.cxx.
Definition at line 46 of file mhttpd.cxx.
|
static |
Definition at line 504 of file mhttpd.cxx.
Definition at line 93 of file mhttpd.cxx.
|
static |
Definition at line 433 of file mhttpd.cxx.
Definition at line 13705 of file mhttpd.cxx.
Definition at line 13706 of file mhttpd.cxx.
Definition at line 13707 of file mhttpd.cxx.
Definition at line 94 of file mhttpd.cxx.
Definition at line 13704 of file mhttpd.cxx.