Paraslash Audio Streaming | |
About News Download Documentation Development |
Paraslash's main server. More...
#include <netinet/in.h>
#include <sys/socket.h>
#include <signal.h>
#include <regex.h>
#include <osl.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <sys/un.h>
#include <netdb.h>
#include <lopsub.h>
#include "server.lsg.h"
#include "para.h"
#include "error.h"
#include "lsu.h"
#include "crypt.h"
#include "afh.h"
#include "string.h"
#include "afs.h"
#include "net.h"
#include "server.h"
#include "list.h"
#include "sched.h"
#include "send.h"
#include "vss.h"
#include "config.h"
#include "close_on_fork.h"
#include "daemon.h"
#include "ipc.h"
#include "fd.h"
#include "user_list.h"
#include "color.h"
#include "version.h"
Macros | |
#define | ALARM_TIMEOUT 10 |
Shut down non-authorized connections after that many seconds. More... | |
#define | CMD_PTR (lls_cmd(0, server_suite)) |
Get a reference to the supercommand of para_server. More... | |
Functions | |
bool | process_is_command_handler (void) |
Tell whether the executing process is a command handler. More... | |
char * | server_get_tasks (void) |
Return the list of tasks for the server process. More... | |
void | parse_config_or_die (bool reload) |
(Re-)read the server configuration files. More... | |
void | free_lpr (void) |
Deallocate all lopsub parse results. More... | |
int | main (int argc, char *argv[]) |
The main function of para_server. More... | |
Variables | |
DEFINE_PARA_ERRLIST | |
Array of error strings. More... | |
__printf_2_3 void(* | para_log )(int, const char *,...) = daemon_log |
The log function of para_gui, always set to curses_log(). More... | |
struct misc_meta_data * | mmd |
Pointer to shared memory area for communication between para_server and its children. More... | |
struct lls_parse_result * | server_lpr = NULL |
The active value for all config options of para_server. More... | |
uint32_t | afs_socket_cookie |
A random number used to "authenticate" the afs connection. More... | |
int | mmd_mutex |
The mutex protecting the shared memory area containing the mmd struct. More... | |
pid_t | afs_pid = 0 |
The process id of the audio file selector process. More... | |
Paraslash's main server.
#define ALARM_TIMEOUT 10 |
Shut down non-authorized connections after that many seconds.
#define CMD_PTR (lls_cmd(0, server_suite)) |
Get a reference to the supercommand of para_server.
bool process_is_command_handler | ( | void | ) |
Tell whether the executing process is a command handler.
Cleanup on exit must be performed differently for command handlers.
References afs_pid.
Referenced by shutdown_client(), and vss_shutdown().
char* server_get_tasks | ( | void | ) |
Return the list of tasks for the server process.
This is called from com_tasks(). The helper is necessary since command handlers can not access the scheduler structure directly.
References get_task_list().
void parse_config_or_die | ( | bool | reload | ) |
(Re-)read the server configuration files.
reload | Whether config file overrides command line. |
This function also re-opens the logfile and the user list. On SIGHUP it is called from both server and afs context.
References MCF_DONT_FREE, and server_lpr.
void free_lpr | ( | void | ) |
Deallocate all lopsub parse results.
The server allocates a parse result for command line options and optionally a second parse result for the effective configuration, defined by merging the command line options with the options stored in the configuration file. This function frees both structures.
References CMD_PTR, and server_lpr.
int main | ( | int | argc, |
char * | argv[] | ||
) |
The main function of para_server.
argc | Usual argument count. |
argv | Usual argument vector. |
References sched::default_timeout, and sched::poll_function.
DEFINE_PARA_ERRLIST |
Array of error strings.
__printf_2_3 void(* para_log) (int, const char *,...) = daemon_log |
The log function of para_gui, always set to curses_log().
struct misc_meta_data* mmd |
Pointer to shared memory area for communication between para_server and its children.
Exported to vss.c, command.c and to afs.
Referenced by vss_chunk_time(), vss_next(), vss_paused(), vss_playing(), vss_repos(), and vss_stopped().
struct lls_parse_result* server_lpr = NULL |
The active value for all config options of para_server.
It is computed by merging the parse result of the command line options with the parse result of the config file.
Referenced by free_lpr(), and parse_config_or_die().
uint32_t afs_socket_cookie |
A random number used to "authenticate" the afs connection.
para_server picks this number by random before it forks the afs process. The command handlers know this number as well and write it to the afs socket, together with the id of the shared memory area which contains the payload of the afs command. A local process has to know this number to abuse the afs service provided by the local socket.
Referenced by send_callback_request().
int mmd_mutex |
The mutex protecting the shared memory area containing the mmd struct.
pid_t afs_pid = 0 |
The process id of the audio file selector process.
Referenced by process_is_command_handler().