Add a check for libosl to configure.ac.
[paraslash.git] / client.h
1 /*
2 * Copyright (C) 1997-2009 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 #include <openssl/rc4.h>
10
11 /**
12 * the different states of a connection from the view of the client
13 */
14 enum {
15 /** tcp connection is established */
16 CL_CONNECTED,
17 /** server sends the welcome message */
18 CL_RECEIVED_WELCOME,
19 /** client sends the authentification request */
20 CL_SENT_AUTH,
21 /** server sends a challenge */
22 CL_RECEIVED_CHALLENGE,
23 /** clientd solves the challenge and sends the result */
24 CL_SENT_CH_RESPONSE,
25 /** server accepts this authentication */
26 CL_RECEIVED_PROCEED,
27 /** client sends the command */
28 CL_SENT_COMMAND,
29 /** server expects data */
30 CL_SENDING,
31 /** client expects data */
32 CL_RECEIVING,
33 };
34
35 /** size of the receiving buffer */
36 #define CLIENT_BUFSIZE 8192
37
38 /**
39 * data specific to a client task
40 */
41 struct client_task {
42 /** the state of the connection */
43 int status;
44 /** The file descriptor and the rc4 keys. */
45 struct rc4_context rc4c;
46 /** the configuration (including the command) */
47 struct client_args_info conf;
48 /** the config file for client options */
49 char *config_file;
50 /** the RSA private key */
51 char *key_file;
52 /** paraslash user name */
53 char *user;
54 /** the client task structure */
55 struct task task;
56 /** the buffer used for handshake and receiving */
57 char *buf;
58 /** number of bytes loaded in \p buf */
59 size_t loaded;
60 /** non-zero if the pre_select hook added \p fd to the read fd set */
61 int check_r;
62 /** non-zero if the pre_select hook added \p fd to the write fd set */
63 int check_w;
64 /** the decrypted challenge */
65 long unsigned challenge_nr;
66 /** pointer to the data to be sent to para_server */
67 char *inbuf;
68 /** number of bytes loaded in \p inbuf */
69 size_t *in_loaded;
70 /** Non-zero if input task encountered an eof or an error condition. */
71 int *in_error;
72 };
73
74 void client_close(struct client_task *ct);
75 int client_open(int argc, char *argv[], struct client_task **ct,
76 int *loglevel);