/contrib/cvs/src/server.h

https://bitbucket.org/freebsd/freebsd-head/ · C++ Header · 202 lines · 86 code · 35 blank · 81 comment · 2 complexity · 62ebed1d808fe5365c101bb942fc69db MD5 · raw file

  1. /*
  2. * Copyright (C) 1986-2005 The Free Software Foundation, Inc.
  3. *
  4. * Portions Copyright (C) 1998-2005 Derek Price, Ximbiot <http://ximbiot.com>,
  5. * and others.
  6. *
  7. * You may distribute under the terms of the GNU General Public License as
  8. * specified in the README file that comes with the CVS kit.
  9. *
  10. *
  11. *
  12. * This file contains the interface between the server and the rest of CVS.
  13. */
  14. /* Miscellaneous stuff which isn't actually particularly server-specific. */
  15. #ifndef STDIN_FILENO
  16. #define STDIN_FILENO 0
  17. #define STDOUT_FILENO 1
  18. #define STDERR_FILENO 2
  19. #endif
  20. /*
  21. * Nonzero if we are using the server. Used by various places to call
  22. * server-specific functions.
  23. */
  24. extern int server_active;
  25. /*
  26. * Expand to `S', ` ', or the empty string. Used in `%s-> ...' trace printfs.
  27. */
  28. #ifdef SERVER_SUPPORT
  29. # define CLIENT_SERVER_STR ((server_active) ? "S" : " ")
  30. #else
  31. # define CLIENT_SERVER_STR ""
  32. #endif
  33. #ifdef SERVER_SUPPORT
  34. /* Server functions exported to the rest of CVS. */
  35. /* Run the server. */
  36. extern int server PROTO((int argc, char **argv));
  37. /* kserver user authentication. */
  38. # ifdef HAVE_KERBEROS
  39. extern void kserver_authenticate_connection PROTO ((void));
  40. # endif
  41. /* pserver user authentication. */
  42. # if defined (AUTH_SERVER_SUPPORT) || defined (HAVE_GSSAPI)
  43. extern void pserver_authenticate_connection PROTO ((void));
  44. # endif
  45. /* See server.c for description. */
  46. extern void server_pathname_check PROTO ((char *));
  47. /* We have a new Entries line for a file. TAG or DATE can be NULL. */
  48. extern void server_register
  49. PROTO((const char *name, const char *version, const char *timestamp,
  50. const char *options, const char *tag, const char *date,
  51. const char *conflict));
  52. /* Set the modification time of the next file sent. This must be
  53. followed by a call to server_updated on the same file. */
  54. extern void server_modtime PROTO ((struct file_info *finfo,
  55. Vers_TS *vers_ts));
  56. /*
  57. * We want to nuke the Entries line for a file, and (unless
  58. * server_scratch_entry_only is subsequently called) the file itself.
  59. */
  60. extern void server_scratch PROTO((const char *name));
  61. /*
  62. * The file which just had server_scratch called on it needs to have only
  63. * the Entries line removed, not the file itself.
  64. */
  65. extern void server_scratch_entry_only PROTO((void));
  66. /*
  67. * We just successfully checked in FILE (which is just the bare
  68. * filename, with no directory). REPOSITORY is the directory for the
  69. * repository.
  70. */
  71. extern void server_checked_in
  72. PROTO((const char *file, const char *update_dir, const char *repository));
  73. extern void server_copy_file
  74. PROTO((const char *file, const char *update_dir, const char *repository,
  75. const char *newfile));
  76. /* Send the appropriate responses for a file described by FINFO and
  77. VERS. This is called after server_register or server_scratch. In
  78. the latter case the file is to be removed (and VERS can be NULL).
  79. In the former case, VERS must be non-NULL, and UPDATED indicates
  80. whether the file is now up to date (SERVER_UPDATED, yes,
  81. SERVER_MERGED, no, SERVER_PATCHED, yes, but file is a diff from
  82. user version to repository version, SERVER_RCS_DIFF, yes, like
  83. SERVER_PATCHED but with an RCS style diff). MODE is the mode the
  84. file should get, or (mode_t) -1 if this should be obtained from the
  85. file itself. CHECKSUM is the MD5 checksum of the file, or NULL if
  86. this need not be sent. If FILEBUF is not NULL, it holds the
  87. contents of the file, in which case the file itself may not exist.
  88. If FILEBUF is not NULL, server_updated will free it. */
  89. enum server_updated_arg4
  90. {
  91. SERVER_UPDATED,
  92. SERVER_MERGED,
  93. SERVER_PATCHED,
  94. SERVER_RCS_DIFF
  95. };
  96. #ifdef __STDC__
  97. struct buffer;
  98. #endif
  99. extern void server_updated
  100. PROTO((struct file_info *finfo, Vers_TS *vers,
  101. enum server_updated_arg4 updated, mode_t mode,
  102. unsigned char *checksum, struct buffer *filebuf));
  103. /* Whether we should send RCS format patches. */
  104. extern int server_use_rcs_diff PROTO((void));
  105. /* Set the Entries.Static flag. */
  106. extern void server_set_entstat PROTO((const char *update_dir,
  107. const char *repository));
  108. /* Clear it. */
  109. extern void server_clear_entstat PROTO((const char *update_dir,
  110. const char *repository));
  111. /* Set or clear a per-directory sticky tag or date. */
  112. extern void server_set_sticky PROTO((const char *update_dir,
  113. const char *repository, const char *tag,
  114. const char *date, int nonbranch));
  115. /* Send Template response. */
  116. extern void server_template PROTO ((const char *, const char *));
  117. extern void server_update_entries
  118. PROTO((const char *file, const char *update_dir, const char *repository,
  119. enum server_updated_arg4 updated));
  120. /* Pointer to a malloc'd string which is the directory which
  121. the server should prepend to the pathnames which it sends
  122. to the client. */
  123. extern char *server_dir;
  124. extern void server_cleanup PROTO((int sig));
  125. #ifdef SERVER_FLOWCONTROL
  126. /* Pause if it's convenient to avoid memory blowout */
  127. extern void server_pause_check PROTO((void));
  128. #endif /* SERVER_FLOWCONTROL */
  129. #ifdef AUTH_SERVER_SUPPORT
  130. extern char *CVS_Username;
  131. extern int system_auth;
  132. #endif /* AUTH_SERVER_SUPPORT */
  133. #endif /* SERVER_SUPPORT */
  134. /* Stuff shared with the client. */
  135. struct request
  136. {
  137. /* Name of the request. */
  138. char *name;
  139. #ifdef SERVER_SUPPORT
  140. /*
  141. * Function to carry out the request. ARGS is the text of the command
  142. * after name and, if present, a single space, have been stripped off.
  143. */
  144. void (*func) PROTO((char *args));
  145. #endif
  146. /* One or more of the RQ_* flags described below. */
  147. int flags;
  148. /* If set, failure to implement this request can imply a fatal
  149. error. This should be set only for commands which were in the
  150. original version of the protocol; it should not be set for new
  151. commands. */
  152. #define RQ_ESSENTIAL 1
  153. /* Set by the client if the server we are talking to supports it. */
  154. #define RQ_SUPPORTED 2
  155. /* If set, and client and server both support the request, the
  156. client should tell the server by making the request. */
  157. #define RQ_ENABLEME 4
  158. /* The server may accept this request before "Root". */
  159. #define RQ_ROOTLESS 8
  160. };
  161. /* Table of requests ending with an entry with a NULL name. */
  162. extern struct request requests[];
  163. /* Gzip library, see zlib.c. */
  164. extern int gunzip_and_write PROTO ((int, char *, unsigned char *, size_t));
  165. extern int read_and_gzip PROTO ((int, const char *, unsigned char **, size_t *,
  166. size_t *, int));