2 * Copyright (C) 1997-2006 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 #define CLIENT_BUFSIZE 8192
50 * data specific to a client task
52 struct private_client_data {
53 /** the state of the connection */
55 /** the file descriptor */
57 /** the configuration (including the command) */
58 struct client_args_info conf;
59 /** the config file for client options */
61 /** the RSA private key */
63 /** paraslash user name */
65 /** session key for receiving data */
67 /** session key for sending data */
69 /** the client task structure */
71 /** non-zero if task is unregistered */
73 /** the buffer used for handshake and receiving */
74 char buf[CLIENT_BUFSIZE];
75 /** number of bytes loaded in \p buf */
77 /** non-zero if the pre_select hook added \p fd to the read fd set */
79 /** non-zero if the pre_select hook added \p fd to the write fd set */
81 /** the decrypted challenge */
82 long unsigned challenge_nr;
83 /** pointer to the data to be sent to para_server */
85 /** number of bytes loaded in \p inbuf */
87 /** non-zero if input task encountered an eof or an errro condition */
91 int client_open(struct private_client_data *pcd);
92 void client_close(struct private_client_data *pcd);
93 int client_parse_config(int argc, char *argv[],
94 struct private_client_data **pcd_ptr);
95 void client_pre_select(struct sched *s, struct task *t);
96 void client_post_select(struct sched *s, struct task *t);