Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

peermux.h 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. /** PeerDist statistics */
  38. struct peerdist_statistics {
  39. /** Maximum observed number of peers */
  40. unsigned int peers;
  41. /** Number of blocks downloaded in total */
  42. unsigned int total;
  43. /** Number of blocks downloaded from peers */
  44. unsigned int local;
  45. };
  46. /** A PeerDist download multiplexer */
  47. struct peerdist_multiplexer {
  48. /** Reference count */
  49. struct refcnt refcnt;
  50. /** Data transfer interface */
  51. struct interface xfer;
  52. /** Content information interface */
  53. struct interface info;
  54. /** Original URI */
  55. struct uri *uri;
  56. /** Content information data transfer buffer */
  57. struct xfer_buffer buffer;
  58. /** Content information cache */
  59. struct peerdist_info_cache cache;
  60. /** Block download initiation process */
  61. struct process process;
  62. /** List of busy block downloads */
  63. struct list_head busy;
  64. /** List of idle block downloads */
  65. struct list_head idle;
  66. /** Block downloads */
  67. struct peerdist_multiplexed_block block[PEERMUX_MAX_BLOCKS];
  68. /** Statistics */
  69. struct peerdist_statistics stats;
  70. };
  71. extern int peermux_filter ( struct interface *xfer, struct interface *info,
  72. struct uri *uri );
  73. #endif /* _IPXE_PEERMUX_H */