RouteInfo
class RouteInfo : Parcelable
| kotlin.Any | |
| ↳ | android.net.RouteInfo |
Represents a network route.
This is used both to describe static network configuration and live network configuration information. A route contains three pieces of information:
- a destination
IpPrefixspecifying the network destinations covered by this route. If this isnullit indicates a default route of the address family (IPv4 or IPv6) implied by the gateway IP address. - a gateway
InetAddressindicating the next hop to use. If this isnullit indicates a directly-connected route. - an interface (which may be unspecified).
null, but not both. If the destination and gateway are both specified, they must be of the same address family (IPv4 or IPv6).
Summary
| Constants | |
|---|---|
| static Int |
Throw route. |
| static Int |
Unicast route. |
| static Int |
Unreachable route. |
| Inherited constants | |
|---|---|
| Public methods | |
|---|---|
| Int |
Implement the Parcelable interface |
| Boolean |
Compares this RouteInfo object against the specified object and indicates if they are equal. |
| IpPrefix |
Retrieves the destination address and prefix length in the form of an |
| InetAddress? |
Retrieves the gateway or next hop |
| String? |
Retrieves the interface used for this route if specified, else |
| Int |
getType()Retrieves the type of this route. |
| Boolean |
Indicates if this route has a next hop ( |
| Int |
hashCode()Returns a hashcode for this |
| Boolean |
Indicates if this route is a default route (ie, has no destination specified). |
| Boolean |
matches(destination: InetAddress!)Determines whether the destination and prefix of this route includes the specified address. |
| String |
toString()Returns a human-readable description of this object. |
| Unit |
writeToParcel(dest: Parcel, flags: Int)Implement the Parcelable interface |
| Properties | |
|---|---|
| static Parcelable.Creator<RouteInfo!> |
Implement the Parcelable interface. |
Constants
RTN_THROW
static val RTN_THROW: Int
Throw route. Indicates that routing information about this destination is not in this table. Routing lookup should continue in another table.
Value: 9RTN_UNICAST
static val RTN_UNICAST: Int
Unicast route. Indicates that destination is reachable directly or via gateway.
Value: 1RTN_UNREACHABLE
static val RTN_UNREACHABLE: Int
Unreachable route. Indicates that destination is unreachable.
Value: 7Public methods
describeContents
fun describeContents(): Int
Implement the Parcelable interface
| Return | |
|---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
equals
fun equals(other: Any?): Boolean
Compares this RouteInfo object against the specified object and indicates if they are equal.
| Parameters | |
|---|---|
obj |
This value may be null. |
| Return | |
|---|---|
Boolean |
true if the objects are equal, false otherwise. |
getDestination
fun getDestination(): IpPrefix
Retrieves the destination address and prefix length in the form of an IpPrefix.
| Return | |
|---|---|
IpPrefix |
IpPrefix specifying the destination. This is never null. |
getGateway
fun getGateway(): InetAddress?
Retrieves the gateway or next hop InetAddress for this route.
| Return | |
|---|---|
InetAddress? |
InetAddress specifying the gateway or next hop. This may be null for a directly-connected route." |
getInterface
fun getInterface(): String?
Retrieves the interface used for this route if specified, else null.
| Return | |
|---|---|
String? |
The name of the interface used for this route. |
getType
fun getType(): Int
Retrieves the type of this route.
| Return | |
|---|---|
Int |
The type of this route; one of the RTN_xxx constants defined in this class. Value is android.net.RouteInfo#RTN_UNICAST, android.net.RouteInfo#RTN_UNREACHABLE, or android.net.RouteInfo#RTN_THROW |
hasGateway
fun hasGateway(): Boolean
Indicates if this route has a next hop (true) or is directly-connected (false).
| Return | |
|---|---|
Boolean |
true if a gateway is specified |
hashCode
fun hashCode(): Int
Returns a hashcode for this RouteInfo object.
| Return | |
|---|---|
Int |
a hash code value for this object. |
isDefaultRoute
fun isDefaultRoute(): Boolean
Indicates if this route is a default route (ie, has no destination specified).
| Return | |
|---|---|
Boolean |
true if the destination has a prefix length of 0. |
matches
fun matches(destination: InetAddress!): Boolean
Determines whether the destination and prefix of this route includes the specified address.
| Parameters | |
|---|---|
destination |
InetAddress!: A InetAddress to test to see if it would match this route. |
| Return | |
|---|---|
Boolean |
true if the destination and prefix length cover the given address. |
toString
fun toString(): String
Returns a human-readable description of this object.
| Return | |
|---|---|
String |
a string representation of the object. |
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Implement the Parcelable interface
| Parameters | |
|---|---|
dest |
Parcel: The Parcel in which the object should be written. This value cannot be null. |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |
Properties
CREATOR
static val CREATOR: Parcelable.Creator<RouteInfo!>
Implement the Parcelable interface.