]> git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Sockets/RawIp4Rx/RawIp4Rx.h
Update the sockets applications
[mirror_edk2.git] / AppPkg / Applications / Sockets / RawIp4Rx / RawIp4Rx.h
1 /** @file
2 Definitions for the raw IP4 receive application
3
4 Copyright (c) 2011, 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 _RAW_IP4_RX_H_
16 #define _RAW_IP4_RX_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 CLOSE_SOCKET closesocket
30 #define SIN_ADDR(port) port.sin_addr.S_un.S_addr
31 #define SIN_FAMILY(port) port.sin_family
32 #define SIN_LEN(port) port.sin_family
33 #define SIN_PORT(port) port.sin_port
34 #define GET_ERRNO WSAGetLastError ( )
35
36 #define ssize_t int
37 #define socklen_t int
38
39 #else // BUILD_FOR_WINDOWS
40 //
41 // Build for EFI environment
42 //
43
44 #include <Uefi.h>
45 #include <errno.h>
46 #include <stdlib.h>
47
48 #include <netinet/in.h>
49
50 #include <sys/EfiSysCall.h>
51 #include <sys/endian.h>
52 #include <sys/socket.h>
53 #include <sys/time.h>
54
55 #define CLOSE_SOCKET close
56 #define SIN_ADDR(port) port.sin_addr.s_addr
57 #define SIN_FAMILY(port) port.sin_family
58 #define SIN_LEN(port) port.sin_len
59 #define SIN_PORT(port) port.sin_port
60 #define SOCKET int
61 #define GET_ERRNO errno
62
63 #endif // BUILD_FOR_WINDOWS
64
65 #include <stdio.h>
66
67 //------------------------------------------------------------------------------
68 // Constants
69 //------------------------------------------------------------------------------
70
71 //
72 // See http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml
73 // and http://tools.ietf.org/html/rfc3692
74 //
75 #define RAW_PROTOCOL 253
76
77 //------------------------------------------------------------------------------
78 // API
79 //------------------------------------------------------------------------------
80
81 /**
82 Run the raw IP4 receive application
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 RawIp4Rx (
92 IN int ArgC,
93 IN char **ArgV
94 );
95
96 //------------------------------------------------------------------------------
97
98 #endif // _RAW_IP4_RX_H_