GW2GetAllIdInfo
Glasswall 엔진이 식별하고 보고하는 모든 이슈에는 고유한 이슈 ID가 연결됩니다. 이 API는 가능한 모든 이슈 ID 번호와 해당하는 상위 수준 설명의 요약을 제공합니다.
session에 대해 GW2GetAllIdInfo 함수는 Glasswall Issue ID 설명과 값 범위가 채워진 XML 데이터를 출력 버퍼에 배치합니다.
- C++
- C#
- Java
- Python
- JavaScript
개요
session session에 대해 GW2GetAllIdInfo 함수는 outputBuffer가 가리키는 객체에 Glasswall Issue ID 설명과 값 범위가 채워진 XML 데이터에 대한 포인터를 배치합니다. 채워진 출력 버퍼의 길이(바이트 단위)는 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 데이터를 가져오기 위해 두 번의 별도 함수 호출이 필요했습니다. 이제는 설정을 String으로 반환하도록 간소화되었습니다. 기존의 두 함수는 더 이상 사용되지 않습니다.
반환값
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 enum 값을 반환합니다. 음수는 실패를 나타냅니다.
예제
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);
...