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 android.net; 18 19 import android.net.RouteInfo; 20 21 /** @hide */ 22 interface IRoutingCoordinator { 23 /** 24 * Add a route for specific network 25 * 26 * @param netId the network to add the route to 27 * @param route the route to add 28 * @throws ServiceSpecificException in case of failure, with an error code indicating the 29 * cause of the failure. 30 */ addRoute(int netId, in RouteInfo route)31 void addRoute(int netId, in RouteInfo route); 32 33 /** 34 * Remove a route for specific network 35 * 36 * @param netId the network to remove the route from 37 * @param route the route to remove 38 * @throws ServiceSpecificException in case of failure, with an error code indicating the 39 * cause of the failure. 40 */ removeRoute(int netId, in RouteInfo route)41 void removeRoute(int netId, in RouteInfo route); 42 43 /** 44 * Update a route for specific network 45 * 46 * @param netId the network to update the route for 47 * @param route parcelable with route information 48 * @throws ServiceSpecificException in case of failure, with an error code indicating the 49 * cause of the failure. 50 */ updateRoute(int netId, in RouteInfo route)51 void updateRoute(int netId, in RouteInfo route); 52 53 /** 54 * Adds an interface to a network. The interface must not be assigned to any network, including 55 * the specified network. 56 * 57 * @param netId the network to add the interface to. 58 * @param iface the name of the interface to add. 59 * 60 * @throws ServiceSpecificException in case of failure, with an error code corresponding to the 61 * unix errno. 62 */ addInterfaceToNetwork(int netId, in String iface)63 void addInterfaceToNetwork(int netId, in String iface); 64 65 /** 66 * Removes an interface from a network. The interface must be assigned to the specified network. 67 * 68 * @param netId the network to remove the interface from. 69 * @param iface the name of the interface to remove. 70 * 71 * @throws ServiceSpecificException in case of failure, with an error code corresponding to the 72 * unix errno. 73 */ removeInterfaceFromNetwork(int netId, in String iface)74 void removeInterfaceFromNetwork(int netId, in String iface); 75 76 /** 77 * Add forwarding ip rule 78 * 79 * @param fromIface interface name to add forwarding ip rule 80 * @param toIface interface name to add forwarding ip rule 81 * @throws ServiceSpecificException in case of failure, with an error code indicating the 82 * cause of the failure. 83 */ addInterfaceForward(in String fromIface, in String toIface)84 void addInterfaceForward(in String fromIface, in String toIface); 85 86 /** 87 * Remove forwarding ip rule 88 * 89 * @param fromIface interface name to remove forwarding ip rule 90 * @param toIface interface name to remove forwarding ip rule 91 * @throws ServiceSpecificException in case of failure, with an error code indicating the 92 * cause of the failure. 93 */ removeInterfaceForward(in String fromIface, in String toIface)94 void removeInterfaceForward(in String fromIface, in String toIface); 95 } 96