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