GW2RegisterPoliciesFile
GW2RegisterPoliciesFile는 콘텐츠 관리 policy XML 파일을 세션에 등록합니다.
GW2RegisterPoliciesFile 또는 GW2RegisterPoliciesMemory 중 어느 것도 세션에 등록되지 않은 경우, 기본 policy가 해당 세션에 적용됩니다. 기본 policy는 모든 콘텐츠 관리 스위치를 Sanitise로 설정합니다.
- C++
- C#
- Java
- Python
- JavaScript
개요
GW2RegisterPoliciesFile 함수는 session이 filename.이 가리키는 문자열 이름의 파일에 지정된 policy를 사용하도록 요청합니다. policy의 형식은 format에 지정된 형식입니다. 해당 policy는 그 세션에 대해 Glasswall이 수행하는 모든 처리에 적용됩니다.
#include "glasswall.core2.api.h"
int GW2RegisterPoliciesFile(Session session, const char *filename, Policy_format format);
반환값
정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다.
예제
#include "glasswall.core2.api.h"
HANDLE session = GW2OpenSession();
if (!session)
/* deal with error */
else
if (GW2RegisterPoliciesFile(session, "Office_Binary_Policies.xml", PF_XML) < 0)
/* deal with error */
else
/* the file has been successfully registered */
...
/* later */
if (GW2CloseSession(session) < 0)
/* error closing session */
개요
session이 참조하는 세션에 대해, policiesFilePath가 가리키는 파일을 policiesFormat에 지정된 형식으로 등록합니다
/// <param name="session">ID number for the session</param>
/// <param name="policiesFilePath">The file path to the file to be processed</param>
/// <param name="policiesFormat">Format of the policy file</param>
public int RegisterPoliciesFile(
int session,
string policiesFilePath,
int policiesFormat
반환값
정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다.
개요
import com.glasswall.core2javabridge.*;
public int GW2RegisterPoliciesFile(int session, String policiesFilePath, int format) throws GlasswallException, NullPointerException
(Deprecated)
public int GW2RegisterPoliciesFile(int session, byte[] policiesFilePath, int format) throws GlasswallException, NullPointerException
설명
format에 유효한 열거자에 대해서는 API Overview/Return types를 참조하십시오.
The GW2RegisterPoliciesFile function parameters have been updated to use String in place of byte[]. The original function has been deprecated.
반환값
GW2RegisterPoliciesFile 함수는 GW2_RetStatus 열거형을 int로 변환하여 반환합니다. 오류가 발생한 경우 값은 음수가 됩니다. 0은 성공을 나타냅니다. 자세한 내용은 API Overview/Return types를 참조하세요.
NullPointerException 예외는 policiesFilePath가 null이거나 비어 있는 경우 발생합니다.
GlasswallException 예외는 session이 유효하지 않거나, policiesFilePath를 가져올 수 없거나, policiesFilePath를 UTF-8로 변환할 수 없는 경우 발생합니다.
개요
콘텐츠 관리 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 값입니다. 음수는 실패를 나타냅니다.
개요
이 함수는 지정된 세션이 지정된 파일의 policy를 사용하도록 요청합니다.
/**
* @param {number} session The ID of the session.
* @param {string} filename The filename from which to load policy settings.
* @param {number} format - The format of the policy to be registered.
*/
GW2RegisterPoliciesFile(
session,
filename,
format)
반환값
정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다.