PXENV_GET_CACHED_INFO
[PXE Preboot API]

GET CACHED INFO. More...


Data Structures

struct  s_PXENV_GET_CACHED_INFO
 Parameter block for pxenv_get_cached_info(). More...
struct  bootph
 Format of buffer filled in by pxenv_get_cached_info(). More...

Defines

#define PXENV_GET_CACHED_INFO   0x0071
 PXE API function code for pxenv_get_cached_info().
#define PXENV_PACKET_TYPE_DHCP_DISCOVER   1
 The client's DHCPDISCOVER packet.
#define PXENV_PACKET_TYPE_DHCP_ACK   2
 The DHCP server's DHCPACK packet.
#define PXENV_PACKET_TYPE_CACHED_REPLY   3
 The Boot Server's Discover Reply packet.
#define BOOTP_REQ   1
 A BOOTP request packet.
#define BOOTP_REP   2
 A BOOTP reply packet.
#define BOOTP_BCAST   0x8000
 DHCP broadcast flag.
#define VM_RFC1048   0x63825363L
 DHCP magic cookie.
#define BOOTP_DHCPVEND   1024
 Maximum length of DHCP options.

Typedefs

typedef struct
s_PXENV_GET_CACHED_INFO 
PXENV_GET_CACHED_INFO_t
typedef struct bootph BOOTPLAYER_t

Functions

PXENV_EXIT_t pxenv_get_cached_info (struct s_PXENV_GET_CACHED_INFO *get_cached_info)

Variables

struct s_PXENV PACKED
 The PXENV+ structure.


Detailed Description

GET CACHED INFO.

Define Documentation

#define PXENV_GET_CACHED_INFO   0x0071

PXE API function code for pxenv_get_cached_info().

Definition at line 268 of file pxe_api.h.

Referenced by get_cached_dhcpack(), pxe_api_call(), and pxeparent_function_name().

#define PXENV_PACKET_TYPE_DHCP_DISCOVER   1

The client's DHCPDISCOVER packet.

Definition at line 271 of file pxe_api.h.

#define PXENV_PACKET_TYPE_DHCP_ACK   2

The DHCP server's DHCPACK packet.

Definition at line 274 of file pxe_api.h.

Referenced by get_cached_dhcpack().

#define PXENV_PACKET_TYPE_CACHED_REPLY   3

The Boot Server's Discover Reply packet.

This packet contains DHCP option 60 set to "PXEClient", a valid boot file name, and may or may not contain MTFTP options.

Definition at line 281 of file pxe_api.h.

#define BOOTP_REQ   1

A BOOTP request packet.

Definition at line 299 of file pxe_api.h.

#define BOOTP_REP   2

A BOOTP reply packet.

Definition at line 300 of file pxe_api.h.

#define BOOTP_BCAST   0x8000

DHCP broadcast flag.

Request a broadcast response (DHCPOFFER or DHCPACK) from the DHCP server.

Definition at line 307 of file pxe_api.h.

#define VM_RFC1048   0x63825363L

DHCP magic cookie.

Definition at line 309 of file pxe_api.h.

#define BOOTP_DHCPVEND   1024

Maximum length of DHCP options.

Definition at line 312 of file pxe_api.h.


Typedef Documentation

Definition at line 297 of file pxe_api.h.

typedef struct bootph BOOTPLAYER_t

Definition at line 404 of file pxe_api.h.


Function Documentation

PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO get_cached_info  ) 

Definition at line 123 of file pxe_preboot.c.

References __from_data16, s_PXENV_GET_CACHED_INFO::Buffer, s_PXENV_GET_CACHED_INFO::BufferLimit, s_PXENV_GET_CACHED_INFO::BufferSize, cached_info, copy_to_user(), pxe_dhcp_packet_creator::create, DBG, pxe_cached_info::dhcphdr, info, NUM_CACHED_INFOS, s_SEGOFF16::offset, dhcphdr::op, s_PXENV_GET_CACHED_INFO::PacketType, pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_OUT_OF_RESOURCES, PXENV_STATUS_SUCCESS, real_to_user(), rm_ds, s_SEGOFF16::segment, and s_PXENV_GET_CACHED_INFO::Status.

Referenced by pxe_api_call().

00124                                                         {
00125         struct pxe_dhcp_packet_creator *creator;
00126         union pxe_cached_info *info;
00127         unsigned int idx;
00128         size_t len;
00129         userptr_t buffer;
00130         int rc;
00131 
00132         DBG ( "PXENV_GET_CACHED_INFO %d", get_cached_info->PacketType );
00133 
00134         DBG ( " to %04x:%04x+%x", get_cached_info->Buffer.segment,
00135               get_cached_info->Buffer.offset, get_cached_info->BufferSize );
00136 
00137         /* Sanity check */
00138         idx = ( get_cached_info->PacketType - 1 );
00139         if ( idx >= NUM_CACHED_INFOS ) {
00140                 DBG ( " bad PacketType" );
00141                 goto err;
00142         }
00143         info = &cached_info[idx];
00144 
00145         /* Construct cached version of packet, if not already constructed. */
00146         if ( ! info->dhcphdr.op ) {
00147                 /* Construct DHCP packet */
00148                 creator = &pxe_dhcp_packet_creators[idx];
00149                 if ( ( rc = creator->create ( pxe_netdev, info,
00150                                               sizeof ( *info ) ) ) != 0 ) {
00151                         DBG ( " failed to build packet" );
00152                         goto err;
00153                 }
00154         }
00155 
00156         len = get_cached_info->BufferSize;
00157         if ( len == 0 ) {
00158                 /* Point client at our cached buffer.
00159                  *
00160                  * To add to the fun, Intel decided at some point in
00161                  * the evolution of the PXE specification to add the
00162                  * BufferLimit field, which we are meant to fill in
00163                  * with the length of our packet buffer, so that the
00164                  * caller can safely modify the boot server reply
00165                  * packet stored therein.  However, this field was not
00166                  * present in earlier versions of the PXE spec, and
00167                  * there is at least one PXE NBP (Altiris) which
00168                  * allocates only exactly enough space for this
00169                  * earlier, shorter version of the structure.  If we
00170                  * actually fill in the BufferLimit field, we
00171                  * therefore risk trashing random areas of the
00172                  * caller's memory.  If we *don't* fill it in, then
00173                  * the caller is at liberty to assume that whatever
00174                  * random value happened to be in that location
00175                  * represents the length of the buffer we've just
00176                  * passed back to it.
00177                  *
00178                  * Since older PXE stacks won't fill this field in
00179                  * anyway, it's probably safe to assume that no
00180                  * callers actually rely on it, so we choose to not
00181                  * fill it in.
00182                  */
00183                 get_cached_info->Buffer.segment = rm_ds;
00184                 get_cached_info->Buffer.offset = __from_data16 ( info );
00185                 get_cached_info->BufferSize = sizeof ( *info );
00186                 DBG ( " returning %04x:%04x+%04x['%x']",
00187                       get_cached_info->Buffer.segment,
00188                       get_cached_info->Buffer.offset,
00189                       get_cached_info->BufferSize,
00190                       get_cached_info->BufferLimit );
00191         } else {
00192                 /* Copy packet to client buffer */
00193                 if ( len > sizeof ( *info ) )
00194                         len = sizeof ( *info );
00195                 if ( len < sizeof ( *info ) )
00196                         DBG ( " buffer may be too short" );
00197                 buffer = real_to_user ( get_cached_info->Buffer.segment,
00198                                         get_cached_info->Buffer.offset );
00199                 copy_to_user ( buffer, 0, info, len );
00200                 get_cached_info->BufferSize = len;
00201         }
00202 
00203         get_cached_info->Status = PXENV_STATUS_SUCCESS;
00204         return PXENV_EXIT_SUCCESS;
00205 
00206  err:
00207         get_cached_info->Status = PXENV_STATUS_OUT_OF_RESOURCES;
00208         return PXENV_EXIT_FAILURE;
00209 }


Variable Documentation

The PXENV+ structure.

Parameter block for undi_loader().

Parameter block for pxenv_file_exit_hook().

Parameter block for pxenv_file_api_check().

Parameter block for pxenv_file_exec().

Parameter block for pxenv_get_file_size().

Parameter block for pxenv_file_read().

Parameter block for pxenv_file_select().

Parameter block for pxenv_file_close().

Parameter block for pxenv_file_open().

Parameter block for pxenv_undi_isr().

Parameter block for pxenv_undi_get_state().

Parameter block for pxenv_undi_get_iface_info().

Parameter block for pxenv_undi_get_nic_type().

Information for an ISAPnP or equivalent NIC.

Information for a PCI or equivalent NIC.

Parameter block for pxenv_undi_get_mcast_address().

Parameter block for pxenv_undi_force_interrupt().

Parameter block for pxenv_undi_initiate_diags().

Parameter block for pxenv_undi_clear_statistics().

Parameter block for pxenv_undi_get_statistics().

Parameter block for pxenv_undi_get_information().

Parameter block for pxenv_undi_set_packet_filter().

Parameter block for pxenv_undi_set_station_address().

Parameter block for pxenv_undi_set_mcast_address().

Parameter block for pxenv_undi_transmit().

A transmit buffer descriptor, as pointed to by s_PXENV_UNDI_TRANSMIT::TBD.

Parameter block for pxenv_undi_close().

Parameter block for pxenv_undi_open().

Parameter block for pxenv_undi_shutdown().

Parameter block for pxenv_undi_reset_adapter().

List of multicast MAC addresses.

Parameter block for pxenv_undi_initialize().

Parameter block for pxenv_undi_cleanup().

Parameter block for pxenv_undi_startup().

Parameter block for pxenv_udp_read().

Parameter block for pxenv_udp_write().

Parameter block for pxenv_udp_close().

Parameter block for pxenv_udp_open().

Parameter block for pxenv_tftp_get_fsize().

Parameter block for pxenv_tftp_read_file().

Parameter block for pxenv_tftp_read().

Parameter block for pxenv_tftp_close().

Parameter block for pxenv_tftp_open().

Parameter block for pxenv_stop_base().

Parameter block for pxenv_start_base().

Parameter block for pxenv_stop_undi().

Parameter block for pxenv_start_undi().

Format of buffer filled in by pxenv_get_cached_info().

Parameter block for pxenv_get_cached_info().

Parameter block for pxenv_unload_stack().

The !PXE structure.

This somewhat convoluted data structure simply describes the layout of a DHCP packet. Refer to RFC2131 section 2 for a full description.


Generated on Tue Apr 6 20:01:59 2010 for gPXE by  doxygen 1.5.7.1