]> git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Sockets/RawIp4Tx/RawIp4Tx.h
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Sockets / RawIp4Tx / RawIp4Tx.h
1 /** @file
2 Definitions for the raw IP4 transmit application
3
4 Copyright (c) 2011-2012, Intel Corporation. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef _RAW_IP4_TX_H_
10 #define _RAW_IP4_TX_H_
11
12 //------------------------------------------------------------------------------
13 // Include Files
14 //------------------------------------------------------------------------------
15
16 #ifdef BUILD_FOR_WINDOWS
17 //
18 // Build for Windows environment
19 //
20
21 #include <winsock2.h>
22
23 #define CHAR8 char
24 #define CLOSE_SOCKET closesocket
25 #define EINVAL 22 // Invalid argument
26 #define GET_ERRNO WSAGetLastError ( )
27 #define SIN_ADDR(port) port.sin_addr.S_un.S_addr
28 #define SIN_FAMILY(port) port.sin_family
29 #define SIN_LEN(port) port.sin_family
30 #define SIN_PORT(port) port.sin_port
31 #define socklen_t int
32 #define ssize_t int
33
34 #else // BUILD_FOR_WINDOWS
35 //
36 // Build for EFI environment
37 //
38
39 #include <Uefi.h>
40 #include <errno.h>
41 #include <stdlib.h>
42 #include <string.h>
43
44 #include <netinet/in.h>
45
46 #include <sys/EfiSysCall.h>
47 #include <sys/endian.h>
48 #include <sys/socket.h>
49
50 #define CLOSE_SOCKET close
51 #define GET_ERRNO errno
52 #define SIN_ADDR(port) port.sin_addr.s_addr
53 #define SIN_FAMILY(port) port.sin_family
54 #define SIN_LEN(port) port.sin_len
55 #define SIN_PORT(port) port.sin_port
56 #define SOCKET int
57
58 #endif // BUILD_FOR_WINDOWS
59
60 #include <stdio.h>
61
62 //------------------------------------------------------------------------------
63 // Constants
64 //------------------------------------------------------------------------------
65
66 //
67 // See http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml
68 // and http://tools.ietf.org/html/rfc3692
69 //
70 #define RAW_PROTOCOL 253
71
72 //------------------------------------------------------------------------------
73 // API
74 //------------------------------------------------------------------------------
75
76 /**
77 Transmit raw IP4 packets to the remote system.
78
79 @param [in] ArgC Argument count
80 @param [in] ArgV Argument value array
81
82 @retval 0 Successfully operation
83 **/
84
85 int
86 RawIp4Tx (
87 IN int ArgC,
88 IN char **ArgV
89 );
90
91 //------------------------------------------------------------------------------
92
93 #endif // _RAW_IP4_TX_H_