Skip to main content
Version: 16.10.0

GW2RegisterPoliciesMemory

The GW2RegisterPoliciesMemory registers the content management policy XML file held in memory to a session.

If neither GW2RegisterPoliciesFile or GW2RegisterPoliciesMemory is registered with a session, the default policies will be applied to that session. The default policy sets all content management switches to Sanitise.

Synopsis

For session session, the GW2RegisterPoliciesMemory function registers the policies to be used by Glasswall when processing files. policies is a pointer to the policies data, policiesLength specifies the size in bytes of the policies data, and policiesFormat specifies the format of the policies data.


#include "glasswall.core2.api.h"
int GW2RegisterPoliciesMemory(Session session,
const char *policies,
size_t policiesLength,
Policy_format format);

Returns

Returns an integer GW2_RetStatus enum value. Negative numbers indicate a failure.

Example


#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 */