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