Пример #1
0
/**
 * z_proxy_stack_object:
 * @self: ZProxy instance
 * @stack_obj: Python object to be stacked
 *
 * This function is a more general interface than
 * z_proxy_stack_proxy/z_proxy_stack_object it first decides how the
 * specified Python object needs to be stacked, performs stacking and
 * returns the stacked proxy.
 **/
gboolean
z_proxy_stack_object(ZProxy *self, ZPolicyObj *stack_obj, ZStackedProxy **stacked, ZPolicyDict *stack_info)
{
  *stacked = NULL;
  if (z_policy_str_check(stack_obj))
    return z_proxy_stack_program(self, z_policy_str_as_string(stack_obj), stacked);
  else 
  if (z_policy_seq_check(stack_obj))
    return z_proxy_stack_tuple(self, stack_obj, stacked, stack_info);
  else
    return z_proxy_stack_proxy(self, stack_obj, stacked, stack_info);
}
Пример #2
0
/**
 * telnet_hash_get_type:
 * @tuple: 
 * @filter_type: 
 *
 * 
 *
 * Returns:
 * 
 */
gboolean
telnet_hash_get_type(ZPolicyObj *tuple, guint *filter_type)
{
  ZPolicyObj    *tmp;
  gboolean      res;

  if (!z_policy_seq_check(tuple))
    {
      res = z_policy_var_parse(tuple, "i", filter_type);
    }
  else
    {
      tmp = z_policy_seq_getitem(tuple, 0);
      res = z_policy_var_parse(tmp, "i", filter_type);  /* FALSE -> policy syntax error */
      z_policy_var_unref(tmp);
    }
  return res;
}
Пример #3
0
gboolean
smtp_hash_get_type(ZPolicyObj *tuple, guint *filter_type)
{
  ZPolicyObj *tmp;

  if (!z_policy_seq_check(tuple))
    {
      if (z_policy_var_parse(tuple, "i", filter_type))
        return TRUE;
      /* not a sequence */
      return FALSE;
    }

  tmp = z_policy_seq_getitem(tuple, 0);
  if (!z_policy_var_parse(tmp, "i", filter_type))
    {
      /* policy syntax error */
      z_policy_var_unref(tmp);
      return FALSE;
    }
  z_policy_var_unref(tmp);
  return TRUE;
}
Пример #4
0
gboolean 
z_policy_tuple_get_verdict(ZPolicyObj *tuple, guint *verdict)
{
  ZPolicyObj *tmp;
                                                                                
  z_enter();
  if (!z_policy_seq_check(tuple))
    {
      if (z_policy_var_parse(tuple, "i", verdict))
        z_return(TRUE);
      /* not a sequence nor an int */
      z_return(FALSE);
    }
                                                                                
  tmp = z_policy_seq_getitem(tuple, 0);
  if (!tmp || !z_policy_var_parse(tmp, "i", verdict))
    {
      /* policy syntax error */
      z_policy_var_unref(tmp);
      z_return(FALSE);
    }
  z_policy_var_unref(tmp);
  z_return(TRUE);
}