Paraslash Audio Streaming | |
About News Download Documentation Development |
Commands for para_audiod. More...
#include <netinet/in.h>
#include <sys/socket.h>
#include <regex.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <sys/un.h>
#include <netdb.h>
#include <lopsub.h>
#include "audiod.lsg.h"
#include "para.h"
#include "lsu.h"
#include "audiod_cmd.lsg.h"
#include "list.h"
#include "sched.h"
#include "buffer_tree.h"
#include "filter.h"
#include "grab_client.h"
#include "error.h"
#include "audiod.h"
#include "net.h"
#include "daemon.h"
#include "string.h"
#include "write.h"
#include "fd.h"
#include "version.h"
Macros | |
#define | MAX_STAT_CLIENTS 50 |
The maximal number of simultaneous connections. More... | |
#define | EXPORT_AUDIOD_CMD_HANDLER(_cmd) |
Define the user_data pointer as expected by lopsub. More... | |
Typedefs | |
typedef int(* | audiod_cmd_handler_t) (int, struct lls_parse_result *) |
Pointer to a command handler function. More... | |
Enumerations | |
enum | stat_client_flags { SCF_PARSER_FRIENDLY = 1 } |
Flags used for the stat command of para_audiod. More... | |
Functions | |
void | close_stat_clients (void) |
Empty the status clients list. More... | |
void | stat_client_write_item (int item_num) |
Write a message to all connected status clients. More... | |
int | dispatch_local_connection (int accept_fd) |
Handle arriving connections on the local socket. More... | |
void | audiod_status_dump (bool force) |
Send the current audiod status to all connected stat clients. More... | |
void | clear_and_dump_items (void) |
Flush and send all status items. More... | |
Variables | |
struct sched | sched |
The scheduler instance of para_audiod. More... | |
char * | stat_item_values [NUM_STAT_ITEMS] |
The array of status items sent by para_server. More... | |
const char * | status_item_list [] = {STATUS_ITEMS} |
The list of all status items used by para_{server,audiod,gui}. More... | |
const struct audiod_command_info | lsg_audiod_cmd_com_help_user_data = { .handler = com_help } |
Implementation of help . More... | |
const struct audiod_command_info | lsg_audiod_cmd_com_ll_user_data = { .handler = com_ll } |
Implementation of ll . More... | |
const struct audiod_command_info | lsg_audiod_cmd_com_tasks_user_data = { .handler = com_tasks } |
Implementation of tasks . More... | |
const struct audiod_command_info | lsg_audiod_cmd_com_stat_user_data = { .handler = com_stat } |
Implementation of stat . More... | |
const struct audiod_command_info | lsg_audiod_cmd_com_grab_user_data = { .handler = com_grab } |
Implementation of grab . More... | |
const struct audiod_command_info | lsg_audiod_cmd_com_term_user_data = { .handler = com_term } |
Implementation of term . More... | |
const struct audiod_command_info | lsg_audiod_cmd_com_on_user_data = { .handler = com_on } |
Implementation of on . More... | |
const struct audiod_command_info | lsg_audiod_cmd_com_off_user_data = { .handler = com_off } |
Implementation of off . More... | |
const struct audiod_command_info | lsg_audiod_cmd_com_sb_user_data = { .handler = com_sb } |
Implementation of sb . More... | |
const struct audiod_command_info | lsg_audiod_cmd_com_cycle_user_data = { .handler = com_cycle } |
Implementation of cycle . More... | |
const struct audiod_command_info | lsg_audiod_cmd_com_version_user_data = { .handler = com_version } |
Implementation of version . More... | |
Commands for para_audiod.
#define MAX_STAT_CLIENTS 50 |
The maximal number of simultaneous connections.
#define EXPORT_AUDIOD_CMD_HANDLER | ( | _cmd | ) |
Define the user_data pointer as expected by lopsub.
typedef int(* audiod_cmd_handler_t) (int, struct lls_parse_result *) |
Pointer to a command handler function.
enum stat_client_flags |
void close_stat_clients | ( | void | ) |
Empty the status clients list.
This iterates over the list of connected status clients, closes each client file descriptor and frees the resources.
References list_for_each_entry_safe.
void stat_client_write_item | ( | int | item_num | ) |
Write a message to all connected status clients.
item_num | The number of the status item of msg. |
On write errors, remove the status client from the client list and close its file descriptor.
References para_buffer::flags, list_for_each_entry_safe, PBF_SIZE_PREFIX, and stat_item_values.
Referenced by audiod_status_dump(), and clear_and_dump_items().
int dispatch_local_connection | ( | int | accept_fd | ) |
Handle arriving connections on the local socket.
accept_fd | The fd to accept connections on. |
This is called in each iteration of the main loop of the scheduler. If there is an incoming connection, the function reads the command sent by the peer, checks the connecting user's permissions by using unix socket credentials (if supported by the OS) and calls the corresponding command handler if permissions are OK.
References MAXLINE.
void audiod_status_dump | ( | bool | force | ) |
Send the current audiod status to all connected stat clients.
force | Whether to write unchanged items. |
References daemon_get_uptime_str(), get_time_string(), now, stat_client_write_item(), and stat_item_values.
void clear_and_dump_items | ( | void | ) |
Flush and send all status items.
Send to each connected client the full status item list with empty values.
References FOR_EACH_STATUS_ITEM, stat_client_write_item(), and stat_item_values.
The scheduler instance of para_audiod.
This is needed also in audiod_command.c (for the tasks command), so it can not be made static.
|
extern |
The array of status items sent by para_server.
The array of status items sent by para_server.
This is used by the amp filter which first tries to obtain the amplification value from an element in this array.
Referenced by audiod_status_dump(), clear_and_dump_items(), and stat_client_write_item().
const char* status_item_list[] = {STATUS_ITEMS} |
The list of all status items used by para_{server,audiod,gui}.
status items
const struct audiod_command_info lsg_audiod_cmd_com_help_user_data = { .handler = com_help } |
Implementation of help .
const struct audiod_command_info lsg_audiod_cmd_com_ll_user_data = { .handler = com_ll } |
Implementation of ll .
const struct audiod_command_info lsg_audiod_cmd_com_tasks_user_data = { .handler = com_tasks } |
Implementation of tasks .
const struct audiod_command_info lsg_audiod_cmd_com_stat_user_data = { .handler = com_stat } |
Implementation of stat .
const struct audiod_command_info lsg_audiod_cmd_com_grab_user_data = { .handler = com_grab } |
Implementation of grab .
const struct audiod_command_info lsg_audiod_cmd_com_term_user_data = { .handler = com_term } |
Implementation of term .
const struct audiod_command_info lsg_audiod_cmd_com_on_user_data = { .handler = com_on } |
Implementation of on .
const struct audiod_command_info lsg_audiod_cmd_com_off_user_data = { .handler = com_off } |
Implementation of off .
const struct audiod_command_info lsg_audiod_cmd_com_sb_user_data = { .handler = com_sb } |
Implementation of sb .
const struct audiod_command_info lsg_audiod_cmd_com_cycle_user_data = { .handler = com_cycle } |
Implementation of cycle .
const struct audiod_command_info lsg_audiod_cmd_com_version_user_data = { .handler = com_version } |
Implementation of version .