xref: /openbsd-src/gnu/usr.bin/cvs/src/server.h (revision 50bf276cd1c7e20f1eda64a5e63e0fae39e12a95)
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 
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 /* We have a new Entries line for a file.  TAG or DATE can be NULL.  */
25 extern void server_register
26     PROTO((char *name, char *version, char *timestamp,
27 	     char *options, char *tag, char *date, char *conflict));
28 
29 /*
30  * We want to nuke the Entries line for a file, and (unless
31  * server_scratch_entry_only is subsequently called) the file itself.
32  */
33 extern void server_scratch PROTO((char *name));
34 
35 /*
36  * The file which just had server_scratch called on it needs to have only
37  * the Entries line removed, not the file itself.
38  */
39 extern void server_scratch_entry_only PROTO((void));
40 
41 /*
42  * We just successfully checked in FILE (which is just the bare
43  * filename, with no directory).  REPOSITORY is the directory for the
44  * repository.
45  */
46 extern void server_checked_in
47     PROTO((char *file, char *update_dir, char *repository));
48 
49 extern void server_copy_file
50     PROTO((char *file, char *update_dir, char *repository, char *newfile));
51 
52 /* Send the appropriate responses for a file described by FILE,
53    UPDATE_DIR, REPOSITORY, and VERS.  FILE_INFO is the result of
54    statting the file, or NULL if it hasn't been statted yet.  This is
55    called after server_register or server_scratch.  In the latter case
56    the file is to be removed (and vers can be NULL).  In the former
57    case, vers must be non-NULL, and UPDATED indicates whether the file
58    is now up to date (SERVER_UPDATED, yes, SERVER_MERGED, no,
59    SERVER_PATCHED, yes, but file is a diff from user version to
60    repository version).  */
61 enum server_updated_arg4 {SERVER_UPDATED, SERVER_MERGED, SERVER_PATCHED};
62 extern void server_updated
63     PROTO((struct file_info *finfo, Vers_TS *vers,
64 	   enum server_updated_arg4 updated, struct stat *,
65 	   unsigned char *checksum));
66 
67 /* Set the Entries.Static flag.  */
68 extern void server_set_entstat PROTO((char *update_dir, char *repository));
69 /* Clear it.  */
70 extern void server_clear_entstat PROTO((char *update_dir, char *repository));
71 
72 /* Set or clear a per-directory sticky tag or date.  */
73 extern void server_set_sticky PROTO((char *update_dir, char *repository,
74 				       char *tag,
75 				       char *date));
76 /* Send Template response.  */
77 extern void server_template PROTO ((char *, char *));
78 
79 extern void server_update_entries
80     PROTO((char *file, char *update_dir, char *repository,
81 	   enum server_updated_arg4 updated));
82 
83 enum progs {PROG_CHECKIN, PROG_UPDATE};
84 extern void server_prog PROTO((char *, char *, enum progs));
85 extern void server_cleanup PROTO((int sig));
86 
87 #ifdef SERVER_FLOWCONTROL
88 /* Pause if it's convenient to avoid memory blowout */
89 extern void server_pause_check PROTO((void));
90 #endif /* SERVER_FLOWCONTROL */
91 
92 #endif /* SERVER_SUPPORT */
93 
94 /* Stuff shared with the client.  */
95 struct request
96 {
97   /* Name of the request.  */
98   char *name;
99 
100 #ifdef SERVER_SUPPORT
101   /*
102    * Function to carry out the request.  ARGS is the text of the command
103    * after name and, if present, a single space, have been stripped off.
104    */
105   void (*func) PROTO((char *args));
106 #endif
107 
108   /* Stuff for use by the client.  */
109   enum {
110       /*
111        * Failure to implement this request can imply a fatal
112        * error.  This should be set only for commands which were in the
113        * original version of the protocol; it should not be set for new
114        * commands.
115        */
116       rq_essential,
117 
118       /* Some servers might lack this request.  */
119       rq_optional,
120 
121       /*
122        * Set by the client to one of the following based on what this
123        * server actually supports.
124        */
125       rq_supported,
126       rq_not_supported,
127 
128       /*
129        * If the server supports this request, and we do too, tell the
130        * server by making the request.
131        */
132       rq_enableme
133       } status;
134 };
135 
136 /* Table of requests ending with an entry with a NULL name.  */
137 extern struct request requests[];
138 
139 extern int use_unchanged;
140