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 3.4KB

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