@Ignore @Test public void testServer() throws Exception { String INTERFACE_NAME = "eth0"; FixedStoreLeaseManager manager = newLeaseManager(INTERFACE_NAME); DhcpServer server = new DhcpServer(manager); server.run(); }
public void run() throws Exception { for (PcapNetworkInterface iface : Pcaps.findAllDevs()) LOG.info(iface.getName() + " : " + iface); PcapNetworkInterface iface = Pcaps.getDevByName("eth0"); LOG.info("Using " + iface.getName() + " : " + iface); InterfaceAddress[] interfaceAddresses = toInterfaceAddresses(iface); LOG.info("Addresses are " + Arrays.toString(interfaceAddresses)); PcapHandle handle = iface.openLive(4096, PcapNetworkInterface.PromiscuousMode.PROMISCUOUS, 0); handle.loop(10, new DhcpPacketListener(service, interfaceAddresses)); }
DhcpServer { public void run() throws Exception { for (PcapNetworkInterface iface : Pcaps.findAllDevs()) LOG.info(iface.getName() + " : " + iface); PcapNetworkInterface iface = Pcaps.getDevByName("eth0"); LOG.info("Using " + iface.getName() + " : " + iface); InterfaceAddress[] interfaceAddresses = toInterfaceAddresses(iface); LOG.info("Addresses are " + Arrays.toString(interfaceAddresses)); PcapHandle handle = iface.openLive(4096, PcapNetworkInterface.PromiscuousMode.PROMISCUOUS, 0); handle.loop(10, new DhcpPacketListener(service, interfaceAddresses)); } }
DhcpServer { public void run() throws Exception { for (PcapNetworkInterface iface : Pcaps.findAllDevs()) LOG.info(iface.getName() + " : " + iface); PcapNetworkInterface iface = Pcaps.getDevByName("eth0"); LOG.info("Using " + iface.getName() + " : " + iface); InterfaceAddress[] interfaceAddresses = toInterfaceAddresses(iface); LOG.info("Addresses are " + Arrays.toString(interfaceAddresses)); PcapHandle handle = iface.openLive(4096, PcapNetworkInterface.PromiscuousMode.PROMISCUOUS, 0); handle.loop(10, new DhcpPacketListener(service, interfaceAddresses)); } DhcpServer(@Nonnull DhcpService service, @Nonnegative int port);  DhcpServer(@Nonnull DhcpService service);  DhcpServer(@Nonnull LeaseManager manager, @Nonnegative int port);  DhcpServer(@Nonnull LeaseManager manager); }
DhcpServer { public void run() throws Exception { for (PcapNetworkInterface iface : Pcaps.findAllDevs()) LOG.info(iface.getName() + " : " + iface); PcapNetworkInterface iface = Pcaps.getDevByName("eth0"); LOG.info("Using " + iface.getName() + " : " + iface); InterfaceAddress[] interfaceAddresses = toInterfaceAddresses(iface); LOG.info("Addresses are " + Arrays.toString(interfaceAddresses)); PcapHandle handle = iface.openLive(4096, PcapNetworkInterface.PromiscuousMode.PROMISCUOUS, 0); handle.loop(10, new DhcpPacketListener(service, interfaceAddresses)); } DhcpServer(@Nonnull DhcpService service, @Nonnegative int port);  DhcpServer(@Nonnull DhcpService service);  DhcpServer(@Nonnull LeaseManager manager, @Nonnegative int port);  DhcpServer(@Nonnull LeaseManager manager); @PostConstruct void start(); @PreDestroy void stop(); void run(); }
DhcpServer { public void run() throws Exception { for (PcapNetworkInterface iface : Pcaps.findAllDevs()) LOG.info(iface.getName() + " : " + iface); PcapNetworkInterface iface = Pcaps.getDevByName("eth0"); LOG.info("Using " + iface.getName() + " : " + iface); InterfaceAddress[] interfaceAddresses = toInterfaceAddresses(iface); LOG.info("Addresses are " + Arrays.toString(interfaceAddresses)); PcapHandle handle = iface.openLive(4096, PcapNetworkInterface.PromiscuousMode.PROMISCUOUS, 0); handle.loop(10, new DhcpPacketListener(service, interfaceAddresses)); } DhcpServer(@Nonnull DhcpService service, @Nonnegative int port);  DhcpServer(@Nonnull DhcpService service);  DhcpServer(@Nonnull LeaseManager manager, @Nonnegative int port);  DhcpServer(@Nonnull LeaseManager manager); @PostConstruct void start(); @PreDestroy void stop(); void run();  }