protocol.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef PROTOCOL_H
  2. #define PROTOCOL_H
  3. enum protocol_version {
  4. protocol_unknown_version = -1,
  5. protocol_v0 = 0,
  6. protocol_v1 = 1,
  7. protocol_v2 = 2,
  8. };
  9. /*
  10. * Used by a client to determine which protocol version to request be used when
  11. * communicating with a server, reflecting the configured value of the
  12. * 'protocol.version' config. If unconfigured, a value of 'protocol_v0' is
  13. * returned.
  14. */
  15. enum protocol_version get_protocol_version_config(void);
  16. /*
  17. * Used by a server to determine which protocol version should be used based on
  18. * a client's request, communicated via the 'GIT_PROTOCOL' environment variable
  19. * by setting appropriate values for the key 'version'. If a client doesn't
  20. * request a particular protocol version, a default of 'protocol_v0' will be
  21. * used.
  22. */
  23. enum protocol_version determine_protocol_version_server(void);
  24. /*
  25. * Used by a client to determine which protocol version the server is speaking
  26. * based on the server's initial response.
  27. */
  28. enum protocol_version determine_protocol_version_client(const char *server_response);
  29. #endif /* PROTOCOL_H */