xref: /openbsd-src/gnu/usr.bin/cvs/src/server.h (revision 1e72d8d26fae84dfb4bcd4cecabd10b989ec3f29)
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 /*
53  * We just successfully updated FILE (bare filename, no directory).
54  * REPOSITORY is the directory for the repository.  This is called
55  * after server_register or server_scratch, in the latter case the
56  * file is to be removed.  UPDATED indicates whether the file is now
57  * up to date (SERVER_UPDATED, yes, SERVER_MERGED, no, SERVER_PATCHED,
58  * yes, but file is a diff from user version to repository version).
59  */
60 enum server_updated_arg4 {SERVER_UPDATED, SERVER_MERGED, SERVER_PATCHED};
61 extern void server_updated
62     PROTO((char *file, char *update_dir, char *repository,
63 	     enum server_updated_arg4 updated, struct stat *,
64 	     unsigned char *checksum));
65 
66 /* Set the Entries.Static flag.  */
67 extern void server_set_entstat PROTO((char *update_dir, char *repository));
68 /* Clear it.  */
69 extern void server_clear_entstat PROTO((char *update_dir, char *repository));
70 
71 /* Set or clear a per-directory sticky tag or date.  */
72 extern void server_set_sticky PROTO((char *update_dir, char *repository,
73 				       char *tag,
74 				       char *date));
75 
76 extern void server_update_entries
77     PROTO((char *file, char *update_dir, char *repository,
78 	     enum server_updated_arg4 updated));
79 
80 enum progs {PROG_CHECKIN, PROG_UPDATE};
81 extern void server_prog PROTO((char *, char *, enum progs));
82 
83 #endif /* SERVER_SUPPORT */
84 
85 /* Stuff shared with the client.  */
86 struct request
87 {
88   /* Name of the request.  */
89   char *name;
90 
91 #ifdef SERVER_SUPPORT
92   /*
93    * Function to carry out the request.  ARGS is the text of the command
94    * after name and, if present, a single space, have been stripped off.
95    */
96   void (*func) PROTO((char *args));
97 #endif
98 
99   /* Stuff for use by the client.  */
100   enum {
101       /*
102        * Failure to implement this request can imply a fatal
103        * error.  This should be set only for commands which were in the
104        * original version of the protocol; it should not be set for new
105        * commands.
106        */
107       rq_essential,
108 
109       /* Some servers might lack this request.  */
110       rq_optional,
111 
112       /*
113        * Set by the client to one of the following based on what this
114        * server actually supports.
115        */
116       rq_supported,
117       rq_not_supported,
118 
119       /*
120        * If the server supports this request, and we do too, tell the
121        * server by making the request.
122        */
123       rq_enableme
124       } status;
125 };
126 
127 /* Table of requests ending with an entry with a NULL name.  */
128 extern struct request requests[];
129 
130 extern int use_unchanged;
131