• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 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 com.google.android.iwlan.epdg;
18 
19 import android.net.Network;
20 
21 import com.google.auto.value.AutoValue;
22 
23 import java.net.InetAddress;
24 import java.util.Optional;
25 
26 @AutoValue
27 public abstract class TunnelSetupRequest {
apnName()28     abstract String apnName();
29 
apnIpProtocol()30     abstract int apnIpProtocol();
31 
network()32     abstract Network network();
33 
srcIpv4Address()34     abstract Optional<InetAddress> srcIpv4Address();
35 
srcIpv6Address()36     abstract Optional<InetAddress> srcIpv6Address();
37 
srcIpv6AddressPrefixLength()38     abstract int srcIpv6AddressPrefixLength();
39 
pduSessionId()40     abstract int pduSessionId();
41 
isRoaming()42     abstract boolean isRoaming();
43 
isEmergency()44     abstract boolean isEmergency();
45 
requestPcscf()46     abstract boolean requestPcscf();
47 
builder()48     public static Builder builder() {
49         return new AutoValue_TunnelSetupRequest.Builder()
50                 .setSrcIpv4Address(Optional.empty())
51                 .setSrcIpv6Address(Optional.empty())
52                 .setSrcIpv6AddressPrefixLength(0);
53     }
54 
55     @AutoValue.Builder
56     public abstract static class Builder {
setApnName(String apnName)57         public abstract Builder setApnName(String apnName);
58 
setApnIpProtocol(int protocol)59         public abstract Builder setApnIpProtocol(int protocol);
60 
setNetwork(Network network)61         public abstract Builder setNetwork(Network network);
62 
setSrcIpv4Address(InetAddress srcIpv4Address)63         public Builder setSrcIpv4Address(InetAddress srcIpv4Address) {
64             return setSrcIpv4Address(Optional.ofNullable(srcIpv4Address));
65         }
66 
setSrcIpv4Address(Optional<InetAddress> srcIpv4Address)67         public abstract Builder setSrcIpv4Address(Optional<InetAddress> srcIpv4Address);
68 
setSrcIpv6Address(InetAddress srcIpv6Address)69         public Builder setSrcIpv6Address(InetAddress srcIpv6Address) {
70             return setSrcIpv6Address(Optional.ofNullable(srcIpv6Address));
71         }
72 
setSrcIpv6Address(Optional<InetAddress> srcIpv6Address)73         public abstract Builder setSrcIpv6Address(Optional<InetAddress> srcIpv6Address);
74 
setSrcIpv6AddressPrefixLength(int srcIpv6AddressPrefixLength)75         public abstract Builder setSrcIpv6AddressPrefixLength(int srcIpv6AddressPrefixLength);
76 
setPduSessionId(int pduSessionId)77         public abstract Builder setPduSessionId(int pduSessionId);
78 
setIsRoaming(boolean isRoaming)79         public abstract Builder setIsRoaming(boolean isRoaming);
80 
setIsEmergency(boolean isEmergency)81         public abstract Builder setIsEmergency(boolean isEmergency);
82 
setRequestPcscf(boolean requestPcscf)83         public abstract Builder setRequestPcscf(boolean requestPcscf);
84 
build()85         public abstract TunnelSetupRequest build();
86     }
87 }
88