/contrib/cvs/src/client.h

https://bitbucket.org/freebsd/freebsd-head/ · C++ Header · 222 lines · 102 code · 47 blank · 73 comment · 4 complexity · 5f241c68c3f0f047aae7dbcdb3a69cb0 MD5 · raw file

  1. /*
  2. * Copyright (C) 1994-2008 The Free Software Foundation, Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2, or (at your option)
  7. * any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. /* Interface between the client and the rest of CVS. */
  15. /* Stuff shared with the server. */
  16. extern char *mode_to_string PROTO((mode_t));
  17. extern int change_mode PROTO((char *, char *, int));
  18. extern int gzip_level;
  19. extern int file_gzip_level;
  20. #if defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT)
  21. /* Whether the connection should be encrypted. */
  22. extern int cvsencrypt;
  23. /* Whether the connection should use per-packet authentication. */
  24. extern int cvsauthenticate;
  25. #ifdef __STDC__
  26. struct buffer;
  27. #endif
  28. # ifdef ENCRYPTION
  29. # ifdef HAVE_KERBEROS
  30. /* We can't declare the arguments without including krb.h, and I don't
  31. want to do that in every file. */
  32. extern struct buffer *krb_encrypt_buffer_initialize ();
  33. # endif /* HAVE_KERBEROS */
  34. # ifdef HAVE_GSSAPI
  35. /* Set this to turn on GSSAPI encryption. */
  36. extern int cvs_gssapi_encrypt;
  37. # endif /* HAVE_GSSAPI */
  38. # endif /* ENCRYPTION */
  39. # ifdef HAVE_GSSAPI
  40. /* We can't declare the arguments without including gssapi.h, and I
  41. don't want to do that in every file. */
  42. extern struct buffer *cvs_gssapi_wrap_buffer_initialize ();
  43. # endif /* HAVE_GSSAPI */
  44. #endif /* defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT) */
  45. #ifdef CLIENT_SUPPORT
  46. /*
  47. * Flag variable for seeing whether the server has been started yet.
  48. * As of this writing, only edit.c:cvs_notify_check() uses it.
  49. */
  50. extern int server_started;
  51. /* Is the -P option to checkout or update specified? */
  52. extern int client_prune_dirs;
  53. # ifdef AUTH_CLIENT_SUPPORT
  54. extern int use_authenticating_server;
  55. # endif /* AUTH_CLIENT_SUPPORT */
  56. # if defined (AUTH_CLIENT_SUPPORT) || defined (HAVE_GSSAPI)
  57. void connect_to_pserver PROTO ((cvsroot_t *,
  58. struct buffer **,
  59. struct buffer **,
  60. int, int ));
  61. # ifndef CVS_AUTH_PORT
  62. # define CVS_AUTH_PORT 2401
  63. # endif /* CVS_AUTH_PORT */
  64. # endif /* (AUTH_CLIENT_SUPPORT) || defined (HAVE_GSSAPI) */
  65. # if HAVE_KERBEROS
  66. # ifndef CVS_PORT
  67. # define CVS_PORT 1999
  68. # endif
  69. # endif /* HAVE_KERBEROS */
  70. /* Talking to the server. */
  71. void send_to_server PROTO((const char *str, size_t len));
  72. void read_from_server PROTO((char *buf, size_t len));
  73. /* Internal functions that handle client communication to server, etc. */
  74. int supported_request PROTO ((char *));
  75. void option_with_arg PROTO((char *option, char *arg));
  76. /* Get the responses and then close the connection. */
  77. extern int get_responses_and_close PROTO((void));
  78. extern int get_server_responses PROTO((void));
  79. /* Start up the connection to the server on the other end. */
  80. void
  81. start_server PROTO((void));
  82. /* Send the names of all the argument files to the server. */
  83. void
  84. send_file_names PROTO((int argc, char **argv, unsigned int flags));
  85. /* Flags for send_file_names. */
  86. /* Expand wild cards? */
  87. # define SEND_EXPAND_WILD 1
  88. /*
  89. * Send Repository, Modified and Entry. argc and argv contain only
  90. * the files to operate on (or empty for everything), not options.
  91. * local is nonzero if we should not recurse (-l option).
  92. */
  93. void
  94. send_files PROTO((int argc, char **argv, int local, int aflag,
  95. unsigned int flags));
  96. /* Flags for send_files. */
  97. # define SEND_BUILD_DIRS 1
  98. # define SEND_FORCE 2
  99. # define SEND_NO_CONTENTS 4
  100. # define BACKUP_MODIFIED_FILES 8
  101. /* Send an argument to the remote server. */
  102. void
  103. send_arg PROTO((const char *string));
  104. /* Send a string of single-char options to the remote server, one by one. */
  105. void send_options PROTO ((int argc, char * const *argv));
  106. extern void send_a_repository PROTO ((const char *, const char *,
  107. const char *));
  108. #endif /* CLIENT_SUPPORT */
  109. /*
  110. * This structure is used to catalog the responses the client is
  111. * prepared to see from the server.
  112. */
  113. struct response
  114. {
  115. /* Name of the response. */
  116. char *name;
  117. #ifdef CLIENT_SUPPORT
  118. /*
  119. * Function to carry out the response. ARGS is the text of the
  120. * command after name and, if present, a single space, have been
  121. * stripped off. The function can scribble into ARGS if it wants.
  122. * Note that although LEN is given, ARGS is also guaranteed to be
  123. * '\0' terminated.
  124. */
  125. void (*func) PROTO((char *args, int len));
  126. /*
  127. * ok and error are special; they indicate we are at the end of the
  128. * responses, and error indicates we should exit with nonzero
  129. * exitstatus.
  130. */
  131. enum {response_type_normal, response_type_ok, response_type_error} type;
  132. #endif
  133. /* Used by the server to indicate whether response is supported by
  134. the client, as set by the Valid-responses request. */
  135. enum {
  136. /*
  137. * Failure to implement this response can imply a fatal
  138. * error. This should be set only for responses which were in the
  139. * original version of the protocol; it should not be set for new
  140. * responses.
  141. */
  142. rs_essential,
  143. /* Some clients might not understand this response. */
  144. rs_optional,
  145. /*
  146. * Set by the server to one of the following based on what this
  147. * client actually supports.
  148. */
  149. rs_supported,
  150. rs_not_supported
  151. } status;
  152. };
  153. /* Table of responses ending in an entry with a NULL name. */
  154. extern struct response responses[];
  155. #ifdef CLIENT_SUPPORT
  156. extern void client_senddate PROTO((const char *date));
  157. extern void client_expand_modules PROTO((int argc, char **argv, int local));
  158. extern void client_send_expansions PROTO((int local, char *where,
  159. int build_dirs));
  160. extern void client_nonexpanded_setup PROTO((void));
  161. extern void send_init_command PROTO ((void));
  162. extern char **failed_patches;
  163. extern int failed_patches_count;
  164. extern char *toplevel_wd;
  165. extern void client_import_setup PROTO((char *repository));
  166. extern int client_process_import_file
  167. PROTO((char *message, char *vfile, char *vtag,
  168. int targc, char *targv[], char *repository, int all_files_binary,
  169. int modtime));
  170. extern void client_import_done PROTO((void));
  171. extern void client_notify PROTO((const char *, const char *, const char *, int,
  172. const char *));
  173. #endif /* CLIENT_SUPPORT */