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