/**@file\r
- Berkeley Packet Filter implementation of the EMU_SNP_PROTOCOL that allows the \r
+ Berkeley Packet Filter implementation of the EMU_SNP_PROTOCOL that allows the\r
emulator to get on real networks.\r
\r
- Tested on Mac OS X. \r
+ Tested on Mac OS X.\r
\r
Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>\r
Portitions copyright (c) 2011, Apple Inc. All rights reserved.\r
\r
-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
+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
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);\r
\r
Private->Mode = Mode;\r
- \r
+\r
//\r
// Set the broadcast address.\r
//\r
if (errno == EACCES) {\r
printf (\r
"SNP: Permissions on '%s' are incorrect. Fix with 'sudo chmod 666 %s'.\n",\r
- BfpDeviceName, \r
- BfpDeviceName \r
+ BfpDeviceName,\r
+ BfpDeviceName\r
);\r
}\r
- \r
+\r
if (errno != EBUSY) {\r
break;\r
}\r
if (ioctl (Private->BpfFd, BIOCGBLEN, &ReadBufferSize) < 0) {\r
goto DeviceErrorExit;\r
}\r
- \r
+\r
//\r
// Default value from BIOCGBLEN is usually too small, so use a much larger size, if necessary.\r
//\r
goto DeviceErrorExit;\r
}\r
}\r
- \r
+\r
//\r
// Associate our interface with this BPF file descriptor.\r
//\r
if ( FilterProgram == NULL ) {\r
goto ErrorExit;\r
}\r
- \r
+\r
CopyMem (FilterProgram, &mFilterInstructionTemplate, sizeof (mFilterInstructionTemplate));\r
\r
//\r
}\r
\r
\r
- Private->Mode->State = EfiSimpleNetworkStarted; \r
+ Private->Mode->State = EfiSimpleNetworkStarted;\r
}\r
\r
return Status;\r
\r
\r
/**\r
- Resets a network adapter and allocates the transmit and receive buffers \r
- required by the network interface; optionally, also requests allocation \r
+ Resets a network adapter and allocates the transmit and receive buffers\r
+ required by the network interface; optionally, also requests allocation\r
of additional transmit and receive buffers.\r
\r
@param This The protocol instance pointer.\r
\r
\r
/**\r
- Resets a network adapter and re-initializes it with the parameters that were \r
- provided in the previous call to Initialize(). \r
+ Resets a network adapter and re-initializes it with the parameters that were\r
+ provided in the previous call to Initialize().\r
\r
@param This The protocol instance pointer.\r
@param ExtendedVerification Indicates that the driver may perform a more\r
\r
\r
/**\r
- Resets a network adapter and leaves it in a state that is safe for \r
+ Resets a network adapter and leaves it in a state that is safe for\r
another driver to initialize.\r
\r
@param This Protocol instance pointer.\r
\r
\r
/**\r
- Performs read and write operations on the NVRAM device attached to a \r
+ Performs read and write operations on the NVRAM device attached to a\r
network interface.\r
\r
@param This The protocol instance pointer.\r
}\r
\r
/**\r
- Reads the current interrupt status and recycled transmit buffer status from \r
+ Reads the current interrupt status and recycled transmit buffer status from\r
a network interface.\r
\r
@param This The protocol instance pointer.\r
\r
@retval EFI_SUCCESS The packet was placed on the transmit queue.\r
@retval EFI_NOT_STARTED The network interface has not been started.\r
- @retval EFI_NOT_READY The network interface is too busy to accept this transmit request. \r
+ @retval EFI_NOT_READY The network interface is too busy to accept this transmit request.\r
@retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.\r
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
if (write (Private->BpfFd, Buffer, BufferSize) < 0) {\r
return EFI_DEVICE_ERROR;\r
}\r
- \r
+\r
return EFI_SUCCESS;\r
}\r
\r
}\r
\r
ZeroMem (&BpfStats, sizeof( BpfStats));\r
- \r
+\r
if (ioctl (Private->BpfFd, BIOCGSTATS, &BpfStats) == 0) {\r
Private->ReceivedPackets += BpfStats.bs_recv;\r
if (BpfStats.bs_drop > Private->DroppedPackets) {\r
printf (\r
"SNP: STATS: RCVD = %d DROPPED = %d. Probably need to increase BPF PcdNetworkPacketFilterSize?\n",\r
- BpfStats.bs_recv, \r
+ BpfStats.bs_recv,\r
BpfStats.bs_drop - Private->DroppedPackets\r
);\r
Private->DroppedPackets = BpfStats.bs_drop;\r
)\r
{\r
EMU_SNP_PRIVATE *Private;\r
- \r
+\r
if (This->Private != NULL) {\r
return EFI_ALREADY_STARTED;\r
}\r
- \r
+\r
if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {\r
return EFI_UNSUPPORTED;\r
}\r
- \r
+\r
Private = malloc (sizeof (EMU_SNP_PRIVATE));\r
if (Private == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- \r
+\r
Private->Signature = EMU_SNP_PRIVATE_SIGNATURE;\r
Private->Thunk = This;\r
CopyMem (&Private->EmuSnp, &gEmuSnpProtocol, sizeof (gEmuSnpProtocol));\r
GetInterfaceMacAddr (Private);\r
- \r
+\r
This->Interface = &Private->EmuSnp;\r
This->Private = Private;\r
return EFI_SUCCESS;\r
if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {\r
return EFI_UNSUPPORTED;\r
}\r
- \r
+\r
Private = This->Private;\r
free (Private);\r
- \r
+\r
return EFI_SUCCESS;\r
}\r
\r