20cce316d25d150ffdac495b3174073e8165292b
[people/adir/gpxe.git] / src / include / gpxe / features.h
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 /**
15  * @defgroup dhcpfeatures DHCP feature option tags
16  *
17  * DHCP feature option tags are Etherboot encapsulated options in the
18  * range 0x10-0x7f.
19  *
20  * @{
21  */
22
23 /** PXE API extensions */
24 #define DHCP_EB_FEATURE_PXE_EXT 0x10
25
26 /** iSCSI */
27 #define DHCP_EB_FEATURE_ISCSI 0x11
28
29 /** AoE */
30 #define DHCP_EB_FEATURE_AOE 0x12
31
32 /** @} */
33
34 /** Declare a feature code for DHCP */
35 #define __dhcp_feature __table ( uint8_t, dhcp_features, 01 )
36
37 /** Construct a DHCP feature table entry */
38 #define DHCP_FEATURE( feature_opt ) \
39         _DHCP_FEATURE ( OBJECT, feature_opt )
40 #define _DHCP_FEATURE( _name, feature_opt ) \
41         __DHCP_FEATURE ( _name, feature_opt )
42 #define __DHCP_FEATURE( _name, feature_opt )                    \
43         uint8_t __dhcp_feature_ ## _name [] __dhcp_feature = {  \
44                 feature_opt, DHCP_BYTE ( 1 )                    \
45         };
46
47 /** Declare a named feature */
48 #define __feature_name __table ( char *, features, 01 )
49
50 /** Construct a named feature */
51 #define FEATURE_NAME( text ) \
52         _FEATURE_NAME ( OBJECT, text )
53 #define _FEATURE_NAME( _name, text ) \
54         __FEATURE_NAME ( _name, text )
55 #define __FEATURE_NAME( _name, text )                           \
56         char * __feature_ ## _name __feature_name = text;
57
58 /** Declare a feature */
59 #define FEATURE( text, feature_opt )                            \
60         FEATURE_NAME ( text );                                  \
61         DHCP_FEATURE ( feature_opt );
62
63 #endif /* _GPXE_FEATURES_H */