⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 policyinfo.c

📁 voltage 公司提供的一个开发Ibe的工具包
💻 C
📖 第 1 页 / 共 3 页
字号:
#include "vibe.h"
#include "environment.h"
#include "base.h"
#include "libctx.h"
#include "policy.h"
#include "localpolicy.h"
#include "idobj.h"
#include "reciplist.h"
#include "emailschema.h"

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_IS_LOCAL_ID.
 * <p>If the given identity is local, this function will allocate space
 * for a VtItem struct and the actual string data. It will be the name
 * of the district to use. The routine will deposit the pointer to the
 * VtItem at the address given by districtName.
 * <p>If the given identity is not local, this function will return a
 * NULL pointer at the address given by districtName.
 * <p>The pointer at the address districtName must be initialized to
 * NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param idObj The identity object to check.
 * @param districtName The address where the function will deposit
 * either the pointer to the allocated memory, the name of the district
 * to use, or else a NULL pointer if the identity is not local.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV IsIdentityLocalAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VoltIdentityObject *idObj,
   VtItem **districtName
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_PROVISIONED_DISTRICT.
 * <p>If the given identity is provisioned, this function will allocate
 * space for a VtItem struct and the actual string data. It will be the
 * name of the district to use. The routine will deposit the pointer to
 * the VtItem at the address given by districtName.
 * <p>If the given identity is not provisioned, this function will
 * return a NULL pointer at the address given by districtName.
 * <p>The pointer at the address districtName must be initialized to
 * NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param idObj The identity object to check.
 * @param districtName The address where the function will deposit
 * either the pointer to the allocated memory, the name of the district
 * to use, or else a NULL pointer if the identity is not provisioned.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV ProvisionedDistrictAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VoltIdentityObject *idObj,
   VtItem **districtName
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_FALL_THROUGH_DISTRICT.
 * <p>If the policy has a fall through district, this function will
 * allocate space for a VtItem struct and the actual string data. It
 * will be the name of the district to use. The routine will deposit
 * the pointer to the VtItem at the address given by districtName.
 * <p>If there is no fall through district, this function will return a
 * NULL pointer at the address given by districtName.
 * <p>The pointer at the address districtName must be initialized to
 * NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param districtName The address where the function will deposit
 * either the pointer to the allocated memory, the name of the district
 * to use, or else a NULL pointer if there is no fall through district.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV FallThroughDistrictAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VtItem **districtName
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_REFRESH_RATE_NEGATIVE or
 * VOLT_POLICY_GET_REFRESH_RATE_POSITIVE.
 * <p>The flag argument indicates which refresh rate is requested,
 * negative or positive. The value must be one of the two
 * PolicyGetType's, REFRESH_RATE_NEGATIVE or REFRESH_RATE_POSITIVE.
 * <p>This function will allocate space for an int and set it to the
 * refresh rate.
 * <p>If the function can find no "official" refresh rate, it will
 * return the address of an int that sets the rate to 0.
 * <p>The pointer at the address rate must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param flag Indicates which refresh rate is requested,
 * REFRESH_RATE_NEGATIVE or REFRESH_RATE_POSITIVE.
 * @param rate The address where the function will deposit the pointer
 * to the int, the rate (in seconds).
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV RefreshRateAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VoltPolicyGetType flag,
   int **rate
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_IS_PARAM_CHECKING_STRICT.
 * <p>This function will allocate space for an int and set it to either
 * 0 or 1. If 1 (yes/true), the param checking is strict. If 0
 * (no/false), the param checking is not strict.
 * <p>If the function can find no "official" strictness, it will return
 * the address of an int that sets the strict to 1.
 * <p>The pointer at the address result must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param result The address where the function will deposit the pointer
 * to the int, the strictness.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV IsParamCheckingStrictAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   int **result
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_IS_DISTRICT_AGGRESSIVE. An aggressive district is
 * one that says the refresh rate negative is 0.
 * <p>This function will allocate space for an int and set it to either
 * 0 or 1. If 1 (yes/true), the district is aggressive. If 0
 * (no/false), the district is not aggressive.
 * <p>If the function can find no "official" aggressiveness, it will
 * return the address of an int that sets the aggressiveness to 0.
 * <p>The pointer at the address result must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param result The address where the function will deposit the pointer
 * to the int, the aggressiveness.
 * @param distObj The district object to check.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV IsDistrictAggressiveAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VoltDistrictObject *distObj,
   int **result
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_IS_TRUSTED_DISTRICT.
 * <p>This function will allocate space for an int and set it to either
 * 0 or 1. If 1 (yes/true), the district is trusted. If 0 (no/false),
 * the trustworthiness of the district is not known.
 * <p>If the function can find no "official" trust status, it will
 * return the address of an int that sets trust to 0.
 * <p>The pointer at the address result must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param distObj The district object to check.
 * @param result The address where the function will deposit the pointer
 * to the int, trusted or not.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV IsDistrictTrustedAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VoltDistrictObject *distObj,
   int **result
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_CREDENTIAL_CACHE_MODE.
 * <p>This function will allocate space for an int and set it to either
 * -1 (cache for life of process), 0 (no caching), or a positive value
 * (cache for that number of seconds).
 * <p>If the function can find no "official" cache mode, it will
 * return the address of an int that sets the mode to 0.
 * <p>The pointer at the address cacheMode must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param cacheMode The address where the function will deposit the
 * pointer to the int, the mode.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV CredentialCacheModeAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   int **cacheMode
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_SECURE_MAIL_HEADER or VOLT_POLICY_GET_CONTENT_FOOTER.
 * <p>The idList argument is needed for when the getType is HEADER. It
 * also indicates which value is requested, becaus if it is NULL, get
 * the footer, if not NULL, get the header.
 * <p>If the policy has the value requested, this function will allocate
 * space for a VtItem struct and the actual string data. The routine will
 * deposit the pointer to the VtItem at the address given by result.
 * <p>If there is no value, this function will return a NULL pointer at
 * the address given by result.
 * <p>The pointer at the address result must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param idList The recipient list if calling for a header, NULL if
 * calling for a footer.
 * @param result The address where the function will deposit either the
 * pointer to the allocated memory, the value, or else a NULL pointer
 * if there is no value.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV HeaderFooterAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VoltIdentityList *idList,
   VtItem **result
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_MESSAGE_HEADER_INTERNAL.
 * <p>If the policy has the value requested, this function will allocate
 * space for a VtItem struct and the actual string data. The routine will
 * deposit the pointer to the VtItem at the address given by result.
 * <p>If there is no value, this function will return a NULL pointer at
 * the address given by result.
 * <p>The pointer at the address result must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param result The address where the function will deposit either the
 * pointer to the allocated memory, the value, or else a NULL pointer
 * if there is no value.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV MessageHeaderInternalAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VtItem **result
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_MESSAGE_HEADER_EXTERNAL.
 * <p>If the policy has the value requested, this function will allocate
 * space for a VtItem struct and the actual string data. The routine will
 * deposit the pointer to the VtItem at the address given by result.
 * <p>If there is no value, this function will return a NULL pointer at
 * the address given by result.
 * <p>The pointer at the address result must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param result The address where the function will deposit either the
 * pointer to the allocated memory, the value, or else a NULL pointer
 * if there is no value.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV MessageHeaderExternalAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VtItem **result
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_ZERO_DOWNLOAD_TEMPLATE.
 * <p>If the policy has the value requested, this function will allocate
 * space for a VtItem struct and the actual string data. The routine will
 * deposit the pointer to the VtItem at the address given by result.
 * <p>If there is no value, this function will return a NULL pointer at
 * the address given by result.
 * <p>The pointer at the address result must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param result The address where the function will deposit either the
 * pointer to the allocated memory, the value, or else a NULL pointer
 * if there is no value.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV ZdrTemplateAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VtItem **result
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_ZDM2_TEMPLATE.
 * <p>If the policy has the value requested, this function will allocate
 * space for a VtItem struct and the actual string data. The routine will
 * deposit the pointer to the VtItem at the address given by result.
 * <p>If there is no value, this function will return a NULL pointer at
 * the address given by result.
 * <p>The pointer at the address result must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param result The address where the function will deposit either the
 * pointer to the allocated memory, the value, or else a NULL pointer
 * if there is no value.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV Zdm2TemplateAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VtItem **result
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_HMTL_MESSAGE_BODY_TEMPLATE.
 * <p>If the policy has the value requested, this function will allocate
 * space for a VtItem struct and the actual string data. The routine will
 * deposit the pointer to the VtItem at the address given by result.
 * <p>If there is no value, this function will return a NULL pointer at
 * the address given by result.
 * <p>The pointer at the address result must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param result The address where the function will deposit either the
 * pointer to the allocated memory, the value, or else a NULL pointer
 * if there is no value.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV HTMLMessageBodyTemplateAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VtItem **result
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_ENCRYPT_RULES.
 * <p>If the policy has the value requested, this function will allocate
 * space for a VtItem struct and the actual string data. The routine will
 * deposit the pointer to the VtItem at the address given by result.
 * <p>If there is no value, this function will return a NULL pointer at
 * the address given by result.
 * <p>The pointer at the address result must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param result The address where the function will deposit either the
 * pointer to the allocated memory, the value, or else a NULL pointer
 * if there is no value.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV EncryptRulesAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VtItem **result
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_DEFAULT_ZDR_LOCATION.
 * <p>If the policy has the value requested, this function will allocate
 * space for a VtItem struct and the actual string data. The routine will
 * deposit the pointer to the VtItem at the address given by result.
 * <p>If there is no value, this function will return a NULL pointer at
 * the address given by result.
 * <p>The pointer at the address result must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param result The address where the function will deposit either the
 * pointer to the allocated memory, the value, or else a NULL pointer
 * if there is no value.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV DefaultZdrLocationAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   VtItem **result
));

/* Call this routine when the PolicyGetType is
 * VOLT_POLICY_GET_DECRYPT_POLICY.
 * <p>This function will allocate space for an int and set it to one of
 * the following values.
 *   VOLT_DECRYPT_ON_VIEW
 *   VOLT_AUTO_DECRYPT
 * <p>The pointer at the address result must be initialized to NULL.
 *
 * @param ctx The policy context to use.
 * @param libCtx The libCtxt to use.
 * @param result The address where the function will deposit the pointer
 * to the int, the decrypt policy.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV DecryptPolicyAlloc VOLT_PROTO_LIST ((
   VoltPolicyCtx *ctx,
   VoltLibCtx *libCtx,
   int **result
));

int VoltLocalPolicyGetInfoAlloc (
   VtPolicyCtx policyCtx,
   VoltPolicyGetType policyGetType,
   Pointer definition,
   Pointer *info
   )
{
  VoltPolicyCtx *ctx = (VoltPolicyCtx *)policyCtx;
  VoltLibCtx *libCtx = (VoltLibCtx *)(ctx->voltObject.libraryCtx);

  *info = (Pointer)0;

  switch (policyGetType)
  {
    default:
      break;

    case VOLT_POLICY_GET_IS_LOCAL_ID:
      return (IsIdentityLocalAlloc (
        ctx, libCtx, (VoltIdentityObject *)definition,
        (VtItem **)info));

    case VOLT_POLICY_GET_PROVISIONED_DISTRICT:
      return (ProvisionedDistrictAlloc (
        ctx, libCtx, (VoltIdentityObject *)definition,
        (VtItem **)info));

    case VOLT_POLICY_GET_DEFAULT_DISTRICT_COMPUTED:
      /* This policy does not override the regular default algorithm.
       * *info is initialized to NULL.
       */
      return (0);

    case VOLT_POLICY_GET_FALL_THROUGH_DISTRICT:
      return (FallThroughDistrictAlloc (ctx, libCtx, (VtItem **)info));

    case VOLT_POLICY_GET_IS_DISTRICT_AGGRESSIVE:
      return (IsDistrictAggressiveAlloc (
        ctx, libCtx, (VoltDistrictObject *)definition, (int **)info));

    case VOLT_POLICY_GET_REFRESH_RATE_NEGATIVE:
    case VOLT_POLICY_GET_REFRESH_RATE_POSITIVE:
      return (RefreshRateAlloc (ctx, libCtx, policyGetType, (int **)info));

    case VOLT_POLICY_GET_IS_PARAM_CHECKING_STRICT:
      return (IsParamCheckingStrictAlloc (ctx, libCtx, (int **)info));

    case VOLT_POLICY_GET_IS_TRUSTED_DISTRICT:
      return (IsDistrictTrustedAlloc (
        ctx, libCtx, (VoltDistrictObject *)definition, (int **)info));

    case VOLT_POLICY_GET_CREDENTIAL_CACHE_MODE:
      return (CredentialCacheModeAlloc (ctx, libCtx, (int **)info));

    case VOLT_POLICY_GET_SECURE_MAIL_HEADER:
      if (definition == (Pointer)0)
        return (VT_ERROR_INVALID_TYPE);
      return (HeaderFooterAlloc (
        ctx, libCtx, (VoltIdentityList *)definition, (VtItem **)info));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -