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