]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/cvs/src/server.h
Import cvs-1.9.23 as at 19980123. There are a number of really nice
[FreeBSD/FreeBSD.git] / contrib / cvs / src / server.h
1 /* Interface between the server and the rest of CVS.  */
2
3 /* Miscellaneous stuff which isn't actually particularly server-specific.  */
4 #ifndef STDIN_FILENO
5 #define STDIN_FILENO 0
6 #define STDOUT_FILENO 1
7 #define STDERR_FILENO 2
8 #endif
9 \f
10 #ifdef SERVER_SUPPORT
11
12 /*
13  * Nonzero if we are using the server.  Used by various places to call
14  * server-specific functions.
15  */
16 extern int server_active;
17 extern int server_expanding;
18
19 /* Server functions exported to the rest of CVS.  */
20
21 /* Run the server.  */
22 extern int server PROTO((int argc, char **argv));
23
24 /* See server.c for description.  */
25 extern void server_pathname_check PROTO ((char *));
26
27 /* We have a new Entries line for a file.  TAG or DATE can be NULL.  */
28 extern void server_register
29     PROTO((char *name, char *version, char *timestamp,
30              char *options, char *tag, char *date, char *conflict));
31
32 /* Set the modification time of the next file sent.  This must be
33    followed by a call to server_updated on the same file.  */
34 extern void server_modtime PROTO ((struct file_info *finfo,
35                                    Vers_TS *vers_ts));
36
37 /*
38  * We want to nuke the Entries line for a file, and (unless
39  * server_scratch_entry_only is subsequently called) the file itself.
40  */
41 extern void server_scratch PROTO((char *name));
42
43 /*
44  * The file which just had server_scratch called on it needs to have only
45  * the Entries line removed, not the file itself.
46  */
47 extern void server_scratch_entry_only PROTO((void));
48
49 /*
50  * We just successfully checked in FILE (which is just the bare
51  * filename, with no directory).  REPOSITORY is the directory for the
52  * repository.
53  */
54 extern void server_checked_in
55     PROTO((char *file, char *update_dir, char *repository));
56
57 extern void server_copy_file
58     PROTO((char *file, char *update_dir, char *repository, char *newfile));
59
60 /* Send the appropriate responses for a file described by FILE,
61    UPDATE_DIR, REPOSITORY, and VERS.  FILE_INFO is the result of
62    statting the file, or NULL if it hasn't been statted yet.  This is
63    called after server_register or server_scratch.  In the latter case
64    the file is to be removed (and vers can be NULL).  In the former
65    case, vers must be non-NULL, and UPDATED indicates whether the file
66    is now up to date (SERVER_UPDATED, yes, SERVER_MERGED, no,
67    SERVER_PATCHED, yes, but file is a diff from user version to
68    repository version, SERVER_RCS_DIFF, yes, like SERVER_PATCHED but
69    with an RCS style diff).  */
70 enum server_updated_arg4
71 {
72     SERVER_UPDATED,
73     SERVER_MERGED,
74     SERVER_PATCHED,
75     SERVER_RCS_DIFF
76 };
77 extern void server_updated
78     PROTO((struct file_info *finfo, Vers_TS *vers,
79            enum server_updated_arg4 updated, struct stat *,
80            unsigned char *checksum));
81
82 /* Whether we should send RCS format patches.  */
83 extern int server_use_rcs_diff PROTO((void));
84
85 /* Set the Entries.Static flag.  */
86 extern void server_set_entstat PROTO((char *update_dir, char *repository));
87 /* Clear it.  */
88 extern void server_clear_entstat PROTO((char *update_dir, char *repository));
89
90 /* Set or clear a per-directory sticky tag or date.  */
91 extern void server_set_sticky PROTO((char *update_dir, char *repository,
92                                      char *tag, char *date, int nonbranch));
93 /* Send Template response.  */
94 extern void server_template PROTO ((char *, char *));
95
96 extern void server_update_entries
97     PROTO((char *file, char *update_dir, char *repository,
98            enum server_updated_arg4 updated));
99
100 /* Pointer to a malloc'd string which is the directory which
101    the server should prepend to the pathnames which it sends
102    to the client.  */
103 extern char *server_dir;
104
105 enum progs {PROG_CHECKIN, PROG_UPDATE};
106 extern void server_prog PROTO((char *, char *, enum progs));
107 extern void server_cleanup PROTO((int sig));
108
109 #ifdef SERVER_FLOWCONTROL
110 /* Pause if it's convenient to avoid memory blowout */
111 extern void server_pause_check PROTO((void));
112 #endif /* SERVER_FLOWCONTROL */
113
114 #ifdef AUTH_SERVER_SUPPORT
115 extern char *CVS_Username;
116 extern int system_auth;
117 #endif /* AUTH_SERVER_SUPPORT */
118
119 #endif /* SERVER_SUPPORT */
120 \f
121 /* Stuff shared with the client.  */
122 struct request
123 {
124   /* Name of the request.  */
125   char *name;
126
127 #ifdef SERVER_SUPPORT
128   /*
129    * Function to carry out the request.  ARGS is the text of the command
130    * after name and, if present, a single space, have been stripped off.
131    */
132   void (*func) PROTO((char *args));
133 #endif
134
135   /* Stuff for use by the client.  */
136   enum {
137       /*
138        * Failure to implement this request can imply a fatal
139        * error.  This should be set only for commands which were in the
140        * original version of the protocol; it should not be set for new
141        * commands.
142        */
143       rq_essential,
144
145       /* Some servers might lack this request.  */
146       rq_optional,
147
148       /*
149        * Set by the client to one of the following based on what this
150        * server actually supports.
151        */
152       rq_supported,
153       rq_not_supported,
154
155       /*
156        * If the server supports this request, and we do too, tell the
157        * server by making the request.
158        */
159       rq_enableme
160       } status;
161 };
162
163 /* Table of requests ending with an entry with a NULL name.  */
164 extern struct request requests[];
165
166 /* Gzip library, see zlib.c.  */
167 extern void gunzip_and_write PROTO ((int, char *, unsigned char *, size_t));
168 extern void read_and_gzip PROTO ((int, char *, unsigned char **, size_t *,
169                                   size_t *, int));