split client.c
[paraslash.git] / client.h
1 /*
2 * Copyright (C) 1997-2006 Andre Noll <maan@systemlinux.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
17 */
18
19 /** \file client.h common client functions and exported symbols from client_common.c */
20
21 #include <openssl/rc4.h>
22 enum {
23 CL_CONNECTED,
24 CL_RECEIVED_WELCOME,
25 CL_SENT_AUTH,
26 CL_RECEIVED_CHALLENGE,
27 CL_SENT_CH_RESPONSE,
28 CL_RECEIVED_PROCEED,
29 CL_SENT_COMMAND,
30 CL_SENDING_STDIN,
31 CL_RECEIVING_SERVER_OUTPUT
32 };
33
34 #define CLIENT_BUFSIZE 8192
35
36 struct private_client_data {
37 int status;
38 int fd;
39 struct client_args_info conf;
40 char *config_file;
41 char *key_file;
42 char *user;
43 RC4_KEY rc4_recv_key;
44 RC4_KEY rc4_send_key;
45 struct task task;
46 int eof;
47 char buf[CLIENT_BUFSIZE];
48 size_t loaded;
49 int check_r;
50 int check_w;
51 long unsigned challenge_nr;
52 /* only used if stdin gets sent to para_server */
53 char *inbuf;
54 size_t *in_loaded;
55 int *in_eof;
56 };
57
58 int client_open(struct private_client_data *pcd);
59 void client_close(struct private_client_data *pcd);
60 int client_parse_config(int argc, char *argv[],
61 struct private_client_data **pcd_ptr);
62 void client_pre_select(struct sched *s, struct task *t);
63 void client_post_select(struct sched *s, struct task *t);