Skip to content
Nikos Filippakis edited this page Jun 22, 2017 · 1 revision

Adding a new wrapper for another library is also very straightforward. All wrapper-related files reside in the wrappers directory. A wrapper must implement the Wrapper interface, which contains the following methods:

InitializeWrapper() error
DestroyWrapper() error
ClassifyFlow(*godpi.Flow) (godpi.Protocol, error)
GetWrapperName() godpi.ClassificationSource

The methods have the following purposes:

  • InitializeWrapper is called once in the initialization of the application and is responsible for initializing the wrapper and library. If it returns an error, the library won’t be used.
  • DestroyWrapper is called when the application is terminating. It is responsible for freeing any resources taken up by the library and the wrapper.
  • ClassifyFlow takes a pointer to a flow and returns the protocol detected by the wrapper, as well as any error that occurred. If the library could not detect the protocol, it should return the Unknown protocol
  • GetWrapperName returns a ClassificationSource, which is a string. This is the name of the library that the wrapper utilizes, and is returned along with the detected protocol when a flow is classified in order to know which module made the classification.
Clone this wiki locally