2 * Copyright (C) 1997-2007 Andre Noll <maan@systemlinux.org>
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.
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.
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.
19 /** \file client.h common client functions and exported symbols from client_common.c */
21 #include <openssl/rc4.h>
24 * the different states of a connection from the view of the client
27 /** tcp connection is established */
29 /** server sends the welcome message */
31 /** client sends the authentification request */
33 /** server sends a challenge */
34 CL_RECEIVED_CHALLENGE,
35 /** clientd solves the challenge and sends the result */
37 /** server accepts this authentication */
39 /** client sends the command */
41 /** server expects data */
43 /** client expects data */
47 /** size of the receiving buffer */
48 #define CLIENT_BUFSIZE 8192
51 * data specific to a client task
53 struct private_client_data {
54 /** the state of the connection */
56 /** the file descriptor */
58 /** the configuration (including the command) */
59 struct client_args_info conf;
60 /** the config file for client options */
62 /** the RSA private key */
64 /** paraslash user name */
66 /** session key for receiving data */
68 /** session key for sending data */
70 /** the client task structure */
72 /** non-zero if task is unregistered */
74 /** the buffer used for handshake and receiving */
75 char buf[CLIENT_BUFSIZE];
76 /** number of bytes loaded in \p buf */
78 /** non-zero if the pre_select hook added \p fd to the read fd set */
80 /** non-zero if the pre_select hook added \p fd to the write fd set */
82 /** the decrypted challenge */
83 long unsigned challenge_nr;
84 /** pointer to the data to be sent to para_server */
86 /** number of bytes loaded in \p inbuf */
88 /** non-zero if input task encountered an eof or an errro condition */
92 void client_close(struct private_client_data *pcd);
93 int client_open(int argc, char *argv[], struct private_client_data **pcd_ptr);
94 void client_pre_select(struct sched *s, struct task *t);
95 void client_post_select(struct sched *s, struct task *t);