You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

peermux.h 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef _IPXE_PEERMUX_H
  2. #define _IPXE_PEERMUX_H
  3. /** @file
  4. *
  5. * Peer Content Caching and Retrieval (PeerDist) protocol multiplexer
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <stdint.h>
  10. #include <ipxe/list.h>
  11. #include <ipxe/refcnt.h>
  12. #include <ipxe/interface.h>
  13. #include <ipxe/process.h>
  14. #include <ipxe/uri.h>
  15. #include <ipxe/xferbuf.h>
  16. #include <ipxe/pccrc.h>
  17. /** Maximum number of concurrent block downloads */
  18. #define PEERMUX_MAX_BLOCKS 32
  19. /** PeerDist download content information cache */
  20. struct peerdist_info_cache {
  21. /** Content information */
  22. struct peerdist_info info;
  23. /** Content information segment */
  24. struct peerdist_info_segment segment;
  25. /** Content information block */
  26. struct peerdist_info_block block;
  27. };
  28. /** A PeerDist multiplexed block download */
  29. struct peerdist_multiplexed_block {
  30. /** PeerDist download multiplexer */
  31. struct peerdist_multiplexer *peermux;
  32. /** List of multiplexed blocks */
  33. struct list_head list;
  34. /** Data transfer interface */
  35. struct interface xfer;
  36. };
  37. /** A PeerDist download multiplexer */
  38. struct peerdist_multiplexer {
  39. /** Reference count */
  40. struct refcnt refcnt;
  41. /** Data transfer interface */
  42. struct interface xfer;
  43. /** Content information interface */
  44. struct interface info;
  45. /** Original URI */
  46. struct uri *uri;
  47. /** Content information data transfer buffer */
  48. struct xfer_buffer buffer;
  49. /** Content information cache */
  50. struct peerdist_info_cache cache;
  51. /** Block download initiation process */
  52. struct process process;
  53. /** List of busy block downloads */
  54. struct list_head busy;
  55. /** List of idle block downloads */
  56. struct list_head idle;
  57. /** Block downloads */
  58. struct peerdist_multiplexed_block block[PEERMUX_MAX_BLOCKS];
  59. };
  60. extern int peermux_filter ( struct interface *xfer, struct interface *info,
  61. struct uri *uri );
  62. #endif /* _IPXE_PEERMUX_H */