PcapPlusPlus  24.09
pcpp::OUILookup Class Reference

#include <OUILookup.h>

Public Member Functions

int64_t initOUIDatabaseFromJson (const std::string &path="")
 
std::string getVendorName (const pcpp::MacAddress &addr)
 

Detailed Description

Provides vendor name matching functionality from MAC addresses. It uses an internal database to define name of the vendor. The class itself should be initialized by using initOUIDatabaseFromJson() otherwise all requests will return "Unknown" as vendor. The class itself currently does not support on-fly modifying the database but anyone who wants to add/modify/remove entries, should modify 3rdParty/OUILookup/PCPP_OUIDatabase.json file and call to initOUIDatabaseFromJson() function to renew the internal data.

Member Function Documentation

◆ getVendorName()

std::string pcpp::OUILookup::getVendorName ( const pcpp::MacAddress addr)

Returns the vendor of the MAC address. OUI database should be initialized with initOUIDatabaseFromJson()

Parameters
[in]addrMAC address to search
Returns
Vendor name

◆ initOUIDatabaseFromJson()

int64_t pcpp::OUILookup::initOUIDatabaseFromJson ( const std::string &  path = "")

Initialise internal OUI database from a JSON file

Parameters
[in]pathPath to OUI database. The database itself is located at 3rdParty/OUILookup/PCPP_OUIDatabase.json
Returns
Returns the number of total vendors, negative on errors