YAZ  5.23.1
Macros | Functions | Variables
statserv.c File Reference

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_servergfs_server_new (const char *id)
 
static struct gfs_listengfs_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_blockstatserv_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_servergfs_server_list = 0
 
static struct gfs_listengfs_listen_list = 0
 
static NMEM gfs_nmem = 0
 
static char * me = "statserver"
 
static char * programname ="statserver"
 
static statserv_options_blockcurrent_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
 

Detailed Description

Implements GFS logic.

Definition in file statserv.c.

Macro Definition Documentation

#define STAT_DEFAULT_LOG_LEVEL   "server,session,request"

Definition at line 91 of file statserv.c.

Referenced by check_options().

Function Documentation

static int add_listener ( char *  where,
int  listen_id 
)
static
static void catchchld ( int  num)
static

Definition at line 1207 of file statserv.c.

Referenced by statserv_sc_main().

int check_options ( int  argc,
char **  argv 
)
int control_association ( association assoc,
const char *  host,
int  force_open 
)
static void daemon_handler ( void *  data)
static

Definition at line 1266 of file statserv.c.

References iochan_event_loop(), and sig_received.

Referenced by statserv_sc_main().

static void get_logbits ( int  force)
static

get_logbits sets global loglevel bits

Definition at line 135 of file statserv.c.

References add_listener(), log_server, log_session, log_sessiondetail, logbits_set, and yaz_log_module_level().

Referenced by check_options().

static struct gfs_listen* gfs_listen_new ( const char *  id,
const char *  address 
)
static

Definition at line 237 of file statserv.c.

References gfs_listen::address, gfs_listen::id, gfs_listen::next, nmem_malloc(), and nmem_strdup().

Referenced by xml_config_read().

static void gfs_server_chdir ( struct gfs_server gfs)
static
static struct gfs_server* gfs_server_new ( const char *  id)
static
static void inetd_connection ( int  what)
static
static void listener ( IOCHAN  h,
int  event 
)
static
static void * new_session ( void *  vp)
static
static char* nmem_dup_xml_content ( NMEM  n,
xmlNodePtr  ptr 
)
static

Definition at line 173 of file statserv.c.

References nmem_malloc(), and yaz_isspace.

Referenced by xml_config_read().

static void normal_stop_handler ( int  num)
static

Definition at line 1260 of file statserv.c.

References sig_received.

Referenced by statserv_sc_main().

static void option_copy ( char *  dst,
const char *  src 
)
static

Definition at line 1353 of file statserv.c.

References BEND_NAME_MAX.

Referenced by check_options().

static void remove_listeners ( void  )
static

Definition at line 1198 of file statserv.c.

References iochan_destroy, iochan::next, and pListener.

Referenced by listener(), and xml_config_bend_stop().

static void show_version ( void  )
static

Definition at line 1272 of file statserv.c.

References yaz_version(), YAZ_VERSION, and YAZ_VERSION_SHA1.

Referenced by check_options().

static void statserv_closedown ( void  )
static
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 
)
void statserv_remove ( IOCHAN  pIOChannel)

Definition at line 928 of file statserv.c.

Referenced by iochan_event_loop(), and xml_config_bend_stop().

static void statserv_reset ( void  )
static

Definition at line 1253 of file statserv.c.

Referenced by statserv_sc_stop().

static int statserv_sc_main ( yaz_sc_t  s,
int  argc,
char **  argv 
)
static
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)
static int xml_config_add_listeners ( void  )
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 void xml_config_bend_start ( void  )
static
static void xml_config_bend_stop ( void  )
static
static void xml_config_close ( void  )
static

Definition at line 591 of file statserv.c.

References nmem_destroy(), and xml_config_doc.

Referenced by statserv_closedown(), and xml_config_bend_stop().

static xmlNodePtr xml_config_get_root ( void  )
static

Definition at line 154 of file statserv.c.

References statserv_options_block::xml_config, xml_config_doc, yaz_log(), and YLOG_WARN.

Referenced by xml_config_read().

static int xml_config_open ( void  )
static
static void xml_config_read ( const char *  base_path)
static

Variable Documentation

statserv_options_block control_block

Definition at line 94 of file statserv.c.

Referenced by control_association(), statserv_getcontrol(), and statserv_main().

statserv_options_block* current_control_block = 0
static

Definition at line 85 of file statserv.c.

Referenced by statserv_getcontrol().

struct gfs_listen* gfs_listen_list = 0
static

Definition at line 73 of file statserv.c.

Referenced by xml_config_add_listeners(), and xml_config_read().

NMEM gfs_nmem = 0
static

Definition at line 74 of file statserv.c.

char gfs_root_dir[FILENAME_MAX+1]
static

Definition at line 71 of file statserv.c.

Referenced by gfs_server_chdir(), statserv_setcontrol(), and xml_config_open().

struct gfs_server* gfs_server_list = 0
static

Definition at line 72 of file statserv.c.

Referenced by xml_config_bend_start(), xml_config_bend_stop(), and xml_config_read().

int log_server = 0
static

Definition at line 132 of file statserv.c.

Referenced by add_listener(), get_logbits(), listener(), and xml_config_bend_stop().

int log_session = 0
static

Definition at line 130 of file statserv.c.

Referenced by get_logbits(), and new_session().

int log_sessiondetail = 0
static

Definition at line 131 of file statserv.c.

Referenced by get_logbits(), inetd_connection(), and listener().

int logbits_set = 0
static

Definition at line 129 of file statserv.c.

Referenced by get_logbits().

int max_sessions = 0
static

Definition at line 127 of file statserv.c.

Referenced by check_options(), and new_session().

char* me = "statserver"
static

Definition at line 76 of file statserv.c.

Referenced by check_options(), listener(), and statserv_sc_main().

int no_sessions = 0
static

Definition at line 945 of file statserv.c.

Referenced by listener(), and new_session().

IOCHAN pListener = NULL
static

Definition at line 69 of file statserv.c.

Referenced by add_listener(), inetd_connection(), new_session(), and remove_listeners().

char* programname ="statserver"
static

Definition at line 77 of file statserv.c.

Referenced by statserv_sc_main().

int sig_received = 0
static

Definition at line 1257 of file statserv.c.

Referenced by daemon_handler(), normal_stop_handler(), and statserv_sc_main().

xmlDocPtr xml_config_doc = 0
static

Definition at line 150 of file statserv.c.

Referenced by xml_config_close(), xml_config_get_root(), and xml_config_open().