src/SeeDll/Packet32.c
/*!
  \brief Sets the timeout after which a read on an adapter returns.
  \param AdapterObject Pointer to an _ADAPTER structure.
  \param timeout indicates the timeout, in milliseconds, after which a call to PacketReceivePacket() on 
  the adapter pointed by AdapterObject will be released, also if no packets have been captured by the driver. 
  Setting timeout to 0 means no timeout, i.e. PacketReceivePacket() never returns if no packet arrives.  
  A timeout of -1 causes PacketReceivePacket() to always return immediately.
  \return If the function succeeds, the return value is nonzero.

  \note This function works also if the adapter is working in statistics mode, and can be used to set the 
  time interval between two statistic reports.
*/
\brief Sets the timeout after which a read on an adapter returns.
\param AdapterObject Pointer to an _ADAPTER structure.
\param timeout indicates the timeout, in milliseconds, after which a call to PacketReceivePacket() on
the adapter pointed by AdapterObject will be released, also if no packets have been captured by the driver.
Setting timeout to 0 means no timeout, i.e. PacketReceivePacket() never returns if no packet arrives.
A timeout of -1 causes PacketReceivePacket() to always return immediately.
\return If the function succeeds, the return value is nonzero.

\note This function works also if the adapter is working in statistics mode, and can be used to set the
time interval between two statistic reports.
\ brief Sets the timeout after which a read on an adapter returns . \ param AdapterObject Pointer to an _ADAPTER structure . \ param timeout indicates the timeout in milliseconds after which a call to PacketReceivePacket () on the adapter pointed by AdapterObject will be released also if no packets have been captured by the driver . Setting timeout to 0 means no timeout i . e . PacketReceivePacket () never returns if no packet arrives . A timeout of - 1 causes PacketReceivePacket () to always return immediately . \ return If the function succeeds the return value is nonzero . \ note This function works also if the adapter is working in statistics mode and can be used to set the time interval between two statistic reports .
BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject,int timeout)
{
	DWORD BytesReturned;
	int DriverTimeOut=-1;
#ifndef _WINNT4
   if (AdapterObject->pWanAdapter != NULL)
      return WanPacketSetReadTimeout(AdapterObject->pWanAdapter,timeout);
#endif 
	AdapterObject->ReadTimeOut=timeout;
#ifdef HAVE_DAG_API
	if(AdapterObject->Flags & INFO_FLAG_DAG_CARD)
	{
		if(timeout == 1)
		{
			AdapterObject->DagReadTimeout.tv_sec = 0;
			AdapterObject->DagReadTimeout.tv_usec = 0;
		}
		else
			if(timeout == 1)
			{
				AdapterObject->DagReadTimeout.tv_sec = -1;
				AdapterObject->DagReadTimeout.tv_usec = -1;
			}
			else
			{
				AdapterObject->DagReadTimeout.tv_sec = timeout / 1000;
				AdapterObject->DagReadTimeout.tv_usec = (timeout * 1000) % 1000000;
			}
			return TRUE;
	}
#endif 
    return DeviceIoControl(AdapterObject->hFile,pBIOCSRTIMEOUT,&DriverTimeOut,4,NULL,0,&BytesReturned,NULL);
}
BOOLEAN PacketSetReadTimeout ( LPADAPTER AdapterObject , int timeout ) { DWORD BytesReturned ; int DriverTimeOut = -1 ; #ifndef _WINNT4 if ( AdapterObject -> pWanAdapter != NULL ) return WanPacketSetReadTimeout ( AdapterObject -> pWanAdapter , timeout ) ; #endif AdapterObject -> ReadTimeOut = timeout ; #ifdef HAVE_DAG_API if ( AdapterObject -> Flags & INFO_FLAG_DAG_CARD ) { if ( timeout == 1 ) { AdapterObject -> DagReadTimeout . tv_sec = 0 ; AdapterObject -> DagReadTimeout . tv_usec = 0 ; } else if ( timeout == 1 ) { AdapterObject -> DagReadTimeout . tv_sec = -1 ; AdapterObject -> DagReadTimeout . tv_usec = -1 ; } else { AdapterObject -> DagReadTimeout . tv_sec = timeout / 1000 ; AdapterObject -> DagReadTimeout . tv_usec = ( timeout * 1000 ) % 1000000 ; } return TRUE ; } #endif return DeviceIoControl ( AdapterObject -> hFile , pBIOCSRTIMEOUT , & DriverTimeOut , 4 , NULL , 0 , & BytesReturned , NULL ) ; }
\brief Sets the timeout after which a read on an adapter returns.
\ brief Sets the timeout after which a read on an adapter returns .
// _WINNT4
 // Under DAG, we simply store the timeout value and then 
 // tell DAG card to return immediately
 // tell the DAG card to wait forever
 // Set the timeout for the DAG card
 // HAVE_DAG_API
