📄 jpcap.html
字号:
<CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../jpcap/Jpcap.html#updateStat()">updateStat</A></B>()</CODE><BR> Updates <A HREF="../jpcap/Jpcap.html#received_packets"><CODE>received_packets</CODE></A> and <A HREF="../jpcap/Jpcap.html#dropped_packets"><CODE>dropped_packets</CODE></A></TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.Object</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="received_packets"><!-- --></A><H3>received_packets</H3><PRE>public int <B>received_packets</B></PRE><DL><DD>Number of packets received<DD><DL><DT><B>See Also: </B><DD><A HREF="../jpcap/Jpcap.html#updateStat()"><CODE>updateStat()</CODE></A></DL></DD></DL><HR><A NAME="dropped_packets"><!-- --></A><H3>dropped_packets</H3><PRE>public int <B>dropped_packets</B></PRE><DL><DD>Number of packets dropped<DD><DL><DT><B>See Also: </B><DD><A HREF="../jpcap/Jpcap.html#updateStat()"><CODE>updateStat()</CODE></A></DL></DD></DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="Jpcap(java.lang.String, int, boolean, int)"><!-- --></A><H3>Jpcap</H3><PRE>public <B>Jpcap</B>(java.lang.String device, int snaplen, boolean promisc, int to_ms) throws java.io.IOException</PRE><DL><DD>Initializes the specified network interface and creates the instance of this class.<DD><DL><DT><B>Parameters:</B><DD><CODE>device</CODE> - Name of the interface (eg: hme0,eth0)<DD><CODE>snaplen</CODE> - Maximum number of bytes captured at once<DD><CODE>promisc</CODE> - The specified interface goes promiscuous mode if true<DD><CODE>to_ms</CODE> - Time out of <A HREF="../jpcap/Jpcap.html#processPacket(int, jpcap.JpcapHandler)"><CODE>processPacket()</CODE></A><DT><B>Throws:</B><DD>java.io.IOException - If the speficied interface couldn't be open</DL></DD></DL><HR><A NAME="Jpcap(java.lang.String)"><!-- --></A><H3>Jpcap</H3><PRE>public <B>Jpcap</B>(java.lang.String filename) throws java.io.IOException</PRE><DL><DD>Opens the dump file created by tcpdump and creates the instance of this class.<DD><DL><DT><B>Parameters:</B><DD><CODE>filename</CODE> - Name of dump file<DT><B>Throws:</B><DD>java.io.IOException - If the specified file couldn't open</DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="lookupDevice()"><!-- --></A><H3>lookupDevice</H3><PRE>public static java.lang.String <B>lookupDevice</B>()</PRE><DL><DD>Returns the name of the device which can be used for capturing.<DD><DL><DT><B>Returns:</B><DD>Name of the found device</DL></DD></DL><HR><A NAME="getPacket()"><!-- --></A><H3>getPacket</H3><PRE>public <A HREF="../jpcap/Packet.html">Packet</A> <B>getPacket</B>()</PRE><DL><DD>Captures one packet.</DL><HR><A NAME="processPacket(int, jpcap.JpcapHandler)"><!-- --></A><H3>processPacket</H3><PRE>public int <B>processPacket</B>(int count, <A HREF="../jpcap/JpcapHandler.html">JpcapHandler</A> handler)</PRE><DL><DD>Captures the specified number of packets consecutively.<DD><DL><DT><B>Parameters:</B><DD><CODE>count</CODE> - Maximum number of packets processing<BR> -1 means to process packets unlimitedly.<DD><CODE>handler</CODE> - The captures packets are passed to this JpcapHandler object to analyze<DT><B>Returns:</B><DD>Number of packet captured</DL></DD></DL><HR><A NAME="setFilter(java.lang.String, boolean)"><!-- --></A><H3>setFilter</H3><PRE>public void <B>setFilter</B>(java.lang.String condition, boolean optimize)</PRE><DL><DD>Sets up the capturing filter.<DD><DL><DT><B>Parameters:</B><DD><CODE>condition</CODE> - String which represents the condition of filtering. (See the document of tcpdump)<DD><CODE>optimize</CODE> - Filter is optimized if true</DL></DD></DL><HR><A NAME="updateStat()"><!-- --></A><H3>updateStat</H3><PRE>public void <B>updateStat</B>()</PRE><DL><DD>Updates <A HREF="../jpcap/Jpcap.html#received_packets"><CODE>received_packets</CODE></A> and <A HREF="../jpcap/Jpcap.html#dropped_packets"><CODE>dropped_packets</CODE></A></DL><HR><A NAME="openRawSocket()"><!-- --></A><H3>openRawSocket</H3><PRE>public void <B>openRawSocket</B>()</PRE><DL><DD>Initializes the sending socket.<BR> This method must be called before sending packets.</DL><HR><A NAME="sendPacket(jpcap.IPPacket)"><!-- --></A><H3>sendPacket</H3><PRE>public void <B>sendPacket</B>(<A HREF="../jpcap/IPPacket.html">IPPacket</A> packet)</PRE><DL><DD>Sends a IP packet.<BR> <BR> Currently only TCP/UDP/ICMP over IPv4 are supported.<BR> For ICMP, only echo packets can be sent.<DD><DL><DT><B>Parameters:</B><DD><CODE>packet</CODE> - IP packet to be sent</DL></DD></DL><HR><A NAME="getErrorMessage()"><!-- --></A><H3>getErrorMessage</H3><PRE>public java.lang.String <B>getErrorMessage</B>()</PRE><DL><DD>Returns the error message which was caused by the error while capturing.</DL><HR><A NAME="close()"><!-- --></A><H3>close</H3><PRE>public void <B>close</B>()</PRE><DL><DD>Close the interface or dump file which is currently opened.</DL><HR><A NAME="getJpcapInfo()"><!-- --></A><H3>getJpcapInfo</H3><PRE>public <A HREF="../jpcap/Jpcap.JpcapInfo.html">Jpcap.JpcapInfo</A> <B>getJpcapInfo</B>()</PRE><DL><DD>Return JpcapInfo of this Jpcap instance.</DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../jpcap/IPv6Option.html"><B>PREV CLASS</B></A> <A HREF="../jpcap/Jpcap.JpcapInfo.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Jpcap.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#inner_class_summary">INNER</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -