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


C++ silc_free函数代码示例

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


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

示例1: silc_client_ftp_ask_name

static void silc_client_ftp_ask_name(const char *filepath,
				     void *context)
{
  SilcClientFtpSession session = (SilcClientFtpSession)context;
  SilcSFTPAttributesStruct attr;
  char *remote_file = NULL;

  SILC_LOG_DEBUG(("Start"));

  if (filepath) {
    remote_file = session->filepath;
    session->filepath = NULL;
    silc_free(session->path);
    session->path = NULL;
    session->filepath = strdup(filepath);
  } else {
    remote_file = strdup(session->filepath);
  }

  /* Now open the file */
  memset(&attr, 0, sizeof(attr));
  silc_sftp_open(session->sftp, remote_file, SILC_SFTP_FXF_READ, &attr,
		 silc_client_ftp_open_handle, session);

  /* Close the directory handle */
  silc_sftp_close(session->sftp, session->dir_handle, NULL, NULL);
  session->dir_handle = NULL;

  silc_free(remote_file);
}
开发者ID:TabTwo,项目名称:silc-client,代码行数:30,代码来源:client_ftp.c

示例2: silc_idlist_del_server

int silc_idlist_del_server(SilcIDList id_list, SilcServerEntry entry)
{
  if (entry) {
    /* Remove from cache */
    if (!silc_idcache_del_by_context(id_list->servers, entry, NULL)) {
      SILC_LOG_DEBUG(("Unknown server, did not delete"));
      return FALSE;
    }

    SILC_LOG_DEBUG(("Deleting server %s id %s", entry->server_name ?
		    entry->server_name : "",
		    entry->id ?
		    silc_id_render(entry->id, SILC_ID_SERVER) : ""));

    /* Free data */
    silc_free(entry->server_name);
    silc_free(entry->id);
    silc_free(entry->server_info);

    memset(entry, 'F', sizeof(*entry));
    silc_free(entry);
    return TRUE;
  }

  return FALSE;
}
开发者ID:FabrizioFabbe,项目名称:silc,代码行数:26,代码来源:idlist.c

示例3: silcpurple_buddy_getkey_cb

static void
silcpurple_buddy_getkey_cb(SilcPurpleBuddyGetkey g,
			 SilcClientCommandReplyContext cmd)
{
	SilcClientEntry client_entry;
	unsigned char *pk;
	SilcUInt32 pk_len;

	/* Get the client entry. */
	client_entry = silc_client_get_client_by_id(g->client, g->conn,
						    &g->client_id);
	if (!client_entry) {
		purple_notify_error(g->client->application, _("Get Public Key"),
				  _("The remote user is not present in the network any more"),
				  NULL);
		silc_free(g);
		return;
	}

	if (!client_entry->public_key) {
		silc_free(g);
		return;
	}

	/* Now verify the public key */
	pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len);
	silcpurple_verify_public_key(g->client, g->conn, client_entry->nickname,
				   SILC_SOCKET_TYPE_CLIENT,
				   pk, pk_len, SILC_SKE_PK_TYPE_SILC,
				   NULL, NULL);
	silc_free(pk);
	silc_free(g);
}
开发者ID:dylex,项目名称:pidgin,代码行数:33,代码来源:buddy.c

示例4: silcpurple_buddy_resetkey

static void
silcpurple_buddy_resetkey(PurpleBlistNode *node, gpointer data)
{
	PurpleBuddy *b;
	PurpleConnection *gc;
        SilcPurple sg;
	char *nickname;
	SilcClientEntry *clients;
	SilcUInt32 clients_count;

	g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));

	b = (PurpleBuddy *) node;
	gc = purple_account_get_connection(b->account);
	sg = gc->proto_data;

	if (!silc_parse_userfqdn(b->name, &nickname, NULL))
		return;

	/* Find client entry */
	clients = silc_client_get_clients_local(sg->client, sg->conn,
						nickname, b->name,
						&clients_count);
	if (!clients) {
		silc_free(nickname);
		return;
	}

	clients[0]->prv_resp = FALSE;
	silc_client_del_private_message_key(sg->client, sg->conn,
					    clients[0]);
	silc_free(clients);
	silc_free(nickname);
}
开发者ID:dylex,项目名称:pidgin,代码行数:34,代码来源:buddy.c

示例5: silc_idlist_add_server

SilcServerEntry
silc_idlist_add_server(SilcIDList id_list,
		       char *server_name, int server_type,
		       SilcServerID *id, SilcServerEntry router,
		       void *connection)
{
  SilcServerEntry server;
  char *server_namec = NULL;

  SILC_LOG_DEBUG(("Adding new server entry"));

  /* Normalize name.  This is cached, original is in server context.  */
  if (server_name) {
    server_namec = silc_identifier_check(server_name, strlen(server_name),
					 SILC_STRING_UTF8, 256, NULL);
    if (!server_namec)
      return NULL;
  }

  server = silc_calloc(1, sizeof(*server));
  server->server_name = server_name;
  server->server_type = server_type;
  server->id = id;
  server->router = router;
  server->connection = connection;

  if (!silc_idcache_add(id_list->servers, server_namec,
			(void *)server->id, (void *)server)) {
    silc_free(server);
    silc_free(server_namec);
    return NULL;
  }

  return server;
}
开发者ID:FabrizioFabbe,项目名称:silc,代码行数:35,代码来源:idlist.c

示例6: silc_server_accept_free

static void silc_server_accept_free(SilcServerAccept ac)
{
  if (ac->connauth)
    silc_connauth_free(ac->connauth);
  silc_free(ac->error_string);
  silc_free(ac);
}
开发者ID:FabrizioFabbe,项目名称:silc,代码行数:7,代码来源:server_st_accept.c

示例7: silc_public_key_payload_encode

SilcBuffer silc_public_key_payload_encode(SilcPublicKey public_key)
{
  SilcBuffer buffer;
  unsigned char *pk;
  SilcUInt32 pk_len;
  SilcPKCSType type;

  if (!public_key)
    return NULL;

  type = silc_pkcs_get_type(public_key);
  pk = silc_pkcs_public_key_encode(public_key, &pk_len);
  if (!pk)
    return NULL;

  buffer = silc_buffer_alloc_size(4 + pk_len);
  if (!buffer) {
    silc_free(pk);
    return NULL;
  }

  if (silc_buffer_format(buffer,
			 SILC_STR_UI_SHORT(pk_len),
			 SILC_STR_UI_SHORT(type),
			 SILC_STR_DATA(pk, pk_len),
			 SILC_STR_END) < 0) {
    silc_buffer_free(buffer);
    silc_free(pk);
    return NULL;
  }

  silc_free(pk);
  return buffer;
}
开发者ID:TabTwo,项目名称:silc-client,代码行数:34,代码来源:silcpubkey.c

示例8: silc_socket_stream_destroy

void silc_socket_stream_destroy(SilcStream stream)
{
  SilcSocketStream socket_stream = stream;

  silc_socket_stream_close(socket_stream);
  silc_free(socket_stream->ip);
  silc_free(socket_stream->hostname);
  if (socket_stream->schedule)
    silc_schedule_task_del_by_fd(socket_stream->schedule, socket_stream->sock);

  if (socket_stream->qos) {
    silc_schedule_task_del_by_context(socket_stream->schedule,
				      socket_stream->qos);
    if (socket_stream->qos->buffer) {
      memset(socket_stream->qos->buffer, 0,
	     socket_stream->qos->read_limit_bytes);
      silc_free(socket_stream->qos->buffer);
    }
    silc_free(socket_stream->qos);
  }

  if (socket_stream->schedule)
    silc_schedule_wakeup(socket_stream->schedule);

  silc_free(socket_stream);
}
开发者ID:TabTwo,项目名称:silc-toolkit,代码行数:26,代码来源:silcunixsocketstream.c

示例9: silcpurple_buddy_keyagr_resolved

static void
silcpurple_buddy_keyagr_resolved(SilcClient client,
			       SilcClientConnection conn,
			       SilcClientEntry *clients,
			       SilcUInt32 clients_count,
			       void *context)
{
	PurpleConnection *gc = client->application;
	SilcPurpleResolve r = context;
	char tmp[256];

	if (!clients) {
		g_snprintf(tmp, sizeof(tmp),
			   _("User %s is not present in the network"), r->nick);
		purple_notify_error(gc, _("Key Agreement"),
				  _("Cannot perform the key agreement"), tmp);
		silc_free(r->nick);
		silc_free(r);
		return;
	}

	silcpurple_buddy_keyagr_do(gc, r->nick, FALSE);
	silc_free(r->nick);
	silc_free(r);
}
开发者ID:dylex,项目名称:pidgin,代码行数:25,代码来源:buddy.c

示例10: silcpurple_buddy_privkey_cb

static void
silcpurple_buddy_privkey_cb(SilcPurplePrivkey p, const char *passphrase)
{
	SilcClientEntry client_entry;

        if (!passphrase || !(*passphrase)) {
                silc_free(p);
                return;
        }

	/* Get the client entry. */
	client_entry = silc_client_get_client_by_id(p->client, p->conn,
						    &p->client_id);
	if (!client_entry) {
		purple_notify_error(p->client->application, _("IM With Password"),
				  _("The remote user is not present in the network any more"),
				  NULL);
		silc_free(p);
		return;
	}

	/* Set the private message key */
	silc_client_del_private_message_key(p->client, p->conn,
					    client_entry);
	silc_client_add_private_message_key(p->client, p->conn,
					    client_entry, NULL, NULL,
					    (unsigned char *)passphrase,
					    strlen(passphrase), FALSE,
					    client_entry->prv_resp);
	if (!client_entry->prv_resp)
		silc_client_send_private_message_key_request(p->client,
							     p->conn,
							     client_entry);
        silc_free(p);
}
开发者ID:dylex,项目名称:pidgin,代码行数:35,代码来源:buddy.c

示例11: silc_pkcs1_verify_no_oid

SilcBool silc_pkcs1_verify_no_oid(void *public_key,
				  unsigned char *signature,
				  SilcUInt32 signature_len,
				  unsigned char *data,
				  SilcUInt32 data_len,
				  SilcHash hash)
{
  RsaPublicKey *key = public_key;
  SilcBool ret = FALSE;
  SilcMPInt mp_tmp2;
  SilcMPInt mp_dst;
  unsigned char *verify, unpadded[2048 + 1], hashr[SILC_HASH_MAXLEN];
  SilcUInt32 verify_len, len = (key->bits + 7) / 8;

  SILC_LOG_DEBUG(("Verify signature"));

  silc_mp_init(&mp_tmp2);
  silc_mp_init(&mp_dst);

  /* Format the signature into MP int */
  silc_mp_bin2mp(signature, signature_len, &mp_tmp2);

  /* Verify */
  silc_rsa_public_operation(key, &mp_tmp2, &mp_dst);

  /* MP to data */
  verify = silc_mp_mp2bin(&mp_dst, len, &verify_len);

  /* Unpad data */
  if (!silc_pkcs1_decode(SILC_PKCS1_BT_PRV1, verify, verify_len,
			 unpadded, sizeof(unpadded), &len)) {
    memset(verify, 0, verify_len);
    silc_free(verify);
    silc_mp_uninit(&mp_tmp2);
    silc_mp_uninit(&mp_dst);
    return FALSE;
  }

  /* Hash data if requested */
  if (hash) {
    silc_hash_make(hash, data, data_len, hashr);
    data = hashr;
    data_len = silc_hash_len(hash);
  }

  /* Compare */
  if (len == data_len && !memcmp(data, unpadded, len))
    ret = TRUE;

  memset(verify, 0, verify_len);
  memset(unpadded, 0, sizeof(unpadded));
  silc_free(verify);
  silc_mp_uninit(&mp_tmp2);
  silc_mp_uninit(&mp_dst);
  if (hash)
    memset(hashr, 0, sizeof(hashr));

  return ret;
}
开发者ID:TabTwo,项目名称:silc-toolkit,代码行数:59,代码来源:silcpkcs1.c

示例12: silc_net_connect_destructor

static void silc_net_connect_destructor(SilcFSM fsm, void *fsm_context,
					void *destructor_context)
{
  SilcNetConnect conn = fsm_context;
  silc_free(conn->local_ip);
  silc_free(conn->remote);
  silc_free(conn);
}
开发者ID:TabTwo,项目名称:silc-toolkit,代码行数:8,代码来源:silcunixnet.c

示例13: silc_config_close

void silc_config_close(SilcConfigFile *file)
{
  if (file) {
    silc_free(file->filename);
    memset(file->base, 'F', file->len);
    silc_free(file->base);
    memset(file, 'F', sizeof(*file));
    silc_free(file);
  }
}
开发者ID:FabrizioFabbe,项目名称:runtime,代码行数:10,代码来源:silcconfig.c

示例14: silc_server_command_reply_free

void silc_server_command_reply_free(SilcServerCommandReplyContext cmd)
{
  if (cmd) {
    silc_command_payload_free(cmd->payload);
    if (cmd->sock)
      silc_packet_stream_unref(cmd->sock);
    silc_free(cmd->callbacks);
    silc_free(cmd);
  }
}
开发者ID:TabTwo,项目名称:silc-server,代码行数:10,代码来源:command_reply.c

示例15: silc_command_payload_parse

SilcCommandPayload silc_command_payload_parse(const unsigned char *payload,
					      SilcUInt32 payload_len)
{
  SilcBufferStruct buffer;
  SilcCommandPayload newp;
  unsigned char args_num;
  SilcUInt16 p_len;
  int ret;

  SILC_LOG_DEBUG(("Parsing command payload"));

  silc_buffer_set(&buffer, (unsigned char *)payload, payload_len);
  newp = silc_calloc(1, sizeof(*newp));
  if (!newp)
    return NULL;

  /* Parse the Command Payload */
  ret = silc_buffer_unformat(&buffer,
			     SILC_STR_UI_SHORT(&p_len),
			     SILC_STR_UI_CHAR(&newp->cmd),
			     SILC_STR_UI_CHAR(&args_num),
			     SILC_STR_UI_SHORT(&newp->ident),
			     SILC_STR_END);
  if (ret == -1) {
    SILC_LOG_ERROR(("Incorrect command payload in packet"));
    silc_free(newp);
    return NULL;
  }

  if (p_len != silc_buffer_len(&buffer)) {
    SILC_LOG_ERROR(("Incorrect command payload in packet"));
    silc_free(newp);
    return NULL;
  }

  if (newp->cmd == 0) {
    SILC_LOG_ERROR(("Incorrect command type in command payload"));
    silc_free(newp);
    return NULL;
  }

  silc_buffer_pull(&buffer, SILC_COMMAND_PAYLOAD_LEN);
  if (args_num) {
    newp->args = silc_argument_payload_parse(buffer.data,
					     silc_buffer_len(&buffer),
					     args_num);
    if (!newp->args) {
      silc_free(newp);
      return NULL;
    }
  }
  silc_buffer_push(&buffer, SILC_COMMAND_PAYLOAD_LEN);

  return newp;
}
开发者ID:FabrizioFabbe,项目名称:silc,代码行数:55,代码来源:silccommand.c


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