Every issue identified and reported by the Glasswall engine has a unique issue ID associated. This API provides a description for a given Issue ID number.
Synopsis
For session session , GW2GetIdInfo places in the object pointed to by outputBuffer , a pointer to a description of Glasswall Issue ID issueId. The length of the description, in bytes, is placed in the size_t object pointed to by bufferLength.
#include "glasswall.core2.api.h"
int GW2GetIdInfo(
Session session,
size_t issueId,
size_t *bufferLength,
char **outputBuffer);
Returns
Returns an integer GW2_RetStatus
enum value. Negative numbers indicate a failure. If successful, the output buffer is populated with the Issue Description.
Example
#include "glasswall.core2.api.h"
char *outbuf = NULL;
size_t buflen = 0;
if (GW2OpenSession() < 0)
/* error opening session */
else
{
int status = GW2GetIdInfo(session, issueId, &buflen, &outbuf);
/* outbuf points to a buffer containing the XML file.
* Either process the data pointed to, or copy the data and process it
* after GW2CloseSession is called
*/
if (GW2CloseSession() < 0)
/* error closing session */
}
Synopsis
public int GetIdInfo(
int session,
uint IssueID,
ref UIntPtr bufferLength,
out IntPtr outputBuffer)
Returns
Returns an integer GW2_RetStatus
enum value. Negative numbers indicate a failure. If successful, the output buffer is populated with the Issue Description.
Example
using glasswall_core2;
...
Glasswall glasswall = new Glasswall(); // Instance of the Glasswall wrapper
int session = glasswall.OpenSession();
int returnStatus = glasswall.GetIdInfo(session, 96, ref bufferLength, out buffer);
if (bufferLength >= 0)
{
byte[] msgArray = glasswall.CreateArrayFromBuffer(buffer, bufferLength);
// Error description for issue ID 96 now stored in a byte array
}
if (glasswall.CloseSession(session))
{
// Error Handling
}
Synopsis
import com.glasswall.core2javabridge.*;
public String GW2GetIdInfoString(int session, int issueId) throws GlasswallException
Description
This functionality previously required two separate function calls to retrieve the ID data. This has now been streamlined to return the settings as a String
. The two original functions have been deprecated.
Returns
The GW2GetIdInfoString function returns a String
containing a description of the given issueId
A GlasswallException exception will be thrown if `session` is invalid, or if the issueId
description could not be retrieved.
Synopsis - Deprecated Functions
import com.glasswall.core2javabridge.*;
(Deprecated)
public int GW2GetIdInfo(int session, int issueId) throws GlasswallException
public byte[] GetIDBuffer(int session) throws GlasswallException
Description - Deprecated Functions
The GW2GetIdInfo function outputs the description of a given issueId
for a given session
to the internal ID Buffer. Retrieve this data through use of GetIDBuffer function.
Returns - Deprecated Functions
The GW2GetIdInfo 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.
GetIDBuffer returns a byte[]
containing the ID description. This will be null if GetIDBuffer has not been called.
A GlasswallException exception will be thrown if session
is invalid, or if the issue description could not be retrieved.
Synopsis
Retrieves the group description for the given Issue ID.
def get_id_info(self, issue_id: int, raise_unsupported: bool = True):
""" Retrieves the group description for the given Issue ID. e.g. issue_id 96 returns "Document Processing Instances"
Args:
issue_id (int): The issue id.
raise_unsupported (bool, optional): Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
id_info (str): The group description for the given Issue ID.
"""
Returns
A string, the group description for the given Issue ID.
Synopsis
This function places a pointer to a description of a specified IssueID in a specified location.
/**
*
* @param {number} session The ID of the session.
* @param {number} issueId The ID of the issue.
* @param {number} bufferLength The length of the buffer.
* @param {string} outputBuffer The location of the output buffer.
*/
GW2GetIdInfo(
session,
issueId,
bufferLength,
outputBuffer)
Returns
Returns an integer GW2_RetStatus
enum value. Negative numbers indicate a failure. If successful, the output buffer is populated with the Issue Description.
Example
const ref = require('ref-napi');
...
function buffer_to_string(buffer, buffer_size) {
if (!buffer.isNull() && ref.deref(buffer_size) > 0) {
return Buffer.from(ref.reinterpret(ref.deref(buffer), ref.deref(buffer_size), 0)).toString();
}
else {
return "";
}
}
...
output_file_buffer = ref.alloc(ref.refType(ref.types.CString));
output_buffer_size = ref.alloc(ref.types.size_t, 0);
return_status = gw.GW2GetIdInfo(session_id, 96, output_buffer_size, output_file_buffer);
let error_description = buffer_to_string(output_file_buffer, output_buffer_size);
...