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.

features.h 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef _GPXE_FEATURES_H
  2. #define _GPXE_FEATURES_H
  3. #include <stdint.h>
  4. #include <gpxe/tables.h>
  5. #include <gpxe/dhcp.h>
  6. /** @file
  7. *
  8. * Feature list
  9. *
  10. */
  11. /**
  12. * @defgroup featurecat Feature categories
  13. * @{
  14. */
  15. #define FEATURE_PROTOCOL 01 /**< Network protocols */
  16. #define FEATURE_IMAGE 02 /**< Image formats */
  17. #define FEATURE_MISC 03 /**< Miscellaneous */
  18. /** @} */
  19. /**
  20. * @defgroup dhcpfeatures DHCP feature option tags
  21. *
  22. * DHCP feature option tags are Etherboot encapsulated options in the
  23. * range 0x10-0x7f.
  24. *
  25. * @{
  26. */
  27. #define DHCP_EB_FEATURE_PXE_EXT 0x10 /**< PXE API extensions */
  28. #define DHCP_EB_FEATURE_ISCSI 0x11 /**< iSCSI protocol */
  29. #define DHCP_EB_FEATURE_AOE 0x12 /**< AoE protocol */
  30. #define DHCP_EB_FEATURE_HTTP 0x13 /**< HTTP protocol */
  31. #define DHCP_EB_FEATURE_HTTPS 0x14 /**< HTTPS protocol */
  32. #define DHCP_EB_FEATURE_TFTP 0x15 /**< TFTP protocol */
  33. #define DHCP_EB_FEATURE_FTP 0x16 /**< FTP protocol */
  34. #define DHCP_EB_FEATURE_DNS 0x17 /**< DNS protocol */
  35. #define DHCP_EB_FEATURE_BZIMAGE 0x18 /**< bzImage format */
  36. #define DHCP_EB_FEATURE_MULTIBOOT 0x19 /**< Multiboot format */
  37. #define DHCP_EB_FEATURE_SLAM 0x1a /**< SLAM protocol */
  38. #define DHCP_EB_FEATURE_NBI 0x20 /**< NBI format */
  39. #define DHCP_EB_FEATURE_PXE 0x21 /**< PXE format */
  40. #define DHCP_EB_FEATURE_ELF 0x22 /**< ELF format */
  41. #define DHCP_EB_FEATURE_COMBOOT 0x23 /**< COMBOOT format */
  42. #define DHCP_EB_FEATURE_EFI 0x24 /**< EFI format */
  43. /** @} */
  44. /** Declare a feature code for DHCP */
  45. #define __dhcp_feature __table ( uint8_t, dhcp_features, 01 )
  46. /** Construct a DHCP feature table entry */
  47. #define DHCP_FEATURE( feature_opt, ... ) \
  48. _DHCP_FEATURE ( OBJECT, feature_opt, __VA_ARGS__ )
  49. #define _DHCP_FEATURE( _name, feature_opt, ... ) \
  50. __DHCP_FEATURE ( _name, feature_opt, __VA_ARGS__ )
  51. #define __DHCP_FEATURE( _name, feature_opt, ... ) \
  52. uint8_t __dhcp_feature_ ## _name [] __dhcp_feature = { \
  53. feature_opt, DHCP_OPTION ( __VA_ARGS__ ) \
  54. };
  55. /** A named feature */
  56. struct feature {
  57. /** Feature name */
  58. char *name;
  59. };
  60. /** Declare a named feature */
  61. #define __feature_name( category ) \
  62. __table ( struct feature, features, category )
  63. /** Construct a named feature */
  64. #define FEATURE_NAME( category, text ) \
  65. _FEATURE_NAME ( category, OBJECT, text )
  66. #define _FEATURE_NAME( category, _name, text ) \
  67. __FEATURE_NAME ( category, _name, text )
  68. #define __FEATURE_NAME( category, _name, text ) \
  69. struct feature __feature_ ## _name __feature_name ( category ) = { \
  70. .name = text, \
  71. };
  72. /** Declare a feature */
  73. #define FEATURE( category, text, feature_opt, version ) \
  74. FEATURE_NAME ( category, text ); \
  75. DHCP_FEATURE ( feature_opt, version );
  76. /** Declare the version number feature */
  77. #define FEATURE_VERSION( ... ) \
  78. DHCP_FEATURE ( DHCP_ENCAPSULATED ( DHCP_EB_VERSION ), __VA_ARGS__ )
  79. #endif /* _GPXE_FEATURES_H */