GW2RegisterPoliciesMemory
GW2RegisterPoliciesMemory मेमोरी में रखी गई content management policy XML file को एक session में register करता है।
यदि GW2RegisterPoliciesFile या GW2RegisterPoliciesMemory में से कोई भी session के साथ registered नहीं है, तो उस session पर default policies लागू की जाएँगी। default policy सभी content management switches को Sanitise पर सेट करती है।
- C++
- C#
- Java
- Python
- JavaScript
सारांश
session session के लिए, GW2RegisterPoliciesMemory function उन policies को register करता है जिन्हें Glasswall फ़ाइलों को process करते समय उपयोग करेगा। policies policies data का pointer है, policiesLength policies data का आकार bytes में निर्दिष्ट करता है, और policiesFormat policies data का format निर्दिष्ट करता है।
#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 द्वारा फ़ाइलों को process करते समय उपयोग की जाने वाली policies को register करता है
/// <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 के लिए मान्य enumerators हेतु API Overview/Return types देखें।
The length of the policiesBuffer may optionally be specified.
रिटर्न
GW2RegisterPoliciesMemory फ़ंक्शन GW2_RetStatus enumeration को 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 configuration सेट करता है। यदि input_file None है, तो default settings (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 के प्रकार के आधार पर अलग-अलग attributes वाला एक object।
-
यदि input_file एक str file path है:
- gw_return_object (glasswall.GwReturnObj): 'session', 'input_file', 'policy_format', 'status' attributes वाला एक GwReturnObj instance.
-
यदि input_file memory में एक file है:
- gw_return_object (glasswall.GwReturnObj): 'session', 'buffer', 'buffer_length', 'policy_format', 'status' attributes वाला एक GwReturnObj instance.
status attribute एक integer GW2_RetStatus enum value है। Negative numbers विफलता को दर्शाते हैं।
सारांश
यह फ़ंक्शन अनुरोध करता है कि निर्दिष्ट session, निर्दिष्ट memory buffer में संग्रहीत 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 मान लौटाता है। नकारात्मक संख्याएँ विफलता को दर्शाती हैं।