pazpar2  1.6.30
Data Structures | Macros | Functions | Variables
http_command.c File Reference
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <yaz/snprintf.h>
#include <yaz/yaz-util.h>
#include "ppmutex.h"
#include "eventl.h"
#include "parameters.h"
#include "session.h"
#include "http.h"
#include "settings.h"
#include "client.h"

Go to the source code of this file.

Data Structures

struct  http_session
struct  http_sessions

Macros

#define print_meminfo(x)
#define PAZPAR2_PROTOCOL_VERSION   "1"
#define HTTP_COMMAND_RESPONSE_PREFIX   "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
#define resultsets_count()   0

Functions

static void show_records_ready (void *data)
int get_version (struct http_request *rq)
int http_session_use (int delta)
http_sessions_t http_sessions_create (void)
void http_sessions_destroy (http_sessions_t hs)
void http_session_destroy (struct http_session *s)
static void session_timeout (IOCHAN i, int event)
struct http_sessionhttp_session_create (struct conf_service *service, http_sessions_t http_sessions, unsigned int sesid)
static const char * get_msg (enum pazpar2_error_code code)
static void error (struct http_response *rs, enum pazpar2_error_code code, const char *addinfo)
static void response_open_no_status (struct http_channel *c, const char *command)
static void response_open (struct http_channel *c, const char *command)
static void response_close (struct http_channel *c, const char *command)
unsigned int make_sessionid (void)
static struct http_sessionlocate_session (struct http_channel *c)
static void release_session (struct http_channel *c, struct http_session *session)
static int process_settings (struct session *se, struct http_request *rq, struct http_response *rs)
static void cmd_exit (struct http_channel *c)
static void cmd_init (struct http_channel *c)
static void apply_local_setting (void *client_data, struct setting *set)
static void cmd_settings (struct http_channel *c)
static void termlist_response (struct http_channel *c, struct http_session *s, const char *cmd_status)
static void termlist_result_ready (void *data)
static void cmd_termlist (struct http_channel *c)
size_t session_get_memory_status (struct session *session)
static void session_status (struct http_channel *c, struct http_session *s)
static void cmd_session_status (struct http_channel *c)
int sessions_count (void)
int clients_count (void)
static void cmd_server_status (struct http_channel *c)
static void bytarget_response (struct http_channel *c, struct http_session *s, const char *cmd_status)
static void bytarget_result_ready (void *data)
static void cmd_bytarget (struct http_channel *c)
static void write_metadata (WRBUF w, struct conf_service *service, struct record_metadata **ml, int full, int indent)
static void write_subrecord (struct record *r, WRBUF w, struct conf_service *service, int show_details)
static void show_raw_record_error (void *data, const char *addinfo)
static void show_raw_record_ok (void *data, const char *buf, size_t sz)
static void show_raw_record_ok_binary (void *data, const char *buf, size_t sz)
void show_raw_reset (void *data, struct http_channel *c, void *data2)
static void cmd_record_ready (void *data)
static void show_record (struct http_channel *c, struct http_session *s)
static void cmd_record (struct http_channel *c)
static void show_records (struct http_channel *c, struct http_session *s, int active)
static void cmd_show (struct http_channel *c)
static void cmd_ping (struct http_channel *c)
static void cmd_search (struct http_channel *c)
static void cmd_stat (struct http_channel *c)
static void cmd_info (struct http_channel *c)
void http_command (struct http_channel *c)

Variables

static YAZ_MUTEX g_http_session_mutex = 0
static int g_http_sessions = 0
struct {
   char *   name
   void(*   fun )(struct http_channel *c)
commands []

Macro Definition Documentation

#define HTTP_COMMAND_RESPONSE_PREFIX   "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"

Definition at line 73 of file http_command.c.

Referenced by error(), and response_open_no_status().

#define PAZPAR2_PROTOCOL_VERSION   "1"

Definition at line 71 of file http_command.c.

Referenced by cmd_init().

#define print_meminfo (   x)

Definition at line 66 of file http_command.c.

Referenced by cmd_server_status().

#define resultsets_count ( )    0

Definition at line 668 of file http_command.c.

Referenced by cmd_server_status().

Function Documentation

static void apply_local_setting ( void *  client_data,
struct setting set 
)
static

Definition at line 487 of file http_command.c.

References session_apply_setting(), and session::session_nmem.

Referenced by cmd_settings().

static void bytarget_response ( struct http_channel c,
struct http_session s,
const char *  cmd_status 
)
static
static void bytarget_result_ready ( void *  data)
static
int clients_count ( void  )

Definition at line 94 of file client.c.

References client_use().

Referenced by cmd_server_status().

static void cmd_bytarget ( struct http_channel c)
static
static void cmd_exit ( struct http_channel c)
static
static void cmd_info ( struct http_channel c)
static
static void cmd_init ( struct http_channel c)
static
static void cmd_ping ( struct http_channel c)
static
static void cmd_record ( struct http_channel c)
static

Definition at line 1089 of file http_command.c.

References locate_session(), release_session(), and show_record().

static void cmd_record_ready ( void *  data)
static
static void cmd_search ( struct http_channel c)
static
static void cmd_server_status ( struct http_channel c)
static
static void cmd_session_status ( struct http_channel c)
static
static void cmd_settings ( struct http_channel c)
static
static void cmd_show ( struct http_channel c)
static
static void cmd_stat ( struct http_channel c)
static
static void cmd_termlist ( struct http_channel c)
static
static void error ( struct http_response rs,
enum pazpar2_error_code  code,
const char *  addinfo 
)
static
static const char* get_msg ( enum pazpar2_error_code  code)
static
int get_version ( struct http_request rq)

Definition at line 98 of file http_command.c.

References http_argbyname().

Referenced by bytarget_response(), show_records(), and termlist_response().

void http_command ( struct http_channel c)
struct http_session* http_session_create ( struct conf_service service,
http_sessions_t  http_sessions,
unsigned int  sesid 
)
read
void http_session_destroy ( struct http_session s)
int http_session_use ( int  delta)

Definition at line 108 of file http_command.c.

References g_http_session_mutex, and g_http_sessions.

Referenced by http_session_create(), and http_session_destroy().

http_sessions_t http_sessions_create ( void  )
void http_sessions_destroy ( http_sessions_t  hs)
static struct http_session* locate_session ( struct http_channel c)
staticread
unsigned int make_sessionid ( void  )

Definition at line 312 of file http_command.c.

References global_parameters, and parameters::predictable_sessions.

Referenced by cmd_init().

static int process_settings ( struct session se,
struct http_request rq,
struct http_response rs 
)
static
static void release_session ( struct http_channel c,
struct http_session session 
)
static
static void response_close ( struct http_channel c,
const char *  command 
)
static
static void response_open ( struct http_channel c,
const char *  command 
)
static
static void response_open_no_status ( struct http_channel c,
const char *  command 
)
static
size_t session_get_memory_status ( struct session session)

Definition at line 938 of file session.c.

References session::nmem, session_enter(), and session_leave().

Referenced by session_status().

static void session_status ( struct http_channel c,
struct http_session s 
)
static
static void session_timeout ( IOCHAN  i,
int  event 
)
static
int sessions_count ( void  )

Definition at line 117 of file session.c.

References session_use().

Referenced by cmd_server_status().

static void show_raw_record_error ( void *  data,
const char *  addinfo 
)
static
static void show_raw_record_ok ( void *  data,
const char *  buf,
size_t  sz 
)
static
static void show_raw_record_ok_binary ( void *  data,
const char *  buf,
size_t  sz 
)
static
void show_raw_reset ( void *  data,
struct http_channel c,
void *  data2 
)

Definition at line 957 of file http_command.c.

Referenced by show_record().

static void show_record ( struct http_channel c,
struct http_session s 
)
static
static void show_records ( struct http_channel c,
struct http_session s,
int  active 
)
static
static void show_records_ready ( void *  data)
static
static void termlist_response ( struct http_channel c,
struct http_session s,
const char *  cmd_status 
)
static
static void termlist_result_ready ( void *  data)
static
static void write_metadata ( WRBUF  w,
struct conf_service service,
struct record_metadata **  ml,
int  full,
int  indent 
)
static
static void write_subrecord ( struct record r,
WRBUF  w,
struct conf_service service,
int  show_details 
)
static

Variable Documentation

struct { ... } commands[]

Referenced by http_command().

void(* fun)(struct http_channel *c)
YAZ_MUTEX g_http_session_mutex = 0
static

Definition at line 93 of file http_command.c.

Referenced by http_session_use().

int g_http_sessions = 0
static

Definition at line 94 of file http_command.c.

Referenced by http_session_use().

char* name