14d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat/*
24d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat * Copyright (C) 2009 The Android Open Source Project
34d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat *
44d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat * Licensed under the Apache License, Version 2.0 (the "License");
54d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat * you may not use this file except in compliance with the License.
64d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat * You may obtain a copy of the License at
74d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat *
84d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat *      http://www.apache.org/licenses/LICENSE-2.0
94d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat *
104d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat * Unless required by applicable law or agreed to in writing, software
114d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat * distributed under the License is distributed on an "AS IS" BASIS,
124d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat * See the License for the specific language governing permissions and
144d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat * limitations under the License.
154d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat */
164d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat
174d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehatpackage android.net;
184d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat
195ad421a3d00c92c155d57af9d1a05d81cc2fa88fLorenzo Colittiimport android.net.LinkAddress;
20c18cbfdf8d40e7a526a088225cb32341e1ea0920Lorenzo Colittiimport android.net.RouteInfo;
215ad421a3d00c92c155d57af9d1a05d81cc2fa88fLorenzo Colitti
224d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat/**
234d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat * Callback class for receiving events from an INetworkManagementService
244d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat *
254d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat * @hide
264d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat */
274d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehatinterface INetworkManagementEventObserver {
284d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat    /**
296143f5f7392fb0d3e5702a46a2415bd0ecb6efb4Mike J. Chen     * Interface configuration status has changed.
304d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat     *
314d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat     * @param iface The interface.
326143f5f7392fb0d3e5702a46a2415bd0ecb6efb4Mike J. Chen     * @param up True if the interface has been enabled.
334d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat     */
346143f5f7392fb0d3e5702a46a2415bd0ecb6efb4Mike J. Chen    void interfaceStatusChanged(String iface, boolean up);
356143f5f7392fb0d3e5702a46a2415bd0ecb6efb4Mike J. Chen
366143f5f7392fb0d3e5702a46a2415bd0ecb6efb4Mike J. Chen    /**
37f59c7d0f2ac8d489b6d8118543a57ea4a603eacfMike J. Chen     * Interface physical-layer link state has changed.  For Ethernet,
386143f5f7392fb0d3e5702a46a2415bd0ecb6efb4Mike J. Chen     * this method is invoked when the cable is plugged in or unplugged.
396143f5f7392fb0d3e5702a46a2415bd0ecb6efb4Mike J. Chen     *
406143f5f7392fb0d3e5702a46a2415bd0ecb6efb4Mike J. Chen     * @param iface The interface.
416143f5f7392fb0d3e5702a46a2415bd0ecb6efb4Mike J. Chen     * @param up  True if the physical link-layer connection signal is valid.
426143f5f7392fb0d3e5702a46a2415bd0ecb6efb4Mike J. Chen     */
43f59c7d0f2ac8d489b6d8118543a57ea4a603eacfMike J. Chen    void interfaceLinkStateChanged(String iface, boolean up);
444d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat
454d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat    /**
464d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat     * An interface has been added to the system
474d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat     *
484d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat     * @param iface The interface.
494d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat     */
504d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat    void interfaceAdded(String iface);
514d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat
524d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat    /**
534d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat     * An interface has been removed from the system
544d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat     *
554d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat     * @param iface The interface.
564d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat     */
574d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat    void interfaceRemoved(String iface);
5812b933d0d9252decaae9fee2456bb1e1cd94c085JP Abgrall
595c7daac2e3d9020185699ba554d763b825ab1778Lorenzo Colitti
605c7daac2e3d9020185699ba554d763b825ab1778Lorenzo Colitti    /**
6164483947fdb03bf838e317ac0a4af5e0f53a5bbfLorenzo Colitti     * An interface address has been added or updated.
625c7daac2e3d9020185699ba554d763b825ab1778Lorenzo Colitti     *
635c7daac2e3d9020185699ba554d763b825ab1778Lorenzo Colitti     * @param iface The interface.
6464483947fdb03bf838e317ac0a4af5e0f53a5bbfLorenzo Colitti     * @param address The address.
655c7daac2e3d9020185699ba554d763b825ab1778Lorenzo Colitti     */
6664483947fdb03bf838e317ac0a4af5e0f53a5bbfLorenzo Colitti    void addressUpdated(String iface, in LinkAddress address);
675c7daac2e3d9020185699ba554d763b825ab1778Lorenzo Colitti
685c7daac2e3d9020185699ba554d763b825ab1778Lorenzo Colitti    /**
6964483947fdb03bf838e317ac0a4af5e0f53a5bbfLorenzo Colitti     * An interface address has been removed.
705c7daac2e3d9020185699ba554d763b825ab1778Lorenzo Colitti     *
715c7daac2e3d9020185699ba554d763b825ab1778Lorenzo Colitti     * @param iface The interface.
7264483947fdb03bf838e317ac0a4af5e0f53a5bbfLorenzo Colitti     * @param address The address.
735c7daac2e3d9020185699ba554d763b825ab1778Lorenzo Colitti     */
7464483947fdb03bf838e317ac0a4af5e0f53a5bbfLorenzo Colitti    void addressRemoved(String iface, in LinkAddress address);
755c7daac2e3d9020185699ba554d763b825ab1778Lorenzo Colitti
7612b933d0d9252decaae9fee2456bb1e1cd94c085JP Abgrall    /**
7712b933d0d9252decaae9fee2456bb1e1cd94c085JP Abgrall     * A networking quota limit has been reached. The quota might not
7812b933d0d9252decaae9fee2456bb1e1cd94c085JP Abgrall     * be specific to an interface.
7912b933d0d9252decaae9fee2456bb1e1cd94c085JP Abgrall     *
8012b933d0d9252decaae9fee2456bb1e1cd94c085JP Abgrall     * @param limitName The name of the limit that triggered.
8112b933d0d9252decaae9fee2456bb1e1cd94c085JP Abgrall     * @param iface The interface on which the limit was detected.
8212b933d0d9252decaae9fee2456bb1e1cd94c085JP Abgrall     */
8312b933d0d9252decaae9fee2456bb1e1cd94c085JP Abgrall    void limitReached(String limitName, String iface);
8412b933d0d9252decaae9fee2456bb1e1cd94c085JP Abgrall
85db3c8678e5cbdfec011afaf25bde2091152c30adHaoyu Bai    /**
86db3c8678e5cbdfec011afaf25bde2091152c30adHaoyu Bai     * Interface data activity status is changed.
87db3c8678e5cbdfec011afaf25bde2091152c30adHaoyu Bai     *
88db3c8678e5cbdfec011afaf25bde2091152c30adHaoyu Bai     * @param iface The interface.
89db3c8678e5cbdfec011afaf25bde2091152c30adHaoyu Bai     * @param active  True if the interface is actively transmitting data, false if it is idle.
900535a9f7aa5d0f875b06845e9af5f6dbfc5c8a19Ashish Sharma     * @param tsNanos Elapsed realtime in nanos when the state of the network interface changed.
91db3c8678e5cbdfec011afaf25bde2091152c30adHaoyu Bai     */
920535a9f7aa5d0f875b06845e9af5f6dbfc5c8a19Ashish Sharma    void interfaceClassDataActivityChanged(String label, boolean active, long tsNanos);
935ae4a531cc31be2868f65c40e8636658f1ae2f06Lorenzo Colitti
945ae4a531cc31be2868f65c40e8636658f1ae2f06Lorenzo Colitti    /**
955ae4a531cc31be2868f65c40e8636658f1ae2f06Lorenzo Colitti     * Information about available DNS servers has been received.
965ae4a531cc31be2868f65c40e8636658f1ae2f06Lorenzo Colitti     *
975ae4a531cc31be2868f65c40e8636658f1ae2f06Lorenzo Colitti     * @param iface The interface on which the information was received.
985ae4a531cc31be2868f65c40e8636658f1ae2f06Lorenzo Colitti     * @param lifetime The time in seconds for which the DNS servers may be used.
995ae4a531cc31be2868f65c40e8636658f1ae2f06Lorenzo Colitti     * @param servers The IP addresses of the DNS servers.
1005ae4a531cc31be2868f65c40e8636658f1ae2f06Lorenzo Colitti     */
1015ae4a531cc31be2868f65c40e8636658f1ae2f06Lorenzo Colitti    void interfaceDnsServerInfo(String iface, long lifetime, in String[] servers);
102c18cbfdf8d40e7a526a088225cb32341e1ea0920Lorenzo Colitti
103c18cbfdf8d40e7a526a088225cb32341e1ea0920Lorenzo Colitti    /**
104c18cbfdf8d40e7a526a088225cb32341e1ea0920Lorenzo Colitti     * A route has been added or updated.
105c18cbfdf8d40e7a526a088225cb32341e1ea0920Lorenzo Colitti     */
106c18cbfdf8d40e7a526a088225cb32341e1ea0920Lorenzo Colitti    void routeUpdated(in RouteInfo route);
107c18cbfdf8d40e7a526a088225cb32341e1ea0920Lorenzo Colitti
108c18cbfdf8d40e7a526a088225cb32341e1ea0920Lorenzo Colitti    /**
109c18cbfdf8d40e7a526a088225cb32341e1ea0920Lorenzo Colitti     * A route has been removed.
110c18cbfdf8d40e7a526a088225cb32341e1ea0920Lorenzo Colitti     */
111c18cbfdf8d40e7a526a088225cb32341e1ea0920Lorenzo Colitti    void routeRemoved(in RouteInfo route);
1124d02d001ef6e06583e858e63e48d1aebf54ba28dSan Mehat}
113