/*
 * Copyright (C) 2017 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.
 */

syntax = "proto2";
package android.service;

option java_multiple_files = true;
option java_outer_classname = "NetworkStatsServiceProto";

// Represents dumpsys from NetworkStatsService (netstats).
message NetworkStatsServiceDumpProto {
  repeated NetworkInterfaceProto active_interfaces = 1;

  repeated NetworkInterfaceProto active_uid_interfaces = 2;

  // Device level network stats, which may include non-IP layer traffic.
  optional NetworkStatsRecorderProto dev_stats = 3;

  // IP-layer traffic stats.
  optional NetworkStatsRecorderProto xt_stats = 4;

  // Per-UID network stats.
  optional NetworkStatsRecorderProto uid_stats = 5;

  // Per-UID, per-tag network stats, excluding the default tag (i.e. tag=0).
  optional NetworkStatsRecorderProto uid_tag_stats = 6;
}

// Corresponds to NetworkStatsService.mActiveIfaces/mActiveUidIfaces.
message NetworkInterfaceProto {
  // Name of the network interface (eg: wlan).
  optional string interface = 1;

  optional NetworkIdentitySetProto identities = 2;
}

// Corresponds to NetworkIdentitySet.
message NetworkIdentitySetProto {
  repeated NetworkIdentityProto identities = 1;
}

// Corresponds to NetworkIdentity.
message NetworkIdentityProto {
  // Constants from ConnectivityManager.TYPE_*.
  optional int32 type = 1;

  optional bool roaming = 4;

  optional bool metered = 5;

  optional bool default_network = 6;

  optional int32 oem_managed_network = 7;
}

// Corresponds to NetworkStatsRecorder.
message NetworkStatsRecorderProto {
  optional int64 pending_total_bytes = 1;

  optional NetworkStatsCollectionProto complete_history = 2;
}

// Corresponds to NetworkStatsCollection.
message NetworkStatsCollectionProto {
  repeated NetworkStatsCollectionStatsProto stats = 1;
}

// Corresponds to NetworkStatsCollection.mStats.
message NetworkStatsCollectionStatsProto {
  optional NetworkStatsCollectionKeyProto key = 1;

  optional NetworkStatsHistoryProto history = 2;
}

// Corresponds to NetworkStatsCollection.Key.
message NetworkStatsCollectionKeyProto {
  optional NetworkIdentitySetProto identity = 1;

  optional int32 uid = 2;

  optional int32 set = 3;

  optional int32 tag = 4;
}

// Corresponds to NetworkStatsHistory.
message NetworkStatsHistoryProto {
  // Duration for this bucket in milliseconds.
  optional int64 bucket_duration_ms = 1;

  repeated NetworkStatsHistoryBucketProto buckets = 2;
}

// Corresponds to each bucket in NetworkStatsHistory.
message NetworkStatsHistoryBucketProto {
  // Bucket start time in milliseconds since epoch.
  optional int64 bucket_start_ms = 1;

  optional int64 rx_bytes = 2;

  optional int64 rx_packets = 3;

  optional int64 tx_bytes = 4;

  optional int64 tx_packets = 5;

  optional int64 operations = 6;
}