GW2RegisterAnalysisMemory
GW2RegisterAnalysisMemory ลงทะเบียนตำแหน่งหน่วยความจำเพื่อจัดเก็บรายงานการวิเคราะห์ให้กับเซสชัน การใช้ฟังก์ชันนี้จะเปิดใช้งานกระบวนการวิเคราะห์สำหรับ Session.
- C++
- C#
- Java
- Python
- JavaScript
สรุป
ฟังก์ชัน GW2RegisterAnalysisMemory จะจัดเก็บตัวชี้ไปยังรายงานการวิเคราะห์ที่สร้างจากการเรียกใช้ API function runSession ที่สำเร็จและใช้เซสชัน session ไว้ในอ็อบเจ็กต์ที่ analysisFileBuffer ชี้อยู่ ขนาดของรายงานการวิเคราะห์ในหน่วยไบต์จะถูกเก็บไว้ในอ็อบเจ็กต์ที่ analysisLength ชี้อยู่ รูปแบบของรายงานการวิเคราะห์จะเป็นไปตามรูปแบบที่ร้องขอโดย format การใช้ฟังก์ชันนี้จะเปิดใช้งานโหมด Analysis Process สำหรับเซสชัน
#include "glasswall.core2.api.h"
int GW2RegisterAnalysisMemory(Session session,
char **analysisFileBuffer,
size_t analysisLength,
Analysis_format format);
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
ตัวอย่าง
#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 */
สรุป
public int RegisterAnalysisMemory(
int session,
out IntPtr analysisBufferPtr,
ref UIntPtr analysisBufferLengthPtr,
int Format)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
สรุป
import com.glasswall.core2javabridge.*;
public int GW2RegisterAnalysisMemory(int session, int format) throws GlasswallException
คำอธิบาย
ฟังก์ชัน GW2RegisterAnalysisMemory ลงทะเบียนบัฟเฟอร์หน่วยความจำเป็นเอาต์พุตสำหรับรายงานการวิเคราะห์ สำหรับเซสชันที่ระบุโดย session ให้เรียก GetAnalysisBuffer หรือ GetAnalysisReport หลังจากเรียก GW2RunSession แล้ว เพื่อดึงรายงานการวิเคราะห์
โปรดดู API Overview/Return types สำหรับ enumerator ที่ใช้ได้ของ format.
ส่งกลับ
ฟังก์ชัน GW2RegisterAnalysisMemory จะส่งคืนค่า enumeration GW2_RetStatus ที่แปลงเป็น int ค่าเป็นลบหมายความว่าเกิดข้อผิดพลาด 0 หมายถึงสำเร็จ โปรดดูรายละเอียดใน API Overview/Return types
ระบบจะโยนข้อยกเว้น GlasswallException หาก session ไม่ถูกต้อง
เรื่องย่อ - ดึงข้อมูล
import com.glasswall.core2javabridge.*;
public byte[] GetAnalysisBuffer(int session) throws GlasswallException
public String GetAnalysisReport(int session) throws GlasswallException
คำอธิบาย
ฟังก์ชัน GetAnalysisBuffer จะดึงเนื้อหาของบัฟเฟอร์รายงานการวิเคราะห์ที่เชื่อมโยงกับเซสชันที่ระบุโดย session.
ส่งกลับ
ฟังก์ชัน GetAnalysisBuffer จะส่งคืน Byte[] ที่มีรายงานการวิเคราะห์ ฟังก์ชัน GetAnalysisReport จะส่งคืน String ที่มีรายงานการวิเคราะห์ โดยค่าจะเป็น null หากยังไม่ได้เรียกทั้ง GW2RunSession และ GW2RegisterAnalysisMemory.
ระบบจะโยนข้อยกเว้น GlasswallException หาก session ไม่ถูกต้อง
สรุป
ลงทะเบียนไฟล์การวิเคราะห์สำหรับ session ที่กำหนด ไฟล์การวิเคราะห์จะถูกสร้างขึ้นระหว่างการเรียก run_session ของ session
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.
"""
ส่งกลับ
gw_return_object (glasswall.GwReturnObj): อินสแตนซ์ของ GwReturnObj ที่มีแอตทริบิวต์ 'status', 'session', 'analysis_format' หาก output_file เป็น None (โหมดหน่วยความจำ) จะมี 'buffer' และ 'buffer_length' รวมอยู่ด้วย ซึ่งประกอบด้วยเนื้อหาไฟล์และขนาดไฟล์ หาก output_file ไม่เป็น None (โหมดไฟล์) จะมี 'output_file' รวมอยู่ด้วย
แอตทริบิวต์ status เป็นค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงความล้มเหลว
สรุป
ฟังก์ชันนี้จะจัดเก็บตัวชี้ไปยังรายงานการวิเคราะห์ที่สร้างขึ้นจากการรัน 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)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว