Sets/Returns HNFileAdapter object automatic mode flag status.
Syntax:
property AutoMode: BOOL;
Description:
Use AutoMode to change status of the flag which indicates that
HNFileAdapter works in automatic mode.
Automatic mode of the HNFileAdapter object sets its working
in the context of its internal thread. For read/write operations in the automatic mode please use
OpenFile/CreateFile
respectively.
To work with HNFileAdapter in AutoMode you should use HNQueue
together with it (see HNFileAdapter.Queue property).
Example of using HNFileAdpater AutoMode for dumping packets to a CAP file:
// OnFileClose event handler
procedure TForm1.HNFileAdapter1FileClose(Sender: TObject; ThParam: Pointer; Result: DWORD)
begin
if Result = HNERR_FILE_SIZE_LIMIT then
begin
...
end;
end;
...
// Create HNAdapter object
HNAdapter1 := HNAdapter.Create();
// Create HNQueue object
HNQueue1 = HNQueue.Create();
// Create HNFileAdapter object
HNFileAdapter1 = HNFileAdapter.Create();
...
// Set HNQueue object for HNAdapter and HNFileAdapter
HNAdapter1.ReceiveQueue := HNQueue1.Handle;
HNFileAdapter1.Queue := HNQueue1.Handle;
// HNFileAdapter additional settings
HNFileAdapter1.AutoMode := TRUE;
HNFileAdapter1.SizeLimit := 1000000;
HNFileAdapter1.OnFileClose := TForm1.HNFileAdapter1FileClose;
// Create CAP file
Res = HNFileAdapter1.CreateFile(h, "packets.cap");
...
// Start queue internal thread
Res = HNQueue1.Start(hQue);
...
// Open network adapter
Res = HNAdapter1.OpenAdapter(hAdp);
...