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