|
Paraslash Audio Streaming |
About News Download Documentation Development |
Data Structures | |
struct | command_context |
struct | server_cmd_user_data |
Macros | |
#define | EXPORT_SERVER_CMD_HANDLER(_cmd) |
#define | SERVER_CMD_CMD_PTR(_cmd) (lls_cmd(LSG_SERVER_CMD_CMD_ ## _cmd, server_cmd_suite)) |
#define | SERVER_CMD_OPT_RESULT(_cmd, _opt, _lpr) (lls_opt_result(LSG_SERVER_CMD_ ## _cmd ## _OPT_ ## _opt, _lpr)) |
#define | SERVER_CMD_OPT_GIVEN(_cmd, _opt, _lpr) (lls_opt_given(SERVER_CMD_OPT_RESULT(_cmd, _opt, _lpr))) |
#define | SERVER_CMD_UINT32_VAL(_cmd, _opt, _lpr) (lls_uint32_val(0, SERVER_CMD_OPT_RESULT(_cmd, _opt, _lpr))) |
Typedefs | |
typedef int(* | server_cmd_handler_t) (struct command_context *, struct lls_parse_result *) |
Functions | |
int | send_sb (struct stream_cipher_context *scc, void *buf, size_t numbytes, int band, bool dont_free) |
__printf_3_4 int | send_sb_va (struct stream_cipher_context *scc, int band, const char *fmt,...) |
int | send_strerror (struct command_context *cc, int err) |
int | send_errctx (struct command_context *cc, char *errctx) |
int | recv_sb (struct stream_cipher_context *scc, enum sb_designator expected_band, size_t max_size, struct iovec *result) |
#define EXPORT_SERVER_CMD_HANDLER | ( | _cmd | ) |
Define the user data structure for one command.
#define SERVER_CMD_CMD_PTR | ( | _cmd | ) | (lls_cmd(LSG_SERVER_CMD_CMD_ ## _cmd, server_cmd_suite)) |
Get the lopsub command pointer by command name.
#define SERVER_CMD_OPT_RESULT | ( | _cmd, | |
_opt, | |||
_lpr | |||
) | (lls_opt_result(LSG_SERVER_CMD_ ## _cmd ## _OPT_ ## _opt, _lpr)) |
Get the lopsub parse result of an option.
#define SERVER_CMD_OPT_GIVEN | ( | _cmd, | |
_opt, | |||
_lpr | |||
) | (lls_opt_given(SERVER_CMD_OPT_RESULT(_cmd, _opt, _lpr))) |
How many times an option was given.
#define SERVER_CMD_UINT32_VAL | ( | _cmd, | |
_opt, | |||
_lpr | |||
) | (lls_uint32_val(0, SERVER_CMD_OPT_RESULT(_cmd, _opt, _lpr))) |
Fetch the (first) argument given to an option of type uint32.
typedef int(* server_cmd_handler_t) (struct command_context *, struct lls_parse_result *) |
Prototype of a server command handler.
int send_sb | ( | struct stream_cipher_context * | scc, |
void * | buf, | ||
size_t | numbytes, | ||
int | band, | ||
bool | dont_free | ||
) |
Send a sideband packet through a blocking file descriptor.
scc | fd and crypto keys. |
buf | The buffer to send. |
numbytes | The size of buf. |
band | The sideband designator of this packet. |
dont_free | If true, never deallocate buf. |
The nonblock flag must be disabled for the file descriptor given by scc.
Stream cipher encryption is automatically activated if necessary via the sideband transformation, depending on the value of band.
References sb_buffer::band, stream_cipher_context::fd, sb_buffer::iov, sb_free(), sb_get_send_buffers(), sb_new_send(), sb_sent(), SBB_INIT, SBD_PROCEED, sc_trafo(), stream_cipher_context::send, and xwritev().
Referenced by send_sb_va().
__printf_3_4 int send_sb_va | ( | struct stream_cipher_context * | scc, |
int | band, | ||
const char * | fmt, | ||
... | |||
) |
Create a variable sized buffer and send it as a sideband packet.
References sb_buffer::band, send_sb(), and xvasprintf().
Referenced by send_errctx(), and send_strerror().
int send_strerror | ( | struct command_context * | cc, |
int | err | ||
) |
Send an error message to a client.
cc | Client info. |
err | The (positive) error code. |
References para_strerror(), SBD_ERROR_LOG, command_context::scc, and send_sb_va().
int send_errctx | ( | struct command_context * | cc, |
char * | errctx | ||
) |
Send an error context to a client,.
cc | Client info. |
errctx | The error context string. |
This function frees the error context string after it was sent.
References SBD_ERROR_LOG, command_context::scc, and send_sb_va().
int recv_sb | ( | struct stream_cipher_context * | scc, |
enum sb_designator | expected_band, | ||
size_t | max_size, | ||
struct iovec * | result | ||
) |
Receive a sideband packet from a blocking file descriptor.
scc | fd and crypto keys. |
expected_band | The expected band designator. |
max_size | Passed to sb_new_recv(). |
result | Body of the sideband packet is returned here. |
If expected_band is not SBD_ANY
, the band designator of the received sideband packet is compared to expected_band and a mismatch is considered an error.
References sb_buffer::band, stream_cipher_context::fd, sb_buffer::iov, stream_cipher_context::recv, recv_bin_buffer(), sb_free(), sb_get_recv_buffer(), sb_new_recv(), sb_received(), SBD_ANY, SBD_PROCEED, and sc_trafo().