paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Enumerations | Functions | Variables
audiod.h File Reference

Symbols exported from audiod.c. More...

Enumerations

enum  {
  AUDIOD_AUDIO_FORMATS_ENUM, CL_CONNECTED, CL_RECEIVED_WELCOME, CL_SENT_AUTH,
  CL_RECEIVED_CHALLENGE, CL_SENT_CH_RESPONSE, CL_RECEIVED_PROCEED, CL_EXECUTING,
  CL_SENDING
}
 enum of audio formats supported by para_audiod More...
 

Functions

struct btr_node * audiod_get_btr_root (void)
 Return the root node of the current buffer tree. More...
 
__malloc char * audiod_get_decoder_flags (void)
 Return the flags for the decoder_flags status item. More...
 
void clear_and_dump_items (void)
 Flush and send all status items. More...
 
__malloc char * get_time_string (void)
 Compute the play time based on information of the current slot. More...
 
bool uid_is_whitelisted (uid_t uid)
 Lookup the given UID in the whitelist. More...
 
void audiod_status_dump (bool force)
 Send the current audiod status to all connected stat clients. More...
 
void close_stat_clients (void)
 Empty the status clients list. More...
 
int dispatch_local_connection (int accept_fd)
 Handle arriving connections on the local socket. More...
 
void stat_client_write_item (int item_num)
 Write a message to all connected status clients. More...
 

Variables

const char * audio_formats []
 array of audio format names supported by para_audiod More...
 
int audiod_status
 The current mode of operation (AUDIOD_OFF, AUDIOD_ON or AUDIOD_STANDBY). More...
 

Detailed Description

Symbols exported from audiod.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

enum of audio formats supported by para_audiod

Enumerator
AUDIOD_AUDIO_FORMATS_ENUM 
CL_CONNECTED 

TCP connection is established.

CL_RECEIVED_WELCOME 

Server sends the welcome message.

CL_SENT_AUTH 

Client sends the authentication request.

CL_RECEIVED_CHALLENGE 

Server sends encrypted challenge.

CL_SENT_CH_RESPONSE 

Client solves the challenge and sends the result.

CL_RECEIVED_PROCEED 

Server accepts this authentication.

CL_EXECUTING 

Command is executing.

CL_SENDING 

Server is expecting data (addblob commands only).

Function Documentation

◆ audiod_get_btr_root()

struct btr_node* audiod_get_btr_root ( void  )

Return the root node of the current buffer tree.

This is only used for stream grabbing.

Returns
NULL if no slot is currently active. If more than one buffer tree exists, the node corresponding to the most recently started receiver is returned.

References btr_get_node_start(), FOR_EACH_SLOT, slot, and tv_diff().

◆ audiod_get_decoder_flags()

__malloc char* audiod_get_decoder_flags ( void  )

Return the flags for the decoder_flags status item.

Allocates a string which contains one octal digit per slot. Bit zero (value 1) is set if a receiver is active. Bit one (value 2) and bit three (value 4) have the analogous meaning for filter and writer, respectively.

Returns
String that must be freed by the caller.

References FOR_EACH_SLOT, MAX_STREAM_SLOTS, para_strdup(), and slot.

◆ clear_and_dump_items()

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.

◆ get_time_string()

__malloc char* get_time_string ( void  )

Compute the play time based on information of the current slot.

This computes a string of the form "0:07 [3:33] (3%/3:40)" using information from the status items received from para_server and the start time of the (first) writer of the current slot.

It has to take into account that the stream was probably not started at the beginning of the file, that the clock between the server and the client host may differ and that playback of the stream was delayed, e.g. because the prebuffer filter is used in the filter configuration.

If no writer is active, for example because para_audiod runs in standby mode, an approximation based only on the status items is computed and the returned string is prefixed with "~".

Returns
A string that must be freed by the caller.

Referenced by audiod_status_dump().

◆ uid_is_whitelisted()

bool uid_is_whitelisted ( uid_t  uid)

Lookup the given UID in the whitelist.

The whitelist is the array of arguments to the –user-allow opion. If the option was not given, the array is empty, in which case the check succeeds.

Parameters
uidUser ID to look up.
Returns
True if –user-allow was not given, or if uid matches an element of the whitelist.

References OPT_GIVEN.

◆ audiod_status_dump()

void audiod_status_dump ( bool  force)

Send the current audiod status to all connected stat clients.

Parameters
forceWhether to write unchanged items.

References daemon_get_uptime_str(), get_time_string(), now, stat_client_write_item(), and stat_item_values.

◆ close_stat_clients()

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.

◆ dispatch_local_connection()

int dispatch_local_connection ( int  accept_fd)

Handle arriving connections on the local socket.

Parameters
accept_fdThe 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.

Returns
Positive on success, negative on errors, zero if there was no connection to accept.
See also
para_accept(), recv_cred_buffer().

References MAXLINE.

◆ stat_client_write_item()

void stat_client_write_item ( int  item_num)

Write a message to all connected status clients.

Parameters
item_numThe 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().

Variable Documentation

◆ audio_formats

const char* audio_formats[]
extern

array of audio format names supported by para_audiod

array of audio format names supported by para_audiod

◆ audiod_status

int audiod_status
extern

The current mode of operation (AUDIOD_OFF, AUDIOD_ON or AUDIOD_STANDBY).

Set by the on/off/cycle commands.