1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.connectivity.mdns; 18 19 /** 20 * mDNS configuration values. 21 * 22 * TODO: consider making some of these adjustable via flags. 23 */ 24 public class MdnsConfigs { castShellEmulatorMdnsPorts()25 public static String[] castShellEmulatorMdnsPorts() { 26 return new String[0]; 27 } 28 initialTimeBetweenBurstsMs()29 public static long initialTimeBetweenBurstsMs() { 30 return 5000L; 31 } 32 timeBetweenBurstsMs()33 public static long timeBetweenBurstsMs() { 34 return 20_000L; 35 } 36 queriesPerBurst()37 public static int queriesPerBurst() { 38 return 3; 39 } 40 timeBetweenQueriesInBurstMs()41 public static long timeBetweenQueriesInBurstMs() { 42 return 1000L; 43 } 44 queriesPerBurstPassive()45 public static int queriesPerBurstPassive() { 46 return 1; 47 } 48 alwaysAskForUnicastResponseInEachBurst()49 public static boolean alwaysAskForUnicastResponseInEachBurst() { 50 return false; 51 } 52 useSessionIdToScheduleMdnsTask()53 public static boolean useSessionIdToScheduleMdnsTask() { 54 return false; 55 } 56 shouldCancelScanTaskWhenFutureIsNull()57 public static boolean shouldCancelScanTaskWhenFutureIsNull() { 58 return false; 59 } 60 sleepTimeForSocketThreadMs()61 public static long sleepTimeForSocketThreadMs() { 62 return 20_000L; 63 } 64 checkMulticastResponse()65 public static boolean checkMulticastResponse() { 66 return false; 67 } 68 useSeparateSocketToSendUnicastQuery()69 public static boolean useSeparateSocketToSendUnicastQuery() { 70 return false; 71 } 72 checkMulticastResponseIntervalMs()73 public static long checkMulticastResponseIntervalMs() { 74 return 10_000L; 75 } 76 clearMdnsPacketQueueAfterDiscoveryStops()77 public static boolean clearMdnsPacketQueueAfterDiscoveryStops() { 78 return true; 79 } 80 allowAddMdnsPacketAfterDiscoveryStops()81 public static boolean allowAddMdnsPacketAfterDiscoveryStops() { 82 return false; 83 } 84 mdnsPacketQueueMaxSize()85 public static int mdnsPacketQueueMaxSize() { 86 return Integer.MAX_VALUE; 87 } 88 preferIpv6()89 public static boolean preferIpv6() { 90 return false; 91 } 92 removeServiceAfterTtlExpires()93 public static boolean removeServiceAfterTtlExpires() { 94 return false; 95 } 96 allowNetworkInterfaceIndexPropagation()97 public static boolean allowNetworkInterfaceIndexPropagation() { 98 return true; 99 } 100 allowMultipleSrvRecordsPerHost()101 public static boolean allowMultipleSrvRecordsPerHost() { 102 return true; 103 } 104 }