GW2GetPolicySettings
Ang GW2GetPolicySettings function ay nagbibigay ng string na tumutugma sa nilalaman ng policy settings file na nauugnay sa ibinigay na session.
- C++
- C#
- Java
- Python
- JavaScript
#include "glasswall.core2.api.h"
int GW2GetPolicySettings (
Session session,
char **policiesBuffer,
size_t *policiesLength,
Policy_format format);
Mga Parameter
session Ang ID ng session gaya ng ibinalik ng GW2OpenSession
policiesBuffer Isang output parameter na string pointer na pinupunan ng impormasyon ng policy settings. Ang memory na ginagamit ng pointer na ito ay hindi kailangang i-free ng user. Kapag nagkaroon ng failure, maaaring itakda ang parameter na ito sa nullptr.
policiesLength Isang output parameter na pinupunan ng laki sa bytes ng memory na tinutukoy ng policiesBuffer
format Ang format ng data. Dapat itong PF_XML.
Ibinabalik
Nagbabalik ng integer na nagsasaad kung matagumpay ang function call. Ang mga negatibong numero ay nagsasaad ng failure. Tingnan ang talahanayang Return Types para sa paliwanag ng mga return code.
Buod
/// <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)
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.
Buod
import com.glasswall.core2javabridge.*;
public String GW2GetPolicySettingsString(int session, int format) throws GlasswallException
Tandaan
Ang function na GW2GetPolicySettingsString ay naglalabas ng kasalukuyang nakarehistrong mga setting ng policy para sa session na tinukoy ng session.
Sumangguni sa API Overview/Return types para sa mga wastong enumerator para sa format.
Dati, ang functionality na ito ay nangangailangan ng dalawang magkahiwalay na function call upang makuha ang data ng setting ng policy. Ngayon ay pinasimple na ito upang ibalik ang mga setting bilang isang String. Ang dalawang orihinal na function ay deprecated na.
Ibinabalik
Ang function na GW2GetPolicySettingsString ay nagbabalik ng isang String na naglalaman ng mga setting ng policy.
Isang exception na GlasswallException ang ita-throw kung hindi wasto ang session, o kung hindi makuha ang mga setting ng policy.
Buod - Mga Hindi na Inirerekomendang Function
import com.glasswall.core2javabridge.*;
(Deprecated)
public int GW2GetPolicySettings(int session, int format) throws GlasswallException
public byte[] GetPolicyBuffer(int session) throws GlasswallException
Paglalarawan - Mga Deprecated na Function
Ang function na GW2GetPolicySettings ay naglalabas ng kasalukuyang nakarehistrong mga setting ng policy para sa session na tinukoy ng session papunta sa internal policy buffer. Kunin ang data na ito sa pamamagitan ng paggamit ng function na GetPolicyBuffer.
Sumangguni sa API Overview/Return types para sa mga wastong enumerator para sa format.
Mga Return - Mga Hindi na Inirerekomendang Function
Ang function na GW2GetPolicySettings ay nagbabalik ng isang enumeration na GW2_RetStatus na kino-convert sa int. Magiging negatibo ang value kung may naganap na error. Ang 0 ay nagpapahiwatig ng tagumpay. Sumangguni sa API Overview/Return types para sa mga detalye.
Ang GetPolicyBuffer ay nagbabalik ng isang byte[] na naglalaman ng mga setting ng policy. Ito ay magiging null kung hindi pa natawag ang GW2GetPolicySettings.
Isang exception na GlasswallException ang ita-throw kung hindi wasto ang session, o kung hindi makuha ang mga setting ng policy.
Buod
Ibinabalik ang configuration ng content management para sa isang ibinigay na session.
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.
"""
Ibinabalik
xml_string (str): Ang XML string ng kasalukuyang configuration ng content management
Buod
/**
* 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)
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.
Halimbawa
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);
...