📄 policyinfo.c
字号:
district = m_vs_cp_get_fallthrough_district (localPolicyCtx->vsPolicyObj);
if (district == (char *)0)
break;
/* There is a fall through district. Allocate space for a VtItem and
* a copy of the district name and return it.
*/
VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
VOLT_SET_FNCT_LINE (fnctLine)
status = VT_ERROR_MEMORY;
districtLen = Z2Strlen (district);
bufferSize = sizeof (VtItem) + districtLen + 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, district, districtLen);
retVal->len = districtLen;
*districtName = retVal;
status = 0;
} while (0);
if (district != (char *)0)
m_vs_free_memory (localPolicyCtx->vsPolicyObj, district);
VOLT_LOG_ERROR_INFO_COMPARE (
status, libCtx, ctx, status, 0, errorType,
(char *)0, "FallThroughDistrictAlloc", fnctLine, (char *)0)
return (status);
}
static int RefreshRateAlloc (
VoltPolicyCtx *ctx,
VoltLibCtx *libCtx,
VoltPolicyGetType flag,
int **rate
)
{
int status;
int *theRate = (int *)0;
VoltDefaultPolicyCtx *localPolicyCtx =
(VoltDefaultPolicyCtx *)(ctx->localCtx);
VOLT_DECLARE_ERROR_TYPE (errorType)
VOLT_DECLARE_FNCT_LINE (fnctLine)
do
{
/* Allocate the space for an int.
*/
VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
VOLT_SET_FNCT_LINE (fnctLine)
status = VT_ERROR_MEMORY;
theRate = (int *)Z2Malloc (sizeof (int), 0);
if (theRate == (int *)0)
break;
/* This checks the XML data.
*/
if (flag == VOLT_POLICY_GET_REFRESH_RATE_NEGATIVE)
*theRate = m_vs_cp_get_parameter_refresh_rate_negative (
localPolicyCtx->vsPolicyObj);
else
*theRate = m_vs_cp_get_parameter_refresh_rate_positive (
localPolicyCtx->vsPolicyObj);
*rate = theRate;
status = 0;
} while (0);
VOLT_LOG_ERROR_INFO_COMPARE (
status, libCtx, ctx, status, 0, errorType,
(char *)0, "RefreshRateAlloc", fnctLine, (char *)0)
return (status);
}
static int IsParamCheckingStrictAlloc (
VoltPolicyCtx *ctx,
VoltLibCtx *libCtx,
int **result
)
{
int status;
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.
*/
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;
/* This checks the XML data.
*/
*theValue = m_vs_cp_is_parameter_checking_strict (
localPolicyCtx->vsPolicyObj);
/* Make sure it's 0 or 1, not 0 or non-zero.
*/
if (*theValue != 0)
*theValue = 1;
*result = theValue;
status = 0;
} while (0);
VOLT_LOG_ERROR_INFO_COMPARE (
status, libCtx, ctx, status, 0, errorType,
(char *)0, "IsParamCheckingStrictAlloc", fnctLine, (char *)0)
return (status);
}
static int IsDistrictAggressiveAlloc (
VoltPolicyCtx *ctx,
VoltLibCtx *libCtx,
VoltDistrictObject *distObj,
int **result
)
{
int status;
VoltDefaultPolicyCtx *localPolicyCtx =
(VoltDefaultPolicyCtx *)(ctx->localCtx);
VtItem *theName;
int *theValue = (int *)0;
VOLT_DECLARE_ERROR_TYPE (errorType)
VOLT_DECLARE_FNCT_LINE (fnctLine)
do
{
/* Allocate the space for an int, initialize to 0.
*/
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 = 0;
*result = theValue;
/* Is there a name to check?
*/
theName = &(distObj->unqualDistrictName);
/* This checks the XML data.
*/
*theValue = m_vs_cp_is_parameter_retrieval_aggressive (
localPolicyCtx->vsPolicyObj, distObj->unqualDistrictName.data);
/* Make sure it's 0 or 1, not 0 or non-zero.
*/
if (*theValue != 0)
*theValue = 1;
status = 0;
} while (0);
VOLT_LOG_ERROR_INFO_COMPARE (
status, libCtx, ctx, status, 0, errorType,
(char *)0, "IsDistrictAggressiveAlloc", fnctLine, (char *)0)
return (status);
}
static int IsDistrictTrustedAlloc (
VoltPolicyCtx *ctx,
VoltLibCtx *libCtx,
VoltDistrictObject *distObj,
int **result
)
{
int status;
VoltDefaultPolicyCtx *localPolicyCtx =
(VoltDefaultPolicyCtx *)(ctx->localCtx);
VtItem *theName;
int *theValue = (int *)0;
VOLT_DECLARE_ERROR_TYPE (errorType)
VOLT_DECLARE_FNCT_LINE (fnctLine)
do
{
/* Allocate the space for an int, initialize to 0.
*/
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 = 0;
*result = theValue;
/* Is there a name to check?
*/
status = 0;
theName = &(distObj->unqualDistrictName);
if (theName->data == (unsigned char *)0)
{
theName = &(distObj->qualDistrictName);
if (theName->data == (unsigned char *)0)
break;
}
/* This checks the XML data.
*/
if (distObj->qualDistrictName.data != (unsigned char *)0)
{
*theValue = m_vs_cp_is_trusted_district (
localPolicyCtx->vsPolicyObj, distObj->qualDistrictName.data);
}
else
{
*theValue = m_vs_cp_is_trusted_district (
localPolicyCtx->vsPolicyObj, distObj->unqualDistrictName.data);
}
/* Make sure it's 0 or 1, not 0 or non-zero.
*/
if (*theValue != 0)
*theValue = 1;
} while (0);
VOLT_LOG_ERROR_INFO_COMPARE (
status, libCtx, ctx, status, 0, errorType,
(char *)0, "IsDistrictTrustedAlloc", fnctLine, (char *)0)
return (status);
}
static int CredentialCacheModeAlloc (
VoltPolicyCtx *ctx,
VoltLibCtx *libCtx,
int **cacheMode
)
{
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 0.
*/
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 = 0;
*cacheMode = theValue;
/* This checks the XML data.
* It returns a 0 or 1 (yes/no, true/false). For this function, 0
* means no caching, which translates to a cache period of 0.
* A return of 1 means cache as long as the process is active.
*/
mode = m_vs_cp_get_password_caching_mode (localPolicyCtx->vsPolicyObj);
/* If mode is 0, the cacheMode is 0, we initialized it to 0 so all we
* have to do is return.
*/
status = 0;
if (mode == 0)
break;
/* The mode is cache for the life of the process, set the return to
* -1.
*/
*theValue = -1;
} while (0);
VOLT_LOG_ERROR_INFO_COMPARE (
status, libCtx, ctx, status, 0, errorType,
(char *)0, "CredentialCacheModeAlloc", fnctLine, (char *)0)
return (status);
}
static int HeaderFooterAlloc (
VoltPolicyCtx *ctx,
VoltLibCtx *libCtx,
unsigned int flag,
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
* header.
*/
status = 0;
if (flag != 0)
{
value = m_vs_cp_get_message_header_internal (
localPolicyCtx->vsPolicyObj);
}
else
{
value = m_vs_cp_get_message_footer (
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, "HeaderFooterAlloc", fnctLine, (char *)0)
return (status);
}
static int MessageHeaderInternalAlloc (
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_internal (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, "MessageHeaderInternalAlloc", fnctLine, (char *)0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -