コード例 #1
0
  public void startModules(
      Collection<ICaptureInterface> enabledInterfaces,
      long spaceId,
      long realmId,
      boolean createInterfaceEntities) {
    if (running) return;

    final Set<WifiDaemonInterface> ifaces = new HashSet<WifiDaemonInterface>();
    for (ICaptureInterface iface : enabledInterfaces) {
      if (!(iface instanceof IWirelessCaptureInterface)) {
        // XXX
      }
      final IWirelessCaptureInterface wifiInterface = (IWirelessCaptureInterface) iface;
      if (createInterfaceEntities) {
        final NetworkInterfaceEntity interfaceEntity =
            daemon.createNetworkInterfaceEntity(realmId, spaceId, iface.getName());
        ifaces.add(new WifiDaemonInterface(wifiInterface, interfaceEntity.getId()));
      } else {
        ifaces.add(new WifiDaemonInterface(wifiInterface, realmId));
      }
    }

    for (EnabledWifiModule module : enabledModules) {
      module.start((IWifiSniffingEngine) daemon.getSniffingEngine(), ifaces, spaceId);
    }
    running = true;
  }
コード例 #2
0
 private void enableModule(IWirelessSniffingModule module) {
   checkValidStateChange(module);
   synchronized (enabledModules) {
     if (findEnabledModule(module) != null) return;
     enabledModules.add(new EnabledWifiModule(module, daemon.getLogger()));
   }
 }
コード例 #3
0
  void setWirelessModuleEnableState(IMessenger messenger, SetWirelessModuleEnableState msg)
      throws MessengerException {
    for (ModuleRecord record : msg.getModuleRecords()) {
      final IWirelessSniffingModule sniffingModule = modulesByName.get(record.getName());
      if (sniffingModule == null) {
        final String error = "No wireless sniffing module found with name " + record.getName();
        daemon.getLogger().warning(error);
        messenger.respondError(msg, error);
        return;
      }

      setModuleEnabled(sniffingModule, record.isEnabled());
      messenger.respondOk(msg);
    }
  }