1 /* 2 * Copyright (C) 2023 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 import android.annotation.NonNull; 20 21 import java.net.InetSocketAddress; 22 import java.util.List; 23 24 /** 25 * Info about a mDNS reply to be sent. 26 */ 27 public final class MdnsReplyInfo { 28 @NonNull 29 public final List<MdnsRecord> answers; 30 @NonNull 31 public final List<MdnsRecord> additionalAnswers; 32 public final long sendDelayMs; 33 @NonNull 34 public final InetSocketAddress destination; 35 @NonNull 36 public final InetSocketAddress source; 37 @NonNull 38 public final List<MdnsRecord> knownAnswers; 39 MdnsReplyInfo( @onNull List<MdnsRecord> answers, @NonNull List<MdnsRecord> additionalAnswers, long sendDelayMs, @NonNull InetSocketAddress destination, @NonNull InetSocketAddress source, @NonNull List<MdnsRecord> knownAnswers)40 public MdnsReplyInfo( 41 @NonNull List<MdnsRecord> answers, 42 @NonNull List<MdnsRecord> additionalAnswers, 43 long sendDelayMs, 44 @NonNull InetSocketAddress destination, 45 @NonNull InetSocketAddress source, 46 @NonNull List<MdnsRecord> knownAnswers) { 47 this.answers = answers; 48 this.additionalAnswers = additionalAnswers; 49 this.sendDelayMs = sendDelayMs; 50 this.destination = destination; 51 this.source = source; 52 this.knownAnswers = knownAnswers; 53 } 54 55 @Override toString()56 public String toString() { 57 return "{MdnsReplyInfo: " + source + " to " + destination 58 + ", answers: " + answers.size() 59 + ", additionalAnswers: " + additionalAnswers.size() 60 + ", knownAnswers: " + knownAnswers.size() 61 + ", sendDelayMs " + sendDelayMs + "}"; 62 } 63 } 64