当前位置: 首页>>代码示例>>C++>>正文


C++ SSH_ASSERT函数代码示例

本文整理汇总了C++中SSH_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ SSH_ASSERT函数的具体用法?C++ SSH_ASSERT怎么用?C++ SSH_ASSERT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SSH_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ssh_eap_resend_timeout_cb

static void
ssh_eap_resend_timeout_cb(void *ctx)
{
  unsigned long max_retransmit;
  SshEap eap = (void*)ctx;

  SSH_ASSERT(eap != NULL);
  SSH_ASSERT(eap->retransmit_timer_active == 1);
  SSH_ASSERT(eap->prev_pkt != NULL);

  SSH_DEBUG(SSH_D_LOWOK,("resend timeout"));

  eap->retransmit_timer_active = 0;
  eap->num_retransmit++;

  max_retransmit = ssh_eap_config_get_ulong(eap->params,
                                            SSH_EAP_PARAM_MAX_RETRANSMIT);

  if (eap->is_authenticator == 1)
    {
      if ((unsigned long)eap->num_retransmit > max_retransmit
          && eap->num_retransmit >= 0)
        {
          ssh_eap_timeout(eap);
          return;
        }

      ssh_eap_set_resend_timeout(eap);
    }

  ssh_eap_send_packet(eap, eap->prev_pkt);
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:32,代码来源:ssheap_protocol.c

示例2: ssh_driver_transfer_data

/*-------------------------------------------------------------------------
  ssh_driver_transfer_data()

  Copies received network data to a given upper layer supplied NDIS packet.
  
  Arguments:
  pkt - NDIS packet for data  
  bytes_transferred - how many bytes has been written into the packet
  miniport_context - virtual NIC object
  receive_context - ???
  byte_offset - where to start copy operation
  bytes_to_transfer -   how may bytes to copy

  Returns:
  NDIS_STATUS_FAILURE - always
  
  Notes:
  This function is not supported because we always indicate complete 
  NDIS packets to the upper layer. So upper layer should never call this 
  function but we anyway return the FAILURE status code to upper layer.

  Default IRQL: DISPATCH_LEVEL
  -------------------------------------------------------------------------*/
static NDIS_STATUS
ssh_driver_transfer_data(PNDIS_PACKET pkt,
                         PUINT bytes_transferred,
                         NDIS_HANDLE miniport_context,
                         NDIS_HANDLE receive_context,
                         UINT byte_offset,
                         UINT bytes_to_transfer)
{
  SshNdisIMAdapter adapter = (SshNdisIMAdapter)miniport_context;

  SSH_ASSERT(SSH_GET_IRQL() <= SSH_DISPATCH_LEVEL);
  SSH_ASSERT(miniport_context != NULL);
  SSH_ASSERT(receive_context != NULL);
  SSH_ASSERT(pkt != NULL);
  SSH_ASSERT(bytes_transferred != NULL);

  *bytes_transferred = 0;

  SSH_DEBUG(SSH_D_ERROR, 
            ("Adapter %@: Unexpected MiniportTransferData() call.",
             ssh_adapter_id_st_render, adapter));

  NDIS_SET_PACKET_STATUS(pkt, NDIS_STATUS_FAILURE);

  return (NDIS_STATUS_FAILURE);
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:49,代码来源:upper_edge.c

示例3: ssh_interceptor_iface_uninit

void ssh_interceptor_iface_uninit(SshInterceptor interceptor)
{
  /* Clear interface table and release net_device references. */
  ssh_interceptor_clear_ifaces(interceptor);

  if (interceptor->nf->iface_notifiers_installed == FALSE)
    return;

  SSH_ASSERT(in_softirq());
  local_bh_enable();
  SSH_ASSERT(!in_softirq());

  /* Unregister notifier callback */
  unregister_netdevice_notifier(&interceptor->nf->notifier_netdev);
  unregister_inetaddr_notifier(&interceptor->nf->notifier_inetaddr);
#ifdef SSH_LINUX_INTERCEPTOR_IPV6
  unregister_inet6addr_notifier(&interceptor->nf->notifier_inet6addr);
#endif /* SSH_LINUX_INTERCEPTOR_IPV6 */

  local_bh_disable();

  /* Due to lack of proper locking in linux kernel notifier code, 
     the unregister_*_notifier functions might leave the notifier 
     blocks out of sync, resulting in that the kernel may call an
     unregistered notifier function.

     Sleep for a while to decrease the possibility of the bug causing
     trouble (crash during module unloading). */
  mdelay(500);
  
  interceptor->nf->iface_notifiers_installed = FALSE;
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:32,代码来源:linux_iface.c

示例4: ssh_virtual_adapter_deregister

/* ssh_virtual_adapter_deregister()
 *
 *
 *
 */
void
ssh_virtual_adapter_deregister(SshVirtualAdapter va)
{
  SshInterceptor interceptor = va->interceptor;
  Boolean was_connected = FALSE;

  SSH_DEBUG(SSH_D_HIGHSTART, ("ssh_virtual_adapter_deregister(0x%p)", va));

  ssh_kernel_mutex_lock(&va->connect_lock);
  was_connected = va->va_connected;
  va->va_connect_aborted = TRUE;
  ssh_kernel_mutex_unlock(&va->connect_lock);

  SSH_ASSERT(va->interceptor != NULL);
  SSH_ASSERT(va != NULL);
  SSH_ASSERT(va->adapter != NULL);

  if (was_connected)
    {
      SSH_ASSERT(va->vnic_disable_cb != NULL_FNPTR);
      SSH_ASSERT(va->vnic_cb_context != NULL);
      
      /* disable adapter - this 'unplugs the cable' */
      (*va->vnic_disable_cb)(va->vnic_cb_context);

      /* Disconnect from underlying virtual NIC */
      ssh_virtual_adapter_disconnect(va);
    }

  /* Decrement the count of virtual adapters */
  InterlockedDecrement(&interceptor->va_interface_cnt);

  /* release the virtual adapter. */
  ssh_virtual_adapter_release(va);
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:40,代码来源:virtual_adapter_private.c

示例5: ssh_interceptor_iodevice_register_ioctl

SshIoctlRegHandle
ssh_interceptor_iodevice_register_ioctl(SshInterceptorIoDevice iodevice,
                                        SshUInt32 ioctl_code,
                                        SshIoctlHandler ioctl_handler,
                                        SshIoctlCancelFunction cancel_fn,
                                        void *context)
{
  SshIoDeviceIoctlHandler handler;
  
  SSH_ASSERT(iodevice != NULL);
  SSH_ASSERT(ioctl_code != 0);
  SSH_ASSERT(ioctl_handler != NULL_FNPTR);

  handler = ssh_calloc(1, sizeof(*handler));
  if (handler == NULL)
    {
      SSH_DEBUG(SSH_D_FAIL, 
                ("Failed to register handler for IOCTL code 0x%08x", 
                ioctl_code));
      return NULL;
    }

  handler->ioctl_code = ioctl_code;
  handler->handle = handler;
  handler->ioctl_handler = ioctl_handler;
  handler->cancel_fn = cancel_fn;
  handler->context = context;

  NdisAcquireSpinLock(&iodevice->ioctl_handler_list_lock);
  InsertTailList(&iodevice->ioctl_handler_list, &handler->link);
  NdisReleaseSpinLock(&iodevice->ioctl_handler_list_lock);

  return handler->handle;
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:34,代码来源:iodevice.c

示例6: dev_hold

/* Internal mapping from ifnum to net_device. 
   This function will assert that 'ifnum' is a valid 
   SshInterceptorIfnum and that the corresponding net_device
   exists in the interface hashtable. This function will dev_hold()
   the net_device. The caller of this function must release it by 
   calling ssh_interceptor_release_netdev(). If `context_return' is
   not NULL then this sets it to point to the interface context. */
inline struct net_device *
ssh_interceptor_ifnum_to_netdev_ctx(SshInterceptor interceptor,
				    SshUInt32 ifnum,
				    void **context_return)
{
  SshInterceptorInternalInterface iface;
  struct net_device *dev = NULL;

  SSH_LINUX_ASSERT_VALID_IFNUM(ifnum);

  read_lock(&interceptor->nf->if_table_lock);
  for (iface = interceptor->nf->if_hash[ifnum % SSH_LINUX_IFACE_HASH_SIZE];
       iface && iface->ifindex != ifnum;
       iface = iface->next)
    ;
  if (iface)
    {
      SSH_ASSERT(iface->generation == interceptor->nf->if_generation);
      dev = iface->dev;
      SSH_ASSERT(dev != NULL);
      dev_hold(dev);
      if (context_return != NULL)
	*context_return = iface->context;
    }
  read_unlock(&interceptor->nf->if_table_lock);
  
  return dev;
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:35,代码来源:linux_iface.c

示例7: ikev2_reply_cb_get_address_pair

static void ikev2_reply_cb_get_address_pair(SshIkev2Error error_code,
					    SshIkev2Server local_server,
					    SshIpAddr remote_ip,
					    void *context)
{
  SshIkev2Packet packet = context;
  
  packet->operation = NULL;
  SSH_FSM_CONTINUE_AFTER_CALLBACK(packet->thread);

  if (error_code != SSH_IKEV2_ERROR_OK)
    {
      SSH_IKEV2_DEBUG(SSH_D_FAIL, ("Error: Get address pair failed: %d", 
				   error_code));
      ikev2_error(packet, error_code);
      return;
    }
  SSH_ASSERT(SSH_IP_DEFINED(remote_ip));
  SSH_ASSERT(local_server != NULL);

  SSH_DEBUG(SSH_D_LOWOK, 
	    ("Address pair returned from policy local=%@, remote=%@",
	     ssh_ipaddr_render, local_server->ip_address,
	     ssh_ipaddr_render, remote_ip));

  packet->remote_ip[0] = *remote_ip;
  packet->remote_port = packet->use_natt ? 
    local_server->nat_t_remote_port : local_server->normal_remote_port;
  packet->server = local_server;

}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:31,代码来源:ikev2-send.c

示例8: ssh_virtual_adapter_connect_retry_timeout_cb

/* ssh_virtual_adapter_connect_retry_timeout_cb()
 *
 * This function gets never invoked on Win9x platforms
 */
static void
ssh_virtual_adapter_connect_retry_timeout_cb(SshVirtualAdapter va)
{
  Boolean aborted;
  SSH_DEBUG(SSH_D_MIDSTART,
	    ("ssh_virtual_adapter_connect_retry_timeout_cb()"));

  SSH_ASSERT(va != NULL);
  SSH_ASSERT(va->interceptor != NULL);

  ssh_kernel_mutex_lock(&va->connect_lock);
  SSH_ASSERT(va->va_connected == 0);
  aborted = va->va_connect_aborted;
  ssh_kernel_mutex_unlock(&va->connect_lock);

  if (aborted)
    {
      SSH_DEBUG(SSH_D_MIDSTART,
                ("Virtual adapter connect aborted."));

      ssh_virtual_adapter_release(va);
    }
  else
    {
      /* force execution in passive level */
      ssh_ndis_wrkqueue_queue_item(va->interceptor->work_queue,
                                   ssh_virtual_adapter_connect, va);
    }
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:33,代码来源:virtual_adapter_private.c

示例9: ssh_buffer_len

size_t ssh_buffer_len(const SshBuffer *buffer)
{
  SSH_ASSERT(buffer);
  SSH_ASSERT(buffer->offset <= buffer->end);

  return buffer->end - buffer->offset;
}
开发者ID:AnthraX1,项目名称:rk,代码行数:7,代码来源:sshbuffer.c

示例10: ssh_fastpath_fragmagic_sent

/* Pullup information from a packetcontext which has been
   sent to the fragentry fe. */
static void
ssh_fastpath_fragmagic_sent(SshFastpath fastpath,
                          SshFastpathFragEntry fe,
                          SshEnginePacketContext pc)
{
  const unsigned char *ucp;
  SshUInt32 fragoff, next_off;

  ssh_fastpath_fragmagic_pullup(fastpath,fe,pc);

  if (pc->pp->flags & SSH_ENGINE_P_FIRSTFRAG)
    {
      /* Indicate that we have received the first fragment, and save
         the flow id. The HAVE_LAST flag will be set in
         ssh_fastpath_fragmagic_enqueue. */
      fe->flags |= SSH_ENGINE_FRAG_SENT_FIRST;
    }

  if (pc->pp->flags & SSH_ENGINE_P_LASTFRAG)
    {
      /* If SSH_ENGINE_P_LASTFRAG is set then ssh_fastpath_context_pullup()
         must have initialized frag_packet_size. */
      fe->packet_size = pc->frag_packet_size;
      fe->flags |= SSH_ENGINE_FRAG_SENT_LAST;
    }

#if defined (WITH_IPV6)
  if (pc->pp->protocol == SSH_PROTOCOL_IP6)
    fragoff = pc->fragment_offset;
  else
#endif /* WITH_IPV6 */
    {
#ifndef SSH_IPSEC_IP_ONLY_INTERCEPTOR
      SSH_ASSERT(pc->protocol_offset == 0);
#endif /* not SSH_IPSEC_IP_ONLY_INTERCEPTOR */

      ucp = ssh_interceptor_packet_pullup_read(pc->pp, SSH_IPH4_HDRLEN);
      if (!ucp)
        {
	  pc->pp = NULL;
          SSH_DEBUG(SSH_D_FAIL, 
		    ("ssh_interceptor_packet_pullup_read failed"));
          return;
        }

      fragoff = 8 * (SSH_IPH4_FRAGOFF(ucp) & SSH_IPH4_FRAGOFF_OFFMASK);
    }

  next_off = fragoff + (SshUInt32) (pc->packet_len - pc->hdrlen);
  /* This should be guaranteed by sanity checks. */

  SSH_ASSERT(next_off <= 0xFFFF);
  fe->next_offset = (SshUInt16) next_off;

  SSH_DEBUG(SSH_D_NICETOKNOW,
            ("sending fragment offset %u length %u",
             (unsigned int) fragoff,
	     pc->packet_len - pc->hdrlen));
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:61,代码来源:fastpath_fragmagic.c

示例11: ssh_directory_file_name

const char *
ssh_directory_file_name(SshDirectoryHandle directory)
{
  SSH_ASSERT(directory != NULL);
  SSH_ASSERT(directory->dirent != NULL);

  return directory->dirent->d_name;
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:8,代码来源:sshunixdirectory.c

示例12: ssh_pm_lookup_p1

SshPmP1
ssh_pm_lookup_p1(SshPm pm, SshPmRule rule, SshPmTunnel tunnel,
		 SshUInt32 peer_handle, SshIpAddr src, SshIpAddr dst,
		 Boolean require_completed)
{
  SshPmLookupP1CtxStruct ctx;
  SshPmP1 p1;
  SshUInt32 hash;

  /* Initialize a search context. */
  memset(&ctx, 0, sizeof(ctx));
  ctx.tunnel = tunnel;
  ctx.rule = rule;
  ctx.peer = ssh_pm_peer_by_handle(pm, peer_handle);
  ctx.pm = pm;
  ctx.require_completed = require_completed;

  /* Use IP addresses from peer if not explicitly specified and peer exists. */
  ctx.src = src;
  if (ctx.src == NULL && ctx.peer != NULL)
    ctx.src = ctx.peer->local_ip;
  ctx.dst = dst;
  if (ctx.dst == NULL && ctx.peer != NULL)
    ctx.dst = ctx.peer->remote_ip;

  /* Peer IP must be defined either explicitly or by peer. Fail lookup if
     it is not defined. */
  if (ctx.dst == NULL)
    {
      SSH_DEBUG(SSH_D_FAIL, ("Missing dst IP address"));
      return NULL;
    }

  SSH_ASSERT(rule != NULL);
  SSH_ASSERT(tunnel != NULL);

  if (!require_completed)
    {
      /* Lookup active Phase-1 initiator and responder negotiations. */
      for (p1 = pm->active_p1_negotiations; p1; p1 = p1->n->next)
	{
	  if (ssh_pm_lookup_p1_check_p1(&ctx, p1))
	    return p1;
	}
    }

  /* Check IKE SA hash table. */
  hash = SSH_PM_IKE_PEER_HASH(ctx.dst);
  for (p1 = pm->ike_sa_hash[hash]; p1; p1 = p1->hash_next)
    {
      if (ssh_pm_lookup_p1_check_p1(&ctx, p1))
	return p1;
    }

  /* No match found. */
  return NULL;
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:57,代码来源:spd_rule_lookup.c

示例13: failure

/* Return a list of ciphers, including native names and aliases. The
   caller must free the returned string with ssh_free. Can return NULL
   on memory allocation failure (if no ciphers are supported, then
   just an empty string is returned). */
char *ssh_cipher_alias_get_supported(void)
{
  int i;
  unsigned char *list, *tmp;
  size_t offset, list_len;

  list = ssh_ustr(ssh_cipher_get_supported());

  if (!list)
    return NULL;

  tmp = ssh_strdup(list);

  if (!tmp)
    return NULL;

  list = tmp;
  offset = ssh_ustrlen(list);
  list_len = offset + 1;

  for (i = 0; ssh_cipher_aliases[i].name != NULL; i++)
    {
      size_t newsize;

      /* It is possible that our alias list has ciphers which are not
         supported by the crypto core */
      if (!ssh_cipher_supported(ssh_cipher_aliases[i].real_name))
        continue;

      newsize = offset + 1 + !!offset + strlen(ssh_cipher_aliases[i].name);

      if (list_len < newsize)
        {
          newsize *= 2;

          if ((tmp = ssh_realloc(list, list_len, newsize)) == NULL)
            {
              ssh_free(list);
              return NULL;
            }

          list = tmp;
          list_len = newsize;
        }

      SSH_ASSERT(list_len > 0);
      SSH_ASSERT(list != NULL);

      offset += ssh_snprintf(list + offset, list_len - offset, "%s%s",
                             offset ? "," : "",
                             ssh_cipher_aliases[i].name);

    }

  return (char *) list;
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:60,代码来源:sshcipheralias.c

示例14: ssh_interceptor_iodevice_close_device

void __fastcall
ssh_interceptor_iodevice_close_device(SshInterceptorIoDevice io_dev)
{
  SSH_DEBUG(SSH_D_HIGHSTART, ("Closing stream device..."));

  SSH_ASSERT(io_dev != NULL);
  SSH_ASSERT(ssh_interceptor_iodevice_is_open(io_dev) == FALSE);

  if (io_dev->handle)  
    DeactivateDevice(io_dev->handle);
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:11,代码来源:wince_iodevice.c

示例15: ssh_file_buffer_attach_with_read_callback

/* Attach a file pointer with a read callback. */
Boolean ssh_file_buffer_attach_with_read_callback(SshFileBuffer buf,
                                      SshFileBufferReadCallback read_callback,
                                      void *read_context)
{
  SSH_ASSERT(buf != NULL);
  SSH_ASSERT(read_callback != NULL_FNPTR);
  ssh_file_buffer_detach(buf);
  buf->read_callback = read_callback;
  buf->read_context = read_context;
  return TRUE;
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:12,代码来源:sshfilebuffer.c


注:本文中的SSH_ASSERT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。