]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Sockets/RawIp4Tx/RawIp4Tx.h
Update the sockets applications
[mirror_edk2.git] / AppPkg / Applications / Sockets / RawIp4Tx / RawIp4Tx.h
diff --git a/AppPkg/Applications/Sockets/RawIp4Tx/RawIp4Tx.h b/AppPkg/Applications/Sockets/RawIp4Tx/RawIp4Tx.h
new file mode 100644 (file)
index 0000000..c37b718
--- /dev/null
@@ -0,0 +1,98 @@
+/** @file\r
+  Definitions for the raw IP4 transmit application\r
+\r
+  Copyright (c) 2011, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _RAW_IP4_TX_H_\r
+#define _RAW_IP4_TX_H_\r
+\r
+//------------------------------------------------------------------------------\r
+//  Include Files\r
+//------------------------------------------------------------------------------\r
+\r
+#ifdef  BUILD_FOR_WINDOWS\r
+//\r
+//  Build for Windows environment\r
+//\r
+\r
+#include <winsock2.h>\r
+\r
+#define CHAR8             char\r
+#define CLOSE_SOCKET      closesocket\r
+#define EINVAL            22    //  Invalid argument\r
+#define GET_ERRNO         WSAGetLastError ( )\r
+#define SIN_ADDR(port)    port.sin_addr.S_un.S_addr\r
+#define SIN_FAMILY(port)  port.sin_family\r
+#define SIN_LEN(port)     port.sin_family\r
+#define SIN_PORT(port)    port.sin_port\r
+#define socklen_t         int\r
+#define ssize_t           int\r
+\r
+#else   //  BUILD_FOR_WINDOWS\r
+//\r
+//  Build for EFI environment\r
+//\r
+\r
+#include <Uefi.h>\r
+#include <errno.h>\r
+#include <stdlib.h>\r
+\r
+#include <netinet/in.h>\r
+\r
+#include <sys/EfiSysCall.h>\r
+#include <sys/endian.h>\r
+#include <sys/socket.h>\r
+\r
+#define CLOSE_SOCKET      close\r
+#define GET_ERRNO         errno\r
+#define SIN_ADDR(port)    port.sin_addr.s_addr\r
+#define SIN_FAMILY(port)  port.sin_family\r
+#define SIN_LEN(port)     port.sin_len\r
+#define SIN_PORT(port)    port.sin_port\r
+#define SOCKET            int\r
+\r
+#endif  //  BUILD_FOR_WINDOWS\r
+\r
+#include <stdio.h>\r
+\r
+//------------------------------------------------------------------------------\r
+//  Constants\r
+//------------------------------------------------------------------------------\r
+\r
+//\r
+//  See http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml\r
+//  and http://tools.ietf.org/html/rfc3692\r
+//\r
+#define RAW_PROTOCOL      253\r
+\r
+//------------------------------------------------------------------------------\r
+//  API\r
+//------------------------------------------------------------------------------\r
+\r
+/**\r
+  Transmit raw IP4 packets to the remote system.\r
+\r
+  @param [in] ArgC        Argument count\r
+  @param [in] ArgV        Argument value array\r
+\r
+  @retval 0               Successfully operation\r
+ **/\r
+\r
+int\r
+RawIp4Tx (\r
+  IN int ArgC,\r
+  IN char **ArgV\r
+  );\r
+\r
+//------------------------------------------------------------------------------\r
+\r
+#endif  //  _RAW_IP4_TX_H_
\ No newline at end of file