Refactor bpf map iterate process

The bpf map read process is very similiar for different kind of maps. It
can be generalized into a single generic function and take callback
functions from the caller. The caller handles the map entry read out
from the generic map iterate function by the lambda expression passed
in.

Bug: 72111305
Test: ./libbpf_test
      run cts -m CtsNetTestCases -t android.net.cts.TrafficStatsTest
Change-Id: I244f306d05f6f5dab36861fc66375963869ea150
(cherry picked from aosp commit 1651348ccaf8a2403c3ddcb62385265bbbe5775a)
4 files changed