iPXE
features.h
Go to the documentation of this file.
00001 #ifndef _IPXE_FEATURES_H
00002 #define _IPXE_FEATURES_H
00003 
00004 #include <stdint.h>
00005 #include <ipxe/tables.h>
00006 #include <ipxe/dhcp.h>
00007 
00008 /** @file
00009  *
00010  * Feature list
00011  *
00012  */
00013 
00014 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00015 
00016 /**
00017  * @defgroup featurecat Feature categories
00018  * @{
00019  */
00020 
00021 #define FEATURE_PROTOCOL                01 /**< Network protocols */
00022 #define FEATURE_IMAGE                   02 /**< Image formats */
00023 #define FEATURE_MISC                    03 /**< Miscellaneous */
00024 
00025 /** @} */
00026 
00027 /**
00028  * @defgroup dhcpfeatures DHCP feature option tags
00029  *
00030  * DHCP feature option tags are Etherboot encapsulated options in the
00031  * range 0x10-0x7f.
00032  *
00033  * @{
00034  */
00035 
00036 #define DHCP_EB_FEATURE_PXE_EXT         0x10 /**< PXE API extensions */
00037 #define DHCP_EB_FEATURE_ISCSI           0x11 /**< iSCSI protocol */
00038 #define DHCP_EB_FEATURE_AOE             0x12 /**< AoE protocol */
00039 #define DHCP_EB_FEATURE_HTTP            0x13 /**< HTTP protocol */
00040 #define DHCP_EB_FEATURE_HTTPS           0x14 /**< HTTPS protocol */
00041 #define DHCP_EB_FEATURE_TFTP            0x15 /**< TFTP protocol */
00042 #define DHCP_EB_FEATURE_FTP             0x16 /**< FTP protocol */
00043 #define DHCP_EB_FEATURE_DNS             0x17 /**< DNS protocol */
00044 #define DHCP_EB_FEATURE_BZIMAGE         0x18 /**< bzImage format */
00045 #define DHCP_EB_FEATURE_MULTIBOOT       0x19 /**< Multiboot format */
00046 #define DHCP_EB_FEATURE_SLAM            0x1a /**< SLAM protocol */
00047 #define DHCP_EB_FEATURE_SRP             0x1b /**< SRP protocol */
00048 #define DHCP_EB_FEATURE_NBI             0x20 /**< NBI format */
00049 #define DHCP_EB_FEATURE_PXE             0x21 /**< PXE format */
00050 #define DHCP_EB_FEATURE_ELF             0x22 /**< ELF format */
00051 #define DHCP_EB_FEATURE_COMBOOT         0x23 /**< COMBOOT format */
00052 #define DHCP_EB_FEATURE_EFI             0x24 /**< EFI format */
00053 #define DHCP_EB_FEATURE_FCOE            0x25 /**< FCoE protocol */
00054 #define DHCP_EB_FEATURE_VLAN            0x26 /**< VLAN support */
00055 #define DHCP_EB_FEATURE_MENU            0x27 /**< Menu support */
00056 #define DHCP_EB_FEATURE_SDI             0x28 /**< SDI image support */
00057 #define DHCP_EB_FEATURE_NFS             0x29 /**< NFS protocol */
00058 
00059 /** @} */
00060 
00061 /** DHCP feature table */
00062 #define DHCP_FEATURES __table ( uint8_t, "dhcp_features" )
00063 
00064 /** Declare a feature code for DHCP */
00065 #define __dhcp_feature __table_entry ( DHCP_FEATURES, 01 )
00066 
00067 /** Construct a DHCP feature table entry */
00068 #define DHCP_FEATURE( feature_opt, ... )                                    \
00069         _DHCP_FEATURE ( OBJECT, feature_opt, __VA_ARGS__ )
00070 #define _DHCP_FEATURE( _name, feature_opt, ... )                            \
00071         __DHCP_FEATURE ( _name, feature_opt, __VA_ARGS__ )
00072 #define __DHCP_FEATURE( _name, feature_opt, ... )                           \
00073         uint8_t __dhcp_feature_ ## _name [] __dhcp_feature = {              \
00074                 feature_opt, DHCP_OPTION ( __VA_ARGS__ )                    \
00075         };
00076 
00077 /** A named feature */
00078 struct feature {
00079         /** Feature name */
00080         char *name;
00081 };
00082 
00083 /** Named feature table */
00084 #define FEATURES __table ( struct feature, "features" )
00085 
00086 /** Declare a named feature */
00087 #define __feature_name( category ) __table_entry ( FEATURES, category )
00088 
00089 /** Construct a named feature */
00090 #define FEATURE_NAME( category, text )                                      \
00091         _FEATURE_NAME ( category, OBJECT, text )
00092 #define _FEATURE_NAME( category, _name, text )                              \
00093         __FEATURE_NAME ( category, _name, text )
00094 #define __FEATURE_NAME( category, _name, text )                             \
00095         struct feature __feature_ ## _name __feature_name ( category ) = {  \
00096                 .name = text,                                               \
00097         };
00098 
00099 /** Declare a feature */
00100 #define FEATURE( category, text, feature_opt, version )                     \
00101         FEATURE_NAME ( category, text );                                    \
00102         DHCP_FEATURE ( feature_opt, version );
00103 
00104 /** Declare the version number feature */
00105 #define FEATURE_VERSION( ... )                                              \
00106         DHCP_FEATURE ( DHCP_ENCAPSULATED ( DHCP_EB_VERSION ), __VA_ARGS__ )
00107 
00108 #endif /* _IPXE_FEATURES_H */