Data Structures | |
struct | TR_CLIENT |
Functions | |
INT | cm_synchronize (DWORD *seconds) |
INT | cm_asctime (char *str, INT buf_size) |
INT | cm_time (DWORD *time) |
char * | cm_get_version () |
INT | cm_set_path (char *path) |
INT | cm_get_path (char *path) |
INT | cm_scan_experiments (void) |
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, char *host_name, char *client_name, INT hw_type, char *password, DWORD watchdog_timeout) |
INT | cm_get_client_info (char *client_name) |
INT | cm_get_environment (char *host_name, int host_name_size, char *exp_name, int exp_name_size) |
INT | cm_connect_experiment (char *host_name, char *exp_name, char *client_name, void(*func)(char *)) |
INT | cm_connect_experiment1 (char *host_name, char *exp_name, char *client_name, void(*func)(char *), INT odb_size, DWORD watchdog_timeout) |
INT | cm_list_experiments (char *host_name, char exp_name[MAX_EXPERIMENT][NAME_LENGTH]) |
INT | cm_select_experiment (char *host_name, char *exp_name) |
INT | cm_connect_client (char *client_name, HNDLE *hConn) |
INT | cm_disconnect_client (HNDLE hConn, BOOL bShutdown) |
INT | cm_disconnect_experiment (void) |
INT | cm_set_experiment_database (HNDLE hDB, HNDLE hKeyClient) |
INT | cm_get_experiment_database (HNDLE *hDB, HNDLE *hKeyClient) |
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, char *client_name, DWORD *timeout, DWORD *last) |
INT | cm_register_transition (INT transition, INT(*func)(INT, char *), INT sequence_number) |
INT | cm_set_transition_sequence (INT transition, INT sequence_number) |
INT | cm_register_deferred_transition (INT transition, BOOL(*func)(INT, BOOL)) |
INT | cm_check_deferred_transition () |
INT | cm_transition (INT transition, INT run_number, char *perror, INT strsize, INT async_flag, INT debug_flag) |
INT | cm_yield (INT millisec) |
INT | cm_execute (char *command, char *result, INT bufsize) |
INT | cm_shutdown (char *name, BOOL bUnique) |
INT | cm_exist (char *name, BOOL bUnique) |
INT | cm_cleanup (char *client_name, BOOL ignore_timeout) |
|
Get time from MIDAS server and set local time.
Definition at line 948 of file midas.c. Referenced by al_trigger_alarm(), and cm_transition(). |
|
Check if a client with a /system/client/xxx entry has a valid entry in the ODB client table. If not, remove that client from the /system/client tree.
Definition at line 1216 of file midas.c. Referenced by cm_set_client_info(). |
|
Check for any deferred transition. If a deferred transition handler has been registered via the cm_register_deferred_transition function, this routine should be called regularly. It checks if a transition request is pending. If so, it calld the registered handler if the transition should be done and then actually does the transition.
Definition at line 2851 of file midas.c. Referenced by scheduler(). |
|
Remove hanging clients independent of their watchdog timeout. Since this function does not obey the client watchdog timeout, it should be only called to remove clients which have their watchdog checking turned off or which are known to be dead. The normal client removement is done via cm_watchdog(). Currently (Sept. 02) there are two applications for that:
Added ignore_timeout on Nov.03. A logger might have an increased tiemout of up to 60 sec. because of tape operations. If ignore_timeout is FALSE, the logger is then not killed if its inactivity is less than 60 sec., while in the previous implementation it was always killed after 2*WATCHDOG_INTERVAL.
Definition at line 4530 of file midas.c. Referenced by main(). |
|
Connect to a MIDAS client of the current experiment For internal use only.
|
|
This function connects to an existing MIDAS experiment. This must be the first call in a MIDAS application. It opens three TCP connection to the remote host (one for RPC calls, one to send events and one for hot-link notifications from the remote host) and writes client information into the ODB under /System/Clients.
Definition at line 1629 of file midas.c. Referenced by main(). |
|
Connect to a MIDAS experiment (to the online database) on a specific host. For internal use only.
Definition at line 1651 of file midas.c. Referenced by cm_connect_experiment(), and main(). |
|
Delete client info from database
Definition at line 1165 of file midas.c. Referenced by cm_check_client(), cm_cleanup(), and cm_disconnect_experiment(). |
|
|
|
Disconnect from a MIDAS client
|
|
Disconnect from a MIDAS experiment.
Definition at line 2070 of file midas.c. Referenced by cm_connect_experiment1(), main(), and register_equipment(). |
|
Executes command via system() call
|
|
Check if a MIDAS client exists in current experiment
Definition at line 4452 of file midas.c. Referenced by main(). |
|
Get info about the current client
Definition at line 1455 of file midas.c. Referenced by bm_open_buffer(). |
|
Returns MIDAS environment variables.
Definition at line 1531 of file midas.c. Referenced by main(). |
|
Get the handle to the ODB from the currently connected experiment.
Definition at line 2215 of file midas.c. Referenced by al_trigger_alarm(), ana_end_of_run(), analyzer_init(), cm_connect_client(), cm_deregister_transition(), cm_disconnect_experiment(), cm_exist(), cm_get_client_info(), cm_msg_log(), cm_msg_log1(), cm_msg_retrieve(), cm_register_deferred_transition(), cm_register_transition(), cm_set_transition_sequence(), cm_set_watchdog_params(), cm_shutdown(), cm_transition(), el_submit(), and main(). |
|
Return the path name previously set with cm_set_path.
Definition at line 1037 of file midas.c. Referenced by cm_connect_experiment1(), cm_msg_log(), cm_msg_log1(), and cm_msg_retrieve(). |
|
Return version number of current MIDAS library as a string
Definition at line 1006 of file midas.c. Referenced by cm_transition(). |
|
Return watchdog information about specific client
|
|
Return the current watchdog parameters
Definition at line 2416 of file midas.c. Referenced by bm_open_buffer(), cm_connect_experiment1(), cm_set_client_info(), and db_open_database(). |
|
Connect to a MIDAS server and return all defined experiments in *exp_name[MAX_EXPERIMENTS]
Definition at line 1848 of file midas.c. Referenced by cm_select_experiment(). |
|
Register a deferred transition handler. If a client is registered as a deferred transition handler, it may defer a requested transition by returning FALSE until a certain condition (like a motor reaches its end position) is reached.
|
|
Registers a callback function for run transitions. This function internally registers the transition callback function and publishes its request for transition notification by writing a transition request to /System/Clients/<pid>/Transition XXX. Other clients making a transition scan the transition requests of all clients and call their transition callbacks via RPC. Clients can register for transitions (Start/Stop/Pause/Resume) in a given sequence. All sequence numbers given in the registration are sorted on a transition and the clients are contacted in ascending order. By default, all programs register with a sequence number of 500. The logger however uses 200 for start, so that it can open files before the other clients are contacted, and 800 for stop, so that the files get closed when all other clients have gone already through the stop trantition. The callback function returns CM_SUCCESS if it can perform the transition or a value larger than one in case of error. An error string can be copied into the error variable.
Definition at line 2595 of file midas.c. Referenced by main(). |
|
Scan the "exptab" file for MIDAS experiment names and save them for later use by rpc_server_accept(). The file is first searched under $MIDAS/exptab if present, then the directory from argv[0] is probed.
Definition at line 1073 of file midas.c. Referenced by cm_connect_experiment1(), and cm_list_experiments(). |
|
Connect to a MIDAS server and select an experiment from the experiments available on this server For internal use only.
Definition at line 1951 of file midas.c. Referenced by cm_connect_experiment1(). |
|
Set client information in online database and return handle
Definition at line 1278 of file midas.c. Referenced by cm_connect_experiment1(). |
|
Set the handle to the ODB for the currently connected experiment
Definition at line 2152 of file midas.c. Referenced by cm_connect_experiment1(), and cm_disconnect_experiment(). |
|
Set path to actual experiment. This function gets called by cm_connect_experiment if the connection is established to a local experiment (not through the TCP/IP server). The path is then used for all shared memory routines.
Definition at line 1020 of file midas.c. Referenced by cm_connect_experiment1(). |
|
Change the transition sequence for the calling program.
|
|
Sets the internal watchdog flags and the own timeout. If call_watchdog is TRUE, the cm_watchdog routine is called periodically from the system to show other clients that this application is "alive". On UNIX systems, the alarm() timer is used which is then not available for user purposes. The timeout specifies the time, after which the calling application should be considered "dead" by other clients. Normally, the cm_watchdog() routines is called periodically. If a client crashes, this does not occur any more. Then other clients can detect this and clear all buffer and database entries of this application so they are not blocked any more. If this application should not checked by others, the timeout can be specified as zero. It might be useful for debugging purposes to do so, because if a debugger comes to a breakpoint and stops the application, the periodic call of cm_watchdog is disabled and the client looks like dead. If the timeout is not zero, but the watchdog is not called (call_watchdog == FALSE), the user must ensure to call cm_watchdog periodically with a period of WATCHDOG_INTERVAL milliseconds or less. An application which calles system routines which block the alarm signal for some time, might increase the timeout to the maximum expected blocking time before issuing the calls. One example is the logger doing Exabyte tape IO, which can take up to one minute.
Definition at line 2302 of file midas.c. Referenced by cm_connect_experiment1(), cm_set_client_info(), and main(). |
|
Shutdown (exit) other MIDAS client
Definition at line 4362 of file midas.c. Referenced by cm_transition(), and main(). |
|
Get time from MIDAS server and set local time.
Definition at line 920 of file midas.c. Referenced by main(). |
|
Get time from ss_time on server.
Definition at line 966 of file midas.c. Referenced by cm_transition(). |
|
Performs a run transition (Start/Stop/Pause/Resume). Synchronous/Asynchronous flag. If set to ASYNC, the transition is done asynchronously, meaning that clients are connected and told to execute their callback routine, but no result is awaited. The return value is specified by the transition callback function on the remote clients. If all callbacks can perform the transition, CM_SUCCESS is returned. If one callback cannot perform the transition, the return value of this callback is returned from cm_transition(). The async_flag is usually FALSE so that transition callbacks can block a run transition in case of problems and return an error string. The only exception are situations where a run transition is performed automatically by a program which cannot block in a transition. For example the logger can cause a run stop when a disk is nearly full but it cannot block in the cm_transition() function since it has its own run stop callback which must flush buffers and close disk files and tapes. ... i = 1; db_set_value(hDB, 0, "/Runinfo/Transition in progress", &i, sizeof(INT), 1, TID_INT); status = cm_transition(TR_START, new_run_number, str, sizeof(str), SYNC, debug_flag); if (status != CM_SUCCESS) { // in case of error printf("Error: %s\n", str); } ...
Definition at line 2948 of file midas.c. Referenced by cm_check_deferred_transition(), scan_fragment(), and scheduler(). |
|
Central yield functions for clients. This routine should be called in an infinite loop by a client in order to give the MIDAS system the opportunity to receive commands over RPC channels, update database records and receive events.
Definition at line 3549 of file midas.c. Referenced by scan_fragment(), and scheduler(). |
|
Definition at line 2903 of file midas.c. Referenced by cm_transition(). |