• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Windows version of the raw IP4 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 #include <RawIp4Tx.h>
16 
17 
18 /**
19   Transmit raw IP4 packets to the 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     //  See http://msdn.microsoft.com/en-us/library/ms740548(v=vs.85).aspx
46     //
47     RetVal = RawIp4Tx ( argc, argv );
48     if ( WSAEACCES == RetVal ) {
49       printf ( "Requires administrator privileges to run!\r\n" );
50     }
51 
52     //
53     //  Done with the WinSock layer
54     //
55     WSACleanup ( );
56   }
57 
58   //
59   //  Return the final result
60   //
61   return RetVal;
62 }
63