| 1 | #ifndef PROTOCOL_H |
| 2 | #define PROTOCOL_H |
| 3 | |
| 4 | /* |
| 5 | * Intensive research over the course of many years has shown that |
| 6 | * port 9418 is totally unused by anything else. Or |
| 7 | * |
| 8 | * Your search - "port 9418" - did not match any documents. |
| 9 | * |
| 10 | * as www.google.com puts it. |
| 11 | * |
| 12 | * This port has been properly assigned for git use by IANA: |
| 13 | * git (Assigned-9418) [I06-050728-0001]. |
| 14 | * |
| 15 | * git 9418/tcp git pack transfer service |
| 16 | * git 9418/udp git pack transfer service |
| 17 | * |
| 18 | * with Linus Torvalds <torvalds@osdl.org> as the point of |
| 19 | * contact. September 2005. |
| 20 | * |
| 21 | * See https://www.iana.org/assignments/port-numbers |
| 22 | */ |
| 23 | #define DEFAULT_GIT_PORT 9418 |
| 24 | |
| 25 | enum protocol_version { |
| 26 | protocol_unknown_version = -1, |
| 27 | protocol_v0 = 0, |
| 28 | protocol_v1 = 1, |
| 29 | protocol_v2 = 2, |
| 30 | }; |
| 31 | |
| 32 | /* |
| 33 | * Used by a client to determine which protocol version to request be used when |
| 34 | * communicating with a server, reflecting the configured value of the |
| 35 | * 'protocol.version' config. If unconfigured, a value of 'protocol_v0' is |
| 36 | * returned. |
| 37 | */ |
| 38 | enum protocol_version get_protocol_version_config(void); |
| 39 | |
| 40 | /* |
| 41 | * Used by a server to determine which protocol version should be used based on |
| 42 | * a client's request, communicated via the 'GIT_PROTOCOL' environment variable |
| 43 | * by setting appropriate values for the key 'version'. If a client doesn't |
| 44 | * request a particular protocol version, a default of 'protocol_v0' will be |
| 45 | * used. |
| 46 | */ |
| 47 | enum protocol_version determine_protocol_version_server(void); |
| 48 | |
| 49 | /* |
| 50 | * Used by a client to determine which protocol version the server is speaking |
| 51 | * based on the server's initial response. |
| 52 | */ |
| 53 | enum protocol_version determine_protocol_version_client(const char *server_response); |
| 54 | |
| 55 | #endif /* PROTOCOL_H */ |