# Class: com.pnfsoftware.jeb.core.units.code.asm.sig.NativeSignatureDBManager

Manage a set of [INativeSignaturePackage](INativeSignaturePackage), such that a native item \(routine, basic block, instruction or data\) can be matched against the [INativeSignature](INativeSignature) contained in these packages. The manager is a singleton handling all analysis. 

 Conflicts resolution, i.e. when several signature match, and processing of signatures' attributes are the client's responsibility.

## Static Field: SIGLIB_EXTENSION
Type: `java.lang.String`

Constant value: `.siglib`

## Static Field: SIGLIB_USER_PACKAGE_FOLDER
Type: `java.lang.String`

Constant value: `custom`

## Method: activateAutoSigningMode
- parameter: `gca`, type: `com.pnfsoftware.jeb.core.units.code.asm.analyzer.INativeCodeAnalyzer<com.pnfsoftware.jeb.core.units.code.IInstruction>`


## Method: addFolder
- parameter: `folder`, type: `java.io.File`
- parameter: `doRescan`, type: `boolean`

Description: Add a new folder to search for native signature packages.
parameter: folder: 
parameter: doRescan: if true all registered folders are scanned for signature packages after the            addition

## Method: createUserPackage
- parameter: `procType`, type: `com.pnfsoftware.jeb.core.units.codeobject.ProcessorType`
- parameter: `packageName`, type: `java.lang.String`
- parameter: `packageDescription`, type: `java.lang.String`
- parameter: `packageAuthor`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.sig.NativeSignaturePackageEntry`

Description: Create new signature package in user folder \(see [#getUserCreatedPackageFolder()](#getUserCreatedPackageFolder()). If there is already a package with same name, it will fail.
parameter: procType: 
parameter: packageName: 
parameter: packageDescription: 
parameter: packageAuthor: 
return: the entry representing the new package, null if the creation failed

## Method: deactivateAutoSigningMode
- parameter: `gca`, type: `com.pnfsoftware.jeb.core.units.code.asm.analyzer.INativeCodeAnalyzer<com.pnfsoftware.jeb.core.units.code.IInstruction>`


## Method: getAvailablePackages
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.sig.NativeSignaturePackageEntry>`

Description: Provides the list of available signature packages entries. The corresponding packages are not necessarily loaded.

## Method: getLoadedPackages
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.sig.NativeSignaturePackageEntry>`

Description: Provides the list of signature packages entries for which the corresponding signatures are loaded in memory.

## Method: getNumberLoadedSigs
- return type: `int`


## Method: getSignatureGenerator
- return type: `com.pnfsoftware.jeb.core.units.code.asm.sig.NativeSignatureGenerator`


## Method: getUserCreatedPackageFolder
- return type: `java.io.File`

Description: Get the path for the user\-created signature package folder, if any, whose name is set to [#SIGLIB_USER_PACKAGE_FOLDER](#SIGLIB_USER_PACKAGE_FOLDER).

## Method: getUserCreatedPackages
- parameter: `procType`, type: `com.pnfsoftware.jeb.core.units.codeobject.ProcessorType`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.sig.NativeSignaturePackageEntry>`

Description: Provides the list of active signature packages entries that were created by a user with a given processor type.
return: list of packages, never null

## Method: getUserCreatedPackages
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.sig.NativeSignaturePackageEntry>`

Description: Provides the list of active signature packages entries that were created by a user.
return: list of packages, never null

## Method: getUserSelectedPackage
- parameter: `analyzer`, type: `com.pnfsoftware.jeb.core.units.code.asm.analyzer.INativeCodeAnalyzer<com.pnfsoftware.jeb.core.units.code.IInstruction>`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.sig.NativeSignaturePackageEntry`


## Method: isActive
- return type: `boolean`


## Method: isAutoSigningModeActivated
- parameter: `gca`, type: `com.pnfsoftware.jeb.core.units.code.asm.analyzer.INativeCodeAnalyzer<com.pnfsoftware.jeb.core.units.code.IInstruction>`
- return type: `boolean`


## Method: loadDefaultPackages
- parameter: `gca`, type: `com.pnfsoftware.jeb.core.units.code.asm.analyzer.INativeCodeAnalyzer<com.pnfsoftware.jeb.core.units.code.IInstruction>`

Description: Loads in memory the available packages suitable for the given analysis. The determination of the suitable packages is based on: 
 
- the processor type of the analysis 
- the detected compiler, if any 

 Note that only PNF Software packages are loaded by this method. User provided packages have to be manually loaded.
parameter: gca: 

## Method: loadPackage
- parameter: `entry`, type: `com.pnfsoftware.jeb.core.units.code.asm.sig.NativeSignaturePackageEntry`
- parameter: `doMatching`, type: `boolean`
- return type: `boolean`

Description: Loads a specific package entry for all analyzers known to the manager. 

 Note: analyzer have to be for the same architecture as the package for the loading to happen.
parameter: entry: 
parameter: doMatching: if true, after the package has been loaded, analyzers will re\-match all            routines
return: true if the package was loaded for at least one analysis, false otherwise

## Method: loadPackage
- parameter: `gca`, type: `com.pnfsoftware.jeb.core.units.code.asm.analyzer.INativeCodeAnalyzer<com.pnfsoftware.jeb.core.units.code.IInstruction>`
- parameter: `entry`, type: `com.pnfsoftware.jeb.core.units.code.asm.sig.NativeSignaturePackageEntry`
- return type: `boolean`

Description: Loads a specific package for the given analysis.
parameter: gca: 
parameter: entry: 
return: 

## Method: match
- parameter: `_gca`, type: `com.pnfsoftware.jeb.core.units.code.asm.analyzer.INativeCodeAnalyzer<? extends com.pnfsoftware.jeb.core.units.code.IInstruction>`
- parameter: `routines`, type: `java.util.Collection<com.pnfsoftware.jeb.core.units.code.asm.items.INativeMethodDataItem>`
- parameter: `uniqueMatchOnly`, type: `boolean`
- parameter: `maximumConfidenceLevel`, type: `boolean`
- parameter: `includeAlreadyMatched`, type: `boolean`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.sig.NativeSignatureMatchResult>`

Description: Match a list of native routines against the currently loaded signatures packages for this analysis. For each routine the algorithm searches for signatures whose **all** [INativeFeatures](INativeFeatures) match the routine. 

 The result can be incomplete: if a unique match was asked we stop the search as soon as we found two matches and report an incomplete result, see [NativeSignatureMatchResult#isComplete()](NativeSignatureMatchResult#isComplete()).
parameter: _gca: 
parameter: routines: 
parameter: uniqueMatchOnly: if true the complete results are the ones for which there is only one            matching signature
parameter: maximumConfidenceLevel: if true the matching signatures \-\- if any \-\- will all be of the            maximum possible level of confidence. For example, if two matching signatures have            [ConfidenceLevel#MEDIUM](ConfidenceLevel#MEDIUM) and one has [ConfidenceLevel#LOW](ConfidenceLevel#LOW), only the            first two will be kept in the results. Otherwise, all matching signatures are            kept.
parameter: includeAlreadyMatched: if true routines already matched will be re\-matched, otherwise            they will be ignored
return: list of results, empty if none

## Method: onEvent
- parameter: `e`, type: `com.pnfsoftware.jeb.util.events.IEvent`


## Method: registerAnalyzer
- parameter: `gca`, type: `com.pnfsoftware.jeb.core.units.code.asm.analyzer.INativeCodeAnalyzer<com.pnfsoftware.jeb.core.units.code.IInstruction>`

Description: Register an analyzer to be handled by this manager.
parameter: gca: 

## Method: removeAllFolders

Description: Empties the list of scanned folders

## Method: removeAllPackages

Description: Empties the list of available packages.

## Method: removeFolder
- parameter: `folder`, type: `java.io.File`
- parameter: `doRescan`, type: `boolean`

Description: Remove a folder from the list of folders to search for native signature packages.
parameter: folder: 
parameter: doRescan: if true all registered folders are scanned for signature packages after the            removal

## Method: rescan

Description: Rescan registered folders to register/unregister native signature packages. Such package names end with [NativeSignatureDBManager#SIGLIB_EXTENSION](NativeSignatureDBManager#SIGLIB_EXTENSION).

## Method: rescan
- parameter: `deleteOldEntries`, type: `boolean`


## Method: setActive
- parameter: `isActive`, type: `boolean`


## Method: setUserSelectedPackage
- parameter: `analyzer`, type: `com.pnfsoftware.jeb.core.units.code.asm.analyzer.INativeCodeAnalyzer<com.pnfsoftware.jeb.core.units.code.IInstruction>`
- parameter: `userSelectedPackage`, type: `com.pnfsoftware.jeb.core.units.code.asm.sig.NativeSignaturePackageEntry`


## Method: unregisterAnalyzer
- parameter: `gca`, type: `com.pnfsoftware.jeb.core.units.code.asm.analyzer.INativeCodeAnalyzer<com.pnfsoftware.jeb.core.units.code.IInstruction>`

Description: Unregister an analyzer handled by this manager. 

 Note that this method unloads from memory the signatures packages used by the given analysis. Only the signatures storage specific to this analysis will be removed, i.e. if another analysis uses the same package it will stay loaded.
parameter: gca: 

## Method: updateOnDiskPackages
- parameter: `updateExistingSignatures`, type: `boolean`

Description: Write new signatures into the on disk packages. These signatures are initially stored in memory into the corresponding entry \(see [NativeSignaturePackageEntry#addSignatureToWrite(INativeSignature)](NativeSignaturePackageEntry#addSignatureToWrite(INativeSignature))\). This allows to delay the actual write on disk of the new signatures. 

 Note: only user\-created signature packages can be written into through this method.

## Static Method: getInstance
- parameter: `enginesContext`, type: `com.pnfsoftware.jeb.core.IEnginesContext`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.sig.NativeSignatureDBManager`


