2 * Copyright (C) 1994-2005 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 char *mode_to_string (mode_t
);
19 int change_mode (const char *, const char *, int);
21 extern int gzip_level
;
22 extern int file_gzip_level
;
26 void make_bufs_from_fds (int, int, int, cvsroot_t
*,
27 struct buffer
**, struct buffer
**, int);
30 #if defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT)
32 /* Whether the connection should be encrypted. */
33 extern int cvsencrypt
;
35 /* Whether the connection should use per-packet authentication. */
36 extern int cvsauthenticate
;
42 /* We can't declare the arguments without including krb.h, and I don't
43 want to do that in every file. */
44 extern struct buffer
*krb_encrypt_buffer_initialize ();
46 # endif /* HAVE_KERBEROS */
48 # endif /* ENCRYPTION */
50 #endif /* defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT) */
54 * Flag variable for seeing whether the server has been started yet.
55 * As of this writing, only edit.c:notify_check() uses it.
57 extern int server_started
;
59 /* Is the -P option to checkout or update specified? */
60 extern int client_prune_dirs
;
62 # ifdef AUTH_CLIENT_SUPPORT
63 extern int use_authenticating_server
;
64 # endif /* AUTH_CLIENT_SUPPORT */
65 # if defined (AUTH_CLIENT_SUPPORT) || defined (HAVE_GSSAPI)
66 void connect_to_pserver (cvsroot_t
*, struct buffer
**, struct buffer
**,
68 # ifndef CVS_AUTH_PORT
69 # define CVS_AUTH_PORT 2401
70 # endif /* CVS_AUTH_PORT */
71 # ifndef CVS_PROXY_PORT
72 # define CVS_PROXY_PORT 8080
73 # endif /* CVS_AUTH_PORT */
74 # endif /* (AUTH_CLIENT_SUPPORT) || defined (HAVE_GSSAPI) */
78 # define CVS_PORT 1999
80 # endif /* HAVE_KERBEROS */
82 /* Talking to the server. */
83 void send_to_server (const char *str
, size_t len
);
84 void read_from_server (char *buf
, size_t len
);
86 /* Internal functions that handle client communication to server, etc. */
87 bool supported_request (const char *);
88 void option_with_arg (const char *option
, const char *arg
);
90 /* Get the responses and then close the connection. */
91 int get_responses_and_close (void);
93 int get_server_responses (void);
95 /* Start up the connection to the server on the other end. */
97 open_connection_to_server (cvsroot_t
*root
, struct buffer
**to_server_p
,
98 struct buffer
**from_server_p
);
102 /* Send the names of all the argument files to the server. */
104 send_file_names (int argc
, char **argv
, unsigned int flags
);
106 /* Flags for send_file_names. */
107 /* Expand wild cards? */
108 # define SEND_EXPAND_WILD 1
111 * Send Repository, Modified and Entry. argc and argv contain only
112 * the files to operate on (or empty for everything), not options.
113 * local is nonzero if we should not recurse (-l option).
116 send_files (int argc
, char **argv
, int local
, int aflag
,
119 /* Flags for send_files. */
120 # define SEND_BUILD_DIRS 1
121 # define SEND_FORCE 2
122 # define SEND_NO_CONTENTS 4
123 # define BACKUP_MODIFIED_FILES 8
125 /* Send an argument to the remote server. */
127 send_arg (const char *string
);
129 /* Send a string of single-char options to the remote server, one by one. */
131 send_options (int argc
, char * const *argv
);
133 void send_a_repository (const char *, const char *, const char *);
135 #endif /* CLIENT_SUPPORT */
138 * This structure is used to catalog the responses the client is
139 * prepared to see from the server.
144 /* Name of the response. */
147 #ifdef CLIENT_SUPPORT
149 * Function to carry out the response. ARGS is the text of the
150 * command after name and, if present, a single space, have been
151 * stripped off. The function can scribble into ARGS if it wants.
152 * Note that although LEN is given, ARGS is also guaranteed to be
155 void (*func
) (char *args
, size_t len
);
158 * ok and error are special; they indicate we are at the end of the
159 * responses, and error indicates we should exit with nonzero
162 enum {response_type_normal
, response_type_ok
, response_type_error
,
163 response_type_redirect
} type
;
166 /* Used by the server to indicate whether response is supported by
167 the client, as set by the Valid-responses request. */
170 * Failure to implement this response can imply a fatal
171 * error. This should be set only for responses which were in the
172 * original version of the protocol; it should not be set for new
177 /* Some clients might not understand this response. */
181 * Set by the server to one of the following based on what this
182 * client actually supports.
189 /* Table of responses ending in an entry with a NULL name. */
191 extern struct response responses
[];
193 #ifdef CLIENT_SUPPORT
195 void client_senddate (const char *date
);
196 void client_expand_modules (int argc
, char **argv
, int local
);
197 void client_send_expansions (int local
, char *where
, int build_dirs
);
198 void client_nonexpanded_setup (void);
200 void send_init_command (void);
202 extern char **failed_patches
;
203 extern int failed_patches_count
;
204 extern char *toplevel_wd
;
205 void client_import_setup (char *repository
);
206 int client_process_import_file
207 (char *message
, char *vfile
, char *vtag
, int targc
, char *targv
[],
208 char *repository
, int all_files_binary
, int modtime
);
209 void client_import_done (void);
210 void client_notify (const char *, const char *, const char *, int,
213 #if defined AUTH_CLIENT_SUPPORT || defined HAVE_KERBEROS || defined HAVE_GSSAPI
214 # include <sys/socket.h>
215 # include <netinet/in.h>
216 # include <arpa/inet.h>
218 struct hostent
*init_sockaddr (struct sockaddr_in
*, char *, unsigned int);
221 #endif /* CLIENT_SUPPORT */