Home | History | Annotate | Download | only in OobTx
      1 /** @file
      2   Definitions for the OOB Transmit application
      3 
      4   Copyright (c) 2011-2012, Intel Corporation
      5   All rights reserved. This program and the accompanying materials
      6   are licensed and made available under the terms and conditions of the BSD License
      7   which accompanies this distribution.  The full text of the license may be found at
      8   http://opensource.org/licenses/bsd-license.php
      9 
     10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     12 
     13 **/
     14 
     15 #ifndef _OOB_TX_H_
     16 #define _OOB_TX_H_
     17 
     18 //------------------------------------------------------------------------------
     19 //  Include Files
     20 //------------------------------------------------------------------------------
     21 
     22 #ifdef  BUILD_FOR_WINDOWS
     23 //
     24 //  Build for Windows environment
     25 //
     26 
     27 #include <winsock2.h>
     28 
     29 #define CHAR8             char
     30 #define CLOSE_SOCKET      closesocket
     31 #define EINVAL            22    //  Invalid argument
     32 #define GET_ERRNO         WSAGetLastError ( )
     33 #define SIN_ADDR(port)    port.sin_addr.S_un.S_addr
     34 #define SIN_FAMILY(port)  port.sin_family
     35 #define SIN_LEN(port)     port.sin_family
     36 #define SIN_PORT(port)    port.sin_port
     37 #define socklen_t         int
     38 #define ssize_t           int
     39 
     40 #else   //  BUILD_FOR_WINDOWS
     41 //
     42 //  Build for EFI environment
     43 //
     44 
     45 #include <Uefi.h>
     46 #include <errno.h>
     47 #include <stdlib.h>
     48 #include <string.h>
     49 
     50 #include <netinet/in.h>
     51 
     52 #include <sys/EfiSysCall.h>
     53 #include <sys/endian.h>
     54 #include <sys/socket.h>
     55 
     56 #define CLOSE_SOCKET      close
     57 #define GET_ERRNO         errno
     58 #define SIN_ADDR(port)    port.sin_addr.s_addr
     59 #define SIN_FAMILY(port)  port.sin_family
     60 #define SIN_LEN(port)     port.sin_len
     61 #define SIN_PORT(port)    port.sin_port
     62 #define SOCKET            int
     63 
     64 #endif  //  BUILD_FOR_WINDOWS
     65 
     66 #include <stdio.h>
     67 
     68 //------------------------------------------------------------------------------
     69 //  Constants
     70 //------------------------------------------------------------------------------
     71 
     72 #define OOB_RX_PORT       12344
     73 
     74 #define TX_MSGS_BEFORE    32
     75 #define TX_MSGS_AFTER     8
     76 
     77 //------------------------------------------------------------------------------
     78 //  API
     79 //------------------------------------------------------------------------------
     80 
     81 /**
     82   Transmit out-of-band messages to the remote system.
     83 
     84   @param [in] ArgC        Argument count
     85   @param [in] ArgV        Argument value array
     86 
     87   @retval 0               Successfully operation
     88  **/
     89 
     90 int
     91 OobTx (
     92   IN int ArgC,
     93   IN char **ArgV
     94   );
     95 
     96 //------------------------------------------------------------------------------
     97 
     98 #endif  //  _OOB_TX_H_
     99