The GW2RegisterAnalysisMemory registers the memory location to store a analysis report to a session. Using this function activates the Analysis Process for the session.
Synopsis
The GW2RegisterAnalysisMemory function stores in the object pointed to by analysisFileBuffer a pointer to the analysis report produced by a successful run of API function runSession that used session session. The size of the analysis report, in bytes, is placed in the object pointed to by analysisLength. The format of the analysis report will be in the format requested by format. Using this function activates the Analysis Process Mode for the session.
#include "glasswall.core2.api.h"
int GW2RegisterAnalysisMemory(Session session,
char **analysisFileBuffer,
size_t analysisLength,
Analysis_format format);Returns
Returns an integer GW2_RetStatus enum value. Negative numbers indicate a failure.
Example
#include "glasswall.core2.api.h"
Session_Handle session;
char *analysisReport = NULL;
size_t analysisReportSize = 0;
session = GW2OpenSession();
if (!session)
/* deal with error */
else
{
if (GW2RegisterAnalysisMemory(session, &analysisReport, &analysisReportSize, PF_XML) < 0)
/* deal with error */
else
/* analysisReport points to the analysis report data */
}
/* later */
if (GW2CloseSession(session) < 0)
/* error closing session */Synopsis
public int RegisterAnalysisMemory(
int session,
out IntPtr analysisBufferPtr,
ref UIntPtr analysisBufferLengthPtr,
int Format)Returns
Returns an integer GW2_RetStatus enum value. Negative numbers indicate a failure.
Synopsis
import com.glasswall.core2javabridge.*;
public int GW2RegisterAnalysisMemory(int session, int format) throws GlasswallExceptionDescription
The GW2RegisterAnalysisMemory function registers a memory buffer as the output for the analysis report, for the session specified by session. Call GetAnalysisBuffer or GetAnalysisReport after having called GW2RunSession in order to retrieve the analysis report.
Please refer to API Overview for Return Types and valid enumerators for format.
Returns
The GW2RegisterAnalysisMemory function returns a GW2_RetStatus enumeration converted to int. The value will be negative if an error occurred. 0 indicates success.
Please refer to API Overview for Return Types and their details.
A GlasswallException exception will be thrown if session is invalid.
Synopsis - Retrieve Data
import com.glasswall.core2javabridge.*;
public byte[] GetAnalysisBuffer(int session) throws GlasswallException
public String GetAnalysisReport(int session) throws GlasswallExceptionDescription
The GetAnalysisBuffer function retrieves the contents of the analysis report buffer associated with the session specified by session.
Returns
The GetAnalysisBuffer function returns a Byte[] containing the analysis report. The GetAnalysisReport function returns a String containing the analysis report. These will be null if both GW2RunSession and GW2RegisterAnalysisMemory have not been called.
A GlasswallException exception will be thrown if session is invalid.
Synopsis
Registers an analysis file for the given session. The analysis file will be created during the session's run_session call.
def register_analysis(self, session: int, output_file: Optional[str] = None):
""" Registers an analysis file for the given session. The analysis file will be created during the session's run_session call.
Args:
session (int): The session integer.
output_file (Optional[str]): Default None. The file path where the analysis will be written. None returns the analysis as bytes.
Returns:
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'status', 'session', 'analysis_format'. If output_file is None (memory mode), 'buffer', and 'buffer_length' are included containing the file content and file size. If output_file is not None (file mode) 'output_file' is included.
"""Returns
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes status, session, analysis_format. If output_file is None (memory mode), buffer, and buffer_length are included containing the file content and file size. If output_file is not None (file mode) output_file is included.
Synopsis
This function stores a pointer to the analysis report produced by a successful run of runSession.
/**
*
* @param {number} session The ID of the session.
* @param {string} analysisFileBuffer The pointer to the location of the analysis report.
* @param {number} analysisOutputLength The size of the analysis report.
* @param {number} format The specified format.
*/
GW2RegisterAnalysisMemory(
session,
analysisFileBuffer,
analysisOutputLength,
format)Returns
Returns an integer GW2_RetStatus enum value. Negative numbers indicate a failure.