Merge "Add key / value data structures for IBpfMaps" am: 4a53677d10
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1969201 Change-Id: Id2e9069959402216b52d1d64603eeb9f27cc21ca
This commit is contained in:
@@ -28,6 +28,11 @@ filegroup {
|
|||||||
"src/com/android/server/net/NetworkStats*.java",
|
"src/com/android/server/net/NetworkStats*.java",
|
||||||
"src/com/android/server/net/BpfInterfaceMapUpdater.java",
|
"src/com/android/server/net/BpfInterfaceMapUpdater.java",
|
||||||
"src/com/android/server/net/InterfaceMapValue.java",
|
"src/com/android/server/net/InterfaceMapValue.java",
|
||||||
|
"src/com/android/server/net/CookieTagMapKey.java",
|
||||||
|
"src/com/android/server/net/CookieTagMapValue.java",
|
||||||
|
"src/com/android/server/net/StatsMapKey.java",
|
||||||
|
"src/com/android/server/net/StatsMapValue.java",
|
||||||
|
"src/com/android/server/net/UidStatsMapKey.java",
|
||||||
],
|
],
|
||||||
path: "src",
|
path: "src",
|
||||||
visibility: [
|
visibility: [
|
||||||
|
|||||||
33
service-t/src/com/android/server/net/CookieTagMapKey.java
Normal file
33
service-t/src/com/android/server/net/CookieTagMapKey.java
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.server.net;
|
||||||
|
|
||||||
|
import com.android.net.module.util.Struct;
|
||||||
|
import com.android.net.module.util.Struct.Field;
|
||||||
|
import com.android.net.module.util.Struct.Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key for cookie tag map.
|
||||||
|
*/
|
||||||
|
public class CookieTagMapKey extends Struct {
|
||||||
|
@Field(order = 0, type = Type.S64)
|
||||||
|
public final long socketCookie;
|
||||||
|
|
||||||
|
public CookieTagMapKey(final long socketCookie) {
|
||||||
|
this.socketCookie = socketCookie;
|
||||||
|
}
|
||||||
|
}
|
||||||
37
service-t/src/com/android/server/net/CookieTagMapValue.java
Normal file
37
service-t/src/com/android/server/net/CookieTagMapValue.java
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.server.net;
|
||||||
|
|
||||||
|
import com.android.net.module.util.Struct;
|
||||||
|
import com.android.net.module.util.Struct.Field;
|
||||||
|
import com.android.net.module.util.Struct.Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value for cookie tag map.
|
||||||
|
*/
|
||||||
|
public class CookieTagMapValue extends Struct {
|
||||||
|
@Field(order = 0, type = Type.U32)
|
||||||
|
public final long uid;
|
||||||
|
|
||||||
|
@Field(order = 1, type = Type.U32)
|
||||||
|
public final long tag;
|
||||||
|
|
||||||
|
public CookieTagMapValue(final long uid, final long tag) {
|
||||||
|
this.uid = uid;
|
||||||
|
this.tag = tag;
|
||||||
|
}
|
||||||
|
}
|
||||||
46
service-t/src/com/android/server/net/StatsMapKey.java
Normal file
46
service-t/src/com/android/server/net/StatsMapKey.java
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.server.net;
|
||||||
|
|
||||||
|
import com.android.net.module.util.Struct;
|
||||||
|
import com.android.net.module.util.Struct.Field;
|
||||||
|
import com.android.net.module.util.Struct.Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key for both stats maps.
|
||||||
|
*/
|
||||||
|
public class StatsMapKey extends Struct {
|
||||||
|
@Field(order = 0, type = Type.U32)
|
||||||
|
public final long uid;
|
||||||
|
|
||||||
|
@Field(order = 1, type = Type.U32)
|
||||||
|
public final long tag;
|
||||||
|
|
||||||
|
@Field(order = 2, type = Type.U32)
|
||||||
|
public final long counterSet;
|
||||||
|
|
||||||
|
@Field(order = 3, type = Type.U32)
|
||||||
|
public final long ifaceIndex;
|
||||||
|
|
||||||
|
public StatsMapKey(final long uid, final long tag, final long counterSet,
|
||||||
|
final long ifaceIndex) {
|
||||||
|
this.uid = uid;
|
||||||
|
this.tag = tag;
|
||||||
|
this.counterSet = counterSet;
|
||||||
|
this.ifaceIndex = ifaceIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
46
service-t/src/com/android/server/net/StatsMapValue.java
Normal file
46
service-t/src/com/android/server/net/StatsMapValue.java
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.server.net;
|
||||||
|
|
||||||
|
import com.android.net.module.util.Struct;
|
||||||
|
import com.android.net.module.util.Struct.Field;
|
||||||
|
import com.android.net.module.util.Struct.Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value used for both stats maps and uid stats map.
|
||||||
|
*/
|
||||||
|
public class StatsMapValue extends Struct {
|
||||||
|
@Field(order = 0, type = Type.U63)
|
||||||
|
public final long rxPackets;
|
||||||
|
|
||||||
|
@Field(order = 1, type = Type.U63)
|
||||||
|
public final long rxBytes;
|
||||||
|
|
||||||
|
@Field(order = 2, type = Type.U63)
|
||||||
|
public final long txPackets;
|
||||||
|
|
||||||
|
@Field(order = 3, type = Type.U63)
|
||||||
|
public final long txBytes;
|
||||||
|
|
||||||
|
public StatsMapValue(final long rxPackets, final long rxBytes, final long txPackets,
|
||||||
|
final long txBytes) {
|
||||||
|
this.rxPackets = rxPackets;
|
||||||
|
this.rxBytes = rxBytes;
|
||||||
|
this.txPackets = txPackets;
|
||||||
|
this.txBytes = txBytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
33
service-t/src/com/android/server/net/UidStatsMapKey.java
Normal file
33
service-t/src/com/android/server/net/UidStatsMapKey.java
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.server.net;
|
||||||
|
|
||||||
|
import com.android.net.module.util.Struct;
|
||||||
|
import com.android.net.module.util.Struct.Field;
|
||||||
|
import com.android.net.module.util.Struct.Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key for uid stats map.
|
||||||
|
*/
|
||||||
|
public class UidStatsMapKey extends Struct {
|
||||||
|
@Field(order = 0, type = Type.U32)
|
||||||
|
public final long uid;
|
||||||
|
|
||||||
|
public UidStatsMapKey(final long uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user