// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

library fuchsia.wlan.stats;

struct Counter {
  uint64 count;
  string name;
};

struct PacketCounter {
  Counter in;
  Counter out;
  Counter drop;
  Counter in_bytes;
  Counter out_bytes;
  Counter drop_bytes;
};

// LINT.IfChange
struct DispatcherStats {
  PacketCounter any_packet;
  PacketCounter mgmt_frame;
  PacketCounter ctrl_frame;
  PacketCounter data_frame;
};

const uint8 RSSI_BINS = 129;

// RssiStats count the occurrence of the RSSIs.
// RSSI value r's occurrence is counted in the bin[-r],
// where r is defined in [-128, 0] in dBm.
struct RssiStats {
  // TODO(alexandrew): Change this to array.
  vector<uint64>:RSSI_BINS hist;
};

struct ClientMlmeStats {
  PacketCounter svc_msg;
  PacketCounter data_frame;
  PacketCounter mgmt_frame;
  PacketCounter tx_frame;
  PacketCounter rx_frame;
  RssiStats assoc_data_rssi;
  RssiStats beacon_rssi;
};

struct ApMlmeStats {
  PacketCounter not_used;
};

// LINT.ThenChange(//garnet/lib/wlan/common/include/wlan/common/stats.h)

union MlmeStats {
  ClientMlmeStats client_mlme_stats;
  ApMlmeStats ap_mlme_stats;
};

struct IfaceStats {
    DispatcherStats dispatcher_stats;
    MlmeStats? mlme_stats;
};