audiod: Check pointers passed to btr_get_node_start().
[paraslash.git] / client.h
1 /*
2 * Copyright (C) 1997-2012 Andre Noll <maan@systemlinux.org>
3 *
4 * Licensed under the GPL v2. For licencing details see COPYING.
5 */
6
7 /** \file client.h Common client functions and exported symbols from client_common.c. */
8
9 /** The different states of a connection from the view of the client. */
10 enum {
11 /** TCP connection is established. */
12 CL_CONNECTED,
13 /** Server sends the welcome message. */
14 CL_RECEIVED_WELCOME,
15 /** Client sends the authentification request. */
16 CL_SENT_AUTH,
17 /** Client solves the challenge and sends the result. */
18 CL_SENT_CH_RESPONSE,
19 /** Server accepts this authentication. */
20 CL_RECEIVED_PROCEED,
21 /** Client sends the command. */
22 CL_SENT_COMMAND,
23 /** Server expects data. */
24 CL_SENDING,
25 /** Client expects data. */
26 CL_RECEIVING,
27 };
28
29 /** Data specific to a client task. */
30 struct client_task {
31 /** The state of the connection. */
32 int status;
33 /** The file descriptor and the session keys. */
34 struct stream_cipher_context scc;
35 /** The configuration (including the command). */
36 struct client_args_info conf;
37 /** The config file for client options. */
38 char *config_file;
39 /** The RSA private key. */
40 char *key_file;
41 /** Paraslash user name. */
42 char *user;
43 /** The client task structure. */
44 struct task task;
45 /** The buffer tree node of the client task. */
46 struct btr_node *btrn;
47 };
48
49 void client_disconnect(struct client_task *ct);
50 void client_close(struct client_task *ct);
51 int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr,
52 int *loglevel);
53 int client_connect(struct client_task *ct, struct sched *s,
54 struct btr_node *parent, struct btr_node *child);
55 int client_open(int argc, char *argv[], struct client_task **ct_ptr,
56 int *loglevel, struct btr_node *parent, struct btr_node *child,
57 struct sched *sched);