netbuff.h 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. #ifndef GRUB_NETBUFF_HEADER
  2. #define GRUB_NETBUFF_HEADER
  3. #include <grub/misc.h>
  4. #define NETBUFF_ALIGN 2048
  5. #define NETBUFFMINLEN 64
  6. struct grub_net_buff
  7. {
  8. /* Pointer to the start of the buffer. */
  9. grub_uint8_t *head;
  10. /* Pointer to the data. */
  11. grub_uint8_t *data;
  12. /* Pointer to the tail. */
  13. grub_uint8_t *tail;
  14. /* Pointer to the end of the buffer. */
  15. grub_uint8_t *end;
  16. };
  17. grub_err_t grub_netbuff_put (struct grub_net_buff *net_buff, grub_size_t len);
  18. grub_err_t grub_netbuff_unput (struct grub_net_buff *net_buff, grub_size_t len);
  19. grub_err_t grub_netbuff_push (struct grub_net_buff *net_buff, grub_size_t len);
  20. grub_err_t grub_netbuff_pull (struct grub_net_buff *net_buff, grub_size_t len);
  21. grub_err_t grub_netbuff_reserve (struct grub_net_buff *net_buff, grub_size_t len);
  22. grub_err_t grub_netbuff_clear (struct grub_net_buff *net_buff);
  23. struct grub_net_buff * grub_netbuff_alloc (grub_size_t len);
  24. struct grub_net_buff * grub_netbuff_make_pkt (grub_size_t len);
  25. void grub_netbuff_free (struct grub_net_buff *net_buff);
  26. #endif