diff options
author | markchien <markchien@google.com> | 2019-09-09 20:50:49 +0800 |
---|---|---|
committer | markchien <markchien@google.com> | 2019-10-24 14:20:52 +0800 |
commit | 08cc03051ada5fb55f8d16b94305af5a87b7783b (patch) | |
tree | be4de52b2bc00c0097fd7abb2e2abc1e8d352521 /packages/Tethering/src/android/net/util/InterfaceSet.java | |
parent | a6ba54d59de5f0e93a603b0a6dddcdc8807cfbca (diff) |
[Tether03] Migrate IpServer into module
Add IpServer which is used to serve ip configuration, dhcp, dns proxy
and nat for downstream interface.
Bug: 136040414
Test: -build, flash, boot
-atest TetheringTests
-atest FrameworksNetTests
Change-Id: I23652ae0b9509abe7d38da96d523eb22ab00a343
Diffstat (limited to 'packages/Tethering/src/android/net/util/InterfaceSet.java')
-rw-r--r-- | packages/Tethering/src/android/net/util/InterfaceSet.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/packages/Tethering/src/android/net/util/InterfaceSet.java b/packages/Tethering/src/android/net/util/InterfaceSet.java new file mode 100644 index 000000000000..758978711bd4 --- /dev/null +++ b/packages/Tethering/src/android/net/util/InterfaceSet.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.net.util; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import java.util.StringJoiner; + + +/** + * @hide + */ +public class InterfaceSet { + public final Set<String> ifnames; + + public InterfaceSet(String... names) { + final Set<String> nameSet = new HashSet<>(); + for (String name : names) { + if (name != null) nameSet.add(name); + } + ifnames = Collections.unmodifiableSet(nameSet); + } + + @Override + public String toString() { + final StringJoiner sj = new StringJoiner(",", "[", "]"); + for (String ifname : ifnames) sj.add(ifname); + return sj.toString(); + } + + @Override + public boolean equals(Object obj) { + return obj != null + && obj instanceof InterfaceSet + && ifnames.equals(((InterfaceSet) obj).ifnames); + } +} |