test_class.declarator: service
test_class.modifier: private
test_class.original_string: private AdVpnService service;
test_class.type: AdVpnService
test_class.var_name: service
test_class.declarator: thread
test_class.modifier: private
test_class.original_string: private AdVpnThread thread;
test_class.type: AdVpnThread
test_class.var_name: thread
test_class.declarator: config
test_class.modifier: private
test_class.original_string: private Configuration config;
test_class.type: Configuration
test_class.var_name: config
test_class.declarator: builder
test_class.modifier: private
test_class.original_string: private VpnService.Builder builder;
test_class.type: VpnService.Builder
test_class.var_name: builder
test_class.declarator: serversAdded
test_class.modifier: private
test_class.original_string: private List<InetAddress> serversAdded;
test_class.type: List<InetAddress>
test_class.var_name: serversAdded
test_class.file: app/src/test/java/org/jak_linux/dns66/vpn/AdVpnThreadTest.java
test_class.identifier: AdVpnThreadTest
test_case.body: @Test
      // Everything works fine, everyone gets through.
      public void testNewDNSServer() throws Exception {
          String format = "192.168.0.%d";
          byte[] ipv6Template = new byte[]{32, 1, 13, (byte) (184 & 0xFF), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  
          InetAddress i6addr = Inet6Address.getByName("::1");
          InetAddress i4addr = Inet4Address.getByName("127.0.0.1");
  
          thread.newDNSServer(builder, format, ipv6Template, i4addr);
          assertTrue(thread.upstreamDnsServers.contains(i4addr));
          assertTrue(serversAdded.contains(InetAddress.getByName("192.168.0.2")));
  
          thread.newDNSServer(builder, format, ipv6Template, i6addr);
          assertTrue(thread.upstreamDnsServers.contains(i6addr));
          assertEquals(3, ipv6Template[ipv6Template.length - 1]);
          assertTrue(serversAdded.contains(InetAddress.getByAddress(ipv6Template)));
      }
test_case.class_method_signature: AdVpnThreadTest.testNewDNSServer()
test_case.full_signature: @Test // Everything works fine, everyone gets through. public void testNewDNSServer()
test_case.identifier: testNewDNSServer
test_case.invocations: getByName getByName newDNSServer assertTrue contains assertTrue contains getByName newDNSServer assertTrue contains assertEquals assertTrue contains getByAddress
test_case.modifiers: @Test // Everything works fine, everyone gets through. public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testNewDNSServer()
focal_class.declarator: TAG = "AdVpnThread"
focal_class.modifier: private static final
focal_class.original_string: private static final String TAG = "AdVpnThread";
focal_class.type: String
focal_class.var_name: TAG
focal_class.declarator: MIN_RETRY_TIME = 5
focal_class.modifier: private static final
focal_class.original_string: private static final int MIN_RETRY_TIME = 5;
focal_class.type: int
focal_class.var_name: MIN_RETRY_TIME
focal_class.declarator: MAX_RETRY_TIME = 2 * 60
focal_class.modifier: private static final
focal_class.original_string: private static final int MAX_RETRY_TIME = 2 * 60;
focal_class.type: int
focal_class.var_name: MAX_RETRY_TIME
focal_class.declarator: RETRY_RESET_SEC = 60
focal_class.modifier: private static final
focal_class.original_string: private static final long RETRY_RESET_SEC = 60;
focal_class.type: long
focal_class.var_name: RETRY_RESET_SEC
focal_class.declarator: DNS_MAXIMUM_WAITING = 1024
focal_class.modifier: private static final
focal_class.original_string: private static final int DNS_MAXIMUM_WAITING = 1024;
focal_class.type: int
focal_class.var_name: DNS_MAXIMUM_WAITING
focal_class.declarator: DNS_TIMEOUT_SEC = 10
focal_class.modifier: private static final
focal_class.original_string: private static final long DNS_TIMEOUT_SEC = 10;
focal_class.type: long
focal_class.var_name: DNS_TIMEOUT_SEC
focal_class.declarator: upstreamDnsServers = new ArrayList<>()
focal_class.modifier: final
focal_class.original_string: final ArrayList<InetAddress> upstreamDnsServers = new ArrayList<>();
focal_class.type: ArrayList<InetAddress>
focal_class.var_name: upstreamDnsServers
focal_class.declarator: vpnService
focal_class.modifier: private final
focal_class.original_string: private final VpnService vpnService;
focal_class.type: VpnService
focal_class.var_name: vpnService
focal_class.declarator: notify
focal_class.modifier: private final
focal_class.original_string: private final Notify notify;
focal_class.type: Notify
focal_class.var_name: notify
focal_class.declarator: deviceWrites = new LinkedList<>()
focal_class.modifier: private final
focal_class.original_string: private final Queue<byte[]> deviceWrites = new LinkedList<>();
focal_class.type: Queue<byte[]>
focal_class.var_name: deviceWrites
focal_class.declarator: dnsIn = new WospList()
focal_class.modifier: private final
focal_class.original_string: private final WospList dnsIn = new WospList();
focal_class.type: WospList
focal_class.var_name: dnsIn
focal_class.declarator: dnsPacketProxy = new DnsPacketProxy(this)
focal_class.modifier: private final
focal_class.original_string: private final DnsPacketProxy dnsPacketProxy = new DnsPacketProxy(this);
focal_class.type: DnsPacketProxy
focal_class.var_name: dnsPacketProxy
focal_class.declarator: vpnWatchDog = new VpnWatchdog()
focal_class.modifier: private final
focal_class.original_string: private final VpnWatchdog vpnWatchDog = new VpnWatchdog();
focal_class.type: VpnWatchdog
focal_class.var_name: vpnWatchDog
focal_class.declarator: thread = null
focal_class.modifier: private
focal_class.original_string: private Thread thread = null;
focal_class.type: Thread
focal_class.var_name: thread
focal_class.declarator: mBlockFd = null
focal_class.modifier: private
focal_class.original_string: private FileDescriptor mBlockFd = null;
focal_class.type: FileDescriptor
focal_class.var_name: mBlockFd
focal_class.declarator: mInterruptFd = null
focal_class.modifier: private
focal_class.original_string: private FileDescriptor mInterruptFd = null;
focal_class.type: FileDescriptor
focal_class.var_name: mInterruptFd
focal_class.declarator: pcap4jFactoryClearCacheCounter = 0
focal_class.modifier: private
focal_class.original_string: private int pcap4jFactoryClearCacheCounter = 0;
focal_class.type: int
focal_class.var_name: pcap4jFactoryClearCacheCounter
focal_class.file: app/src/main/java/org/jak_linux/dns66/vpn/AdVpnThread.java
focal_class.identifier: AdVpnThread
focal_class.interfaces: implements Runnable, DnsPacketProxy.EventLoop
focal_class.class_method_signature: AdVpnThread.AdVpnThread(VpnService vpnService, Notify notify)
focal_class.full_signature: public  AdVpnThread(VpnService vpnService, Notify notify)
focal_class.identifier: AdVpnThread
focal_class.modifiers: public
focal_class.parameters: (VpnService vpnService, Notify notify)
focal_class.signature:  AdVpnThread(VpnService vpnService, Notify notify)
focal_class.class_method_signature: AdVpnThread.getDnsServers(Context context)
focal_class.full_signature: private static List<InetAddress> getDnsServers(Context context)
focal_class.identifier: getDnsServers
focal_class.modifiers: private static
focal_class.parameters: (Context context)
focal_class.return: List<InetAddress>
focal_class.signature: List<InetAddress> getDnsServers(Context context)
focal_class.class_method_signature: AdVpnThread.startThread()
focal_class.full_signature: public void startThread()
focal_class.identifier: startThread
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void startThread()
focal_class.class_method_signature: AdVpnThread.stopThread()
focal_class.full_signature: public void stopThread()
focal_class.identifier: stopThread
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void stopThread()
focal_class.class_method_signature: AdVpnThread.run()
focal_class.full_signature: @Override public synchronized void run()
focal_class.identifier: run
focal_class.modifiers: @Override public synchronized
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void run()
focal_class.class_method_signature: AdVpnThread.runVpn()
focal_class.full_signature: private void runVpn()
focal_class.identifier: runVpn
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void runVpn()
focal_class.class_method_signature: AdVpnThread.doOne(FileInputStream inputStream, FileOutputStream outFd, byte[] packet)
focal_class.full_signature: private boolean doOne(FileInputStream inputStream, FileOutputStream outFd, byte[] packet)
focal_class.identifier: doOne
focal_class.modifiers: private
focal_class.parameters: (FileInputStream inputStream, FileOutputStream outFd, byte[] packet)
focal_class.return: boolean
focal_class.signature: boolean doOne(FileInputStream inputStream, FileOutputStream outFd, byte[] packet)
focal_class.class_method_signature: AdVpnThread.writeToDevice(FileOutputStream outFd)
focal_class.full_signature: private void writeToDevice(FileOutputStream outFd)
focal_class.identifier: writeToDevice
focal_class.modifiers: private
focal_class.parameters: (FileOutputStream outFd)
focal_class.return: void
focal_class.signature: void writeToDevice(FileOutputStream outFd)
focal_class.class_method_signature: AdVpnThread.readPacketFromDevice(FileInputStream inputStream, byte[] packet)
focal_class.full_signature: private void readPacketFromDevice(FileInputStream inputStream, byte[] packet)
focal_class.identifier: readPacketFromDevice
focal_class.modifiers: private
focal_class.parameters: (FileInputStream inputStream, byte[] packet)
focal_class.return: void
focal_class.signature: void readPacketFromDevice(FileInputStream inputStream, byte[] packet)
focal_class.class_method_signature: AdVpnThread.forwardPacket(DatagramPacket outPacket, IpPacket parsedPacket)
focal_class.full_signature: public void forwardPacket(DatagramPacket outPacket, IpPacket parsedPacket)
focal_class.identifier: forwardPacket
focal_class.modifiers: public
focal_class.parameters: (DatagramPacket outPacket, IpPacket parsedPacket)
focal_class.return: void
focal_class.signature: void forwardPacket(DatagramPacket outPacket, IpPacket parsedPacket)
focal_class.class_method_signature: AdVpnThread.handleRawDnsResponse(IpPacket parsedPacket, DatagramSocket dnsSocket)
focal_class.full_signature: private void handleRawDnsResponse(IpPacket parsedPacket, DatagramSocket dnsSocket)
focal_class.identifier: handleRawDnsResponse
focal_class.modifiers: private
focal_class.parameters: (IpPacket parsedPacket, DatagramSocket dnsSocket)
focal_class.return: void
focal_class.signature: void handleRawDnsResponse(IpPacket parsedPacket, DatagramSocket dnsSocket)
focal_class.class_method_signature: AdVpnThread.queueDeviceWrite(IpPacket ipOutPacket)
focal_class.full_signature: public void queueDeviceWrite(IpPacket ipOutPacket)
focal_class.identifier: queueDeviceWrite
focal_class.modifiers: public
focal_class.parameters: (IpPacket ipOutPacket)
focal_class.return: void
focal_class.signature: void queueDeviceWrite(IpPacket ipOutPacket)
focal_class.class_method_signature: AdVpnThread.newDNSServer(VpnService.Builder builder, String format, byte[] ipv6Template, InetAddress addr)
focal_class.full_signature:  void newDNSServer(VpnService.Builder builder, String format, byte[] ipv6Template, InetAddress addr)
focal_class.identifier: newDNSServer
focal_class.parameters: (VpnService.Builder builder, String format, byte[] ipv6Template, InetAddress addr)
focal_class.return: void
focal_class.signature: void newDNSServer(VpnService.Builder builder, String format, byte[] ipv6Template, InetAddress addr)
focal_class.class_method_signature: AdVpnThread.configurePackages(VpnService.Builder builder, Configuration config)
focal_class.full_signature:  void configurePackages(VpnService.Builder builder, Configuration config)
focal_class.identifier: configurePackages
focal_class.parameters: (VpnService.Builder builder, Configuration config)
focal_class.return: void
focal_class.signature: void configurePackages(VpnService.Builder builder, Configuration config)
focal_class.class_method_signature: AdVpnThread.configure()
focal_class.full_signature: private ParcelFileDescriptor configure()
focal_class.identifier: configure
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: ParcelFileDescriptor
focal_class.signature: ParcelFileDescriptor configure()
focal_class.class_method_signature: AdVpnThread.hasIpV6Servers(Configuration config, List<InetAddress> dnsServers)
focal_class.full_signature:  boolean hasIpV6Servers(Configuration config, List<InetAddress> dnsServers)
focal_class.identifier: hasIpV6Servers
focal_class.parameters: (Configuration config, List<InetAddress> dnsServers)
focal_class.return: boolean
focal_class.signature: boolean hasIpV6Servers(Configuration config, List<InetAddress> dnsServers)
focal_method.body: void newDNSServer(VpnService.Builder builder, String format, byte[] ipv6Template, InetAddress addr) throws UnknownHostException {
          // Optimally we'd allow either one, but the forwarder checks if upstream size is empty, so
          // we really need to acquire both an ipv6 and an ipv4 subnet.
          if (addr instanceof Inet6Address && ipv6Template == null) {
              Log.i(TAG, "newDNSServer: Ignoring DNS server " + addr);
          } else if (addr instanceof Inet4Address && format == null) {
              Log.i(TAG, "newDNSServer: Ignoring DNS server " + addr);
          } else if (addr instanceof Inet4Address) {
              upstreamDnsServers.add(addr);
              String alias = String.format(format, upstreamDnsServers.size() + 1);
              Log.i(TAG, "configure: Adding DNS Server " + addr + " as " + alias);
              builder.addDnsServer(alias);
              builder.addRoute(alias, 32);
              vpnWatchDog.setTarget(InetAddress.getByName(alias));
          } else if (addr instanceof Inet6Address) {
              upstreamDnsServers.add(addr);
              ipv6Template[ipv6Template.length - 1] = (byte) (upstreamDnsServers.size() + 1);
              InetAddress i6addr = Inet6Address.getByAddress(ipv6Template);
              Log.i(TAG, "configure: Adding DNS Server " + addr + " as " + i6addr);
              builder.addDnsServer(i6addr);
              vpnWatchDog.setTarget(i6addr);
          }
      }
focal_method.class_method_signature: AdVpnThread.newDNSServer(VpnService.Builder builder, String format, byte[] ipv6Template, InetAddress addr)
focal_method.full_signature:  void newDNSServer(VpnService.Builder builder, String format, byte[] ipv6Template, InetAddress addr)
focal_method.identifier: newDNSServer
focal_method.invocations: i i add format size i addDnsServer addRoute setTarget getByName add size getByAddress i addDnsServer setTarget
focal_method.parameters: (VpnService.Builder builder, String format, byte[] ipv6Template, InetAddress addr)
focal_method.return: void
focal_method.signature: void newDNSServer(VpnService.Builder builder, String format, byte[] ipv6Template, InetAddress addr)