paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Data Structures | Macros | Enumerations | Functions
client.h File Reference

Common client functions and exported symbols from client_common.c. More...

Data Structures

struct  client_task
 Data specific to a client task. More...
 

Macros

#define CLIENT_CMD_PTR   (lls_cmd(0, client_suite))
 
#define CLIENT_OPT_RESULT(_name, _lpr)    (lls_opt_result(LSG_CLIENT_PARA_CLIENT_OPT_ ## _name, _lpr))
 
#define CLIENT_OPT_GIVEN(_name, _lpr)    (lls_opt_given(CLIENT_OPT_RESULT(_name, _lpr)))
 
#define CLIENT_OPT_UINT32_VAL(_name, _lpr)    (lls_uint32_val(0, CLIENT_OPT_RESULT(_name, _lpr)))
 
#define CLIENT_OPT_STRING_VAL(_name, _lpr)    (lls_string_val(0, CLIENT_OPT_RESULT(_name, _lpr)))
 

Enumerations

enum  {
  CL_CONNECTED, CL_RECEIVED_WELCOME, CL_SENT_AUTH, CL_RECEIVED_CHALLENGE,
  CL_SENT_CH_RESPONSE, CL_RECEIVED_PROCEED, CL_EXECUTING, CL_SENDING
}
 The different states of a connection from the view of the client. More...
 

Functions

void client_close (struct client_task *ct)
 Close the connection to para_server and free all resources. More...
 
int client_parse_config (int argc, char *argv[], struct client_task **ct_ptr, int *loglevel)
 Parse a client configuration. 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_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 client functions and exported symbols from client_common.c.

Macro Definition Documentation

◆ CLIENT_CMD_PTR

#define CLIENT_CMD_PTR   (lls_cmd(0, client_suite))

◆ CLIENT_OPT_RESULT

#define CLIENT_OPT_RESULT (   _name,
  _lpr 
)     (lls_opt_result(LSG_CLIENT_PARA_CLIENT_OPT_ ## _name, _lpr))

◆ CLIENT_OPT_GIVEN

#define CLIENT_OPT_GIVEN (   _name,
  _lpr 
)     (lls_opt_given(CLIENT_OPT_RESULT(_name, _lpr)))

◆ CLIENT_OPT_UINT32_VAL

#define CLIENT_OPT_UINT32_VAL (   _name,
  _lpr 
)     (lls_uint32_val(0, CLIENT_OPT_RESULT(_name, _lpr)))

◆ CLIENT_OPT_STRING_VAL

#define CLIENT_OPT_STRING_VAL (   _name,
  _lpr 
)     (lls_string_val(0, CLIENT_OPT_RESULT(_name, _lpr)))

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

The different states of a connection from the view of the client.

Enumerator
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

◆ 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_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_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_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.