パッケージ org.pcap4j.core

クラス PcapHandle.Builder

  • 含まれているクラス:
    PcapHandle

    public static final class PcapHandle.Builder
    extends Object
    This class is used to open (i.e. create and activate) a live capture handle as PcapNetworkInterface#openLive does but with more parameters.
    導入されたバージョン:
    pcap4j 1.2.0
    作成者:
    Kaito Yamada
    • メソッドの詳細

      • snaplen

        public PcapHandle.Builder snaplen​(int snaplen)
        パラメータ:
        snaplen - Snapshot length, which is the number of bytes captured for each packet. If this method isn't called, the platform's default snaplen will be applied at build().
        戻り値:
        this Builder object for method chaining.
      • promiscuousMode

        public PcapHandle.Builder promiscuousMode​(PcapNetworkInterface.PromiscuousMode promiscuousMode)
        パラメータ:
        promiscuousMode - Promiscuous mode. If this method isn't called, the platform's default mode will be used at build().
        戻り値:
        this Builder object for method chaining.
      • rfmon

        public PcapHandle.Builder rfmon​(boolean rfmon)
        パラメータ:
        rfmon - Whether monitor mode should be set on a PcapHandle when it is built. If true, monitor mode will be set, otherwise it will not be set. Some platforms don't support setting monitor mode. Calling this method on such platforms may cause PcapNativeException at build(). If this method isn't called, the platform's default mode will be applied at build() (if supported).
        戻り値:
        this Builder object for method chaining.
      • timeoutMillis

        public PcapHandle.Builder timeoutMillis​(int timeoutMillis)
        パラメータ:
        timeoutMillis - Read timeout. Most OSs buffer packets. The OSs pass the packets to Pcap4j after the buffer gets full or the read timeout expires. Must be non-negative. May be ignored by some OSs. 0 means disable buffering on Solaris. 0 means infinite on the other OSs. 1 through 9 means infinite on Solaris. If this method isn't called, the platform's default timeout will be applied at build().
        戻り値:
        this Builder object for method chaining.
      • bufferSize

        public PcapHandle.Builder bufferSize​(int bufferSize)
        パラメータ:
        bufferSize - The buffer size, which is in units of bytes. If this method isn't called, the platform's default buffer size will be applied at build().
        戻り値:
        this Builder object for method chaining.
      • timestampPrecision

        public PcapHandle.Builder timestampPrecision​(PcapHandle.TimestampPrecision timestampPrecision)
        パラメータ:
        timestampPrecision - The timestamp precision. If this method isn't called, microsecond precision will be applied at build().
        戻り値:
        this Builder object for method chaining.
      • direction

        public PcapHandle.Builder direction​(PcapHandle.PcapDirection direction)
        Set direction flag, which controls whether we accept only incoming packets, only outgoing packets, or both. Note that, depending on the platform, some or all direction arguments might not be supported.
        パラメータ:
        direction - The direction of packets to capture. If this method isn't called, no packets will be filtered by their direction.
        戻り値:
        this Builder object for method chaining.
      • immediateMode

        public PcapHandle.Builder immediateMode​(boolean immediateMode)
        Set immediate mode, which allows programs to process packets as soon as they arrive.
        パラメータ:
        immediateMode - Whether immediate mode should be set on a PcapHandle when it is built. If true, immediate mode will be set, otherwise it will not be set. Some platforms and library versions don't support setting immediate mode. Calling this method in such cases may cause PcapNativeException at build(). If this method isn't called, immediate mode will not be set build().
        戻り値:
        this Builder object for method chaining.