src/SeeDll/Packet32.c
/*! 
  \brief Sends one (or more) copies of a packet to the network.
  \param AdapterObject Pointer to an _ADAPTER structure identifying the network adapter that will 
   send the packets.
  \param lpPacket Pointer to a PACKET structure with the packet to send.
  \param Sync This parameter is deprecated and will be ignored. It is present for compatibility with 
   older applications.
  \return If the function succeeds, the return value is nonzero.

  This function is used to send a raw packet to the network. 'Raw packet' means that the programmer 
  will have to include the protocol headers, since the packet is sent to the network 'as is'. 
  The CRC needs not to be calculated and put at the end of the packet, because it will be transparently 
  added by the network interface.

  The behavior of this function is influenced by the PacketSetNumWrites() function. With PacketSetNumWrites(),
  it is possible to change the number of times a single write must be repeated. The default is 1, 
  i.e. every call to PacketSendPacket() will correspond to one packet sent to the network. If this number is
  greater than 1, for example 1000, every raw packet written by the application will be sent 1000 times on 
  the network. This feature mitigates the overhead of the context switches and therefore can be used to generate 
  high speed traffic. It is particularly useful for tools that test networks, routers, and servers and need 
  to obtain high network loads.
  The optimized sending process is still limited to one packet at a time: for the moment it cannot be used 
  to send a buffer with multiple packets.

  \note The ability to write multiple packets is currently present only in the Windows NTx version of the 
  packet driver. In Windows 95/98/ME it is emulated at user level in packet.dll. This means that an application
  that uses the multiple write method will run in Windows 9x as well, but its performance will be very low 
  compared to the one of WindowsNTx.
*/
\brief Sends one (or more) copies of a packet to the network.
\param AdapterObject Pointer to an _ADAPTER structure identifying the network adapter that will
send the packets.
\param lpPacket Pointer to a PACKET structure with the packet to send.
\param Sync This parameter is deprecated and will be ignored. It is present for compatibility with
older applications.
\return If the function succeeds, the return value is nonzero.

This function is used to send a raw packet to the network. 'Raw packet' means that the programmer
will have to include the protocol headers, since the packet is sent to the network 'as is'.
The CRC needs not to be calculated and put at the end of the packet, because it will be transparently
added by the network interface.

The behavior of this function is influenced by the PacketSetNumWrites() function. With PacketSetNumWrites(),
it is possible to change the number of times a single write must be repeated. The default is 1,
i.e. every call to PacketSendPacket() will correspond to one packet sent to the network. If this number is
greater than 1, for example 1000, every raw packet written by the application will be sent 1000 times on
the network. This feature mitigates the overhead of the context switches and therefore can be used to generate
high speed traffic. It is particularly useful for tools that test networks, routers, and servers and need
to obtain high network loads.
The optimized sending process is still limited to one packet at a time: for the moment it cannot be used
to send a buffer with multiple packets.

\note The ability to write multiple packets is currently present only in the Windows NTx version of the
packet driver. In Windows 95/98/ME it is emulated at user level in packet.dll. This means that an application
that uses the multiple write method will run in Windows 9x as well, but its performance will be very low
compared to the one of WindowsNTx.
\ brief Sends one ( or more ) copies of a packet to the network . \ param AdapterObject Pointer to an _ADAPTER structure identifying the network adapter that will send the packets . \ param lpPacket Pointer to a PACKET structure with the packet to send . \ param Sync This parameter is deprecated and will be ignored . It is present for compatibility with older applications . \ return If the function succeeds the return value is nonzero . This function is used to send a raw packet to the network . ' Raw packet ' means that the programmer will have to include the protocol headers since the packet is sent to the network ' as is ' . The CRC needs not to be calculated and put at the end of the packet because it will be transparently added by the network interface . The behavior of this function is influenced by the PacketSetNumWrites () function . With PacketSetNumWrites () it is possible to change the number of times a single write must be repeated . The default is 1 i . e . every call to PacketSendPacket () will correspond to one packet sent to the network . If this number is greater than 1 for example 1000 every raw packet written by the application will be sent 1000 times on the network . This feature mitigates the overhead of the context switches and therefore can be used to generate high speed traffic . It is particularly useful for tools that test networks routers and servers and need to obtain high network loads . The optimized sending process is still limited to one packet at a time : for the moment it cannot be used to send a buffer with multiple packets . \ note The ability to write multiple packets is currently present only in the Windows NTx version of the packet driver . In Windows 95 / 98 / ME it is emulated at user level in packet . dll . This means that an application that uses the multiple write method will run in Windows 9x as well but its performance will be very low compared to the one of WindowsNTx .
BOOLEAN PacketSendPacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync)
{
    DWORD        BytesTransfered;
#ifndef _WINNT4
	if(AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER)
	{
		ODS("PacketSendPacket: packet sending not allowed on wan adapters\n");
		return FALSE;
	}
#endif 
    return WriteFile(AdapterObject->hFile,lpPacket->Buffer,lpPacket->Length,&BytesTransfered,NULL);
}
BOOLEAN PacketSendPacket ( LPADAPTER AdapterObject , LPPACKET lpPacket , BOOLEAN Sync ) { DWORD BytesTransfered ; #ifndef _WINNT4 if ( AdapterObject -> Flags != INFO_FLAG_NDIS_ADAPTER ) { ODS ( " \n " ) ; return FALSE ; } #endif return WriteFile ( AdapterObject -> hFile , lpPacket -> Buffer , lpPacket -> Length , & BytesTransfered , NULL ) ; }
\brief Sends one (or more) copies of a packet to the network.
\ brief Sends one ( or more ) copies of a packet to the network .
// _WINNT4
