Added in API level 31

Builder


class Builder
kotlin.Any
   ↳ android.net.ipsec.ike.TunnelModeChildSessionParams.Builder

This class can be used to incrementally construct a TunnelModeChildSessionParams.

Summary

Public constructors

Create a Builder for negotiating a tunnel mode Child Session.

Construct Builder from the TunnelModeChildSessionParams object.

Public methods
TunnelModeChildSessionParams.Builder

Adds an Child SA proposal to the TunnelModeChildSessionParams being built.

TunnelModeChildSessionParams.Builder

Adds an inbound IkeTrafficSelector to the TunnelModeChildSessionParams being built.

TunnelModeChildSessionParams.Builder

Adds an internal IP address request to the TunnelModeChildSessionParams being built.

TunnelModeChildSessionParams.Builder

Adds a specific internal IPv4 address request to the TunnelModeChildSessionParams being built.

TunnelModeChildSessionParams.Builder

Adds a specific internal IPv6 address request to the TunnelModeChildSessionParams being built.

TunnelModeChildSessionParams.Builder

Adds an internal DHCP server request to the TunnelModeChildSessionParams being built.

TunnelModeChildSessionParams.Builder

Adds an internal DNS server request to the TunnelModeChildSessionParams being built.

TunnelModeChildSessionParams.Builder

Adds an outbound IkeTrafficSelector to the TunnelModeChildSessionParams being built.

TunnelModeChildSessionParams

Validates and builds the TunnelModeChildSessionParams.

TunnelModeChildSessionParams.Builder
setLifetimeSeconds(hardLifetimeSeconds: Int, softLifetimeSeconds: Int)

Sets hard and soft lifetimes.

Public constructors

Builder

Added in API level 31
Builder()

Create a Builder for negotiating a tunnel mode Child Session.

Builder

Added in API level 31
Builder(childParams: TunnelModeChildSessionParams)

Construct Builder from the TunnelModeChildSessionParams object.

Parameters
childParams TunnelModeChildSessionParams: the object this Builder will be constructed with. This value cannot be null.

Public methods

addChildSaProposal

Added in API level 31
fun addChildSaProposal(proposal: ChildSaProposal): TunnelModeChildSessionParams.Builder

Adds an Child SA proposal to the TunnelModeChildSessionParams being built.

Parameters
proposal ChildSaProposal: Child SA proposal. This value cannot be null.
Return
TunnelModeChildSessionParams.Builder Builder this, to facilitate chaining. This value cannot be null.

addInboundTrafficSelectors

Added in API level 31
fun addInboundTrafficSelectors(trafficSelector: IkeTrafficSelector): TunnelModeChildSessionParams.Builder

Adds an inbound IkeTrafficSelector to the TunnelModeChildSessionParams being built.

This method allows callers to limit the inbound traffic transmitted over the Child Session to the given range. The IKE server may further narrow the range. Callers should refer to ChildSessionConfiguration for the negotiated traffic selectors.

If no inbound IkeTrafficSelector is provided, a default value will be used that covers all IP addresses and ports.

Parameters
trafficSelector IkeTrafficSelector: the inbound IkeTrafficSelector. This value cannot be null.
Return
TunnelModeChildSessionParams.Builder Builder this, to facilitate chaining. This value cannot be null.

addInternalAddressRequest

Added in API level 31
fun addInternalAddressRequest(addressFamily: Int): TunnelModeChildSessionParams.Builder

Adds an internal IP address request to the TunnelModeChildSessionParams being built.

Parameters
addressFamily Int: the address family. Only AF_INET and AF_INET6 are allowed
Return
TunnelModeChildSessionParams.Builder Builder this, to facilitate chaining. This value cannot be null.

addInternalAddressRequest

Added in API level 31
fun addInternalAddressRequest(address: Inet4Address): TunnelModeChildSessionParams.Builder

Adds a specific internal IPv4 address request to the TunnelModeChildSessionParams being built.

Parameters
address Inet4Address: the requested IPv4 address. This value cannot be null.
Return
TunnelModeChildSessionParams.Builder Builder this, to facilitate chaining. This value cannot be null.

addInternalAddressRequest

Added in API level 31
fun addInternalAddressRequest(
    address: Inet6Address,
    prefixLen: Int
): TunnelModeChildSessionParams.Builder

Adds a specific internal IPv6 address request to the TunnelModeChildSessionParams being built.

Parameters
address Inet6Address: the requested IPv6 address. This value cannot be null.
prefixLen Int: length of the IPv6 address prefix length.
Return
TunnelModeChildSessionParams.Builder Builder this, to facilitate chaining. This value cannot be null.

addInternalDhcpServerRequest

Added in API level 31
fun addInternalDhcpServerRequest(addressFamily: Int): TunnelModeChildSessionParams.Builder

Adds an internal DHCP server request to the TunnelModeChildSessionParams being built.

Only DHCPv4 server requests are supported.

Parameters
addressFamily Int: the address family. Only AF_INET is allowed
Return
TunnelModeChildSessionParams.Builder Builder this, to facilitate chaining. This value cannot be null.

addInternalDnsServerRequest

Added in API level 31
fun addInternalDnsServerRequest(addressFamily: Int): TunnelModeChildSessionParams.Builder

Adds an internal DNS server request to the TunnelModeChildSessionParams being built.

Parameters
addressFamily Int: the address family. Only AF_INET and AF_INET6 are allowed
Return
TunnelModeChildSessionParams.Builder Builder this, to facilitate chaining. This value cannot be null.

addOutboundTrafficSelectors

Added in API level 31
fun addOutboundTrafficSelectors(trafficSelector: IkeTrafficSelector): TunnelModeChildSessionParams.Builder

Adds an outbound IkeTrafficSelector to the TunnelModeChildSessionParams being built.

This method allows callers to limit the outbound traffic transmitted over the Child Session to the given range. The IKE server may further narrow the range. Callers should refer to ChildSessionConfiguration for the negotiated traffic selectors.

If no outbound IkeTrafficSelector is provided, a default value will be used that covers all IP addresses and ports.

Parameters
trafficSelector IkeTrafficSelector: the outbound IkeTrafficSelector. This value cannot be null.
Return
TunnelModeChildSessionParams.Builder Builder this, to facilitate chaining. This value cannot be null.

build

Added in API level 31
fun build(): TunnelModeChildSessionParams

Validates and builds the TunnelModeChildSessionParams.

Return
TunnelModeChildSessionParams the validated TunnelModeChildSessionParams. This value cannot be null.

setLifetimeSeconds

Added in API level 31
fun setLifetimeSeconds(
    hardLifetimeSeconds: Int,
    softLifetimeSeconds: Int
): TunnelModeChildSessionParams.Builder

Sets hard and soft lifetimes.

Lifetimes will not be negotiated with the remote IKE server.

Parameters
hardLifetimeSeconds Int: number of seconds after which Child SA will expire. Defaults to 7200 seconds (2 hours). Considering IPsec packet lifetime, IKE library requires hard lifetime to be a value from 300 seconds (5 minutes) to 14400 seconds (4 hours), inclusive. Value is between CHILD_HARD_LIFETIME_SEC_MINIMUM and CHILD_HARD_LIFETIME_SEC_MAXIMUM inclusive
softLifetimeSeconds Int: number of seconds after which Child SA will request rekey. Defaults to 3600 seconds (1 hour). MUST be at least 120 seconds (2 minutes), and at least 60 seconds (1 minute) shorter than the hard lifetime. Value is between CHILD_SOFT_LIFETIME_SEC_MINIMUM and CHILD_HARD_LIFETIME_SEC_MAXIMUM inclusive
Return
TunnelModeChildSessionParams.Builder This value cannot be null.