• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Windows version of the raw IP4 receive 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 #include <RawIp4Rx.h>
16 
17 
18 /**
19   Receive raw IP4 packets from a remote system.
20 
21   Please note that this program must be run with administrator privileges!
22 
23   @param [in] argc  The number of arguments
24   @param [in] argv  The argument value array
25 
26   @retval  0        The application exited normally.
27   @retval  Other    An error occurred.
28 **/
29 int
main(int argc,char ** argv)30 main(
31   int argc,
32   char ** argv
33   )
34 {
35   int RetVal;
36   WSADATA WsaData;
37 
38   //
39   //  Initialize the WinSock layer
40   //
41   RetVal = WSAStartup ( MAKEWORD ( 2, 2 ), &WsaData );
42   if ( 0 == RetVal ) {
43     //
44     //  Start the application
45     //
46     RetVal = RawIp4Rx ( argc, argv );
47     if ( WSAEACCES == RetVal ) {
48       printf ( "Requires administrator privileges to run!\r\n" );
49     }
50 
51     //
52     //  Done with the WinSock layer
53     //
54     WSACleanup ( );
55   }
56 
57   //
58   //  Return the final result
59   //
60   return RetVal;
61 }
62