1 /* 2 * Copyright (C) 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.android.networkstack.tethering; 18 19 import android.net.MacAddress; 20 21 import androidx.annotation.NonNull; 22 23 import com.android.net.module.util.Struct; 24 25 import java.util.Objects; 26 27 /** Key type for upstream IPv6 forwarding map. */ 28 public class TetherUpstream6Key extends Struct { 29 @Field(order = 0, type = Type.S32) 30 public final int iif; // The input interface index. 31 32 @Field(order = 1, type = Type.EUI48, padding = 6) 33 public final MacAddress dstMac; // Destination ethernet mac address (zeroed iff rawip ingress). 34 35 @Field(order = 2, type = Type.ByteArray, arraysize = 8) 36 public final byte[] src64; // The top 64-bits of the source ip. 37 TetherUpstream6Key(int iif, @NonNull final MacAddress dstMac, final byte[] src64)38 public TetherUpstream6Key(int iif, @NonNull final MacAddress dstMac, final byte[] src64) { 39 Objects.requireNonNull(dstMac); 40 41 this.iif = iif; 42 this.dstMac = dstMac; 43 this.src64 = src64; 44 } 45 } 46