share eBPF struct definitions between ebpf and C++ netd

This is the main commit in a set of 3 commits across 3 diff git repos.
The other two are:
  https://android-review.googlesource.com/c/platform/system/bpf/+/1199649
  "remove network specific struct definitions from BpfUtils.h"
and
  https://android-review.googlesource.com/c/platform/frameworks/base/+/1200738
  "minor change to keep it building"

We move the struct definitions to bpf_shared.h so they can be
shared between C++ netd and C ebpf code.

They also become typedefs and are renamed for more consistent naming.
(there's some weird issue with ebpf compiler on some devices with
non-typedef'ed structs)

Test: builds, atest
Bug: 146787904
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I324c0ab9db0186dcea0ec9ee33140909be285bc4
diff --git a/server/TrafficController.h b/server/TrafficController.h
index 7ec0279..741ceb7 100644
--- a/server/TrafficController.h
+++ b/server/TrafficController.h
@@ -32,10 +32,6 @@
 #include "utils/String16.h"
 
 using android::bpf::BpfMap;
-using android::bpf::IfaceValue;
-using android::bpf::StatsKey;
-using android::bpf::StatsValue;
-using android::bpf::UidTag;
 
 namespace android {
 namespace net {
@@ -136,9 +132,9 @@
      * that receives them, then the kernel will drop some of these sockets and we
      * won't delete their tags.
      * Map Key: uint64_t socket cookie
-     * Map Value: struct UidTag, contains a uint32 uid and a uint32 tag.
+     * Map Value: UidTagValue, contains a uint32 uid and a uint32 tag.
      */
-    BpfMap<uint64_t, UidTag> mCookieTagMap GUARDED_BY(mMutex);
+    BpfMap<uint64_t, UidTagValue> mCookieTagMap GUARDED_BY(mMutex);
 
     /*
      * mUidCounterSetMap: Store the counterSet of a specific uid.
@@ -159,9 +155,9 @@
      * mStatsMapA/mStatsMapB: Store the traffic statistics for a specific
      * combination of uid, tag, iface and counterSet. These two maps contain
      * both tagged and untagged traffic.
-     * Map Key: Struct StatsKey contains the uid, tag, counterSet and ifaceIndex
+     * Map Key: StatsKey contains the uid, tag, counterSet and ifaceIndex
      * information.
-     * Map Value: struct Stats, contains packet count and byte count of each
+     * Map Value: Stats, contains packet count and byte count of each
      * transport protocol on egress and ingress direction.
      */
     BpfMap<StatsKey, StatsValue> mStatsMapA GUARDED_BY(mMutex);