GW2RegisterPoliciesFile
GW2RegisterPoliciesFile content management policy XML file को एक session में रजिस्टर करता है।
यदि GW2RegisterPoliciesFile या GW2RegisterPoliciesMemory में से कोई भी session के साथ registered नहीं है, तो उस session पर default policies लागू की जाएँगी। default policy सभी content management switches को Sanitise पर सेट करती है।
- C++
- C#
- Java
- Python
- JavaScript
सारांश
GW2RegisterPoliciesFile फ़ंक्शन अनुरोध करता है कि session उस फ़ाइल में निर्दिष्ट policies का उपयोग करे जिसका नाम filename. द्वारा इंगित string है। policies का format, format द्वारा निर्दिष्ट format में होता है। ये policies उस session के लिए Glasswall द्वारा किए गए सभी processing पर लागू होंगी।
#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 द्वारा संदर्भित session के साथ, policiesFilePath द्वारा इंगित फ़ाइल को, policiesFormat द्वारा निर्दिष्ट format के साथ रजिस्टर करता है
/// <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 के लिए मान्य enumerators हेतु 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 enumeration को int में परिवर्तित करके लौटाता है। यदि कोई त्रुटि हुई हो, तो मान ऋणात्मक होगा। 0 सफलता को दर्शाता है। विवरण के लिए API Overview/Return types देखें।
A NullPointerException exception will be thrown if policiesFilePath is null or empty.
A GlasswallException exception will be thrown if session is invalid, if the policiesFilePath could not be retrieved, or if the policiesFilePath could not be converted to UTF-8.
सारांश
कंटेंट मैनेजमेंट 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, निर्दिष्ट file में मौजूद policies का उपयोग करे।
/**
* @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 मान लौटाता है। नकारात्मक संख्याएँ विफलता को दर्शाती हैं।