2.5. nDPI API

The nDPI API exposes functions for dealing with nDPI protocols and categories.

Functions

function getnDPIProtoName(int proto)

Convert a nDPI protocol id to a protocol name.

Parameters:

proto – the protocol id to convert

Returns:

the protocol name on success, nil otherwise.

function getnDPIProtoId(string proto)

Convert a protocol name to the corresponding nDPI protocol id.

Parameters:

proto – the protocol name to convert

Returns:

the protocol id on success, nil otherwise.

function getnDPICategoryId(string category)

Convert a category name to the corresponding nDPI category id.

Parameters:

category – the category name to convert

Returns:

the category id on success, nil otherwise.

function getnDPICategoryName(int category)

Convert a nDPI category id to a category name.

Parameters:

category – the category id to convert

Returns:

the category name on success, nil otherwise.

function getnDPIProtoBreed(int proto)

Get the nDPI protocol breed associated to the protocol.

Parameters:

proto – the protocol id to query

Returns:

the protocol breed string on success, nil otherwise.

function getnDPIProtocols(int category_filter = nil, bool skip_critical = false)

Get the available nDPI protocols.

Parameters:
  • category_filter – only show protocols of this category

  • skip_critical – if true, skip protocols marked as critical for a network (e.g. DNS)

Returns:

a table (proto_name -> proto_id) on success, nil otherwise.

function getnDPICategories()

Get the available nDPI categories.

Returns:

a table (category_name -> category_id) on success, nil otherwise.