net.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2002,2007 Free Software Foundation, Inc.
  4. *
  5. * GRUB is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * GRUB is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef GRUB_NET_HEADER
  19. #define GRUB_NET_HEADER 1
  20. #include <grub/symbol.h>
  21. #include <grub/err.h>
  22. #include <grub/types.h>
  23. struct grub_net;
  24. struct grub_net_dev
  25. {
  26. /* The device name. */
  27. const char *name;
  28. /* FIXME: Just a template. */
  29. int (*probe) (struct grub_net *net, const void *addr);
  30. void (*reset) (struct grub_net *net);
  31. int (*poll) (struct grub_net *net);
  32. void (*transmit) (struct grub_net *net, const void *destip,
  33. unsigned srcsock, unsigned destsock, const void *packet);
  34. void (*disable) (struct grub_net *net);
  35. /* The next net device. */
  36. struct grub_net_dev *next;
  37. };
  38. typedef struct grub_net_dev *grub_net_dev_t;
  39. struct grub_fs;
  40. struct grub_net
  41. {
  42. /* The net name. */
  43. const char *name;
  44. /* The underlying disk device. */
  45. grub_net_dev_t dev;
  46. /* The binding filesystem. */
  47. struct grub_fs *fs;
  48. /* FIXME: More data would be required, such as an IP address, a mask,
  49. a gateway, etc. */
  50. /* Device-specific data. */
  51. void *data;
  52. };
  53. typedef struct grub_net *grub_net_t;
  54. /* FIXME: How to abstract networks? More consideration is necessary. */
  55. /* Note: Networks are very different from disks, because networks must
  56. be initialized before used, and the status is persistent. */
  57. #endif /* ! GRUB_NET_HEADER */