ข้ามไปยังเนื้อหาหลัก

GW2RegisterPoliciesMemory

ฟังก์ชัน GW2RegisterPoliciesMemory ใช้ลงทะเบียนไฟล์ XML ของ policy การจัดการเนื้อหาที่เก็บอยู่ในหน่วยความจำเข้ากับเซสชันหนึ่ง

หากไม่มีการลงทะเบียนทั้ง GW2RegisterPoliciesFile หรือ GW2RegisterPoliciesMemory กับเซสชัน ระบบจะใช้ policies เริ่มต้นกับเซสชันนั้น policy เริ่มต้นจะตั้งค่าสวิตช์การจัดการเนื้อหาทั้งหมดเป็น Sanitise.

สรุป

สำหรับเซสชัน session ฟังก์ชัน GW2RegisterPoliciesMemory จะลงทะเบียน policies ที่ Glasswall จะใช้เมื่อประมวลผลไฟล์ โดย policies เป็นตัวชี้ไปยังข้อมูล policies, policiesLength ระบุขนาดของข้อมูล policies เป็นไบต์ และ policiesFormat ระบุรูปแบบของข้อมูล policies


#include "glasswall.core2.api.h"
int GW2RegisterPoliciesMemory(Session session,
const char *policies,
size_t policiesLength,
Policy_format format);

ส่งกลับ

ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว

ตัวอย่าง


#include "glasswall.core2.api.h"

Session session = GW2OpenSession();
char *policies = NULL;
size_t size = 0;
if (!session)
/* deal with error */
else
{
/* ... load 'policies' with a pointer to the policies content ... */
if (GW2RegisterPoliciesMemory(session, policies, size, PF_XML) < 0)
/* deal with error */
else
/* continue processing */
}

. . .

/* later */
if (GW2CloseSession(session) < 0)
/* error closing session */