client.h revision 1.1.1.11
1/* Interface between the client and the rest of CVS. */ 2 3/* Stuff shared with the server. */ 4extern char *mode_to_string PROTO((mode_t)); 5extern int change_mode PROTO((char *, char *, int)); 6 7extern int gzip_level; 8extern int file_gzip_level; 9extern int filter_through_gzip PROTO((int, int, int, pid_t *)); 10extern int filter_through_gunzip PROTO((int, int, pid_t *)); 11 12#if defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT) 13 14/* Whether the connection should be encrypted. */ 15extern int cvsencrypt; 16 17/* Whether the connection should use per-packet authentication. */ 18extern int cvsauthenticate; 19 20#ifdef ENCRYPTION 21 22#ifdef HAVE_KERBEROS 23 24/* We can't declare the arguments without including krb.h, and I don't 25 want to do that in every file. */ 26extern struct buffer *krb_encrypt_buffer_initialize (); 27 28#endif /* HAVE_KERBEROS */ 29 30#ifdef HAVE_GSSAPI 31 32/* Set this to turn on GSSAPI encryption. */ 33extern int cvs_gssapi_encrypt; 34 35#endif /* HAVE_GSSAPI */ 36 37#endif /* ENCRYPTION */ 38 39#ifdef HAVE_GSSAPI 40 41/* We can't declare the arguments without including gssapi.h, and I 42 don't want to do that in every file. */ 43extern struct buffer *cvs_gssapi_wrap_buffer_initialize (); 44 45#endif /* HAVE_GSSAPI */ 46 47#endif /* defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT) */ 48 49#ifdef CLIENT_SUPPORT 50/* 51 * Flag variable for seeing whether the server has been started yet. 52 * As of this writing, only edit.c:notify_check() uses it. 53 */ 54extern int server_started; 55 56/* Is the -P option to checkout or update specified? */ 57extern int client_prune_dirs; 58 59#ifdef AUTH_CLIENT_SUPPORT 60extern int use_authenticating_server; 61void connect_to_pserver PROTO ((int *tofdp, int* fromfdp, int verify_only, 62 int do_gssapi)); 63# ifndef CVS_AUTH_PORT 64# define CVS_AUTH_PORT 2401 65# endif /* CVS_AUTH_PORT */ 66#endif /* AUTH_CLIENT_SUPPORT */ 67 68#if defined (AUTH_SERVER_SUPPORT) || (defined (SERVER_SUPPORT) && defined (HAVE_GSSAPI)) 69extern void pserver_authenticate_connection PROTO ((void)); 70#endif 71 72#if defined (SERVER_SUPPORT) && defined (HAVE_KERBEROS) 73extern void kserver_authenticate_connection PROTO ((void)); 74#endif 75 76/* Talking to the server. */ 77void send_to_server PROTO((char *str, size_t len)); 78void read_from_server PROTO((char *buf, size_t len)); 79 80/* Internal functions that handle client communication to server, etc. */ 81int supported_request PROTO ((char *)); 82void option_with_arg PROTO((char *option, char *arg)); 83 84/* Get the responses and then close the connection. */ 85extern int get_responses_and_close PROTO((void)); 86 87extern int get_server_responses PROTO((void)); 88 89/* Start up the connection to the server on the other end. */ 90void 91start_server PROTO((void)); 92 93/* Send the names of all the argument files to the server. */ 94void 95send_file_names PROTO((int argc, char **argv, unsigned int flags)); 96 97/* Flags for send_file_names. */ 98/* Expand wild cards? */ 99#define SEND_EXPAND_WILD 1 100 101/* 102 * Send Repository, Modified and Entry. argc and argv contain only 103 * the files to operate on (or empty for everything), not options. 104 * local is nonzero if we should not recurse (-l option). 105 */ 106void 107send_files PROTO((int argc, char **argv, int local, int aflag, 108 unsigned int flags)); 109 110/* Flags for send_files. */ 111#define SEND_BUILD_DIRS 1 112#define SEND_FORCE 2 113#define SEND_NO_CONTENTS 4 114 115/* Send an argument to the remote server. */ 116void 117send_arg PROTO((char *string)); 118 119/* Send a string of single-char options to the remote server, one by one. */ 120void 121send_option_string PROTO((char *string)); 122 123extern void send_a_repository PROTO ((char *, char *, char *)); 124 125#endif /* CLIENT_SUPPORT */ 126 127/* 128 * This structure is used to catalog the responses the client is 129 * prepared to see from the server. 130 */ 131 132struct response 133{ 134 /* Name of the response. */ 135 char *name; 136 137#ifdef CLIENT_SUPPORT 138 /* 139 * Function to carry out the response. ARGS is the text of the 140 * command after name and, if present, a single space, have been 141 * stripped off. The function can scribble into ARGS if it wants. 142 * Note that although LEN is given, ARGS is also guaranteed to be 143 * '\0' terminated. 144 */ 145 void (*func) PROTO((char *args, int len)); 146 147 /* 148 * ok and error are special; they indicate we are at the end of the 149 * responses, and error indicates we should exit with nonzero 150 * exitstatus. 151 */ 152 enum {response_type_normal, response_type_ok, response_type_error} type; 153#endif 154 155 /* Used by the server to indicate whether response is supported by 156 the client, as set by the Valid-responses request. */ 157 enum { 158 /* 159 * Failure to implement this response can imply a fatal 160 * error. This should be set only for responses which were in the 161 * original version of the protocol; it should not be set for new 162 * responses. 163 */ 164 rs_essential, 165 166 /* Some clients might not understand this response. */ 167 rs_optional, 168 169 /* 170 * Set by the server to one of the following based on what this 171 * client actually supports. 172 */ 173 rs_supported, 174 rs_not_supported 175 } status; 176}; 177 178/* Table of responses ending in an entry with a NULL name. */ 179 180extern struct response responses[]; 181 182#ifdef CLIENT_SUPPORT 183 184extern void client_senddate PROTO((const char *date)); 185extern void client_expand_modules PROTO((int argc, char **argv, int local)); 186extern void client_send_expansions PROTO((int local, char *where, 187 int build_dirs)); 188extern void client_nonexpanded_setup PROTO((void)); 189 190extern void send_init_command PROTO ((void)); 191 192extern char **failed_patches; 193extern int failed_patches_count; 194extern char *toplevel_wd; 195extern void client_import_setup PROTO((char *repository)); 196extern int client_process_import_file 197 PROTO((char *message, char *vfile, char *vtag, 198 int targc, char *targv[], char *repository, int all_files_binary)); 199extern void client_import_done PROTO((void)); 200extern void client_notify PROTO((char *, char *, char *, int, char *)); 201#endif /* CLIENT_SUPPORT */ 202