YAZ
5.34.0
|
Implements GFS logic. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <yaz/sc.h>
#include <yaz/tpath.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xinclude.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#include <yaz/comstack.h>
#include <yaz/tcpip.h>
#include <yaz/options.h>
#include <yaz/log.h>
#include "eventl.h"
#include "session.h"
#include <yaz/statserv.h>
#include <yaz/daemon.h>
#include <yaz/yaz-iconv.h>
Go to the source code of this file.
Macros | |
#define | STAT_DEFAULT_LOG_LEVEL "server,session,request" |
Functions | |
int | check_options (int argc, char **argv) |
static void | get_logbits (int force) |
static int | add_listener (char *where, int listen_id) |
static xmlNodePtr | xml_config_get_root (void) |
static char * | nmem_dup_xml_content (NMEM n, xmlNodePtr ptr) |
static struct gfs_server * | gfs_server_new (const char *id) |
static struct gfs_listen * | gfs_listen_new (const char *id, const char *address) |
static void | gfs_server_chdir (struct gfs_server *gfs) |
int | control_association (association *assoc, const char *host, int force_open) |
static void | xml_config_read (const char *base_path) |
static int | xml_config_open (void) |
static void | xml_config_close (void) |
static int | xml_config_add_listeners (void) |
static void | xml_config_bend_start (void) |
static void | xml_config_bend_stop (void) |
static void | remove_listeners (void) |
void | statserv_remove (IOCHAN pIOChannel) |
static void | statserv_closedown (void) |
static void * | new_session (void *vp) |
static void | listener (IOCHAN h, int event) |
static void | inetd_connection (int what) |
static void | catchchld (int num) |
statserv_options_block * | statserv_getcontrol (void) |
void | statserv_setcontrol (statserv_options_block *block) |
static void | statserv_reset (void) |
static void | normal_stop_handler (int num) |
static void | daemon_handler (void *data) |
static void | show_version (void) |
static int | statserv_sc_main (yaz_sc_t s, int argc, char **argv) |
static void | option_copy (char *dst, const char *src) |
void | statserv_sc_stop (yaz_sc_t s) |
int | statserv_main (int argc, char **argv, bend_initresult *(*bend_init)(bend_initrequest *r), void(*bend_close)(void *handle)) |
Variables | |
static IOCHAN | pListener = NULL |
static char | gfs_root_dir [FILENAME_MAX+1] |
static struct gfs_server * | gfs_server_list = 0 |
static struct gfs_listen * | gfs_listen_list = 0 |
static NMEM | gfs_nmem = 0 |
static char * | me = "statserver" |
static char * | programname ="statserver" |
static statserv_options_block * | current_control_block = 0 |
statserv_options_block | control_block |
static int | max_sessions = 0 |
static int | logbits_set = 0 |
static int | log_session = 0 |
static int | log_sessiondetail = 0 |
static int | log_server = 0 |
static xmlDocPtr | xml_config_doc = 0 |
static int | no_sessions = 0 |
static int | sig_received = 0 |
Implements GFS logic.
Definition in file statserv.c.
#define STAT_DEFAULT_LOG_LEVEL "server,session,request" |
Definition at line 91 of file statserv.c.
|
static |
Definition at line 1146 of file statserv.c.
References statserv_options_block::cert_fname, control_block, cs_bind, cs_close, cs_create_host(), cs_errno, cs_fileno, CS_SERVER, cs_set_ssl_certificate_file(), cs_strerror(), CSYSERR, statserv_options_block::dynamic, EVENT_EXCEPT, EVENT_INPUT, iochan_create(), iochan_setdata, listener(), log_server, iochan::next, pListener, statserv_options_block::threads, comstack::user, yaz_log(), YLOG_ERRNO, and YLOG_FATAL.
Referenced by check_options(), statserv_sc_main(), and xml_config_add_listeners().
|
static |
Definition at line 1207 of file statserv.c.
Referenced by statserv_sc_main().
int check_options | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 1359 of file statserv.c.
References add_listener(), statserv_options_block::apdufile, statserv_options_block::background, statserv_options_block::cert_fname, statserv_options_block::configname, control_block, statserv_options_block::daemon_name, statserv_options_block::default_proto, statserv_options_block::dynamic, get_logbits(), statserv_options_block::idle_timeout, statserv_options_block::inetd, statserv_options_block::keepalive, statserv_options_block::logfile, max_sessions, statserv_options_block::maxrecordsize, me, statserv_options_block::one_shot, option_copy(), options(), statserv_options_block::pid_fname, PROTO_Z3950, statserv_options_block::setuid, show_version(), STAT_DEFAULT_LOG_LEVEL, statserv_options_block::threads, statserv_options_block::xml_config, yaz_log_init_file(), yaz_log_init_level(), yaz_log_init_max_size(), yaz_log_mask_str(), and yaz_log_time_format().
int control_association | ( | association * | assoc, |
const char * | host, | ||
int | force_open | ||
) |
Definition at line 267 of file statserv.c.
References association::backend, statserv_options_block::bend_close, gfs_server::cb, iochan::chan_id, association::client_chan, association::client_link, statserv_options_block::configname, control_block, cs_set_max_recv_bytes(), gfs_server_chdir(), gfs_server_list, gfs_server::host, association::init, association::last_control, gfs_server::listen_ref, association::maximumRecordSize, statserv_options_block::maxrecordsize, gfs_server::next, association::preferredMessageSize, association::server, statserv_setcontrol(), xfree, statserv_options_block::xml_config, yaz_log(), and YLOG_DEBUG.
Referenced by process_http_request(), and process_initRequest().
|
static |
Definition at line 1266 of file statserv.c.
References iochan_event_loop(), pListener, and sig_received.
Referenced by statserv_sc_main().
|
static |
get_logbits sets global loglevel bits
Definition at line 135 of file statserv.c.
References log_server, log_session, log_sessiondetail, logbits_set, and yaz_log_module_level().
Referenced by check_options().
|
static |
Definition at line 237 of file statserv.c.
References gfs_listen::address, gfs_nmem, gfs_listen::id, gfs_listen::next, nmem_malloc(), and nmem_strdup().
Referenced by xml_config_read().
|
static |
Definition at line 252 of file statserv.c.
References gfs_server::directory, gfs_root_dir, yaz_log(), YLOG_ERRNO, and YLOG_WARN.
Referenced by control_association(), and xml_config_bend_start().
|
static |
Definition at line 215 of file statserv.c.
References gfs_server::cb, gfs_server::ccl_transform, gfs_server::client_query_charset, control_block, gfs_server::cql_transform, gfs_server::directory, gfs_server::docpath, gfs_nmem, gfs_server::host, gfs_server::id, gfs_server::listen_ref, gfs_server::next, nmem_malloc(), nmem_strdup_null(), gfs_server::retrieval, gfs_server::server_node_ptr, gfs_server::stylesheet, and yaz_retrieval_create().
Referenced by xml_config_read().
|
static |
Definition at line 1103 of file statserv.c.
References statserv_options_block::apdufile, control_block, create_association(), cs_addrstr, cs_createbysocket, cs_fileno, association::cs_get_mask, EVENT_INPUT, iochan_create(), iochan_setdata, iochan_settimeout, ir_session(), log_sessiondetail, iochan::next, pListener, tcpip_type(), yaz_log(), YLOG_ERRNO, and YLOG_FATAL.
Referenced by statserv_sc_main().
|
static |
Definition at line 948 of file statserv.c.
References statserv_options_block::bend_stop, statserv_options_block::check_ip, control_block, cs_accept, cs_addrstr, cs_close, cs_listen_check, statserv_options_block::daemon_name, statserv_options_block::dynamic, EVENT_EXCEPT, EVENT_INPUT, EVENT_TIMEOUT, iochan_destroy, iochan_getdata, iochan_getnext, iochan_setflags, log_server, log_sessiondetail, me, new_session(), no_sessions, statserv_options_block::one_shot, pListener, remove_listeners(), statserv_options_block::threads, yaz_log(), yaz_log_init_prefix(), YLOG_ERRNO, YLOG_FATAL, and YLOG_WARN.
Referenced by add_listener().
|
static |
Definition at line 1038 of file statserv.c.
References statserv_options_block::apdufile, iochan::chan_id, control_block, create_association(), association::cs_accept_mask, cs_addrstr, cs_fileno, association::cs_get_mask, CS_WANT_READ, CS_WANT_WRITE, EVENT_INPUT, EVENT_OUTPUT, comstack::io_pending, iochan_create(), iochan_event_loop(), iochan_setdata, iochan_settimeout, ir_session(), log_session, mask, max_sessions, iochan::next, no_sessions, statserv_options_block::one_shot, pListener, statserv_options_block::threads, comstack::user, yaz_log(), yaz_log_xml_errors(), YLOG_FATAL, and YLOG_WARN.
Referenced by listener().
|
static |
Definition at line 173 of file statserv.c.
References nmem_malloc(), and yaz_isspace.
Referenced by xml_config_read().
|
static |
Definition at line 1260 of file statserv.c.
References sig_received.
Referenced by statserv_sc_main().
|
static |
Definition at line 1353 of file statserv.c.
References BEND_NAME_MAX.
Referenced by check_options().
|
static |
Definition at line 1198 of file statserv.c.
References iochan_destroy, iochan::next, and pListener.
Referenced by listener().
|
static |
Definition at line 1272 of file statserv.c.
References yaz_version(), YAZ_VERSION, and YAZ_VERSION_SHA1.
Referenced by check_options().
|
static |
Definition at line 932 of file statserv.c.
References iochan_destroy, iochan::next, pListener, xml_config_bend_stop(), and xml_config_close().
Referenced by statserv_sc_stop().
statserv_options_block* statserv_getcontrol | ( | void | ) |
Definition at line 1215 of file statserv.c.
References control_block, and current_control_block.
Referenced by destroy_association(), process_initRequest(), and srw_bend_init().
int statserv_main | ( | int | argc, |
char ** | argv, | ||
bend_initresult *(*)(bend_initrequest *r) | bend_init, | ||
void(*)(void *handle) | bend_close | ||
) |
Definition at line 1504 of file statserv.c.
References bend_close(), statserv_options_block::bend_close, bend_init(), statserv_options_block::bend_init, control_block, statserv_sc_main(), statserv_sc_stop(), yaz_sc_create(), yaz_sc_destroy(), and yaz_sc_program().
Referenced by main().
void statserv_remove | ( | IOCHAN | pIOChannel | ) |
Definition at line 928 of file statserv.c.
Referenced by iochan_event_loop().
|
static |
Definition at line 1253 of file statserv.c.
Referenced by statserv_sc_stop().
|
static |
Definition at line 1283 of file statserv.c.
References add_listener(), statserv_options_block::background, catchchld(), control_block, daemon_handler(), statserv_options_block::default_proto, statserv_options_block::dynamic, statserv_options_block::inetd, inetd_connection(), me, normal_stop_handler(), statserv_options_block::options_func, statserv_options_block::pid_fname, pListener, programname, statserv_options_block::setuid, sig_received, xml_config_add_listeners(), xml_config_bend_start(), xml_config_open(), yaz_daemon(), YAZ_DAEMON_FORK, yaz_log(), yaz_sc_running(), and YLOG_LOG.
Referenced by statserv_main().
void statserv_sc_stop | ( | yaz_sc_t | s | ) |
Definition at line 1498 of file statserv.c.
References statserv_closedown(), and statserv_reset().
Referenced by statserv_main().
void statserv_setcontrol | ( | statserv_options_block * | block | ) |
Definition at line 1235 of file statserv.c.
References current_control_block, gfs_root_dir, yaz_log(), YLOG_ERRNO, and YLOG_WARN.
Referenced by control_association(), xml_config_bend_start(), and xml_config_bend_stop().
|
static |
Definition at line 611 of file statserv.c.
References add_listener(), gfs_listen::address, gfs_listen_list, and gfs_listen::next.
Referenced by statserv_sc_main().
|
static |
Definition at line 625 of file statserv.c.
References statserv_options_block::bend_start, gfs_server::cb, statserv_options_block::configname, control_block, gfs_server_chdir(), gfs_server_list, gfs_server::next, statserv_setcontrol(), statserv_options_block::xml_config, yaz_log(), and YLOG_DEBUG.
Referenced by statserv_sc_main().
|
static |
Definition at line 651 of file statserv.c.
References statserv_options_block::bend_stop, gfs_server::cb, statserv_options_block::configname, control_block, gfs_server_list, gfs_server::next, statserv_setcontrol(), statserv_options_block::xml_config, yaz_log(), and YLOG_DEBUG.
Referenced by statserv_closedown().
|
static |
Definition at line 591 of file statserv.c.
References gfs_nmem, gfs_server_list, nmem_destroy(), and xml_config_doc.
Referenced by statserv_closedown().
|
static |
Definition at line 154 of file statserv.c.
References control_block, statserv_options_block::xml_config, xml_config_doc, yaz_log(), and YLOG_WARN.
Referenced by xml_config_read().
|
static |
Definition at line 530 of file statserv.c.
References control_block, gfs_nmem, gfs_root_dir, nmem_create(), wrbuf_alloc(), wrbuf_cstr(), wrbuf_destroy(), wrbuf_write(), statserv_options_block::xml_config, xml_config_doc, xml_config_read(), yaz_log(), YLOG_ERRNO, YLOG_FATAL, and YLOG_WARN.
Referenced by statserv_sc_main().
|
static |
Definition at line 343 of file statserv.c.
References gfs_server::cb, ccl_qual_file(), ccl_qual_mk(), gfs_server::ccl_transform, gfs_server::client_query_charset, statserv_options_block::configname, control_block, gfs_server::cql_transform, cql_transform_open_fname(), gfs_server::directory, gfs_server::docpath, gfs_listen_list, gfs_listen_new(), gfs_nmem, gfs_server_list, gfs_server_new(), gfs_server::host, gfs_listen::id, gfs_server::listen_ref, statserv_options_block::maxrecordsize, gfs_server::next, gfs_listen::next, nmem_dup_xml_content(), nmem_malloc(), nmem_strsplit(), gfs_server::retrieval, gfs_server::server_node_ptr, gfs_server::stylesheet, statserv_options_block::xml_config, xml_config_get_root(), yaz_filepath_resolve(), yaz_log(), yaz_retrieval_configure(), yaz_retrieval_get_error(), yaz_retrieval_set_path(), YLOG_ERRNO, YLOG_FATAL, and YLOG_WARN.
Referenced by xml_config_open().
statserv_options_block control_block |
Definition at line 94 of file statserv.c.
Referenced by add_listener(), check_options(), control_association(), gfs_server_new(), inetd_connection(), listener(), new_session(), statserv_getcontrol(), statserv_main(), statserv_sc_main(), xml_config_bend_start(), xml_config_bend_stop(), xml_config_get_root(), xml_config_open(), and xml_config_read().
|
static |
Definition at line 85 of file statserv.c.
Referenced by statserv_getcontrol(), and statserv_setcontrol().
|
static |
Definition at line 73 of file statserv.c.
Referenced by xml_config_add_listeners(), and xml_config_read().
|
static |
Definition at line 74 of file statserv.c.
Referenced by gfs_listen_new(), gfs_server_new(), xml_config_close(), xml_config_open(), and xml_config_read().
|
static |
Definition at line 71 of file statserv.c.
Referenced by gfs_server_chdir(), statserv_setcontrol(), and xml_config_open().
|
static |
Definition at line 72 of file statserv.c.
Referenced by control_association(), xml_config_bend_start(), xml_config_bend_stop(), xml_config_close(), and xml_config_read().
|
static |
Definition at line 132 of file statserv.c.
Referenced by add_listener(), get_logbits(), and listener().
|
static |
Definition at line 130 of file statserv.c.
Referenced by get_logbits(), and new_session().
|
static |
Definition at line 131 of file statserv.c.
Referenced by get_logbits(), inetd_connection(), and listener().
|
static |
Definition at line 129 of file statserv.c.
Referenced by get_logbits().
|
static |
Definition at line 127 of file statserv.c.
Referenced by check_options(), and new_session().
|
static |
Definition at line 76 of file statserv.c.
Referenced by check_options(), listener(), and statserv_sc_main().
|
static |
Definition at line 945 of file statserv.c.
Referenced by listener(), and new_session().
|
static |
Definition at line 69 of file statserv.c.
Referenced by add_listener(), daemon_handler(), inetd_connection(), listener(), new_session(), remove_listeners(), statserv_closedown(), and statserv_sc_main().
|
static |
Definition at line 77 of file statserv.c.
Referenced by statserv_sc_main().
|
static |
Definition at line 1257 of file statserv.c.
Referenced by daemon_handler(), normal_stop_handler(), and statserv_sc_main().
|
static |
Definition at line 150 of file statserv.c.
Referenced by xml_config_close(), xml_config_get_root(), and xml_config_open().