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 sleepTimeForSocketThreadMs()53 public static long sleepTimeForSocketThreadMs() { 54 return 20_000L; 55 } 56 checkMulticastResponse()57 public static boolean checkMulticastResponse() { 58 return false; 59 } 60 useSeparateSocketToSendUnicastQuery()61 public static boolean useSeparateSocketToSendUnicastQuery() { 62 return false; 63 } 64 checkMulticastResponseIntervalMs()65 public static long checkMulticastResponseIntervalMs() { 66 return 10_000L; 67 } 68 clearMdnsPacketQueueAfterDiscoveryStops()69 public static boolean clearMdnsPacketQueueAfterDiscoveryStops() { 70 return true; 71 } 72 allowAddMdnsPacketAfterDiscoveryStops()73 public static boolean allowAddMdnsPacketAfterDiscoveryStops() { 74 return false; 75 } 76 mdnsPacketQueueMaxSize()77 public static int mdnsPacketQueueMaxSize() { 78 return Integer.MAX_VALUE; 79 } 80 preferIpv6()81 public static boolean preferIpv6() { 82 return false; 83 } 84 removeServiceAfterTtlExpires()85 public static boolean removeServiceAfterTtlExpires() { 86 return false; 87 } 88 allowNetworkInterfaceIndexPropagation()89 public static boolean allowNetworkInterfaceIndexPropagation() { 90 return true; 91 } 92 allowMultipleSrvRecordsPerHost()93 public static boolean allowMultipleSrvRecordsPerHost() { 94 return true; 95 } 96 }