2.5. nDPI API¶
The nDPI API exposes functions for dealing with nDPI protocols and categories.
Functions
-
function
getnDPIStats
(string host_ip = nil, int vlan_id = nil)¶ Get nDPI protocol information of the network interface/a specific host.
- Return
- table with nDPI stats on success, nil otherwise.
- Parameters
host_ip
: filter by a specific host/host@vlanvlan_id
: specify the host_ip filter vlan separately
-
function
getnDPIProtoName
(int proto)¶ Convert a nDPI protocol id to a protocol name.
- Return
- the protocol name on success, nil otherwise.
- Parameters
proto
: the protocol id to convert
-
function
getnDPIProtoId
(string proto)¶ Convert a protocol name to the corresponding nDPI protocol id.
- Return
- the protocol id on success, nil otherwise.
- Parameters
proto
: the protocol name to convert
-
function
getnDPICategoryId
(string category)¶ Convert a category name to the corresponding nDPI category id.
- Return
- the category id on success, nil otherwise.
- Parameters
category
: the category name to convert
-
function
getnDPICategoryName
(int category)¶ Convert a nDPI category id to a category name.
- Return
- the category name on success, nil otherwise.
- Parameters
category
: the category id to convert
-
function
getnDPIProtoCategory
(int proto)¶ Get the nDPI category currently associated to the protocol.
- Return
- a table (id->category_id, name->category_name) on success, nil otherwise.
- Note
- the protocol to category mapping can be changed dynamically via setnDPICategory
- Parameters
proto
: the protocol id to query the category for
-
function
setnDPIProtoCategory
(int proto, int category)¶ Associate the protocol to the specified nDPI category.
- Parameters
proto
: the protocol idcategory
: the category id
-
function
getnDPIProtocols
(int category_filter = nil, bool skip_critical = false)¶ Get the available nDPI protocols.
- Return
- a table (proto_name -> proto_id) on success, nil otherwise.
- Parameters
category_filter
: only show protocols of this categoryskip_critical
: if true, skip protocols marked as critical for a network (e.g. DNS)
-
function
getnDPICategories
()¶ Get the available nDPI categories.
- Return
- a table (category_name -> category_id) on success, nil otherwise.