paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Macros | Functions
client_common.c File Reference

Common functions of para_client and 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 "client.lsg.h"
#include "para.h"
#include "error.h"
#include "list.h"
#include "lsu.h"
#include "sched.h"
#include "crypt.h"
#include "net.h"
#include "fd.h"
#include "sideband.h"
#include "string.h"
#include "client.h"
#include "buffer_tree.h"
#include "version.h"

Macros

#define CLIENT_BUFSIZE   4000
 The size of the receiving buffer. More...
 

Functions

void client_close (struct client_task *ct)
 Close the connection to para_server and free all resources. More...
 
int client_connect (struct client_task *ct, struct sched *s, struct btr_node *parent, struct btr_node *child)
 Connect to para_server and register the client task. More...
 
int client_parse_config (int argc, char *argv[], struct client_task **ct_ptr, int *loglevel)
 Parse a client configuration. More...
 
int client_open (int argc, char *argv[], struct client_task **ct_ptr, int *loglevel, struct btr_node *parent, struct btr_node *child, struct sched *sched)
 Parse the client configuration and open a connection to para_server. More...
 

Detailed Description

Common functions of para_client and para_audiod.

Macro Definition Documentation

◆ CLIENT_BUFSIZE

#define CLIENT_BUFSIZE   4000

The size of the receiving buffer.

Function Documentation

◆ client_close()

void client_close ( struct client_task ct)

Close the connection to para_server and free all resources.

Parameters
ctPointer to the client data.
See also
client_open().

◆ client_connect()

int client_connect ( struct client_task ct,
struct sched s,
struct btr_node *  parent,
struct btr_node *  child 
)

Connect to para_server and register the client task.

Parameters
ctThe initialized client task structure.
sThe scheduler instance to register the client task to.
parentThe parent node of the client btr node.
childThe child node of the client node.

The client task structure given by ct must be allocated and initialized by client_parse_config() before this function is called.

Returns
Standard.

◆ client_parse_config()

int client_parse_config ( int  argc,
char *  argv[],
struct client_task **  ct_ptr,
int *  loglevel 
)

Parse a client configuration.

Parameters
argcUsual argument count.
argvUsual argument vector.
ct_ptrFilled in by this function.
loglevelIf not NULL, the number of the loglevel is stored here.

This checks the command line options given by argc and argv, sets default values for the user name and the name of the rsa key file and reads further options from the config file.

Upon successful return, ct_ptr points to a dynamically allocated and initialized client task struct.

Returns
The number of non-option arguments in argc/argv on success, negative on errors.

Referenced by main().

◆ client_open()

int client_open ( int  argc,
char *  argv[],
struct client_task **  ct_ptr,
int *  loglevel,
struct btr_node *  parent,
struct btr_node *  child,
struct sched sched 
)

Parse the client configuration and open a connection to para_server.

Parameters
argcSee client_parse_config.
argvSee client_parse_config.
ct_ptrSee client_parse_config.
loglevelSee client_parse_config.
parentSee client_connect().
childSee client_connect().
schedSee client_connect().

This function combines client_parse_config() and client_connect(). It is considered a syntax error if no command was given, i.e. if the number of non-option arguments is zero.

Returns
Standard.