2 * Copyright (C) 1994-2008 The Free Software Foundation, Inc.
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, or (at your option)
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.
15 /* Interface between the client and the rest of CVS. */
17 /* Stuff shared with the server. */
18 extern char *mode_to_string PROTO((mode_t));
19 extern int change_mode PROTO((char *, char *, int));
21 extern int gzip_level;
22 extern int file_gzip_level;
24 #if defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT)
26 /* Whether the connection should be encrypted. */
27 extern int cvsencrypt;
29 /* Whether the connection should use per-packet authentication. */
30 extern int cvsauthenticate;
40 /* We can't declare the arguments without including krb.h, and I don't
41 want to do that in every file. */
42 extern struct buffer *krb_encrypt_buffer_initialize ();
44 # endif /* HAVE_KERBEROS */
48 /* Set this to turn on GSSAPI encryption. */
49 extern int cvs_gssapi_encrypt;
51 # endif /* HAVE_GSSAPI */
53 # endif /* ENCRYPTION */
57 /* We can't declare the arguments without including gssapi.h, and I
58 don't want to do that in every file. */
59 extern struct buffer *cvs_gssapi_wrap_buffer_initialize ();
61 # endif /* HAVE_GSSAPI */
63 #endif /* defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT) */
67 * Flag variable for seeing whether the server has been started yet.
68 * As of this writing, only edit.c:cvs_notify_check() uses it.
70 extern int server_started;
72 /* Is the -P option to checkout or update specified? */
73 extern int client_prune_dirs;
75 # ifdef AUTH_CLIENT_SUPPORT
76 extern int use_authenticating_server;
77 # endif /* AUTH_CLIENT_SUPPORT */
78 # if defined (AUTH_CLIENT_SUPPORT) || defined (HAVE_GSSAPI)
79 void connect_to_pserver PROTO ((cvsroot_t *,
83 # ifndef CVS_AUTH_PORT
84 # define CVS_AUTH_PORT 2401
85 # endif /* CVS_AUTH_PORT */
86 # endif /* (AUTH_CLIENT_SUPPORT) || defined (HAVE_GSSAPI) */
90 # define CVS_PORT 1999
92 # endif /* HAVE_KERBEROS */
94 /* Talking to the server. */
95 void send_to_server PROTO((const char *str, size_t len));
96 void read_from_server PROTO((char *buf, size_t len));
98 /* Internal functions that handle client communication to server, etc. */
99 int supported_request PROTO ((char *));
100 void option_with_arg PROTO((char *option, char *arg));
102 /* Get the responses and then close the connection. */
103 extern int get_responses_and_close PROTO((void));
105 extern int get_server_responses PROTO((void));
107 /* Start up the connection to the server on the other end. */
109 start_server PROTO((void));
111 /* Send the names of all the argument files to the server. */
113 send_file_names PROTO((int argc, char **argv, unsigned int flags));
115 /* Flags for send_file_names. */
116 /* Expand wild cards? */
117 # define SEND_EXPAND_WILD 1
120 * Send Repository, Modified and Entry. argc and argv contain only
121 * the files to operate on (or empty for everything), not options.
122 * local is nonzero if we should not recurse (-l option).
125 send_files PROTO((int argc, char **argv, int local, int aflag,
126 unsigned int flags));
128 /* Flags for send_files. */
129 # define SEND_BUILD_DIRS 1
130 # define SEND_FORCE 2
131 # define SEND_NO_CONTENTS 4
132 # define BACKUP_MODIFIED_FILES 8
134 /* Send an argument to the remote server. */
136 send_arg PROTO((const char *string));
138 /* Send a string of single-char options to the remote server, one by one. */
139 void send_options PROTO ((int argc, char * const *argv));
141 extern void send_a_repository PROTO ((const char *, const char *,
144 #endif /* CLIENT_SUPPORT */
147 * This structure is used to catalog the responses the client is
148 * prepared to see from the server.
153 /* Name of the response. */
156 #ifdef CLIENT_SUPPORT
158 * Function to carry out the response. ARGS is the text of the
159 * command after name and, if present, a single space, have been
160 * stripped off. The function can scribble into ARGS if it wants.
161 * Note that although LEN is given, ARGS is also guaranteed to be
164 void (*func) PROTO((char *args, int len));
167 * ok and error are special; they indicate we are at the end of the
168 * responses, and error indicates we should exit with nonzero
171 enum {response_type_normal, response_type_ok, response_type_error} type;
174 /* Used by the server to indicate whether response is supported by
175 the client, as set by the Valid-responses request. */
178 * Failure to implement this response can imply a fatal
179 * error. This should be set only for responses which were in the
180 * original version of the protocol; it should not be set for new
185 /* Some clients might not understand this response. */
189 * Set by the server to one of the following based on what this
190 * client actually supports.
197 /* Table of responses ending in an entry with a NULL name. */
199 extern struct response responses[];
201 #ifdef CLIENT_SUPPORT
203 extern void client_senddate PROTO((const char *date));
204 extern void client_expand_modules PROTO((int argc, char **argv, int local));
205 extern void client_send_expansions PROTO((int local, char *where,
207 extern void client_nonexpanded_setup PROTO((void));
209 extern void send_init_command PROTO ((void));
211 extern char **failed_patches;
212 extern int failed_patches_count;
213 extern char *toplevel_wd;
214 extern void client_import_setup PROTO((char *repository));
215 extern int client_process_import_file
216 PROTO((char *message, char *vfile, char *vtag,
217 int targc, char *targv[], char *repository, int all_files_binary,
219 extern void client_import_done PROTO((void));
220 extern void client_notify PROTO((const char *, const char *, const char *, int,
222 #endif /* CLIENT_SUPPORT */