GW2RegisterPoliciesMemory
GW2RegisterPoliciesMemory는 메모리에 보관된 콘텐츠 관리 policy XML 파일을 세션에 등록합니다.
GW2RegisterPoliciesFile 또는 GW2RegisterPoliciesMemory 중 어느 것도 세션에 등록되지 않은 경우, 기본 policy가 해당 세션에 적용됩니다. 기본 policy는 모든 콘텐츠 관리 스위치를 Sanitise로 설정합니다.
- C++
- C#
- Java
- Python
- JavaScript
개요
세션 session에 대해 GW2RegisterPoliciesMemory 함수는 Glasswall가 파일을 처리할 때 사용할 policies를 등록합니다. policies는 policies 데이터에 대한 포인터이고, policiesLength는 policies 데이터의 바이트 단위 크기를 지정하며, policiesFormat은 policies 데이터의 형식을 지정합니다.
#include "glasswall.core2.api.h"
int GW2RegisterPoliciesMemory(Session session,
const char *policies,
size_t policiesLength,
Policy_format format);
반환값
정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다.
예제
#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 */
개요
Glasswall가 파일을 처리할 때 사용할 policies를 등록합니다
/// <param name="session">Session ID number</param>
/// <param name="policies">The policy file</param>
/// <param name="policiesFormat">Format of the policies data</param>
public int RegisterPoliciesMemory(
int session,
byte[] policies,
int policiesFormat)
반환값
정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다.
개요
import com.glasswall.core2javabridge.*;
public int GW2RegisterPoliciesMemory(int session, byte[] policiesBuffer, int format) throws GlasswallException, NullPointerException
public int GW2RegisterPoliciesMemory(int session, byte[] policiesBuffer, int length, int format) throws GlasswallException, NullPointerException
참고
format에 유효한 열거자에 대해서는 API Overview/Return types를 참조하십시오.
The length of the policiesBuffer may optionally be specified.
반환값
GW2RegisterPoliciesMemory 함수는 GW2_RetStatus 열거형을 int로 변환하여 반환합니다. 오류가 발생한 경우 값은 음수가 됩니다. 0은 성공을 나타냅니다. 자세한 내용은 API Overview/Return types를 참조하세요.
A GlasswallException exception will be thrown if session is invalid.
A NullPointerException exception will be thrown if policiesBuffer is null or empty.
개요
콘텐츠 관리 policy 구성을 설정합니다. input_file이 None이면 기본 설정(sanitise)이 적용됩니다.
def set_content_management_policy(self, session: int, input_file: Union[None, str, bytes, bytearray, io.BytesIO, "glasswall.content_management.policies.policy.Policy"] = None, policy_format=0):
""" Sets the content management policy configuration. If input_file is None then default settings (sanitise) are applied.
Args:
session (int): The session integer.
input_file (Union[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional): Default None (sanitise). The content management policy to apply.
policy_format (int): The format of the content management policy. 0=XML.
Returns:
- result (glasswall.GwReturnObj): Depending on the input 'input_file':
- If input_file is a str file path:
- gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'input_file', 'policy_format', 'status'.
- If input_file is a file in memory:
- gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'buffer', 'buffer_length', 'policy_format', 'status'.
"""
반환값
input_file의 유형에 따라 서로 다른 속성을 가진 객체입니다.
-
input_file이 str 파일 경로인 경우:
- gw_return_object (glasswall.GwReturnObj): 'session', 'input_file', 'policy_format', 'status' 속성을 가진 GwReturnObj 인스턴스입니다.
-
input_file이 메모리 내 파일인 경우:
- gw_return_object (glasswall.GwReturnObj): 'session', 'buffer', 'buffer_length', 'policy_format', 'status' 속성을 가진 GwReturnObj 인스턴스입니다.
status 속성은 정수 GW2_RetStatus enum 값입니다. 음수는 실패를 나타냅니다.
개요
이 함수는 지정된 세션이 지정된 메모리 버퍼에 저장된 polices를 사용하도록 요청합니다.
/**
* @param {number} session The ID of the session.
* @param {string} policies A pointer to the policy data buffer.
* @param {number} policiesLength The length of the data in the policy buffer.
* @param {number} format The format of the policy.
*/
GW2RegisterPoliciesMemory(
session,
policies,
policyLength,
format)
반환값
정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다.