server.h revision 17721
18097Sjkh/* Interface between the server and the rest of CVS. */ 28097Sjkh 38097Sjkh/* Miscellaneous stuff which isn't actually particularly server-specific. */ 48097Sjkh#ifndef STDIN_FILENO 58097Sjkh#define STDIN_FILENO 0 68097Sjkh#define STDOUT_FILENO 1 750479Speter#define STDERR_FILENO 2 88097Sjkh#endif 98097Sjkh 108097Sjkh#ifdef SERVER_SUPPORT 118097Sjkh 128097Sjkh/* 13155347Sceri * Nonzero if we are using the server. Used by various places to call 148629Sjkh * server-specific functions. 158629Sjkh */ 168629Sjkhextern int server_active; 178097Sjkhextern int server_expanding; 188097Sjkh 198097Sjkh/* Server functions exported to the rest of CVS. */ 208097Sjkh 2150917Sjkh/* Run the server. */ 22123686Sjhbextern int server PROTO((int argc, char **argv)); 238097Sjkh 2466834Sphk/* We have a new Entries line for a file. TAG or DATE can be NULL. */ 258097Sjkhextern void server_register 268097Sjkh PROTO((char *name, char *version, char *timestamp, 27123686Sjhb char *options, char *tag, char *date, char *conflict)); 2842392Sjkh 2958547Sjhb/* 30123686Sjhb * We want to nuke the Entries line for a file, and (unless 318097Sjkh * server_scratch_entry_only is subsequently called) the file itself. 3216975Sjkh */ 3316975Sjkhextern void server_scratch PROTO((char *name)); 3442392Sjkh 3542392Sjkh/* 3616975Sjkh * The file which just had server_scratch called on it needs to have only 3721010Sjkh * the Entries line removed, not the file itself. 3821010Sjkh */ 398302Sjkhextern void server_scratch_entry_only PROTO((void)); 408302Sjkh 418302Sjkh/* 428302Sjkh * We just successfully checked in FILE (which is just the bare 438302Sjkh * filename, with no directory). REPOSITORY is the directory for the 4467862Seivind * repository. 4567862Seivind */ 4667862Seivindextern void server_checked_in 4783440Smurray PROTO((char *file, char *update_dir, char *repository)); 4867862Seivind 4967862Seivindextern void server_copy_file 5067862Seivind PROTO((char *file, char *update_dir, char *repository, char *newfile)); 5167862Seivind 5267862Seivind/* 5383440Smurray * We just successfully updated FILE (bare filename, no directory). 5483440Smurray * REPOSITORY is the directory for the repository. This is called 5583440Smurray * after server_register or server_scratch, in the latter case the 5667862Seivind * file is to be removed. UPDATED indicates whether the file is now 5767862Seivind * up to date (SERVER_UPDATED, yes, SERVER_MERGED, no, SERVER_PATCHED, 5867862Seivind * yes, but file is a diff from user version to repository version). 5967862Seivind */ 6067862Seivindenum server_updated_arg4 {SERVER_UPDATED, SERVER_MERGED, SERVER_PATCHED}; 6184152Smurrayextern void server_updated 62211417Sbrucec PROTO((char *file, char *update_dir, char *repository, 6384152Smurray enum server_updated_arg4 updated, struct stat *, 6484152Smurray unsigned char *checksum)); 6583820Smurray 6684152Smurray/* Set the Entries.Static flag. */ 6784152Smurrayextern void server_set_entstat PROTO((char *update_dir, char *repository)); 6884152Smurray/* Clear it. */ 69211417Sbrucecextern void server_clear_entstat PROTO((char *update_dir, char *repository)); 70211417Sbrucec 71211417Sbrucec/* Set or clear a per-directory sticky tag or date. */ 72211417Sbrucecextern void server_set_sticky PROTO((char *update_dir, char *repository, 73211417Sbrucec char *tag, 74211417Sbrucec char *date)); 75211417Sbrucec/* Send Template response. */ 7683820Smurrayextern void server_template PROTO ((char *, char *)); 7783440Smurray 7883440Smurrayextern void server_update_entries 7967862Seivind PROTO((char *file, char *update_dir, char *repository, 8067862Seivind enum server_updated_arg4 updated)); 8167862Seivind 8283440Smurrayenum progs {PROG_CHECKIN, PROG_UPDATE}; 8383440Smurrayextern void server_prog PROTO((char *, char *, enum progs)); 8483440Smurrayextern void server_cleanup PROTO((int sig)); 8567862Seivind 8667862Seivind#ifdef SERVER_FLOWCONTROL 8767862Seivind/* Pause if it's convenient to avoid memory blowout */ 888097Sjkhextern void server_pause_check PROTO((void)); 898097Sjkh#endif /* SERVER_FLOWCONTROL */ 908097Sjkh 9118619Sjkh#endif /* SERVER_SUPPORT */ 9218619Sjkh 9367862Seivind/* Stuff shared with the client. */ 9467862Seivindstruct request 9567862Seivind{ 9667862Seivind /* Name of the request. */ 9767862Seivind char *name; 9867862Seivind 9967862Seivind#ifdef SERVER_SUPPORT 10067862Seivind /* 10167862Seivind * Function to carry out the request. ARGS is the text of the command 10267862Seivind * after name and, if present, a single space, have been stripped off. 1038097Sjkh */ 1048097Sjkh void (*func) PROTO((char *args)); 105156119Sjhb#endif 10683142Smurray 10783142Smurray /* Stuff for use by the client. */ 10883142Smurray enum { 10983142Smurray /* 11083142Smurray * Failure to implement this request can imply a fatal 11183142Smurray * error. This should be set only for commands which were in the 11283142Smurray * original version of the protocol; it should not be set for new 11383440Smurray * commands. 11483440Smurray */ 11583142Smurray rq_essential, 11683142Smurray 11783142Smurray /* Some servers might lack this request. */ 118156119Sjhb rq_optional, 11983142Smurray 12016975Sjkh /* 12116975Sjkh * Set by the client to one of the following based on what this 12216975Sjkh * server actually supports. 12316975Sjkh */ 124174473Sobrien rq_supported, 12539814Sjkh rq_not_supported, 12642392Sjkh 12742392Sjkh /* 12842392Sjkh * If the server supports this request, and we do too, tell the 12942392Sjkh * server by making the request. 13042392Sjkh */ 13142392Sjkh rq_enableme 13242392Sjkh } status; 13342392Sjkh}; 13442392Sjkh 135174473Sobrien/* Table of requests ending with an entry with a NULL name. */ 136174473Sobrienextern struct request requests[]; 13716975Sjkh 13816975Sjkhextern int use_unchanged; 13916975Sjkh