@Test public void testSetDirection() throws Exception { try { ph.setDirection(PcapDirection.OUT); fail(); } catch (PcapNativeException e) { assertTrue(e.getMessage().startsWith("Failed to set direction:")); } }
public void setDirection(PcapDirection direction) throws PcapNativeException, NotOpenException { if (direction == null) { throw new NullPointerException("direction must not be null."); } if (!open) { throw new NotOpenException(); } if (!handleLock.readLock().tryLock()) { throw new NotOpenException(); } try { if (!open) { throw new NotOpenException(); } int rc = NativeMappings.pcap_setdirection(handle, direction.getValue()); if (rc < 0) { throw new PcapNativeException("Failed to set direction: " + getError(), rc); } } finally { handleLock.readLock().unlock(); } }
PcapHandle implements Closeable { public void setDirection(PcapDirection direction) throws PcapNativeException, NotOpenException { if (direction == null) { throw new NullPointerException("direction must not be null."); } if (!open) { throw new NotOpenException(); } if (!handleLock.readLock().tryLock()) { throw new NotOpenException(); } try { if (!open) { throw new NotOpenException(); } int rc = NativeMappings.pcap_setdirection(handle, direction.getValue()); if (rc < 0) { throw new PcapNativeException("Failed to set direction: " + getError(), rc); } } finally { handleLock.readLock().unlock(); } } }
PcapHandle implements Closeable { public void setDirection(PcapDirection direction) throws PcapNativeException, NotOpenException { if (direction == null) { throw new NullPointerException("direction must not be null."); } if (!open) { throw new NotOpenException(); } if (!handleLock.readLock().tryLock()) { throw new NotOpenException(); } try { if (!open) { throw new NotOpenException(); } int rc = NativeMappings.pcap_setdirection(handle, direction.getValue()); if (rc < 0) { throw new PcapNativeException("Failed to set direction: " + getError(), rc); } } finally { handleLock.readLock().unlock(); } } PcapHandle(Pointer handle, TimestampPrecision timestampPrecision); private  PcapHandle(Builder builder); }
PcapHandle implements Closeable { public void setDirection(PcapDirection direction) throws PcapNativeException, NotOpenException { if (direction == null) { throw new NullPointerException("direction must not be null."); } if (!open) { throw new NotOpenException(); } if (!handleLock.readLock().tryLock()) { throw new NotOpenException(); } try { if (!open) { throw new NotOpenException(); } int rc = NativeMappings.pcap_setdirection(handle, direction.getValue()); if (rc < 0) { throw new PcapNativeException("Failed to set direction: " + getError(), rc); } } finally { handleLock.readLock().unlock(); } } PcapHandle(Pointer handle, TimestampPrecision timestampPrecision); private  PcapHandle(Builder builder); DataLinkType getDlt(); void setDlt(DataLinkType dlt); boolean isOpen(); String getFilteringExpression(); TimestampPrecision getTimestampPrecision(); void setDirection(PcapDirection direction); Timestamp getTimestamp(); Integer getOriginalLength(); int getSnapshot(); SwappedType isSwapped(); int getMajorVersion(); int getMinorVersion(); BpfProgram compileFilter(String bpfExpression, BpfCompileMode mode, Inet4Address netmask); void setFilter(String bpfExpression, BpfCompileMode mode, Inet4Address netmask); void setFilter(String bpfExpression, BpfCompileMode mode); void setFilter(BpfProgram prog); void setBlockingMode(BlockingMode mode); BlockingMode getBlockingMode(); Packet getNextPacket(); byte[] getNextRawPacket(); Packet getNextPacketEx(); byte[] getNextRawPacketEx(); void loop(int packetCount, PacketListener listener); void loop(int packetCount, PacketListener listener, Executor executor); void loop(int packetCount, RawPacketListener listener); void loop(int packetCount, RawPacketListener listener, Executor executor); int dispatch(int packetCount, PacketListener listener); int dispatch(int packetCount, PacketListener listener, Executor executor); int dispatch(int packetCount, RawPacketListener listener); int dispatch(int packetCount, RawPacketListener listener, Executor executor); PcapDumper dumpOpen(String filePath); void loop(int packetCount, PcapDumper dumper); void breakLoop(); void sendPacket(Packet packet); void sendPacket(byte[] bytes); void sendPacket(byte[] bytes, int len); PcapStat getStats(); List<DataLinkType> listDatalinks(); String getError(); @Override void close(); @Override String toString(); }
PcapHandle implements Closeable { public void setDirection(PcapDirection direction) throws PcapNativeException, NotOpenException { if (direction == null) { throw new NullPointerException("direction must not be null."); } if (!open) { throw new NotOpenException(); } if (!handleLock.readLock().tryLock()) { throw new NotOpenException(); } try { if (!open) { throw new NotOpenException(); } int rc = NativeMappings.pcap_setdirection(handle, direction.getValue()); if (rc < 0) { throw new PcapNativeException("Failed to set direction: " + getError(), rc); } } finally { handleLock.readLock().unlock(); } } PcapHandle(Pointer handle, TimestampPrecision timestampPrecision); private  PcapHandle(Builder builder); DataLinkType getDlt(); void setDlt(DataLinkType dlt); boolean isOpen(); String getFilteringExpression(); TimestampPrecision getTimestampPrecision(); void setDirection(PcapDirection direction); Timestamp getTimestamp(); Integer getOriginalLength(); int getSnapshot(); SwappedType isSwapped(); int getMajorVersion(); int getMinorVersion(); BpfProgram compileFilter(String bpfExpression, BpfCompileMode mode, Inet4Address netmask); void setFilter(String bpfExpression, BpfCompileMode mode, Inet4Address netmask); void setFilter(String bpfExpression, BpfCompileMode mode); void setFilter(BpfProgram prog); void setBlockingMode(BlockingMode mode); BlockingMode getBlockingMode(); Packet getNextPacket(); byte[] getNextRawPacket(); Packet getNextPacketEx(); byte[] getNextRawPacketEx(); void loop(int packetCount, PacketListener listener); void loop(int packetCount, PacketListener listener, Executor executor); void loop(int packetCount, RawPacketListener listener); void loop(int packetCount, RawPacketListener listener, Executor executor); int dispatch(int packetCount, PacketListener listener); int dispatch(int packetCount, PacketListener listener, Executor executor); int dispatch(int packetCount, RawPacketListener listener); int dispatch(int packetCount, RawPacketListener listener, Executor executor); PcapDumper dumpOpen(String filePath); void loop(int packetCount, PcapDumper dumper); void breakLoop(); void sendPacket(Packet packet); void sendPacket(byte[] bytes); void sendPacket(byte[] bytes, int len); PcapStat getStats(); List<DataLinkType> listDatalinks(); String getError(); @Override void close(); @Override String toString(); static final Inet4Address PCAP_NETMASK_UNKNOWN; }