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 列挙値を返します。負の数は失敗を示します。
例
#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 がファイルを処理する際に使用する policy を登録します
/// <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 列挙値を返します。負の数は失敗を示します。
概要
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 列挙値を返します。負の数は失敗を示します。