Lumaktaw sa pangunahing nilalaman

GW2RegisterPoliciesMemory

Ang GW2RegisterPoliciesMemory ay nagrerehistro ng XML file ng policy sa pamamahala ng nilalaman na nakaimbak sa memory sa isang session.

Kung alinman sa GW2RegisterPoliciesFile o GW2RegisterPoliciesMemory ay hindi nairehistro sa isang session, ang mga default policy ay ilalapat sa session na iyon. Itinatakda ng default policy ang lahat ng content management switch sa Sanitise.

Buod

Para sa session na session, ang function na GW2RegisterPoliciesMemory ay nagrerehistro ng mga policy na gagamitin ng Glasswall kapag nagpoproseso ng mga file. Ang policies ay isang pointer sa data ng mga policy, tinutukoy ng policiesLength ang laki sa bytes ng data ng mga policy, at tinutukoy ng policiesFormat ang format ng data ng mga policy.


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

Ibinabalik

Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.

Halimbawa


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