📄 policyinfo.c
字号:
return (status);
}
static int MessageHeaderExternalAlloc (
VoltPolicyCtx *ctx,
VoltLibCtx *libCtx,
VtItem **result
)
{
int status;
unsigned int bufferSize, valueLen;
VoltDefaultPolicyCtx *localPolicyCtx =
(VoltDefaultPolicyCtx *)(ctx->localCtx);
char *value = (char *)0;
unsigned char *buffer = (unsigned char *)0;
VtItem *retVal;
VOLT_DECLARE_ERROR_TYPE (errorType)
VOLT_DECLARE_FNCT_LINE (fnctLine)
do
{
/* This checks the XML data. If the return is null, there is no
* ZDR template.
*/
status = 0;
value = m_vs_cp_get_message_header_external (localPolicyCtx->vsPolicyObj);
if (value == (char *)0)
break;
/* There is a value. Allocate space for a VtItem and a copy of the
* value and return it.
*/
VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
VOLT_SET_FNCT_LINE (fnctLine)
status = VT_ERROR_MEMORY;
valueLen = Z2Strlen (value);
bufferSize = sizeof (VtItem) + valueLen + 1;
buffer = Z2Malloc (bufferSize, 0);
if (buffer == (unsigned char *)0)
break;
Z2Memset (buffer, 0, bufferSize);
retVal = (VtItem *)buffer;
/* Point the data to the space after the VtItem, it's a byte
* array, no need to worry about alignment.
*/
retVal->data = buffer + sizeof (VtItem);
Z2Memcpy (retVal->data, value, valueLen);
retVal->len = valueLen;
*result = retVal;
status = 0;
} while (0);
if (value != (char *)0)
m_vs_free_memory (localPolicyCtx->vsPolicyObj, value);
VOLT_LOG_ERROR_INFO_COMPARE (
status, libCtx, ctx, status, 0, errorType,
(char *)0, "MessageHeaderExternalAlloc", fnctLine, (char *)0)
return (status);
}
static int ZdrTemplateAlloc (
VoltPolicyCtx *ctx,
VoltLibCtx *libCtx,
VtItem **result
)
{
int status;
unsigned int bufferSize, valueLen;
VoltDefaultPolicyCtx *localPolicyCtx =
(VoltDefaultPolicyCtx *)(ctx->localCtx);
char *value = (char *)0;
unsigned char *buffer = (unsigned char *)0;
VtItem *retVal;
VOLT_DECLARE_ERROR_TYPE (errorType)
VOLT_DECLARE_FNCT_LINE (fnctLine)
do
{
/* This checks the XML data. If the return is null, there is no
* ZDR template.
*/
status = 0;
value = m_vs_cp_get_zfr_template (localPolicyCtx->vsPolicyObj);
if (value == (char *)0)
break;
/* There is a value. Allocate space for a VtItem and a copy of the
* value and return it.
*/
VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
VOLT_SET_FNCT_LINE (fnctLine)
status = VT_ERROR_MEMORY;
valueLen = Z2Strlen (value);
bufferSize = sizeof (VtItem) + valueLen + 1;
buffer = Z2Malloc (bufferSize, 0);
if (buffer == (unsigned char *)0)
break;
Z2Memset (buffer, 0, bufferSize);
retVal = (VtItem *)buffer;
/* Point the data to the space after the VtItem, it's a byte
* array, no need to worry about alignment.
*/
retVal->data = buffer + sizeof (VtItem);
Z2Memcpy (retVal->data, value, valueLen);
retVal->len = valueLen;
*result = retVal;
status = 0;
} while (0);
if (value != (char *)0)
m_vs_free_memory (localPolicyCtx->vsPolicyObj, value);
VOLT_LOG_ERROR_INFO_COMPARE (
status, libCtx, ctx, status, 0, errorType,
(char *)0, "ZdrTemplateAlloc", fnctLine, (char *)0)
return (status);
}
static int Zdm2TemplateAlloc (
VoltPolicyCtx *ctx,
VoltLibCtx *libCtx,
VtItem **result
)
{
int status;
unsigned int bufferSize, valueLen;
VoltDefaultPolicyCtx *localPolicyCtx =
(VoltDefaultPolicyCtx *)(ctx->localCtx);
char *value = (char *)0;
unsigned char *buffer = (unsigned char *)0;
VtItem *retVal;
VOLT_DECLARE_ERROR_TYPE (errorType)
VOLT_DECLARE_FNCT_LINE (fnctLine)
do
{
/* This checks the XML data. If the return is null, there is no
* ZDR template.
*/
status = 0;
value = m_vs_cp_get_zdm2_template (localPolicyCtx->vsPolicyObj);
if (value == (char *)0)
break;
/* There is a value. Allocate space for a VtItem and a copy of the
* value and return it.
*/
VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
VOLT_SET_FNCT_LINE (fnctLine)
status = VT_ERROR_MEMORY;
valueLen = Z2Strlen (value);
bufferSize = sizeof (VtItem) + valueLen + 1;
buffer = Z2Malloc (bufferSize, 0);
if (buffer == (unsigned char *)0)
break;
Z2Memset (buffer, 0, bufferSize);
retVal = (VtItem *)buffer;
/* Point the data to the space after the VtItem, it's a byte
* array, no need to worry about alignment.
*/
retVal->data = buffer + sizeof (VtItem);
Z2Memcpy (retVal->data, value, valueLen);
retVal->len = valueLen;
*result = retVal;
status = 0;
} while (0);
if (value != (char *)0)
m_vs_free_memory (localPolicyCtx->vsPolicyObj, value);
VOLT_LOG_ERROR_INFO_COMPARE (
status, libCtx, ctx, status, 0, errorType,
(char *)0, "Zdm2TemplateAlloc", fnctLine, (char *)0)
return (status);
}
static int HTMLMessageBodyTemplateAlloc (
VoltPolicyCtx *ctx,
VoltLibCtx *libCtx,
VtItem **result
)
{
int status;
unsigned int bufferSize, valueLen;
VoltDefaultPolicyCtx *localPolicyCtx =
(VoltDefaultPolicyCtx *)(ctx->localCtx);
char *value = (char *)0;
unsigned char *buffer = (unsigned char *)0;
VtItem *retVal;
VOLT_DECLARE_ERROR_TYPE (errorType)
VOLT_DECLARE_FNCT_LINE (fnctLine)
do
{
/* This checks the XML data. If the return is null, there is no
* ZDR template.
*/
status = 0;
value = m_vs_cp_get_html_message_body_template (localPolicyCtx->vsPolicyObj);
if (value == (char *)0)
break;
/* There is a value. Allocate space for a VtItem and a copy of the
* value and return it.
*/
VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
VOLT_SET_FNCT_LINE (fnctLine)
status = VT_ERROR_MEMORY;
valueLen = Z2Strlen (value);
bufferSize = sizeof (VtItem) + valueLen + 1;
buffer = Z2Malloc (bufferSize, 0);
if (buffer == (unsigned char *)0)
break;
Z2Memset (buffer, 0, bufferSize);
retVal = (VtItem *)buffer;
/* Point the data to the space after the VtItem, it's a byte
* array, no need to worry about alignment.
*/
retVal->data = buffer + sizeof (VtItem);
Z2Memcpy (retVal->data, value, valueLen);
retVal->len = valueLen;
*result = retVal;
status = 0;
} while (0);
if (value != (char *)0)
m_vs_free_memory (localPolicyCtx->vsPolicyObj, value);
VOLT_LOG_ERROR_INFO_COMPARE (
status, libCtx, ctx, status, 0, errorType,
(char *)0, "HTMLMessageBodyTemplateAlloc", fnctLine, (char *)0)
return (status);
}
static int EncryptRulesAlloc (
VoltPolicyCtx *ctx,
VoltLibCtx *libCtx,
VtItem **result
)
{
int status;
unsigned int bufferSize, valueLen;
VoltDefaultPolicyCtx *localPolicyCtx =
(VoltDefaultPolicyCtx *)(ctx->localCtx);
char *value = (char *)0;
unsigned char *buffer = (unsigned char *)0;
VtItem *retVal;
VOLT_DECLARE_ERROR_TYPE (errorType)
VOLT_DECLARE_FNCT_LINE (fnctLine)
do
{
/* This checks the XML data. If the return is null, there is no
* ZDR template.
*/
status = 0;
value = m_vs_cp_get_encrypt_rules (localPolicyCtx->vsPolicyObj);
if (value == (char *)0)
break;
/* There is a value. Allocate space for a VtItem and a copy of the
* value and return it.
*/
VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
VOLT_SET_FNCT_LINE (fnctLine)
status = VT_ERROR_MEMORY;
valueLen = Z2Strlen (value);
bufferSize = sizeof (VtItem) + valueLen + 1;
buffer = Z2Malloc (bufferSize, 0);
if (buffer == (unsigned char *)0)
break;
Z2Memset (buffer, 0, bufferSize);
retVal = (VtItem *)buffer;
/* Point the data to the space after the VtItem, it's a byte
* array, no need to worry about alignment.
*/
retVal->data = buffer + sizeof (VtItem);
Z2Memcpy (retVal->data, value, valueLen);
retVal->len = valueLen;
*result = retVal;
status = 0;
} while (0);
if (value != (char *)0)
m_vs_free_memory (localPolicyCtx->vsPolicyObj, value);
VOLT_LOG_ERROR_INFO_COMPARE (
status, libCtx, ctx, status, 0, errorType,
(char *)0, "EncryptRulesAlloc", fnctLine, (char *)0)
return (status);
}
static int DefaultZdrLocationAlloc (
VoltPolicyCtx *ctx,
VoltLibCtx *libCtx,
VtItem **result
)
{
int status;
unsigned int bufferSize, valueLen;
VoltDefaultPolicyCtx *localPolicyCtx =
(VoltDefaultPolicyCtx *)(ctx->localCtx);
char *value = (char *)0;
unsigned char *buffer = (unsigned char *)0;
VtItem *retVal;
VOLT_DECLARE_ERROR_TYPE (errorType)
VOLT_DECLARE_FNCT_LINE (fnctLine)
do
{
/* This checks the XML data. If the return is null, there is no
* default ZDR location.
*/
status = 0;
value = m_vs_cp_get_defaultZDM (localPolicyCtx->vsPolicyObj);
if (value == (char *)0)
break;
/* There is a value. Allocate space for a VtItem and a copy of the
* value and return it.
*/
VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
VOLT_SET_FNCT_LINE (fnctLine)
status = VT_ERROR_MEMORY;
valueLen = Z2Strlen (value);
bufferSize = sizeof (VtItem) + valueLen + 1;
buffer = Z2Malloc (bufferSize, 0);
if (buffer == (unsigned char *)0)
break;
Z2Memset (buffer, 0, bufferSize);
retVal = (VtItem *)buffer;
/* Point the data to the space after the VtItem, it's a byte
* array, no need to worry about alignment.
*/
retVal->data = buffer + sizeof (VtItem);
Z2Memcpy (retVal->data, value, valueLen);
retVal->len = valueLen;
*result = retVal;
status = 0;
} while (0);
if (value != (char *)0)
m_vs_free_memory (localPolicyCtx->vsPolicyObj, value);
VOLT_LOG_ERROR_INFO_COMPARE (
status, libCtx, ctx, status, 0, errorType,
(char *)0, "DefaultZdrLocationAlloc", fnctLine, (char *)0)
return (status);
}
static int DecryptPolicyAlloc (
VoltPolicyCtx *ctx,
VoltLibCtx *libCtx,
int **result
)
{
int status, mode;
int *theValue = (int *)0;
VoltDefaultPolicyCtx *localPolicyCtx =
(VoltDefaultPolicyCtx *)(ctx->localCtx);
VOLT_DECLARE_ERROR_TYPE (errorType)
VOLT_DECLARE_FNCT_LINE (fnctLine)
do
{
/* Allocate the space for an int, initialize to VOLT_AUTO_DECRYPT.
*/
VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
VOLT_SET_FNCT_LINE (fnctLine)
status = VT_ERROR_MEMORY;
theValue = (int *)Z2Malloc (sizeof (int), 0);
if (theValue == (int *)0)
break;
*theValue = VOLT_AUTO_DECRYPT;
*result = theValue;
/* This checks the XML data.
* It returns a 0 for AUTO_DECRYPT. Any other return value will be
* DECRYPT_ON_VIEW.
*/
mode = m_vs_cp_get_decryption_mode (localPolicyCtx->vsPolicyObj);
/* If mode is 0, we have theValue set properly, just return.
*/
status = 0;
if (mode == 0)
break;
/* The mode is not AUTO, set it to ON_VIEW.
*/
*theValue = VOLT_DECRYPT_ON_VIEW;
} while (0);
VOLT_LOG_ERROR_INFO_COMPARE (
status, libCtx, ctx, status, 0, errorType,
(char *)0, "DecryptPolicyAlloc", fnctLine, (char *)0)
return (status);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -