PcapPlusPlus  Next
OUILookup.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "MacAddress.h"
4 
5 #include <unordered_map>
6 #include <vector>
7 
9 
12 namespace pcpp
13 {
20  class OUILookup
21  {
22  private:
25  struct MaskedFilter
26  {
27  MaskedFilter(int maskVal, std::unordered_map<uint64_t, std::string> map)
28  : mask(maskVal), vendorMap(std::move(map))
29  {}
30 
31  int mask;
32  std::unordered_map<uint64_t, std::string> vendorMap;
33  };
34 
36  struct VendorData
37  {
38  std::string vendorName;
39  std::vector<MaskedFilter> maskedFilter;
40  };
41 
44  using OUIVendorMap = std::unordered_map<uint64_t, VendorData>;
45 
47  OUIVendorMap vendorMap;
48 
49  template <typename T> int64_t internalParser(T& jsonData);
50 
51  public:
56  int64_t initOUIDatabaseFromJson(const std::string& path = "");
57 
61  std::string getVendorName(const pcpp::MacAddress& addr);
62  };
63 } // namespace pcpp
Definition: MacAddress.h:21
Definition: OUILookup.h:21
int64_t initOUIDatabaseFromJson(const std::string &path="")
std::string getVendorName(const pcpp::MacAddress &addr)
The main namespace for the PcapPlusPlus lib.