sideband.h 903 B

123456789101112131415161718192021222324252627282930
  1. #ifndef SIDEBAND_H
  2. #define SIDEBAND_H
  3. enum sideband_type {
  4. SIDEBAND_PROTOCOL_ERROR = -2,
  5. SIDEBAND_REMOTE_ERROR = -1,
  6. SIDEBAND_FLUSH = 0,
  7. SIDEBAND_PRIMARY = 1
  8. };
  9. /*
  10. * Inspects a multiplexed packet read from the remote. If this packet is a
  11. * progress packet and thus should not be processed by the caller, returns 0.
  12. * Otherwise, returns 1, releases scratch, and sets sideband_type.
  13. *
  14. * If this packet is SIDEBAND_PROTOCOL_ERROR, SIDEBAND_REMOTE_ERROR, or a
  15. * progress packet, also prints a message to stderr.
  16. *
  17. * scratch must be a struct strbuf allocated by the caller. It is used to store
  18. * progress messages split across multiple packets.
  19. */
  20. int demultiplex_sideband(const char *me, char *buf, int len,
  21. int die_on_error,
  22. struct strbuf *scratch,
  23. enum sideband_type *sideband_type);
  24. void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max);
  25. #endif