Home | History | Annotate | Download | only in Protocol
      1 /** @file
      2   It is invoked when the PXE Base Code Protocol is about to transmit, has received,
      3   or is waiting to receive a packet.
      4 
      5 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
      6 This program and the accompanying materials are licensed and made available under
      7 the terms and conditions of the BSD License that accompanies this distribution.
      8 The full text of the license may be found at
      9 http://opensource.org/licenses/bsd-license.php.
     10 
     11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     13 
     14   @par Revision Reference:
     15   This Protocol is introduced in EFI Specification 1.10
     16 
     17 **/
     18 
     19 #ifndef _PXE_BASE_CODE_CALLBACK_H_
     20 #define _PXE_BASE_CODE_CALLBACK_H_
     21 
     22 ///
     23 /// Call Back Definitions.
     24 ///
     25 #define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID \
     26   { \
     27     0x245dca21, 0xfb7b, 0x11d3, {0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
     28   }
     29 
     30 ///
     31 /// UEFI Revision Number Definition.
     32 ///
     33 #define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION 0x00010000
     34 
     35 ///
     36 /// EFI 1.1 Revision Number defintion.
     37 ///
     38 #define EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION  \
     39         EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION
     40 
     41 ///
     42 /// UEFI Protocol name.
     43 ///
     44 typedef struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL  EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL;
     45 
     46 ///
     47 /// EFI1.1 Protocol name.
     48 ///
     49 typedef EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL   EFI_PXE_BASE_CODE_CALLBACK;
     50 
     51 ///
     52 /// Event type list for PXE Base Code Protocol function.
     53 ///
     54 typedef enum {
     55   EFI_PXE_BASE_CODE_FUNCTION_FIRST,
     56   EFI_PXE_BASE_CODE_FUNCTION_DHCP,
     57   EFI_PXE_BASE_CODE_FUNCTION_DISCOVER,
     58   EFI_PXE_BASE_CODE_FUNCTION_MTFTP,
     59   EFI_PXE_BASE_CODE_FUNCTION_UDP_WRITE,
     60   EFI_PXE_BASE_CODE_FUNCTION_UDP_READ,
     61   EFI_PXE_BASE_CODE_FUNCTION_ARP,
     62   EFI_PXE_BASE_CODE_FUNCTION_IGMP,
     63   EFI_PXE_BASE_CODE_PXE_FUNCTION_LAST
     64 } EFI_PXE_BASE_CODE_FUNCTION;
     65 
     66 ///
     67 /// Callback status type.
     68 ///
     69 typedef enum {
     70   EFI_PXE_BASE_CODE_CALLBACK_STATUS_FIRST,
     71   EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
     72   EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT,
     73   EFI_PXE_BASE_CODE_CALLBACK_STATUS_LAST
     74 } EFI_PXE_BASE_CODE_CALLBACK_STATUS;
     75 
     76 /**
     77   Callback function that is invoked when the PXE Base Code Protocol is about to transmit, has
     78   received, or is waiting to receive a packet.
     79 
     80   This function is invoked when the PXE Base Code Protocol is about to transmit, has received,
     81   or is waiting to receive a packet. Parameters Function and Received specify the type of event.
     82   Parameters PacketLen and Packet specify the packet that generated the event. If these fields
     83   are zero and NULL respectively, then this is a status update callback. If the operation specified
     84   by Function is to continue, then CALLBACK_STATUS_CONTINUE should be returned. If the operation
     85   specified by Function should be aborted, then CALLBACK_STATUS_ABORT should be returned. Due to
     86   the polling nature of UEFI device drivers, a callback function should not execute for more than 5 ms.
     87   The SetParameters() function must be called after a Callback Protocol is installed to enable the
     88   use of callbacks.
     89 
     90   @param  This                  The pointer to the EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL instance.
     91   @param  Function              The PXE Base Code Protocol function that is waiting for an event.
     92   @param  Received              TRUE if the callback is being invoked due to a receive event. FALSE if
     93                                 the callback is being invoked due to a transmit event.
     94   @param  PacketLen             The length, in bytes, of Packet. This field will have a value of zero if
     95                                 this is a wait for receive event.
     96   @param  Packet                If Received is TRUE, a pointer to the packet that was just received;
     97                                 otherwise a pointer to the packet that is about to be transmitted.
     98 
     99   @retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE if Function specifies a continue operation
    100   @retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT    if Function specifies an abort operation
    101 
    102 **/
    103 typedef
    104 EFI_PXE_BASE_CODE_CALLBACK_STATUS
    105 (EFIAPI *EFI_PXE_CALLBACK)(
    106   IN EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL  *This,
    107   IN EFI_PXE_BASE_CODE_FUNCTION           Function,
    108   IN BOOLEAN                              Received,
    109   IN UINT32                               PacketLen,
    110   IN EFI_PXE_BASE_CODE_PACKET             *Packet     OPTIONAL
    111   );
    112 
    113 ///
    114 /// Protocol that is invoked when the PXE Base Code Protocol is about
    115 /// to transmit, has received, or is waiting to receive a packet.
    116 ///
    117 struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL {
    118   ///
    119   ///  The revision of the EFI_PXE_BASE_CODE_PROTOCOL. All future revisions must
    120   ///  be backwards compatible. If a future version is not backwards compatible
    121   ///  it is not the same GUID.
    122   ///
    123   UINT64            Revision;
    124   EFI_PXE_CALLBACK  Callback;
    125 };
    126 
    127 extern EFI_GUID gEfiPxeBaseCodeCallbackProtocolGuid;
    128 
    129 #endif
    130 
    131