Brandon Williams | 373d70e | 2017-10-16 10:55:24 -0700 | [diff] [blame] | 1 | #ifndef PROTOCOL_H |
| 2 | #define PROTOCOL_H |
| 3 | |
| 4 | enum protocol_version { |
| 5 | protocol_unknown_version = -1, |
| 6 | protocol_v0 = 0, |
| 7 | protocol_v1 = 1, |
Brandon Williams | 8f6982b | 2018-03-14 11:31:47 -0700 | [diff] [blame] | 8 | protocol_v2 = 2, |
Brandon Williams | 373d70e | 2017-10-16 10:55:24 -0700 | [diff] [blame] | 9 | }; |
| 10 | |
| 11 | /* |
| 12 | * Used by a client to determine which protocol version to request be used when |
| 13 | * communicating with a server, reflecting the configured value of the |
| 14 | * 'protocol.version' config. If unconfigured, a value of 'protocol_v0' is |
| 15 | * returned. |
| 16 | */ |
Denton Liu | 5545442 | 2019-04-29 04:28:14 -0400 | [diff] [blame] | 17 | enum protocol_version get_protocol_version_config(void); |
Brandon Williams | 373d70e | 2017-10-16 10:55:24 -0700 | [diff] [blame] | 18 | |
| 19 | /* |
| 20 | * Used by a server to determine which protocol version should be used based on |
| 21 | * a client's request, communicated via the 'GIT_PROTOCOL' environment variable |
| 22 | * by setting appropriate values for the key 'version'. If a client doesn't |
| 23 | * request a particular protocol version, a default of 'protocol_v0' will be |
| 24 | * used. |
| 25 | */ |
Denton Liu | 5545442 | 2019-04-29 04:28:14 -0400 | [diff] [blame] | 26 | enum protocol_version determine_protocol_version_server(void); |
Brandon Williams | 373d70e | 2017-10-16 10:55:24 -0700 | [diff] [blame] | 27 | |
| 28 | /* |
| 29 | * Used by a client to determine which protocol version the server is speaking |
| 30 | * based on the server's initial response. |
| 31 | */ |
Denton Liu | 5545442 | 2019-04-29 04:28:14 -0400 | [diff] [blame] | 32 | enum protocol_version determine_protocol_version_client(const char *server_response); |
Brandon Williams | 373d70e | 2017-10-16 10:55:24 -0700 | [diff] [blame] | 33 | |
| 34 | #endif /* PROTOCOL_H */ |