GW2GetPolicySettings
GW2GetPolicySettings 関数は、指定された session に関連付けられた policy 設定ファイルの内容に対応する文字列を提供します。
- C++
- C#
- Java
- Python
- JavaScript
#include "glasswall.core2.api.h"
int GW2GetPolicySettings (
Session session,
char **policiesBuffer,
size_t *policiesLength,
Policy_format format);
パラメーター
session GW2OpenSession によって返されるセッションの ID
policiesBuffer policy 設定情報が格納される文字列ポインタの出力パラメータです。このポインタで使用されるメモリをユーザーが解放する必要は ありません。失敗した場合、このパラメータは nullptr に設定されることがあります。
policiesLength policiesBuffer が指すメモリのサイズ(バイト単位)が格納される出力パラメータです
format データの形式です。これは PF_XML でなければなりません。
戻り値
関数呼び出しが成功したかどうかを示す整数を返します。負の数は失敗を示します。戻りコードの説明については、Return Types 表を参照してください。
概要
/// <summary>
/// Retrieves policy settings for the session
/// </summary>
/// <param name="session">Current open Glasswall session</param>
/// <param name="policiesBufferPtr">A pointer to the object containing a pointer pointing to the policy data</param>
/// <param name="policiesLengthPtr">A pointer to a object containing the size in bytes </param>
public int GetPolicySettings(
int session,
out IntPtr policiesBufferPtr,
ref UIntPtr policiesLengthPtr,
int format)
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。
概要
import com.glasswall.core2javabridge.*;
public String GW2GetPolicySettingsString(int session, int format) throws GlasswallException
注
GW2GetPolicySettingsString 関数は、session で指定されたセッションについて現在登録されているpolicy設定を出力します。
format の有効な列挙子については、API Overview/Return types を参照してください。
この機能では以前、policy設定データを取得するために2つの別個の関数呼び出しが必要でした。現在は合理化され、設定を String として返します。元の2つの関数は非推奨になりました。
戻り値
GW2GetPolicySettingsString 関数は、policy設定を含む String を返します。
GlasswallException 例外は、session が無効である場合、または policy 設定を取得できなかった場合にスローされます。
概要 - 非推奨関数
import com.glasswall.core2javabridge.*;
(Deprecated)
public int GW2GetPolicySettings(int session, int format) throws GlasswallException
public byte[] GetPolicyBuffer(int session) throws GlasswallException
説明 - 非推奨の関数
GW2GetPolicySettings 関数は、session で指定されたセッションについて現在登録されているpolicy設定を内部policyバッファーに出力します。このデータは GetPolicyBuffer 関数を使用して取得します。
format の有効な列挙子については、API Overview/Return types を参照してください。
戻り値 - 非推奨関数
GW2GetPolicySettings 関数は、GW2_RetStatus 列挙型を int に変換して返します。エラーが発生した場合、値は負になります。0 は成功を示します。詳細については、API Overview/Return types を参照してください。
GetPolicyBuffer は、policy設定を含む byte[] を返します。GW2GetPolicySettings が呼び出されていない場合、これは null になります。
GlasswallException 例外は、session が無効である場合、または policy 設定を取得できなかった場合にスローされます。
概要
指定されたセッションのコンテンツ管理構成を返します。
def get_content_management_policy(self, session: int):
""" Returns the content management configuration for a given session.
Args:
session (int): The session integer.
Returns:
xml_string (str): The XML string of the current content management configuration.
"""
戻り値
xml_string (str): 現在のコンテンツ管理構成のXML文字列
概要
/**
* This function returns the policy settings used for the specified session
*
* @param {number} session The ID of the session.
* @param {string} policiesBuffer The pointer to the policy buffer.
* @param {number} policiesLength The size of the data in the policy buffer
* @param {number} format The format of the policy.
*/
GW2GetPolicySettings(
session,
policiesBuffer,
policiesLength,
format)
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。
例
const ref = require('ref-napi');
...
function buffer_to_string(buffer, buffer_size) {
if (!buffer.isNull() && ref.deref(buffer_size) > 0) {
return Buffer.from(ref.reinterpret(ref.deref(buffer), ref.deref(buffer_size), 0)).toString();
}
else {
return "";
}
}
...
let policy_file_buffer = ref.alloc(ref.refType(ref.types.CString));
let policy_buffer_size = ref.alloc(ref.types.size_t, 0);
let return_status = gw.GW2GetPolicySettings(session_id, policy_file_buffer, policy_buffer_size, 0);
let xml_string = buffer_to_string(policy_file_buffer, policy_buffer_size);
...