MIDAS
Loading...
Searching...
No Matches
midas.cxx File Reference
#include "midas.h"
#include "msystem.h"
#include "git-revision.h"
#include "mstrlcpy.h"
#include "odbxx.h"
#include <assert.h>
#include <signal.h>
#include <sys/resource.h>
#include <mutex>
#include <deque>
#include <thread>
#include <atomic>
#include <algorithm>
Include dependency graph for midas.cxx:

Go to the source code of this file.

Classes

struct  EventRequest
 
struct  TRANS_TABLE
 
struct  ERROR_TABLE
 
struct  DBG_MEM_LOC
 
struct  TR_PARAM
 
struct  msg_buffer_entry
 
struct  exptab_entry
 
struct  exptab_struct
 
class  bm_lock_buffer_guard
 
struct  TrClient
 
struct  TrState
 
struct  BUFFER_INFO
 
struct  EVENT_DEFRAG_BUFFER
 
class  RPC_CLIENT_CONNECTION
 
struct  TR_FIFO
 
struct  TLS_POINTER
 
struct  RING_BUFFER
 

Macros

#define MAX_DEFRAG_EVENTS   10
 
#define MAX_RING_BUFFER   100
 

Typedefs

typedef int(* MessagePrintCallback) (const char *)
 

Functions

std::string cm_transition_name (int transition)
 
static INT rpc_transition_dispatch (INT idx, void *prpc_param[])
 
void cm_ctrlc_handler (int sig)
 
voiddbg_malloc (unsigned int size, char *file, int line)
 
voiddbg_calloc (unsigned int size, unsigned int count, char *file, int line)
 
void dbg_free (void *adr, char *file, int line)
 
static std::vector< std::string > split (const char *sep, const std::string &s)
 
static std::string join (const char *sep, const std::vector< std::string > &v)
 
bool ends_with_char (const std::string &s, char c)
 
std::string msprintf (const char *format,...)
 
std::string cm_get_error (INT code)
 
int cm_msg_early_init (void)
 
int cm_msg_open_buffer (void)
 
int cm_msg_close_buffer (void)
 
INT EXPRT cm_msg_facilities (STRING_LIST *list)
 
void cm_msg_get_logfile (const char *fac, time_t t, std::string *filename, std::string *linkname, std::string *linktarget)
 
INT cm_set_msg_print (INT system_mask, INT user_mask, int(*func)(const char *))
 
INT cm_msg_log (INT message_type, const char *facility, const char *message)
 
static std::string cm_msg_format (INT message_type, const char *filename, INT line, const char *routine, const char *format, va_list *argptr)
 
static INT cm_msg_send_event (DWORD ts, INT message_type, const char *send_message)
 
INT cm_msg_flush_buffer ()
 
INT cm_msg (INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
 
INT cm_msg1 (INT message_type, const char *filename, INT line, const char *facility, const char *routine, const char *format,...)
 
INT cm_msg_register (EVENT_HANDLER *func)
 
static void add_message (char **messages, int *length, int *allocated, time_t tstamp, const char *new_message)
 
static int cm_msg_retrieve1 (const char *filename, time_t t, INT n_messages, char **messages, int *length, int *allocated, int *num_messages)
 
INT cm_msg_retrieve2 (const char *facility, time_t t, INT n_message, char **messages, int *num_messages)
 
INT cm_msg_retrieve (INT n_message, char *message, INT buf_size)
 
INT cm_synchronize (DWORD *seconds)
 
INT cm_asctime (char *str, INT buf_size)
 
std::string cm_asctime ()
 
INT cm_time (DWORD *t)
 
const charcm_get_version ()
 
const charcm_get_revision ()
 
INT cm_set_path (const char *path)
 
INT cm_get_path (char *path, int path_size)
 
std::string cm_get_path ()
 
INT EXPRT cm_get_path_string (std::string *path)
 
INT cm_set_experiment_name (const char *name)
 
INT cm_get_experiment_name (char *name, int name_length)
 
std::string cm_get_experiment_name ()
 
INT cm_read_exptab (exptab_struct *exptab)
 
int cm_get_exptab_filename (char *s, int size)
 
std::string cm_get_exptab_filename ()
 
int cm_get_exptab (const char *expname, std::string *dir, std::string *user)
 
int cm_get_exptab (const char *expname, char *dir, int dir_size, char *user, int user_size)
 
INT cm_delete_client_info (HNDLE hDB, INT pid)
 
INT cm_check_client (HNDLE hDB, HNDLE hKeyClient)
 
INT cm_set_client_info (HNDLE hDB, HNDLE *hKeyClient, const char *host_name, char *client_name, INT hw_type, const char *password, DWORD watchdog_timeout)
 
std::string cm_get_client_name ()
 
INT cm_get_environment (char *host_name, int host_name_size, char *exp_name, int exp_name_size)
 
INT cm_get_environment (std::string *host_name, std::string *exp_name)
 
int cm_set_experiment_local (const char *exp_name)
 
void cm_check_connect (void)
 
INT cm_connect_experiment (const char *host_name, const char *exp_name, const char *client_name, void(*func)(char *))
 
INT cm_connect_experiment1 (const char *host_name, const char *default_exp_name, const char *client_name, void(*func)(char *), INT odb_size, DWORD watchdog_timeout)
 
INT cm_list_experiments_local (STRING_LIST *exp_names)
 
INT cm_list_experiments_remote (const char *host_name, STRING_LIST *exp_names)
 
INT cm_select_experiment_local (std::string *exp_name)
 
INT cm_select_experiment_remote (const char *host_name, std::string *exp_name)
 
INT cm_connect_client (const char *client_name, HNDLE *hConn)
 
static void rpc_client_shutdown ()
 
INT cm_disconnect_client (HNDLE hConn, BOOL bShutdown)
 
INT cm_disconnect_experiment (void)
 
INT cm_set_experiment_database (HNDLE hDB, HNDLE hKeyClient)
 
INT cm_set_experiment_semaphore (INT semaphore_alarm, INT semaphore_elog, INT semaphore_history, INT semaphore_msg)
 
INT cm_get_experiment_database (HNDLE *hDB, HNDLE *hKeyClient)
 
INT cm_get_experiment_semaphore (INT *semaphore_alarm, INT *semaphore_elog, INT *semaphore_history, INT *semaphore_msg)
 
static BUFFERbm_get_buffer (const char *who, INT buffer_handle, int *pstatus)
 
static int bm_lock_buffer_read_cache (BUFFER *pbuf)
 
static int bm_lock_buffer_write_cache (BUFFER *pbuf)
 
static int bm_lock_buffer_mutex (BUFFER *pbuf)
 
static int xbm_lock_buffer (BUFFER *pbuf)
 
static void xbm_unlock_buffer (BUFFER *pbuf)
 
static BUFFER_CLIENTbm_get_my_client_locked (bm_lock_buffer_guard &pbuf_guard)
 
static INT bm_notify_client (const char *buffer_name, int s)
 
static INT bm_push_event (const char *buffer_name)
 
static void bm_defragment_event (HNDLE buffer_handle, HNDLE request_id, EVENT_HEADER *pevent, void *pdata, EVENT_HANDLER *dispatcher)
 
INT cm_set_watchdog_params_local (BOOL call_watchdog, DWORD timeout)
 
INT cm_set_watchdog_params (BOOL call_watchdog, DWORD timeout)
 
INT cm_get_watchdog_params (BOOL *call_watchdog, DWORD *timeout)
 
INT cm_get_watchdog_info (HNDLE hDB, const char *client_name, DWORD *timeout, DWORD *last)
 
static void load_rpc_hosts (HNDLE hDB, HNDLE hKey, int index, void *info)
 
static void init_rpc_hosts (HNDLE hDB)
 
INT cm_register_server (void)
 
INT cm_register_transition (INT transition, INT(*func)(INT, char *), INT sequence_number)
 
INT cm_deregister_transition (INT transition)
 
INT cm_set_transition_sequence (INT transition, INT sequence_number)
 
INT cm_set_client_run_state (INT state)
 
INT cm_register_deferred_transition (INT transition, BOOL(*func)(INT, BOOL))
 
INT cm_check_deferred_transition ()
 
static bool tr_compare (const std::unique_ptr< TrClient > &arg1, const std::unique_ptr< TrClient > &arg2)
 
static int tr_finish (HNDLE hDB, TrState *tr, int transition, int status, const char *errorstr)
 
static void write_tr_client_to_odb (HNDLE hDB, const TrClient *tr_client)
 
static int cm_transition_detach (INT transition, INT run_number, char *errstr, INT errstr_size, INT async_flag, INT debug_flag)
 
static int cm_transition_call (TrState *s, int idx)
 
static int cm_transition_call_direct (TrClient *tr_client)
 
static INT cm_transition2 (INT transition, INT run_number, char *errstr, INT errstr_size, INT async_flag, INT debug_flag)
 
static INT cm_transition1 (INT transition, INT run_number, char *errstr, INT errstr_size, INT async_flag, INT debug_flag)
 
static INT tr_main_thread (void *param)
 
INT cm_transition_cleanup ()
 
INT cm_transition (INT transition, INT run_number, char *errstr, INT errstr_size, INT async_flag, INT debug_flag)
 
INT cm_dispatch_ipc (const char *message, int message_size, int client_socket)
 
BOOL cm_is_ctrlc_pressed ()
 
void cm_ack_ctrlc_pressed ()
 
int cm_exec_script (const char *odb_path_to_script)
 
static void bm_cleanup (const char *who, DWORD actual_time, BOOL wrong_interval)
 
INT cm_periodic_tasks ()
 
INT cm_yield (INT millisec)
 
INT cm_execute (const char *command, char *result, INT bufsize)
 
INT cm_register_function (INT id, INT(*func)(INT, void **))
 
std::string cm_get_history_path (const char *history_channel)
 
static int bm_validate_client_index_locked (bm_lock_buffer_guard &pbuf_guard)
 
INT bm_match_event (short int event_id, short int trigger_mask, const EVENT_HEADER *pevent)
 
void bm_remove_client_locked (BUFFER_HEADER *pheader, int j)
 
static void bm_cleanup_buffer_locked (BUFFER *pbuf, const char *who, DWORD actual_time)
 
static void bm_update_last_activity (DWORD millitime)
 
static BOOL bm_validate_rp (const char *who, const BUFFER_HEADER *pheader, int rp)
 
static int bm_incr_rp_no_check (const BUFFER_HEADER *pheader, int rp, int total_size)
 
static int bm_next_rp (const char *who, const BUFFER_HEADER *pheader, const char *pdata, int rp)
 
static int bm_validate_buffer_locked (const BUFFER *pbuf)
 
static void bm_reset_buffer_locked (BUFFER *pbuf)
 
static void bm_clear_buffer_statistics (HNDLE hDB, BUFFER *pbuf)
 
static void bm_write_buffer_statistics_to_odb_copy (HNDLE hDB, const char *buffer_name, const char *client_name, int client_index, BUFFER_INFO *pbuf, BUFFER_HEADER *pheader)
 
static void bm_write_buffer_statistics_to_odb (HNDLE hDB, BUFFER *pbuf, BOOL force)
 
INT bm_open_buffer (const char *buffer_name, INT buffer_size, INT *buffer_handle)
 
INT bm_get_buffer_handle (const char *buffer_name, INT *buffer_handle)
 
INT bm_close_buffer (INT buffer_handle)
 
INT bm_close_all_buffers (void)
 
INT bm_write_statistics_to_odb (void)
 
INT cm_watchdog_thread (void *unused)
 
static void xcm_watchdog_thread ()
 
INT cm_start_watchdog_thread ()
 
INT cm_stop_watchdog_thread ()
 
INT cm_shutdown (const char *name, BOOL bUnique)
 
INT cm_exist (const char *name, BOOL bUnique)
 
INT cm_cleanup (const char *client_name, BOOL ignore_timeout)
 
std::string cm_expand_env (const char *str)
 
static bool test_cm_expand_env1 (const char *str, const char *expected)
 
void cm_test_expand_env ()
 
INT bm_get_buffer_info (INT buffer_handle, BUFFER_HEADER *buffer_header)
 
INT bm_get_buffer_level (INT buffer_handle, INT *n_bytes)
 
INT bm_init_buffer_counters (INT buffer_handle)
 
INT bm_set_cache_size (INT buffer_handle, size_t read_size, size_t write_size)
 
INT bm_compose_event (EVENT_HEADER *event_header, short int event_id, short int trigger_mask, DWORD data_size, DWORD serial)
 
INT bm_compose_event_threadsafe (EVENT_HEADER *event_header, short int event_id, short int trigger_mask, DWORD data_size, DWORD *serial)
 
INT bm_add_event_request (INT buffer_handle, short int event_id, short int trigger_mask, INT sampling_type, EVENT_HANDLER *func, INT request_id)
 
INT bm_request_event (HNDLE buffer_handle, short int event_id, short int trigger_mask, INT sampling_type, HNDLE *request_id, EVENT_HANDLER *func)
 
INT bm_remove_event_request (INT buffer_handle, INT request_id)
 
INT bm_delete_request (INT request_id)
 
static void bm_validate_client_pointers_locked (const BUFFER_HEADER *pheader, BUFFER_CLIENT *pclient)
 
static BOOL bm_update_read_pointer_locked (const char *caller_name, BUFFER_HEADER *pheader)
 
static void bm_wakeup_producers_locked (const BUFFER_HEADER *pheader, const BUFFER_CLIENT *pc)
 
static void bm_dispatch_event (int buffer_handle, EVENT_HEADER *pevent)
 
static void bm_incr_read_cache_locked (BUFFER *pbuf, int total_size)
 
static BOOL bm_peek_read_cache_locked (BUFFER *pbuf, EVENT_HEADER **ppevent, int *pevent_size, int *ptotal_size)
 
static int bm_peek_buffer_locked (BUFFER *pbuf, BUFFER_HEADER *pheader, BUFFER_CLIENT *pc, EVENT_HEADER **ppevent, int *pevent_size, int *ptotal_size)
 
static void bm_read_from_buffer_locked (const BUFFER_HEADER *pheader, int rp, char *buf, int event_size)
 
static void bm_read_from_buffer_locked (const BUFFER_HEADER *pheader, int rp, std::vector< char > *vecptr, int event_size)
 
static BOOL bm_check_requests (const BUFFER_CLIENT *pc, const EVENT_HEADER *pevent)
 
static int bm_wait_for_more_events_locked (bm_lock_buffer_guard &pbuf_guard, BUFFER_CLIENT *pc, int timeout_msec, BOOL unlock_read_cache)
 
static int bm_fill_read_cache_locked (bm_lock_buffer_guard &pbuf_guard, int timeout_msec)
 
static void bm_convert_event_header (EVENT_HEADER *pevent, int convert_flags)
 
static int bm_wait_for_free_space_locked (bm_lock_buffer_guard &pbuf_guard, int timeout_msec, int requested_space, bool unlock_write_cache)
 
static void bm_write_to_buffer_locked (BUFFER_HEADER *pheader, int sg_n, const char *const sg_ptr[], const size_t sg_len[], size_t total_size)
 
static int bm_find_first_request_locked (BUFFER_CLIENT *pc, const EVENT_HEADER *pevent)
 
static void bm_notify_reader_locked (BUFFER_HEADER *pheader, BUFFER_CLIENT *pc, int old_write_pointer, int request_id)
 
INT bm_send_event (INT buffer_handle, const EVENT_HEADER *pevent, int unused, int timeout_msec)
 
int bm_send_event_vec (int buffer_handle, const std::vector< char > &event, int timeout_msec)
 
int bm_send_event_vec (int buffer_handle, const std::vector< std::vector< char > > &event, int timeout_msec)
 
static INT bm_flush_cache_locked (bm_lock_buffer_guard &pbuf_guard, int timeout_msec)
 
int bm_send_event_sg (int buffer_handle, int sg_n, const char *const sg_ptr[], const size_t sg_len[], int timeout_msec)
 
static int bm_flush_cache_rpc (int buffer_handle, int timeout_msec)
 
INT bm_flush_cache (int buffer_handle, int timeout_msec)
 
static INT bm_read_buffer (BUFFER *pbuf, INT buffer_handle, void **bufptr, void *buf, INT *buf_size, std::vector< char > *vecptr, int timeout_msec, int convert_flags, BOOL dispatch)
 
static INT bm_receive_event_rpc (INT buffer_handle, void *buf, int *buf_size, EVENT_HEADER **ppevent, std::vector< char > *pvec, int timeout_msec)
 
INT bm_receive_event (INT buffer_handle, void *destination, INT *buf_size, int timeout_msec)
 
INT bm_receive_event_alloc (INT buffer_handle, EVENT_HEADER **ppevent, int timeout_msec)
 
INT bm_receive_event_vec (INT buffer_handle, std::vector< char > *pvec, int timeout_msec)
 
static int bm_skip_event (BUFFER *pbuf)
 
INT bm_skip_event (INT buffer_handle)
 
static INT bm_push_buffer (BUFFER *pbuf, int buffer_handle)
 
INT bm_check_buffers ()
 
INT bm_poll_event ()
 
INT bm_empty_buffers ()
 
static RPC_SERVER_ACCEPTIONrpc_get_server_acception (int idx)
 
RPC_SERVER_ACCEPTIONrpc_get_mserver_acception ()
 
static RPC_SERVER_ACCEPTIONrpc_new_server_acception ()
 
void rpc_calc_convert_flags (INT hw_type, INT remote_hw_type, INT *convert_flags)
 
void rpc_get_convert_flags (INT *convert_flags)
 
void rpc_ieee2vax_float (float *var)
 
void rpc_vax2ieee_float (float *var)
 
void rpc_vax2ieee_double (double *var)
 
void rpc_ieee2vax_double (double *var)
 
void rpc_convert_single (void *data, INT tid, INT flags, INT convert_flags)
 
void rpc_convert_data (void *data, INT tid, INT flags, INT total_size, INT convert_flags)
 
INT rpc_tid_size (INT id)
 
const charrpc_tid_name (INT id)
 
const charrpc_tid_name_old (INT id)
 
int rpc_name_tid (const char *name)
 
INT rpc_register_client (const char *name, RPC_LIST *list)
 
INT rpc_register_functions (const RPC_LIST *new_list, RPC_HANDLER func)
 
INT rpc_deregister_functions ()
 
INT rpc_register_function (INT id, INT(*func)(INT, void **))
 
static int handle_msg_odb (int n, const NET_COMMAND *nc)
 
INT rpc_client_dispatch (int sock)
 
INT rpc_client_connect (const char *host_name, INT port, const char *client_name, HNDLE *hConnection)
 
void rpc_client_check ()
 
INT rpc_server_connect (const char *host_name, const char *exp_name)
 
static RPC_CLIENT_CONNECTIONrpc_get_locked_client_connection (HNDLE hConn)
 
INT rpc_client_disconnect (HNDLE hConn, BOOL bShutdown)
 
INT rpc_server_disconnect ()
 
bool rpc_is_remote (void)
 
bool rpc_is_connected (void)
 
std::string rpc_get_mserver_hostname (void)
 
bool rpc_is_mserver (void)
 
INT rpc_get_hw_type ()
 
INT rpc_get_timeout (HNDLE hConn)
 
INT rpc_set_timeout (HNDLE hConn, int timeout_msec, int *old_timeout_msec)
 
INT rpc_get_convert_flags (void)
 
const charrpc_get_mserver_path ()
 
INT rpc_set_mserver_path (const char *path)
 
std::string rpc_get_name ()
 
INT rpc_set_name (const char *name)
 
INT rpc_set_debug (void(*func)(const char *), INT mode)
 
void rpc_debug_printf (const char *format,...)
 
void rpc_va_arg (va_list *arg_ptr, INT arg_type, void *arg)
 
static void rpc_call_encode (va_list &ap, const RPC_LIST &rl, NET_COMMAND **nc)
 
static int rpc_call_decode (va_list &ap, const RPC_LIST &rl, const char *buf, size_t buf_size)
 
INT rpc_client_call (HNDLE hConn, DWORD routine_id,...)
 
INT rpc_call (DWORD routine_id,...)
 
INT rpc_set_opt_tcp_size (INT tcp_size)
 
INT rpc_get_opt_tcp_size ()
 
INT rpc_send_event (INT buffer_handle, const EVENT_HEADER *pevent, int unused, INT async_flag, INT mode)
 
INT rpc_send_event1 (INT buffer_handle, const EVENT_HEADER *pevent)
 
INT rpc_send_event_sg (INT buffer_handle, int sg_n, const char *const sg_ptr[], const size_t sg_len[])
 
INT rpc_flush_event ()
 
int cm_query_transition (int *transition, int *run_number, int *trans_time)
 
static int recv_net_command_realloc (INT idx, char **pbuf, int *pbufsize, INT *remaining)
 
INT recv_tcp_check (int sock)
 
static int recv_event_server_realloc (INT idx, RPC_SERVER_ACCEPTION *psa, char **pbuffer, int *pbuffer_size)
 
INT rpc_register_server (int port, int *plsock, int *pport)
 
INT rpc_register_listener (int port, RPC_HANDLER func, int *plsock, int *pport)
 
INT rpc_execute (INT sock, char *buffer, INT convert_flags)
 
int rpc_test_rpc ()
 
static std::atomic_bool gAllowedHostsEnabled (false)
 
INT rpc_clear_allowed_hosts ()
 
INT rpc_add_allowed_host (const char *hostname)
 
INT rpc_check_allowed_host (const char *hostname)
 
static INT rpc_socket_check_allowed_host (int sock)
 
INT rpc_server_accept (int lsock)
 
INT rpc_client_accept (int lsock)
 
INT rpc_server_callback (struct callback_addr *pcallback)
 
INT rpc_server_loop (void)
 
INT rpc_server_receive_rpc (int idx, RPC_SERVER_ACCEPTION *sa)
 
INT rpc_server_receive_event (int idx, RPC_SERVER_ACCEPTION *sa, int timeout_msec)
 
int rpc_flush_event_socket (int timeout_msec)
 
INT rpc_server_shutdown (void)
 
INT rpc_check_channels (void)
 
void bk_init (void *event)
 
BOOL bk_is32 (const void *event)
 
BOOL bk_is32a (const void *event)
 
void bk_init32 (void *event)
 
void bk_init32a (void *event)
 
INT bk_size (const void *event)
 
static void copy_bk_name (char *dst, const char *src)
 
void bk_create (void *event, const char *name, WORD type, void **pdata)
 
INT bk_copy (char *pevent, char *psrce, const char *bkname)
 
int bk_delete (void *event, const char *name)
 
INT bk_close (void *event, void *pdata)
 
INT bk_list (const void *event, char *bklist)
 
INT bk_locate (const void *event, const char *name, void *pdata)
 
INT bk_find (const BANK_HEADER *pbkh, const char *name, DWORD *bklen, DWORD *bktype, void **pdata)
 
INT bk_iterate (const void *event, BANK **pbk, void *pdata)
 
INT bk_iterate32 (const void *event, BANK32 **pbk, void *pdata)
 
INT bk_iterate32a (const void *event, BANK32A **pbk32a, void *pdata)
 
INT bk_swap (void *event, BOOL force)
 
int rb_set_nonblocking ()
 
int rb_create (int size, int max_event_size, int *handle)
 
int rb_delete (int handle)
 
int rb_get_wp (int handle, void **p, int millisec)
 
int rb_increment_wp (int handle, int size)
 
int rb_get_rp (int handle, void **p, int millisec)
 
int rb_increment_rp (int handle, int size)
 
int rb_get_buffer_level (int handle, int *n_bytes)
 
int cm_write_event_to_odb (HNDLE hDB, HNDLE hKey, const EVENT_HEADER *pevent, INT format)
 

Variables

static const int tid_size []
 
static const chartid_name_old []
 
static const chartid_name []
 
const charmname []
 
DATABASE_database
 
INT _database_entries
 
static std::mutex gBuffersMutex
 
static std::vector< BUFFER * > gBuffers
 
static INT _msg_buffer = 0
 
static EVENT_HANDLER_msg_dispatch = NULL
 
static std::mutex _request_list_mutex
 
static std::vector< EventRequest_request_list
 
static MUTEX_T_mutex_rpc = NULL
 
static void(* _debug_print )(const char *) = NULL
 
static INT _debug_mode = 0
 
static int _rpc_connect_timeout = 10000
 
static int disable_bind_rpc_to_localhost = 0
 
static std::mutex _trans_table_mutex
 
static std::vector< TRANS_TABLE_trans_table
 
static TRANS_TABLE _deferred_trans_table []
 
static BOOL _rpc_registered = FALSE
 
static int _rpc_listen_socket = 0
 
static const ERROR_TABLE _error_table []
 
static DBG_MEM_LOC_mem_loc = NULL
 
static INT _n_mem = 0
 
static TR_PARAM _trp
 
static std::atomic< MessagePrintCallback_message_print {puts}
 
static std::atomic_int _message_mask_system {MT_ALL}
 
static std::atomic_int _message_mask_user {MT_ALL}
 
static std::deque< msg_buffer_entrygMsgBuf
 
static std::mutex gMsgBufMutex
 
static HNDLE _hKeyClient = 0
 
static HNDLE _hDB = 0
 
static std::string _experiment_name
 
static std::string _client_name
 
static std::string _path_name
 
static INT _watchdog_timeout = DEFAULT_WATCHDOG_TIMEOUT
 
INT _semaphore_alarm = -1
 
INT _semaphore_elog = -1
 
INT _semaphore_history = -1
 
static exptab_struct _exptab
 
static INT _requested_transition
 
static DWORD _deferred_transition_mask
 
static BOOL _ctrlc_pressed = FALSE
 
static DWORD _bm_max_event_size = 0
 
static int _bm_lock_timeout = 5 * 60 * 1000
 
static double _bm_mutex_timeout_sec = _bm_lock_timeout/1000 + 15.000
 
static std::atomic< bool_watchdog_thread_run {false}
 
static std::atomic< bool_watchdog_thread_is_running {false}
 
static std::atomic< std::thread * > _watchdog_thread {NULL}
 
static EVENT_DEFRAG_BUFFER defrag_buffer [MAX_DEFRAG_EVENTS]
 
static std::mutex _client_connections_mutex
 
static std::vector< RPC_CLIENT_CONNECTION * > _client_connections
 
static RPC_SERVER_CONNECTION _server_connection
 
static bool _rpc_is_remote = false
 
static std::vector< RPC_SERVER_ACCEPTION * > _server_acceptions
 
static RPC_SERVER_ACCEPTION_mserver_acception = NULL
 
static std::vector< RPC_LISTrpc_list
 
static std::mutex rpc_list_mutex
 
static int _opt_tcp_size = OPT_TCP_SIZE
 
static std::string _mserver_path
 
static std::mutex _tr_fifo_mutex
 
static TR_FIFO _tr_fifo [10]
 
static int _tr_fifo_wp = 0
 
static int _tr_fifo_rp = 0
 
static TLS_POINTERtls_buffer = NULL
 
static int tls_size = 0
 
static std::vector< std::string > gAllowedHosts
 
static std::mutex gAllowedHostsMutex
 
static RING_BUFFER rb [MAX_RING_BUFFER]
 
static volatile int _rb_nonblocking = 0
 

Typedef Documentation

◆ MessagePrintCallback

typedef int(* MessagePrintCallback) (const char *)

Definition at line 443 of file midas.cxx.

Function Documentation

◆ bm_get_buffer_info()

INT bm_get_buffer_info ( INT  buffer_handle,
BUFFER_HEADER buffer_header 
)

dox dox

Definition at line 7813 of file midas.cxx.

7835{
7836 if (rpc_is_remote())
7837 return rpc_call(RPC_BM_GET_BUFFER_INFO, buffer_handle, buffer_header);
7838
7839#ifdef LOCAL_ROUTINES
7840
7841 int status = 0;
7842 BUFFER *pbuf = bm_get_buffer("bm_get_buffer_info", buffer_handle, &status);
7843
7844 if (!pbuf)
7845 return status;
7846
7848
7849 if (!pbuf_guard.is_locked())
7850 return pbuf_guard.get_status();
7851
7852 memcpy(buffer_header, pbuf->buffer_header, sizeof(BUFFER_HEADER));
7853
7854#endif /* LOCAL_ROUTINES */
7855
7856 return BM_SUCCESS;
7857}
static BUFFER * bm_get_buffer(const char *who, INT buffer_handle, int *pstatus)
Definition midas.cxx:6644
#define BM_SUCCESS
Definition midas.h:605
#define RPC_BM_GET_BUFFER_INFO
Definition mrpc.h:39
bool rpc_is_remote(void)
Definition midas.cxx:12783
INT rpc_call(DWORD routine_id,...)
Definition midas.cxx:13685
DWORD status
Definition odbhist.cxx:39
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bm_get_buffer_level()

INT bm_get_buffer_level ( INT  buffer_handle,
INT n_bytes 
)

Definition at line 7860 of file midas.cxx.

7879{
7880 if (rpc_is_remote())
7881 return rpc_call(RPC_BM_GET_BUFFER_LEVEL, buffer_handle, n_bytes);
7882
7883#ifdef LOCAL_ROUTINES
7884 {
7885 int status = 0;
7886
7887 BUFFER *pbuf = bm_get_buffer("bm_get_buffer_level", buffer_handle, &status);
7888
7889 if (!pbuf)
7890 return status;
7891
7893
7894 if (!pbuf_guard.is_locked())
7895 return pbuf_guard.get_status();
7896
7897 BUFFER_HEADER *pheader = pbuf->buffer_header;
7898
7900
7901 *n_bytes = pheader->write_pointer - pclient->read_pointer;
7902 if (*n_bytes < 0)
7903 *n_bytes += pheader->size;
7904
7905 pbuf_guard.unlock();
7906
7907 if (pbuf->read_cache_size) {
7909 if (status == BM_SUCCESS) {
7910 /* add bytes in cache */
7911 if (pbuf->read_cache_wp > pbuf->read_cache_rp)
7912 *n_bytes += pbuf->read_cache_wp - pbuf->read_cache_rp;
7913 pbuf->read_cache_mutex.unlock();
7914 }
7915 }
7916 }
7917#endif /* LOCAL_ROUTINES */
7918
7919 return BM_SUCCESS;
7920}
static BUFFER_CLIENT * bm_get_my_client_locked(bm_lock_buffer_guard &pbuf_guard)
Definition midas.cxx:6021
static int bm_lock_buffer_read_cache(BUFFER *pbuf)
Definition midas.cxx:7926
#define RPC_BM_GET_BUFFER_LEVEL
Definition mrpc.h:40
INT write_pointer
Definition midas.h:963
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bm_init_buffer_counters()

INT bm_init_buffer_counters ( INT  buffer_handle)

Definition at line 8085 of file midas.cxx.

8104{
8105 if (rpc_is_remote())
8106 return rpc_call(RPC_BM_INIT_BUFFER_COUNTERS, buffer_handle);
8107
8108#ifdef LOCAL_ROUTINES
8109
8110 int status = 0;
8111
8112 BUFFER* pbuf = bm_get_buffer("bm_init_buffer_counters", buffer_handle, &status);
8113
8114 if (!pbuf)
8115 return status;
8116
8118
8119 if (!pbuf_guard.is_locked())
8120 return pbuf_guard.get_status();
8121
8122 pbuf->buffer_header->num_in_events = 0;
8123 pbuf->buffer_header->num_out_events = 0;
8124
8125#endif /* LOCAL_ROUTINES */
8126
8127 return BM_SUCCESS;
8128}
#define RPC_BM_INIT_BUFFER_COUNTERS
Definition mrpc.h:41
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cm_transition_name()

std::string cm_transition_name ( int  transition)

Definition at line 133 of file midas.cxx.

134{
135 if (transition == TR_START) return "START";
136 if (transition == TR_STOP) return "STOP";
137 if (transition == TR_PAUSE) return "PAUSE";
138 if (transition == TR_RESUME) return "RESUME";
139 if (transition == TR_STARTABORT) return "STARTABORT";
140 if (transition == TR_DEFERRED) return "DEFERRED";
141 return msprintf("UNKNOWN TRANSITION %d", transition);
142}
INT transition(INT run_number, char *error)
Definition consume.cxx:35
#define TR_RESUME
Definition midas.h:408
#define TR_PAUSE
Definition midas.h:407
#define TR_START
Definition midas.h:405
#define TR_STARTABORT
Definition midas.h:409
#define TR_DEFERRED
Definition midas.h:410
#define TR_STOP
Definition midas.h:406
std::string msprintf(const char *format,...)
Definition midas.cxx:419
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cm_write_event_to_odb()

int cm_write_event_to_odb ( HNDLE  hDB,
HNDLE  hKey,
const EVENT_HEADER pevent,
INT  format 
)

Definition at line 17745 of file midas.cxx.

17746{
17747 if (format == FORMAT_FIXED) {
17748 int status;
17749 status = db_set_record(hDB, hKey, (char *) (pevent + 1), pevent->data_size, 0);
17750 if (status != DB_SUCCESS) {
17751 cm_msg(MERROR, "cm_write_event_to_odb", "event %d ODB record size mismatch, db_set_record() status %d", pevent->event_id, status);
17752 return status;
17753 }
17754 return SUCCESS;
17755 } else if (format == FORMAT_MIDAS) {
17756 INT size, i, status, n_data;
17757 int n;
17758 char *pdata, *pdata0;
17759
17760 char name[5];
17762 BANK *pbk;
17763 BANK32 *pbk32;
17764 BANK32A *pbk32a;
17765 DWORD bkname;
17766 WORD bktype;
17768 KEY key;
17769
17770 pbh = (BANK_HEADER *) (pevent + 1);
17771 pbk = NULL;
17772 pbk32 = NULL;
17773 pbk32a = NULL;
17774
17775 /* count number of banks */
17776 for (n=0 ; ; n++) {
17777 if (bk_is32a(pbh)) {
17779 if (pbk32a == NULL)
17780 break;
17781 } else if (bk_is32(pbh)) {
17783 if (pbk32 == NULL)
17784 break;
17785 } else {
17786 bk_iterate(pbh, &pbk, &pdata);
17787 if (pbk == NULL)
17788 break;
17789 }
17790 }
17791
17792 /* build array of keys */
17793 hKeys = (HNDLE *)malloc(sizeof(HNDLE) * n);
17794
17795 pbk = NULL;
17796 pbk32 = NULL;
17797 n = 0;
17798 do {
17799 /* scan all banks */
17800 if (bk_is32a(pbh)) {
17801 size = bk_iterate32a(pbh, &pbk32a, &pdata);
17802 if (pbk32a == NULL)
17803 break;
17804 bkname = *((DWORD *) pbk32a->name);
17805 bktype = (WORD) pbk32a->type;
17806 } else if (bk_is32(pbh)) {
17807 size = bk_iterate32(pbh, &pbk32, &pdata);
17808 if (pbk32 == NULL)
17809 break;
17810 bkname = *((DWORD *) pbk32->name);
17811 bktype = (WORD) pbk32->type;
17812 } else {
17813 size = bk_iterate(pbh, &pbk, &pdata);
17814 if (pbk == NULL)
17815 break;
17816 bkname = *((DWORD *) pbk->name);
17817 bktype = (WORD) pbk->type;
17818 }
17819
17820 n_data = size;
17821 if (rpc_tid_size(bktype & 0xFF))
17822 n_data /= rpc_tid_size(bktype & 0xFF);
17823
17824 /* get bank key */
17825 *((DWORD *) name) = bkname;
17826 name[4] = 0;
17827 /* record the start of the data in case it is struct */
17828 pdata0 = pdata;
17829 if (bktype == TID_STRUCT) {
17831 if (status != DB_SUCCESS) {
17832 cm_msg(MERROR, "cm_write_event_to_odb", "please define bank \"%s\" in BANK_LIST in frontend", name);
17833 continue;
17834 }
17835
17836 /* write structured bank */
17837 for (i = 0;; i++) {
17840 break;
17841
17842 db_get_key(hDB, hKeyl, &key);
17843
17844 /* adjust for alignment */
17845 if (key.type != TID_STRING && key.type != TID_LINK)
17847
17849 if (status != DB_SUCCESS) {
17850 cm_msg(MERROR, "cm_write_event_to_odb", "cannot write bank \"%s\" to ODB, db_set_data1() status %d", name, status);
17851 continue;
17852 }
17853 hKeys[n++] = hKeyl;
17854
17855 /* shift data pointer to next item */
17857 }
17858 } else {
17859 /* write variable length bank */
17861 if (status != DB_SUCCESS) {
17863 if (status != DB_SUCCESS) {
17864 cm_msg(MERROR, "cm_write_event_to_odb", "cannot create key for bank \"%s\" with tid %d in ODB, db_create_key() status %d", name, bktype, status);
17865 continue;
17866 }
17868 if (status != DB_SUCCESS) {
17869 cm_msg(MERROR, "cm_write_event_to_odb", "cannot find key for bank \"%s\" in ODB, after db_create_key(), db_find_key() status %d", name, status);
17870 continue;
17871 }
17872 }
17873 if (n_data > 0) {
17874 status = db_set_data1(hDB, hKeyRoot, pdata, size, n_data, bktype & 0xFF);
17875 if (status != DB_SUCCESS) {
17876 cm_msg(MERROR, "cm_write_event_to_odb", "cannot write bank \"%s\" to ODB, db_set_data1() status %d", name, status);
17877 }
17878 hKeys[n++] = hKeyRoot;
17879 }
17880 }
17881 } while (1);
17882
17883 /* notify all hot-lined clients in one go */
17885
17886 free(hKeys);
17887
17888 return SUCCESS;
17889 } else {
17890 cm_msg(MERROR, "cm_write_event_to_odb", "event format %d is not supported (see midas.h definitions of FORMAT_xxx)", format);
17891 return CM_DB_ERROR;
17892 }
17893}
INT bk_iterate32a(const void *event, BANK32A **pbk32a, void *pdata)
Definition midas.cxx:17125
BOOL bk_is32a(const void *event)
Definition midas.cxx:16459
BOOL bk_is32(const void *event)
Definition midas.cxx:16437
INT bk_iterate32(const void *event, BANK32 **pbk, void *pdata)
Definition midas.cxx:17089
INT bk_iterate(const void *event, BANK **pbk, void *pdata)
Definition midas.cxx:17068
#define CM_DB_ERROR
Definition midas.h:585
#define DB_SUCCESS
Definition midas.h:631
#define DB_NO_MORE_SUBKEYS
Definition midas.h:646
unsigned short int WORD
Definition mcstd.h:49
unsigned int DWORD
Definition mcstd.h:51
#define SUCCESS
Definition mcstd.h:54
#define FORMAT_FIXED
Definition midas.h:314
#define TID_STRUCT
Definition midas.h:348
#define TID_LINK
Definition midas.h:350
#define TID_STRING
Definition midas.h:346
#define MERROR
Definition midas.h:559
#define FORMAT_MIDAS
Definition midas.h:311
#define VALIGN(adr, align)
Definition midas.h:526
#define MIN(a, b)
Definition midas.h:515
INT ss_get_struct_align()
Definition system.cxx:1321
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
Definition midas.cxx:929
INT db_create_key(HNDLE hDB, HNDLE hKey, const char *key_name, DWORD type)
Definition odb.cxx:3313
INT db_get_key(HNDLE hDB, HNDLE hKey, KEY *key)
Definition odb.cxx:6024
INT db_set_data1(HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type)
Definition odb.cxx:7318
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
Definition odb.cxx:4084
INT db_notify_clients_array(HNDLE hDB, HNDLE hKeys[], INT size)
Definition odb.cxx:12631
INT db_set_record(HNDLE hDB, HNDLE hKey, void *data, INT buf_size, INT align)
Definition odb.cxx:12299
INT db_enum_key(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
Definition odb.cxx:5591
INT rpc_tid_size(INT id)
Definition midas.cxx:11779
HNDLE hKey
DWORD n[4]
Definition mana.cxx:247
HNDLE hDB
main ODB handle
Definition mana.cxx:207
KEY key
Definition mdump.cxx:34
INT i
Definition mdump.cxx:32
INT HNDLE
Definition midas.h:132
int INT
Definition midas.h:129
#define name(x)
Definition midas_macro.h:24
Definition midas.h:1213
short int event_id
Definition midas.h:852
DWORD data_size
Definition midas.h:856
Definition midas.h:1026
INT num_values
Definition midas.h:1028
DWORD type
Definition midas.h:1027
INT item_size
Definition midas.h:1032
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbg_calloc()

void * dbg_calloc ( unsigned int  size,
unsigned int  count,
char file,
int  line 
)

Definition at line 346 of file midas.cxx.

346 {
347 void *adr;
348
349 adr = dbg_malloc(size * count, file, line);
350 if (adr)
351 memset(adr, 0, size * count);
352
353 return adr;
354}
double count
Definition mdump.cxx:33
void * dbg_malloc(unsigned int size, char *file, int line)
Definition midas.cxx:306
Here is the call graph for this function:

◆ dbg_free()

void dbg_free ( void adr,
char file,
int  line 
)

Definition at line 356 of file midas.cxx.

356 {
357 FILE *f;
358 int i;
359
360 free(adr);
361
362 for (i = 0; i < _n_mem; i++)
363 if (_mem_loc[i].adr == adr)
364 break;
365
366 if (i < _n_mem)
367 _mem_loc[i].adr = NULL;
368
369 f = fopen("mem.txt", "w");
370
371 assert(f != NULL);
372
373 for (i = 0; i < _n_mem; i++)
374 if (_mem_loc[i].adr)
375 fprintf(f, "%s:%d %s:%d size=%d adr=%p\n", _mem_loc[i].file, _mem_loc[i].line,
376 file, line, _mem_loc[i].size, _mem_loc[i].adr);
377
378 fclose(f);
379}
static INT _n_mem
Definition midas.cxx:287
static DBG_MEM_LOC * _mem_loc
Definition midas.cxx:286
void * adr
Definition midas.cxx:280
Here is the call graph for this function:

◆ dbg_malloc()

void * dbg_malloc ( unsigned int  size,
char file,
int  line 
)

Definition at line 306 of file midas.cxx.

306 {
307 FILE *f;
308 void *adr;
309 int i;
310
311 adr = malloc(size);
312
313 /* search for deleted entry */
314 for (i = 0; i < _n_mem; i++)
315 if (_mem_loc[i].adr == NULL)
316 break;
317
318 if (i == _n_mem) {
319 _n_mem++;
320 if (!_mem_loc)
321 _mem_loc = (DBG_MEM_LOC *) malloc(sizeof(DBG_MEM_LOC));
322 else
324 }
325
326 assert(_mem_loc != NULL);
327
328 _mem_loc[i].adr = adr;
329 _mem_loc[i].size = size;
330 strcpy(_mem_loc[i].file, file);
331 _mem_loc[i].line = line;
332
333 f = fopen("mem.txt", "w");
334
335 assert(f != NULL);
336
337 for (i = 0; i < _n_mem; i++)
338 if (_mem_loc[i].adr)
339 fprintf(f, "%s:%d size=%d adr=%p\n", _mem_loc[i].file, _mem_loc[i].line, _mem_loc[i].size, _mem_loc[i].adr);
340
341 fclose(f);
342
343 return adr;
344}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ends_with_char()

bool ends_with_char ( const std::string &  s,
char  c 
)

Definition at line 412 of file midas.cxx.

413{
414 if (s.length() < 1)
415 return false;
416 return s[s.length()-1] == c;
417}
char c
Definition system.cxx:1312
Here is the caller graph for this function:

◆ join()

static std::string join ( const char sep,
const std::vector< std::string > &  v 
)
static

Definition at line 398 of file midas.cxx.

399{
400 std::string s;
401
402 for (unsigned i=0; i<v.size(); i++) {
403 if (i>0) {
404 s += sep;
405 }
406 s += v[i];
407 }
408
409 return s;
410}
Here is the call graph for this function:

◆ msprintf()

std::string msprintf ( const char format,
  ... 
)

Definition at line 419 of file midas.cxx.

419 {
420 va_list ap, ap1;
421 va_start(ap, format);
422 va_copy(ap1, ap);
423 size_t size = vsnprintf(nullptr, 0, format, ap1) + 1;
424 char *buffer = (char *)malloc(size);
425 if (!buffer) {
426 va_end(ap);
427 va_end(ap1);
428 return "";
429 }
430 vsnprintf(buffer, size, format, ap);
431 va_end(ap);
432 std::string s(buffer);
433 free(buffer);
434 return s;
435}
Here is the call graph for this function:

◆ split()

static std::vector< std::string > split ( const char sep,
const std::string &  s 
)
static

Definition at line 381 of file midas.cxx.

382{
383 unsigned sep_len = strlen(sep);
384 std::vector<std::string> v;
385 std::string::size_type pos = 0;
386 while (1) {
387 std::string::size_type next = s.find(sep, pos);
388 if (next == std::string::npos) {
389 v.push_back(s.substr(pos));
390 break;
391 }
392 v.push_back(s.substr(pos, next-pos));
393 pos = next+sep_len;
394 }
395 return v;
396}
Here is the call graph for this function:

Variable Documentation

◆ _client_name

std::string _client_name
static

Definition at line 1473 of file midas.cxx.

◆ _database

DATABASE* _database
extern

◆ _database_entries

INT _database_entries
extern

◆ _debug_mode

INT _debug_mode = 0
static

Definition at line 231 of file midas.cxx.

◆ _debug_print

void(* _debug_print) (const char *) ( const char ) = NULL
static

Definition at line 229 of file midas.cxx.

◆ _deferred_trans_table

TRANS_TABLE _deferred_trans_table[]
static
Initial value:
= {
{TR_START, 0, NULL},
{TR_STOP, 0, NULL},
{TR_PAUSE, 0, NULL},
{TR_RESUME, 0, NULL},
{0, 0, NULL}
}

Definition at line 250 of file midas.cxx.

250 {
251 {TR_START, 0, NULL},
252 {TR_STOP, 0, NULL},
253 {TR_PAUSE, 0, NULL},
254 {TR_RESUME, 0, NULL},
255 {0, 0, NULL}
256};

◆ _error_table

const ERROR_TABLE _error_table[]
static
Initial value:
= {
{CM_WRONG_PASSWORD, "Wrong password"},
{CM_UNDEF_EXP, "Experiment not defined"},
"\"exptab\" file not found and MIDAS_DIR or MIDAS_EXPTAB environment variable is not defined"},
{RPC_NET_ERROR, "Cannot connect to remote host"},
{0, NULL}
}
#define CM_UNDEF_EXP
Definition midas.h:586
#define CM_WRONG_PASSWORD
Definition midas.h:589
#define CM_UNDEF_ENVIRON
Definition midas.h:590
#define RPC_NET_ERROR
Definition midas.h:701

Definition at line 270 of file midas.cxx.

270 {
271 {CM_WRONG_PASSWORD, "Wrong password"},
272 {CM_UNDEF_EXP, "Experiment not defined"},
274 "\"exptab\" file not found and MIDAS_DIR or MIDAS_EXPTAB environment variable is not defined"},
275 {RPC_NET_ERROR, "Cannot connect to remote host"},
276 {0, NULL}
277};

◆ _experiment_name

std::string _experiment_name
static

Definition at line 1472 of file midas.cxx.

◆ _hDB

HNDLE _hDB = 0
static

Definition at line 1471 of file midas.cxx.

◆ _hKeyClient

HNDLE _hKeyClient = 0
static

dox

Definition at line 1470 of file midas.cxx.

◆ _mem_loc

DBG_MEM_LOC* _mem_loc = NULL
static

Definition at line 286 of file midas.cxx.

◆ _message_mask_system

std::atomic_int _message_mask_system {MT_ALL}
static

Definition at line 447 of file midas.cxx.

447{MT_ALL};
#define MT_ALL
Definition midas.h:549

◆ _message_mask_user

std::atomic_int _message_mask_user {MT_ALL}
static

Definition at line 448 of file midas.cxx.

448{MT_ALL};

◆ _message_print

std::atomic<MessagePrintCallback> _message_print {puts}
static

Definition at line 445 of file midas.cxx.

445{puts};

◆ _msg_buffer

INT _msg_buffer = 0
static

Definition at line 198 of file midas.cxx.

◆ _msg_dispatch

EVENT_HANDLER* _msg_dispatch = NULL
static

Definition at line 199 of file midas.cxx.

◆ _mutex_rpc

MUTEX_T* _mutex_rpc = NULL
static

Definition at line 227 of file midas.cxx.

◆ _n_mem

INT _n_mem = 0
static

Definition at line 287 of file midas.cxx.

◆ _path_name

std::string _path_name
static

Definition at line 1474 of file midas.cxx.

◆ _request_list

std::vector<EventRequest> _request_list
static

Definition at line 220 of file midas.cxx.

◆ _request_list_mutex

std::mutex _request_list_mutex
static

Definition at line 219 of file midas.cxx.

◆ _rpc_connect_timeout

int _rpc_connect_timeout = 10000
static

Definition at line 233 of file midas.cxx.

◆ _rpc_listen_socket

int _rpc_listen_socket = 0
static

Definition at line 259 of file midas.cxx.

◆ _rpc_registered

BOOL _rpc_registered = FALSE
static

Definition at line 258 of file midas.cxx.

◆ _semaphore_alarm

INT _semaphore_alarm = -1

Definition at line 1476 of file midas.cxx.

◆ _semaphore_elog

INT _semaphore_elog = -1

Definition at line 1477 of file midas.cxx.

◆ _semaphore_history

INT _semaphore_history = -1

Definition at line 1478 of file midas.cxx.

◆ _trans_table

std::vector<TRANS_TABLE> _trans_table
static

Definition at line 248 of file midas.cxx.

◆ _trans_table_mutex

std::mutex _trans_table_mutex
static

Definition at line 247 of file midas.cxx.

◆ _trp

TR_PARAM _trp
static

Definition at line 302 of file midas.cxx.

◆ _watchdog_timeout

INT _watchdog_timeout = DEFAULT_WATCHDOG_TIMEOUT
static

Definition at line 1475 of file midas.cxx.

◆ disable_bind_rpc_to_localhost

int disable_bind_rpc_to_localhost = 0
static

Definition at line 237 of file midas.cxx.

◆ gBuffers

std::vector<BUFFER*> gBuffers
static

Definition at line 196 of file midas.cxx.

◆ gBuffersMutex

std::mutex gBuffersMutex
static

Definition at line 195 of file midas.cxx.

◆ mname

const char* mname[]
Initial value:
= {
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
}

Definition at line 144 of file midas.cxx.

144 {
145 "January",
146 "February",
147 "March",
148 "April",
149 "May",
150 "June",
151 "July",
152 "August",
153 "September",
154 "October",
155 "November",
156 "December"
157};

◆ tid_name

const char* tid_name[]
static
Initial value:
= {
"NULL",
"UINT8",
"INT8",
"CHAR",
"UINT16",
"INT16",
"UINT32",
"INT32",
"BOOL",
"FLOAT",
"DOUBLE",
"BITFIELD",
"STRING",
"ARRAY",
"STRUCT",
"KEY",
"LINK",
"INT64",
"UINT64"
}

Definition at line 111 of file midas.cxx.

111 {
112 "NULL",
113 "UINT8",
114 "INT8",
115 "CHAR",
116 "UINT16",
117 "INT16",
118 "UINT32",
119 "INT32",
120 "BOOL",
121 "FLOAT",
122 "DOUBLE",
123 "BITFIELD",
124 "STRING",
125 "ARRAY",
126 "STRUCT",
127 "KEY",
128 "LINK",
129 "INT64",
130 "UINT64"
131};

◆ tid_name_old

const char* tid_name_old[]
static
Initial value:
= {
"NULL",
"BYTE",
"SBYTE",
"CHAR",
"WORD",
"SHORT",
"DWORD",
"INT",
"BOOL",
"FLOAT",
"DOUBLE",
"BITFIELD",
"STRING",
"ARRAY",
"STRUCT",
"KEY",
"LINK",
"INT64",
"UINT64"
}

Definition at line 89 of file midas.cxx.

89 {
90 "NULL",
91 "BYTE",
92 "SBYTE",
93 "CHAR",
94 "WORD",
95 "SHORT",
96 "DWORD",
97 "INT",
98 "BOOL",
99 "FLOAT",
100 "DOUBLE",
101 "BITFIELD",
102 "STRING",
103 "ARRAY",
104 "STRUCT",
105 "KEY",
106 "LINK",
107 "INT64",
108 "UINT64"
109};

◆ tid_size

const int tid_size[]
static
Initial value:
= {
0,
1,
1,
1,
2,
2,
4,
4,
4,
4,
8,
4,
0,
0,
0,
0,
0,
8,
8
}

dox

Definition at line 66 of file midas.cxx.

66 {
67 0, /* tid == 0 not defined */
68 1, /* TID_UINT8 unsigned byte 0 255 */
69 1, /* TID_INT8 signed byte -128 127 */
70 1, /* TID_CHAR single character 0 255 */
71 2, /* TID_UINT16 two bytes 0 65535 */
72 2, /* TID_INT16 signed word -32768 32767 */
73 4, /* TID_UINT32 four bytes 0 2^32-1 */
74 4, /* TID_INT32 signed dword -2^31 2^31-1 */
75 4, /* TID_BOOL four bytes bool 0 1 */
76 4, /* TID_FLOAT 4 Byte float format */
77 8, /* TID_DOUBLE 8 Byte float format */
78 4, /* TID_BITFIELD 32 Bits Bitfield 0000... 11111... */
79 0, /* TID_STRING zero terminated string */
80 0, /* TID_ARRAY variable length array of unkown type */
81 0, /* TID_STRUCT C structure */
82 0, /* TID_KEY key in online database */
83 0, /* TID_LINK link in online database */
84 8, /* TID_INT64 8 bytes int -2^63 2^63-1 */
85 8 /* TID_UINT64 8 bytes unsigned int 0 2^64-1 */
86};