1/*
2 * Copyright (C) 2017 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
17package com.android.server.connectivity.tethering;
18
19import android.content.Context;
20import android.net.INetd;
21import android.net.ip.RouterAdvertisementDaemon;
22import android.net.util.InterfaceParams;
23import android.net.util.NetdService;
24import android.os.Handler;
25import android.net.util.SharedLog;
26
27import com.android.internal.util.StateMachine;
28
29import java.util.ArrayList;
30
31
32/**
33 * Capture tethering dependencies, for injection.
34 *
35 * @hide
36 */
37public class TetheringDependencies {
38    public OffloadHardwareInterface getOffloadHardwareInterface(Handler h, SharedLog log) {
39        return new OffloadHardwareInterface(h, log);
40    }
41
42    public UpstreamNetworkMonitor getUpstreamNetworkMonitor(Context ctx, StateMachine target,
43            SharedLog log, int what) {
44        return new UpstreamNetworkMonitor(ctx, target, log, what);
45    }
46
47    public IPv6TetheringCoordinator getIPv6TetheringCoordinator(
48            ArrayList<TetherInterfaceStateMachine> notifyList, SharedLog log) {
49        return new IPv6TetheringCoordinator(notifyList, log);
50    }
51
52    public RouterAdvertisementDaemon getRouterAdvertisementDaemon(InterfaceParams ifParams) {
53        return new RouterAdvertisementDaemon(ifParams);
54    }
55
56    public InterfaceParams getInterfaceParams(String ifName) {
57        return InterfaceParams.getByName(ifName);
58    }
59
60    public INetd getNetdService() {
61        return NetdService.getInstance();
62    }
63
64    public boolean isTetheringSupported() {
65        return true;
66    }
67}
68