1 /* Interface between the server and the rest of CVS. */
3 /* Miscellaneous stuff which isn't actually particularly server-specific. */
6 #define STDOUT_FILENO 1
7 #define STDERR_FILENO 2
12 * Expand to `S', ` ', or the empty string. Used in `%s-> ...' trace printfs.
15 # define CLIENT_SERVER_STR ((server_active) ? "S" : " ")
17 # define CLIENT_SERVER_STR ""
23 * Nonzero if we are using the server. Used by various places to call
24 * server-specific functions.
26 extern int server_active;
27 extern int server_expanding;
29 /* Server functions exported to the rest of CVS. */
32 extern int server PROTO((int argc, char **argv));
34 /* See server.c for description. */
35 extern void server_pathname_check PROTO ((char *));
37 /* We have a new Entries line for a file. TAG or DATE can be NULL. */
38 extern void server_register
39 PROTO((char *name, char *version, char *timestamp,
40 char *options, char *tag, char *date, char *conflict));
42 /* Set the modification time of the next file sent. This must be
43 followed by a call to server_updated on the same file. */
44 extern void server_modtime PROTO ((struct file_info *finfo,
48 * We want to nuke the Entries line for a file, and (unless
49 * server_scratch_entry_only is subsequently called) the file itself.
51 extern void server_scratch PROTO((char *name));
54 * The file which just had server_scratch called on it needs to have only
55 * the Entries line removed, not the file itself.
57 extern void server_scratch_entry_only PROTO((void));
60 * We just successfully checked in FILE (which is just the bare
61 * filename, with no directory). REPOSITORY is the directory for the
64 extern void server_checked_in
65 PROTO((char *file, char *update_dir, char *repository));
67 extern void server_copy_file
68 PROTO((char *file, char *update_dir, char *repository, char *newfile));
70 /* Send the appropriate responses for a file described by FINFO and
71 VERS. This is called after server_register or server_scratch. In
72 the latter case the file is to be removed (and VERS can be NULL).
73 In the former case, VERS must be non-NULL, and UPDATED indicates
74 whether the file is now up to date (SERVER_UPDATED, yes,
75 SERVER_MERGED, no, SERVER_PATCHED, yes, but file is a diff from
76 user version to repository version, SERVER_RCS_DIFF, yes, like
77 SERVER_PATCHED but with an RCS style diff). MODE is the mode the
78 file should get, or (mode_t) -1 if this should be obtained from the
79 file itself. CHECKSUM is the MD5 checksum of the file, or NULL if
80 this need not be sent. If FILEBUF is not NULL, it holds the
81 contents of the file, in which case the file itself may not exist.
82 If FILEBUF is not NULL, server_updated will free it. */
83 enum server_updated_arg4
94 extern void server_updated
95 PROTO((struct file_info *finfo, Vers_TS *vers,
96 enum server_updated_arg4 updated, mode_t mode,
97 unsigned char *checksum, struct buffer *filebuf));
99 /* Whether we should send RCS format patches. */
100 extern int server_use_rcs_diff PROTO((void));
102 /* Set the Entries.Static flag. */
103 extern void server_set_entstat PROTO((char *update_dir, char *repository));
105 extern void server_clear_entstat PROTO((char *update_dir, char *repository));
107 /* Set or clear a per-directory sticky tag or date. */
108 extern void server_set_sticky PROTO((char *update_dir, char *repository,
109 char *tag, char *date, int nonbranch));
110 /* Send Template response. */
111 extern void server_template PROTO ((char *, char *));
113 extern void server_update_entries
114 PROTO((char *file, char *update_dir, char *repository,
115 enum server_updated_arg4 updated));
117 /* Pointer to a malloc'd string which is the directory which
118 the server should prepend to the pathnames which it sends
120 extern char *server_dir;
122 enum progs {PROG_CHECKIN, PROG_UPDATE};
123 extern void server_prog PROTO((char *, char *, enum progs));
124 extern void server_cleanup PROTO((int sig));
126 #ifdef SERVER_FLOWCONTROL
127 /* Pause if it's convenient to avoid memory blowout */
128 extern void server_pause_check PROTO((void));
129 #endif /* SERVER_FLOWCONTROL */
131 #ifdef AUTH_SERVER_SUPPORT
132 extern char *CVS_Username;
133 extern int system_auth;
134 #endif /* AUTH_SERVER_SUPPORT */
136 #endif /* SERVER_SUPPORT */
138 /* Stuff shared with the client. */
141 /* Name of the request. */
144 #ifdef SERVER_SUPPORT
146 * Function to carry out the request. ARGS is the text of the command
147 * after name and, if present, a single space, have been stripped off.
149 void (*func) PROTO((char *args));
152 /* One or more of the RQ_* flags described below. */
155 /* If set, failure to implement this request can imply a fatal
156 error. This should be set only for commands which were in the
157 original version of the protocol; it should not be set for new
159 #define RQ_ESSENTIAL 1
161 /* Set by the client if the server we are talking to supports it. */
162 #define RQ_SUPPORTED 2
164 /* If set, and client and server both support the request, the
165 client should tell the server by making the request. */
166 #define RQ_ENABLEME 4
168 /* The server may accept this request before "Root". */
169 #define RQ_ROOTLESS 8
172 /* Table of requests ending with an entry with a NULL name. */
173 extern struct request requests[];
175 /* Gzip library, see zlib.c. */
176 extern int gunzip_and_write PROTO ((int, char *, unsigned char *, size_t));
177 extern int read_and_gzip PROTO ((int, char *, unsigned char **, size_t *,