|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jnetpcap.PcapTask<T>
T - user supplied type start() and stop(). These 2
methods perform various synchronization functions between the worker
and the parent threads.public abstract class PcapTask<T>
A pcap background task handle. This provides status and control over the background loop. The task provides 2 methods for controlling the thread.
| Field Summary | |
|---|---|
protected int |
count
Number of packets to capture or 0 for infinate. |
protected Pcap |
pcap
Pcap handle. |
protected int |
result
Libpcap result code. |
protected java.lang.Thread |
thread
Controlling thread. |
protected T |
user
User data. |
| Constructor Summary | |
|---|---|
PcapTask(Pcap pcap,
int count,
T user)
Creates a new task handle for controlling background thread. |
|
| Method Summary | |
|---|---|
protected void |
breakLoop()
Algorithm for breaking the loop, whatever it is. |
int |
getCount()
The packet count that was supplied by the user. |
Pcap |
getPcap()
Returns the underlying Pcap object being used by this task |
int |
getResult()
Returns the result code that was returned from the user supplied pcap function. |
java.lang.Thread |
getThread()
Gets the background thread this task is using. |
T |
getUser()
User supplied data object. |
boolean |
isAlive()
Checks if the background thread is running and is alive. |
void |
start()
Creates and starts up the background thread while synchronizing with the background thread. |
void |
stop()
Terminates the task after making sure that the pcap session and thread are active. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.lang.Runnable |
|---|
run |
| Field Detail |
|---|
protected int result
protected java.lang.Thread thread
protected final Pcap pcap
protected final int count
protected final T user
| Constructor Detail |
|---|
public PcapTask(Pcap pcap,
int count,
T user)
pcap - pcap handlecount - number of packets to capture or 0 for infiniteuser - user supplied object| Method Detail |
|---|
public final int getResult()
public final java.lang.Thread getThread()
start() and
stop() methods.
public void start()
throws java.lang.InterruptedException
java.lang.InterruptedException - if the synchronization between threads was interrupted
public void stop()
throws java.lang.InterruptedException
Terminates the task after making sure that the pcap session and thread are active.
java.lang.InterruptedException - since this method waits for the background thread to terminate,
it can be interruptedprotected void breakLoop()
public boolean isAlive()
public final Pcap getPcap()
public final int getCount()
stop() is
called or an error occures.public final T getUser()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||