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 431 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 7791 of file midas.cxx.

7813{
7814 if (rpc_is_remote())
7815 return rpc_call(RPC_BM_GET_BUFFER_INFO, buffer_handle, buffer_header);
7816
7817#ifdef LOCAL_ROUTINES
7818
7819 int status = 0;
7820 BUFFER *pbuf = bm_get_buffer("bm_get_buffer_info", buffer_handle, &status);
7821
7822 if (!pbuf)
7823 return status;
7824
7826
7827 if (!pbuf_guard.is_locked())
7828 return pbuf_guard.get_status();
7829
7830 memcpy(buffer_header, pbuf->buffer_header, sizeof(BUFFER_HEADER));
7831
7832#endif /* LOCAL_ROUTINES */
7833
7834 return BM_SUCCESS;
7835}
static BUFFER * bm_get_buffer(const char *who, INT buffer_handle, int *pstatus)
Definition midas.cxx:6622
#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:12761
INT rpc_call(DWORD routine_id,...)
Definition midas.cxx:13663
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 7838 of file midas.cxx.

7857{
7858 if (rpc_is_remote())
7859 return rpc_call(RPC_BM_GET_BUFFER_LEVEL, buffer_handle, n_bytes);
7860
7861#ifdef LOCAL_ROUTINES
7862 {
7863 int status = 0;
7864
7865 BUFFER *pbuf = bm_get_buffer("bm_get_buffer_level", buffer_handle, &status);
7866
7867 if (!pbuf)
7868 return status;
7869
7871
7872 if (!pbuf_guard.is_locked())
7873 return pbuf_guard.get_status();
7874
7875 BUFFER_HEADER *pheader = pbuf->buffer_header;
7876
7878
7879 *n_bytes = pheader->write_pointer - pclient->read_pointer;
7880 if (*n_bytes < 0)
7881 *n_bytes += pheader->size;
7882
7883 pbuf_guard.unlock();
7884
7885 if (pbuf->read_cache_size) {
7887 if (status == BM_SUCCESS) {
7888 /* add bytes in cache */
7889 if (pbuf->read_cache_wp > pbuf->read_cache_rp)
7890 *n_bytes += pbuf->read_cache_wp - pbuf->read_cache_rp;
7891 pbuf->read_cache_mutex.unlock();
7892 }
7893 }
7894 }
7895#endif /* LOCAL_ROUTINES */
7896
7897 return BM_SUCCESS;
7898}
static BUFFER_CLIENT * bm_get_my_client_locked(bm_lock_buffer_guard &pbuf_guard)
Definition midas.cxx:5999
static int bm_lock_buffer_read_cache(BUFFER *pbuf)
Definition midas.cxx:7904
#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 8063 of file midas.cxx.

8082{
8083 if (rpc_is_remote())
8084 return rpc_call(RPC_BM_INIT_BUFFER_COUNTERS, buffer_handle);
8085
8086#ifdef LOCAL_ROUTINES
8087
8088 int status = 0;
8089
8090 BUFFER* pbuf = bm_get_buffer("bm_init_buffer_counters", buffer_handle, &status);
8091
8092 if (!pbuf)
8093 return status;
8094
8096
8097 if (!pbuf_guard.is_locked())
8098 return pbuf_guard.get_status();
8099
8100 pbuf->buffer_header->num_in_events = 0;
8101 pbuf->buffer_header->num_out_events = 0;
8102
8103#endif /* LOCAL_ROUTINES */
8104
8105 return BM_SUCCESS;
8106}
#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:410
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 17723 of file midas.cxx.

17724{
17725 if (format == FORMAT_FIXED) {
17726 int status;
17727 status = db_set_record(hDB, hKey, (char *) (pevent + 1), pevent->data_size, 0);
17728 if (status != DB_SUCCESS) {
17729 cm_msg(MERROR, "cm_write_event_to_odb", "event %d ODB record size mismatch, db_set_record() status %d", pevent->event_id, status);
17730 return status;
17731 }
17732 return SUCCESS;
17733 } else if (format == FORMAT_MIDAS) {
17734 INT size, i, status, n_data;
17735 int n;
17736 char *pdata, *pdata0;
17737
17738 char name[5];
17740 BANK *pbk;
17741 BANK32 *pbk32;
17742 BANK32A *pbk32a;
17743 DWORD bkname;
17744 WORD bktype;
17746 KEY key;
17747
17748 pbh = (BANK_HEADER *) (pevent + 1);
17749 pbk = NULL;
17750 pbk32 = NULL;
17751 pbk32a = NULL;
17752
17753 /* count number of banks */
17754 for (n=0 ; ; n++) {
17755 if (bk_is32a(pbh)) {
17757 if (pbk32a == NULL)
17758 break;
17759 } else if (bk_is32(pbh)) {
17761 if (pbk32 == NULL)
17762 break;
17763 } else {
17764 bk_iterate(pbh, &pbk, &pdata);
17765 if (pbk == NULL)
17766 break;
17767 }
17768 }
17769
17770 /* build array of keys */
17771 hKeys = (HNDLE *)malloc(sizeof(HNDLE) * n);
17772
17773 pbk = NULL;
17774 pbk32 = NULL;
17775 n = 0;
17776 do {
17777 /* scan all banks */
17778 if (bk_is32a(pbh)) {
17779 size = bk_iterate32a(pbh, &pbk32a, &pdata);
17780 if (pbk32a == NULL)
17781 break;
17782 bkname = *((DWORD *) pbk32a->name);
17783 bktype = (WORD) pbk32a->type;
17784 } else if (bk_is32(pbh)) {
17785 size = bk_iterate32(pbh, &pbk32, &pdata);
17786 if (pbk32 == NULL)
17787 break;
17788 bkname = *((DWORD *) pbk32->name);
17789 bktype = (WORD) pbk32->type;
17790 } else {
17791 size = bk_iterate(pbh, &pbk, &pdata);
17792 if (pbk == NULL)
17793 break;
17794 bkname = *((DWORD *) pbk->name);
17795 bktype = (WORD) pbk->type;
17796 }
17797
17798 n_data = size;
17799 if (rpc_tid_size(bktype & 0xFF))
17800 n_data /= rpc_tid_size(bktype & 0xFF);
17801
17802 /* get bank key */
17803 *((DWORD *) name) = bkname;
17804 name[4] = 0;
17805 /* record the start of the data in case it is struct */
17806 pdata0 = pdata;
17807 if (bktype == TID_STRUCT) {
17809 if (status != DB_SUCCESS) {
17810 cm_msg(MERROR, "cm_write_event_to_odb", "please define bank \"%s\" in BANK_LIST in frontend", name);
17811 continue;
17812 }
17813
17814 /* write structured bank */
17815 for (i = 0;; i++) {
17818 break;
17819
17820 db_get_key(hDB, hKeyl, &key);
17821
17822 /* adjust for alignment */
17823 if (key.type != TID_STRING && key.type != TID_LINK)
17825
17827 if (status != DB_SUCCESS) {
17828 cm_msg(MERROR, "cm_write_event_to_odb", "cannot write bank \"%s\" to ODB, db_set_data1() status %d", name, status);
17829 continue;
17830 }
17831 hKeys[n++] = hKeyl;
17832
17833 /* shift data pointer to next item */
17835 }
17836 } else {
17837 /* write variable length bank */
17839 if (status != DB_SUCCESS) {
17841 if (status != DB_SUCCESS) {
17842 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);
17843 continue;
17844 }
17846 if (status != DB_SUCCESS) {
17847 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);
17848 continue;
17849 }
17850 }
17851 if (n_data > 0) {
17852 status = db_set_data1(hDB, hKeyRoot, pdata, size, n_data, bktype & 0xFF);
17853 if (status != DB_SUCCESS) {
17854 cm_msg(MERROR, "cm_write_event_to_odb", "cannot write bank \"%s\" to ODB, db_set_data1() status %d", name, status);
17855 }
17856 hKeys[n++] = hKeyRoot;
17857 }
17858 }
17859 } while (1);
17860
17861 /* notify all hot-lined clients in one go */
17863
17864 free(hKeys);
17865
17866 return SUCCESS;
17867 } else {
17868 cm_msg(MERROR, "cm_write_event_to_odb", "event format %d is not supported (see midas.h definitions of FORMAT_xxx)", format);
17869 return CM_DB_ERROR;
17870 }
17871}
INT bk_iterate32a(const void *event, BANK32A **pbk32a, void *pdata)
Definition midas.cxx:17103
BOOL bk_is32a(const void *event)
Definition midas.cxx:16437
BOOL bk_is32(const void *event)
Definition midas.cxx:16415
INT bk_iterate32(const void *event, BANK32 **pbk, void *pdata)
Definition midas.cxx:17067
INT bk_iterate(const void *event, BANK **pbk, void *pdata)
Definition midas.cxx:17046
#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:1319
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
Definition midas.cxx:915
INT db_create_key(HNDLE hDB, HNDLE hKey, const char *key_name, DWORD type)
Definition odb.cxx:3308
INT db_get_key(HNDLE hDB, HNDLE hKey, KEY *key)
Definition odb.cxx:6019
INT db_set_data1(HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type)
Definition odb.cxx:7313
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
Definition odb.cxx:4079
INT db_notify_clients_array(HNDLE hDB, HNDLE hKeys[], INT size)
Definition odb.cxx:12623
INT db_set_record(HNDLE hDB, HNDLE hKey, void *data, INT buf_size, INT align)
Definition odb.cxx:12291
INT db_enum_key(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
Definition odb.cxx:5586
INT rpc_tid_size(INT id)
Definition midas.cxx:11757
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:1215
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 341 of file midas.cxx.

341 {
342 void *adr;
343
344 adr = dbg_malloc(size * count, file, line);
345 if (adr)
346 memset(adr, 0, size * count);
347
348 return adr;
349}
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 351 of file midas.cxx.

351 {
352 FILE *f;
353 int i;
354
355 free(adr);
356
357 for (i = 0; i < _n_mem; i++)
358 if (_mem_loc[i].adr == adr)
359 break;
360
361 if (i < _n_mem)
362 _mem_loc[i].adr = NULL;
363
364 f = fopen("mem.txt", "w");
365 for (i = 0; i < _n_mem; i++)
366 if (_mem_loc[i].adr)
367 fprintf(f, "%s:%d %s:%d size=%d adr=%p\n", _mem_loc[i].file, _mem_loc[i].line,
368 file, line, _mem_loc[i].size, _mem_loc[i].adr);
369 fclose(f);
370}
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 _mem_loc[i].adr = adr;
327 _mem_loc[i].size = size;
328 strcpy(_mem_loc[i].file, file);
329 _mem_loc[i].line = line;
330
331 f = fopen("mem.txt", "w");
332 for (i = 0; i < _n_mem; i++)
333 if (_mem_loc[i].adr)
334 fprintf(f, "%s:%d size=%d adr=%p\n", _mem_loc[i].file, _mem_loc[i].line, _mem_loc[i].size,
335 _mem_loc[i].adr);
336 fclose(f);
337
338 return adr;
339}
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 403 of file midas.cxx.

404{
405 if (s.length() < 1)
406 return false;
407 return s[s.length()-1] == c;
408}
char c
Definition system.cxx:1310
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 389 of file midas.cxx.

390{
391 std::string s;
392
393 for (unsigned i=0; i<v.size(); i++) {
394 if (i>0) {
395 s += sep;
396 }
397 s += v[i];
398 }
399
400 return s;
401}
Here is the call graph for this function:

◆ msprintf()

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

Definition at line 410 of file midas.cxx.

410 {
411 va_list ap, ap1;
412 va_start(ap, format);
413 va_copy(ap1, ap);
414 size_t size = vsnprintf(nullptr, 0, format, ap1) + 1;
415 char *buffer = (char *)malloc(size);
416 if (!buffer)
417 return "";
418 vsnprintf(buffer, size, format, ap);
419 va_end(ap);
420 std::string s(buffer);
421 free(buffer);
422 return s;
423}
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 372 of file midas.cxx.

373{
374 unsigned sep_len = strlen(sep);
375 std::vector<std::string> v;
376 std::string::size_type pos = 0;
377 while (1) {
378 std::string::size_type next = s.find(sep, pos);
379 if (next == std::string::npos) {
380 v.push_back(s.substr(pos));
381 break;
382 }
383 v.push_back(s.substr(pos, next-pos));
384 pos = next+sep_len;
385 }
386 return v;
387}
Here is the call graph for this function:

Variable Documentation

◆ _client_name

std::string _client_name
static

Definition at line 1459 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 1458 of file midas.cxx.

◆ _hDB

HNDLE _hDB = 0
static

Definition at line 1457 of file midas.cxx.

◆ _hKeyClient

HNDLE _hKeyClient = 0
static

dox

Definition at line 1456 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 435 of file midas.cxx.

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

◆ _message_mask_user

std::atomic_int _message_mask_user {MT_ALL}
static

Definition at line 436 of file midas.cxx.

436{MT_ALL};

◆ _message_print

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

Definition at line 433 of file midas.cxx.

433{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 1460 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 1462 of file midas.cxx.

◆ _semaphore_elog

INT _semaphore_elog = -1

Definition at line 1463 of file midas.cxx.

◆ _semaphore_history

INT _semaphore_history = -1

Definition at line 1464 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 1461 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};