GW2GetAllIdInfo
Glasswall engine によって特定および報告されるすべての issue には、一意の issue ID が関連付けられています。この API は、考えられるすべての issue ID 番号と、それに対応する概要説明の要約を提供します。
session に対して、GW2GetAllIdInfo 関数は、Glasswall Issue ID の説明と値の範囲が格納された XML データを出力バッファに配置します。
- C++
- C#
- Java
- Python
- JavaScript
概要
session session に対して、GW2GetAllIdInfo 関数は、Glasswall Issue ID の説明と値の範囲が格納された XML データへのポインタを、outputBuffer が指すオブジェクトに格納します。格納された出力バッファの長さ(バイト単位)は、bufferLength が指す size_t オブジェクトに格納されます。
#include "glasswall.core2.api.h"
int GW2GetAllIdInfo(
Session session,
size_t *bufferLength,
char **outputBuffer);
戻り値
整数の GW2_RetStatus enum 値を返します。負の数は失敗を示します。成功した場合、出力バッファには XML ファイルが含まれます。
例
#include "glasswall.core2.api.h"
...
char *outbuf = NULL;
size_t buflen = 0;
if (GW2OpenSession())
/* error opening session*/
else
{
int status = GW2GetAllIdInfo(session, &buflen, &outbuf);
/* Buffer contains the XML file.
* Either process the data pointed to, or copy the data and process it
* after the session is closed
*/
if (GW2CloseSession())
/* error closing session */
}
概要
public int GetAllIdInfo(
int session,
ref UIntPtr bufferLength,
out IntPtr outputBuffer)
戻り値
整数の GW2_RetStatus enum 値を返します。負の数は失敗を示します。成功した場合、出力バッファには XML ファイルが含まれます。
例
...
UIntPtr bufferLength = UIntPtr.Zero;
IntPtr buffer = new IntPtr();
int session = glasswall.OpenSession();
int returnStatus = glasswall.GetAllIdInfo(session, ref bufferLength, out buffer);
using (StreamWriter writer = new StreamWriter(fileStream))
{
writer.WriteLine($"GW2GetAllIdInfo completed with status code {returnStatus}");
if ((int)bufferLength != 0)
{
WriteBytesToFile(Path.Combine(di.FullName, $"22 - GW2GetAllIdInfo.xml"),
glasswall.CreateArrayFromBuffer(buffer, bufferLength)
);
}
}
import com.glasswall.core2javabridge.*;
public String GW2GetAllIdInfoString(int session) throws GlasswallException
注
この機能では以前、ID データを取得するために 2 つの別個の関数呼び出しが必要でした。現在は合理化され、設定を String として返すようになりました。元の 2 つの関数は非推奨になりました。
戻り値
GW2GetAllIdInfoString 関数は、すべての Glasswall ID の説明を含む String を返します。
GlasswallException 例外は、session が無効である場合、またはすべての ID 情報を取得できなかった場合にスローされます。
概要 - 非推奨関数
import com.glasswall.core2javabridge.*;
(Deprecated)
public int GW2GetAllIdInfo(int session) throws GlasswallException
public byte[] GetAllIDBuffer(int session) throws GlasswallException
説明 - 非推奨の関数
GW2GetAllIdInfo 関数は、session で指定されたセッションのすべての Glasswall ID の説明を内部 All ID Buffer に出力します。このデータは GetAllIDBuffer 関数を使用して取得します。
戻り値 - 非推奨関数
GW2GetAllIdInfo 関数は、GW2_RetStatus 列挙型を int に変換して返します。エラーが発生した場合、値は負になります。0 は成功を示します。詳細については、API Overview/Return types を参照してください。
GetAllIDBuffer は、Glasswall ID の説明を含むバイト配列を返します。GW2GetAllIdInfo が呼び出されていない場合、これは null になります。
GlasswallException 例外は、session が無効である場合、またはすべての ID 情報を取得できなかった場合にスローされます。
概要
グループ説明を含むすべての Issue ID 範囲を含んだ XML を取得します。
def get_all_id_info(self, output_file: Optional[str] = None, raise_unsupported: bool = True) -> str:
""" Retrieves the XML containing all the Issue ID ranges with their group descriptions
Args:
output_file (Optional[str], optional): The output file path where the analysis file will be written.
raise_unsupported (bool, optional): Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
all_id_info (str): A string XML analysis report containing all id info.
"""
戻り値
すべての ID 情報を含む文字列の XML 分析レポート。
概要
/**
* This function places a pointer in a specified location to XML data populated with
* Glasswall Issue ID descriptions and value ranges, for a specified session.
*
* @param {number} session The ID of the session.
* @param {number} bufferLength The length of the buffer.
* @param {string} outputBuffer The location of the output buffer.
*/
GW2GetAllIdInfo(
session,
bufferLength,
outputBuffer)
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。
例
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 "";
}
}
...
let output_file_buffer = ref.alloc(ref.refType(ref.types.CString));
let output_buffer_size = ref.alloc(ref.types.size_t, 0);
let return_status = gw.GW2GetAllIdInfo(session_id, output_buffer_size, output_file_buffer);
let xml_string = buffer_to_string(output_file_buffer, output_buffer_size);
...