Junio C Hamano | 49a52b1 | 2006-09-10 01:06:33 -0700 | [diff] [blame] | 1 | #ifndef SIDEBAND_H |
| 2 | #define SIDEBAND_H |
| 3 | |
Jonathan Tan | fbd76cd | 2019-01-16 11:28:13 -0800 | [diff] [blame] | 4 | enum sideband_type { |
| 5 | SIDEBAND_PROTOCOL_ERROR = -2, |
| 6 | SIDEBAND_REMOTE_ERROR = -1, |
| 7 | SIDEBAND_FLUSH = 0, |
| 8 | SIDEBAND_PRIMARY = 1 |
| 9 | }; |
Junio C Hamano | 49a52b1 | 2006-09-10 01:06:33 -0700 | [diff] [blame] | 10 | |
Jonathan Tan | fbd76cd | 2019-01-16 11:28:13 -0800 | [diff] [blame] | 11 | /* |
| 12 | * Inspects a multiplexed packet read from the remote. If this packet is a |
| 13 | * progress packet and thus should not be processed by the caller, returns 0. |
| 14 | * Otherwise, returns 1, releases scratch, and sets sideband_type. |
| 15 | * |
| 16 | * If this packet is SIDEBAND_PROTOCOL_ERROR, SIDEBAND_REMOTE_ERROR, or a |
| 17 | * progress packet, also prints a message to stderr. |
| 18 | * |
| 19 | * scratch must be a struct strbuf allocated by the caller. It is used to store |
| 20 | * progress messages split across multiple packets. |
| 21 | */ |
| 22 | int demultiplex_sideband(const char *me, char *buf, int len, |
Jonathan Tan | 0bbc0bc | 2019-01-16 11:28:14 -0800 | [diff] [blame] | 23 | int die_on_error, |
Jonathan Tan | fbd76cd | 2019-01-16 11:28:13 -0800 | [diff] [blame] | 24 | struct strbuf *scratch, |
| 25 | enum sideband_type *sideband_type); |
| 26 | |
Lukas Fleischer | 4c4b7d1 | 2016-06-14 16:49:16 +0200 | [diff] [blame] | 27 | void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max); |
Junio C Hamano | 49a52b1 | 2006-09-10 01:06:33 -0700 | [diff] [blame] | 28 | |
| 29 | #endif |