本文整理汇总了C++中SILC_LOG_DEBUG函数的典型用法代码示例。如果您正苦于以下问题:C++ SILC_LOG_DEBUG函数的具体用法?C++ SILC_LOG_DEBUG怎么用?C++ SILC_LOG_DEBUG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SILC_LOG_DEBUG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: silc_thread_pool_unref
static void silc_thread_pool_unref(SilcThreadPool tp)
{
tp->refcnt--;
SILC_LOG_DEBUG(("Thread pool %p refcnt %d -> %d", tp, tp->refcnt + 1,
tp->refcnt));
if (!tp->refcnt) {
SilcStack stack = tp->stack;
silc_mutex_unlock(tp->lock);
silc_mutex_free(tp->lock);
silc_cond_free(tp->pool_signal);
silc_sfree(stack, tp);
silc_stack_free(stack);
return;
}
silc_mutex_unlock(tp->lock);
}
示例2: silc_client_listener_completion
static void silc_client_listener_completion(SilcSKE ske,
SilcSKEStatus status,
SilcSKESecurityProperties prop,
SilcSKEKeyMaterial keymat,
SilcSKERekeyMaterial rekey,
void *context)
{
SilcClientConnection conn = context;
SilcCipher send_key, receive_key;
SilcHmac hmac_send, hmac_receive;
SILC_LOG_DEBUG(("Key exchange completed"));
if (status != SILC_SKE_STATUS_OK) {
/* Key exchange failed */
conn->callback(conn->client, conn,
status == SILC_SKE_STATUS_TIMEOUT ?
SILC_CLIENT_CONN_ERROR_TIMEOUT :
SILC_CLIENT_CONN_ERROR_KE, conn->internal->error,
conn->internal->disconnect_message,
conn->callback_context);
return;
}
/* Allocate the cipher and HMAC contexts */
if (!silc_ske_set_keys(ske, keymat, prop, &send_key, &receive_key,
&hmac_send, &hmac_receive, &conn->internal->hash)) {
conn->callback(conn->client, conn,
SILC_CLIENT_CONN_ERROR_KE, 0, NULL,
conn->callback_context);
return;
}
/* Set the keys into the packet stream. After this call packets will be
encrypted with these keys. */
if (!silc_packet_set_keys(conn->stream, send_key, receive_key, hmac_send,
hmac_receive, FALSE)) {
conn->callback(conn->client, conn,
SILC_CLIENT_CONN_ERROR_KE, 0, NULL,
conn->callback_context);
return;
}
/* Key exchange successful */
conn->callback(conn->client, conn, SILC_CLIENT_CONN_SUCCESS, 0, NULL,
conn->callback_context);
}
示例3: silc_command_payload_encode
SilcBuffer silc_command_payload_encode(SilcCommand cmd,
SilcUInt32 argc,
unsigned char **argv,
SilcUInt32 *argv_lens,
SilcUInt32 *argv_types,
SilcUInt16 ident)
{
SilcBuffer buffer;
SilcBuffer args = NULL;
SilcUInt32 len = 0;
SILC_LOG_DEBUG(("Encoding command payload"));
if (argc) {
args = silc_argument_payload_encode(argc, argv, argv_lens, argv_types);
if (!args)
return NULL;
len = silc_buffer_len(args);
}
len += SILC_COMMAND_PAYLOAD_LEN;
buffer = silc_buffer_alloc_size(len);
if (!buffer)
return NULL;
/* Create Command payload */
silc_buffer_format(buffer,
SILC_STR_UI_SHORT(len),
SILC_STR_UI_CHAR(cmd),
SILC_STR_UI_CHAR(argc),
SILC_STR_UI_SHORT(ident),
SILC_STR_END);
/* Add arguments */
if (argc) {
silc_buffer_pull(buffer, SILC_COMMAND_PAYLOAD_LEN);
silc_buffer_format(buffer,
SILC_STR_UI_XNSTRING(args->data,
silc_buffer_len(args)),
SILC_STR_END);
silc_buffer_push(buffer, SILC_COMMAND_PAYLOAD_LEN);
silc_buffer_free(args);
}
return buffer;
}
示例4: silc_attribute_payload_parse
SilcDList silc_attribute_payload_parse(const unsigned char *payload,
SilcUInt32 payload_len)
{
SilcBufferStruct buffer;
SilcDList list;
SilcAttributePayload newp;
SilcUInt32 len;
int ret;
SILC_LOG_DEBUG(("Parsing Attribute Payload list"));
silc_buffer_set(&buffer, (unsigned char *)payload, payload_len);
list = silc_dlist_init();
while (silc_buffer_len(&buffer)) {
newp = silc_calloc(1, sizeof(*newp));
if (!newp)
goto err;
ret = silc_buffer_unformat(&buffer,
SILC_STR_UI_CHAR(&newp->attribute),
SILC_STR_UI_CHAR(&newp->flags),
SILC_STR_UI16_NSTRING_ALLOC(&newp->data,
&newp->data_len),
SILC_STR_END);
if (ret == -1)
goto err;
if (newp->data_len > silc_buffer_len(&buffer) - 4) {
SILC_LOG_ERROR(("Incorrect attribute payload in list"));
goto err;
}
len = 4 + newp->data_len;
if (silc_buffer_len(&buffer) < len)
break;
silc_buffer_pull(&buffer, len);
silc_dlist_add(list, newp);
}
return list;
err:
silc_attribute_payload_list_free(list);
return NULL;
}
示例5: silc_connauth_get_signature
static SilcBool silc_connauth_get_signature(SilcConnAuth connauth,
unsigned char **auth_data,
SilcUInt32 *auth_data_len)
{
int len;
SilcSKE ske;
SilcPrivateKey private_key;
SilcBuffer auth;
SILC_LOG_DEBUG(("Compute signature"));
ske = connauth->ske;
private_key = connauth->auth_data;
/* Make the authentication data. Protocol says it is HASH plus
KE Start Payload. */
len = ske->hash_len + silc_buffer_len(ske->start_payload_copy);
auth = silc_buffer_alloc_size(len);
if (!auth)
return FALSE;
silc_buffer_format(auth,
SILC_STR_UI_XNSTRING(ske->hash, ske->hash_len),
SILC_STR_UI_XNSTRING(
ske->start_payload_copy->data,
silc_buffer_len(ske->start_payload_copy)),
SILC_STR_END);
len = ((silc_pkcs_private_key_get_len(private_key) + 7) / 8) + 1;
*auth_data = silc_calloc(len, sizeof(**auth_data));
if (*auth_data == NULL) {
silc_buffer_free(auth);
return FALSE;
}
/* Compute signature */
if (!silc_pkcs_sign(private_key, auth->data, silc_buffer_len(auth),
*auth_data, len, auth_data_len, TRUE, ske->prop->hash)) {
silc_free(*auth_data);
silc_buffer_free(auth);
return FALSE;
}
silc_buffer_free(auth);
return TRUE;
}
示例6: silc_client_key_exchange
SilcAsyncOperation
silc_client_key_exchange(SilcClient client,
SilcClientConnectionParams *params,
SilcPublicKey public_key,
SilcPrivateKey private_key,
SilcStream stream,
SilcConnectionType conn_type,
SilcClientConnectCallback callback,
void *context)
{
SilcClientConnection conn;
const char *host;
SilcUInt16 port;
SILC_LOG_DEBUG(("Performing key exchange"));
if (!client || !stream)
return NULL;
if (client->internal->run_callback) {
SILC_LOG_ERROR(("Client library is not started yet. SilcClientRunning "
"callback has not been called yet."));
return NULL;
}
if (!silc_socket_stream_get_info(stream, NULL, &host, NULL, &port)) {
SILC_LOG_ERROR(("Socket stream does not have remote host name set"));
callback(client, NULL, SILC_CLIENT_CONN_ERROR, 0, NULL, context);
return NULL;
}
/* Add new connection */
conn = silc_client_add_connection(client, conn_type, TRUE, params,
public_key, private_key,
(char *)host, port, callback, context);
if (!conn) {
callback(client, NULL, SILC_CLIENT_CONN_ERROR, 0, NULL, context);
return NULL;
}
conn->internal->user_stream = stream;
/* Signal connection to start key exchange */
conn->internal->key_exchange = TRUE;
return conn->internal->cop;
}
示例7: silc_command_payload_encode_payload
SilcBuffer silc_command_payload_encode_payload(SilcCommandPayload payload)
{
SilcBuffer buffer;
SilcBuffer args = NULL;
SilcUInt32 len = 0;
SilcUInt32 argc = 0;
SILC_LOG_DEBUG(("Encoding command payload"));
if (payload->args) {
args = silc_argument_payload_encode_payload(payload->args);
if (args)
len = silc_buffer_len(args);
argc = silc_argument_get_arg_num(payload->args);
}
len += SILC_COMMAND_PAYLOAD_LEN;
buffer = silc_buffer_alloc_size(len);
if (!buffer) {
if (args)
silc_buffer_free(args);
return NULL;
}
/* Create Command payload */
silc_buffer_format(buffer,
SILC_STR_UI_SHORT(len),
SILC_STR_UI_CHAR(payload->cmd),
SILC_STR_UI_CHAR(argc),
SILC_STR_UI_SHORT(payload->ident),
SILC_STR_END);
/* Add arguments */
if (args) {
silc_buffer_pull(buffer, SILC_COMMAND_PAYLOAD_LEN);
silc_buffer_format(buffer,
SILC_STR_UI_XNSTRING(args->data,
silc_buffer_len(args)),
SILC_STR_END);
silc_buffer_push(buffer, SILC_COMMAND_PAYLOAD_LEN);
silc_buffer_free(args);
}
return buffer;
}
示例8: silc_client_stop
void silc_client_stop(SilcClient client, SilcClientStopped stopped,
void *context)
{
SILC_LOG_DEBUG(("Stopping client"));
if (!silc_fsm_is_started(&client->internal->fsm)) {
SILC_LOG_WARNING(("Attempting to stop client library before it has been "
"started (silc_client_init not called)"));
return;
}
client->internal->running = (SilcClientRunning)stopped;
client->internal->running_context = context;
/* Signal to stop */
client->internal->stop = TRUE;
SILC_FSM_EVENT_SIGNAL(&client->internal->wait_event);
}
示例9: sftp_data
static void sftp_data(SilcSFTP sftp, SilcSFTPStatus status,
const unsigned char *data, SilcUInt32 data_len,
void *context)
{
SilcSFTPHandle handle = (SilcSFTPHandle)context;
if (status != SILC_SFTP_STATUS_OK) {
SilcSFTPAttributesStruct attrs;
fprintf(stderr, "Status %d\n", status);
if (status != SILC_SFTP_STATUS_EOF) {
SILC_LOG_DEBUG(("Error status"));
success = FALSE;
end_test();
return;
}
if (!strcmp(file, "/sftp/sftp_server.c")) {
fprintf(stderr, "FStatting file handle %s\n", file);
silc_sftp_fstat(sftp, handle, sftp_attr, context);
return;
}
/* Open another file */
opendir = FALSE;
memset(&attrs, 0, sizeof(attrs));
file = "/sftp/sftp_server.c";
fprintf(stderr, "Opening file %s\n", file);
offset = 0;
silc_sftp_open(sftp, file, SILC_SFTP_FXF_READ,
&attrs, sftp_handle, gclient);
return;
}
SILC_LOG_HEXDUMP(("data"), (unsigned char *)data, data_len);
offset += data_len;
/* Attempt to read more */
fprintf(stderr, "Reading more of file %s\n", file);
silc_sftp_read(sftp, handle, offset, 2048, sftp_data, handle);
}
示例10: silc_notify_payload_parse
SilcNotifyPayload silc_notify_payload_parse(const unsigned char *payload,
SilcUInt32 payload_len)
{
SilcBufferStruct buffer;
SilcNotifyPayload newp;
SilcUInt16 len;
int ret;
SILC_LOG_DEBUG(("Parsing Notify payload"));
silc_buffer_set(&buffer, (unsigned char *)payload, payload_len);
newp = silc_calloc(1, sizeof(*newp));
if (!newp)
return NULL;
ret = silc_buffer_unformat(&buffer,
SILC_STR_UI_SHORT(&newp->type),
SILC_STR_UI_SHORT(&len),
SILC_STR_UI_CHAR(&newp->argc),
SILC_STR_END);
if (ret == -1)
goto err;
if (len > silc_buffer_len(&buffer))
goto err;
if (newp->argc) {
silc_buffer_pull(&buffer, 5);
newp->args = silc_argument_payload_parse(buffer.data,
silc_buffer_len(&buffer),
newp->argc);
if (!newp->args)
goto err;
silc_buffer_push(&buffer, 5);
}
return newp;
err:
silc_free(newp);
return NULL;
}
示例11: connect_callback
static void connect_callback(SilcNetStatus status, SilcStream stream,
void *context)
{
Client client = context;
if (!stream) {
SILC_LOG_DEBUG(("Connect error"));
success = FALSE;
end_test();
}
/* Start SFTP session */
client->stream = stream;
client->sftp = silc_sftp_client_start(stream, client->schedule, sftp_version,
sftp_error, client);
if (!client->sftp) {
success = FALSE;
end_test();
}
}
示例12: silc_client_connect_abort
static void silc_client_connect_abort(SilcAsyncOperation op, void *context)
{
SilcClientConnection conn = context;
SILC_LOG_DEBUG(("Connection %p aborted by application", conn));
/* Connection callback will not be called after user aborted connecting */
conn->callback = NULL;
conn->internal->cop = NULL;
/* Signal to close connection */
if (!conn->internal->disconnected) {
conn->internal->disconnected = TRUE;
/* If user aborts before connection machine is even up yet, then don't
send signal yet. It will process this event when it comes up. */
if (silc_fsm_is_started(&conn->internal->fsm))
SILC_FSM_EVENT_SIGNAL(&conn->internal->wait_event);
}
}
示例13: silc_server_command_status_reply
static void
silc_server_command_status_reply(SilcServerCommand cmd,
SilcCommand command,
SilcStatus status,
SilcStatus error)
{
SilcBuffer buffer;
/* Statistics */
cmd->thread->server->stat.commands_sent++;
SILC_LOG_DEBUG(("Sending command status %d", status));
buffer =
silc_command_reply_payload_encode_va(command, status, error,
silc_command_get_ident(cmd->payload),
0);
silc_packet_send(cmd->packet->stream, SILC_PACKET_COMMAND_REPLY, 0,
buffer->data, silc_buffer_len(buffer));
silc_buffer_free(buffer);
}
示例14: silc_socket_stream_notifier
SilcBool silc_socket_stream_notifier(SilcStream stream,
SilcSchedule schedule,
SilcStreamNotifier callback,
void *context)
{
SilcSocketStream socket_stream = stream;
SILC_LOG_DEBUG(("Setting stream notifier callback"));
socket_stream->notifier = callback;
socket_stream->notifier_context = context;
socket_stream->schedule = schedule;
if (socket_stream->notifier && socket_stream->schedule) {
/* Set the socket to non-blocking mode */
silc_net_set_socket_nonblock(socket_stream->sock);
/* Add the socket to scheduler. Safe to call if already added. */
if (!silc_schedule_task_add_fd(socket_stream->schedule,
socket_stream->sock,
silc_socket_stream_io, socket_stream))
return FALSE;
/* Initially set socket for reading */
if (!silc_schedule_set_listen_fd(socket_stream->schedule,
socket_stream->sock,
SILC_TASK_READ, FALSE))
return FALSE;
} else if (socket_stream->schedule) {
/* Unschedule the socket */
silc_schedule_unset_listen_fd(socket_stream->schedule,
socket_stream->sock);
silc_schedule_task_del_by_fd(socket_stream->schedule,
socket_stream->sock);
}
if (socket_stream->schedule)
silc_schedule_wakeup(socket_stream->schedule);
return TRUE;
}
示例15: silc_config_register
SilcBool silc_config_register(SilcConfigEntity ent, const char *name,
SilcConfigType type, SilcConfigCallback cb,
const SilcConfigTable *subtable, void *context)
{
SilcConfigOption *newopt;
SILC_CONFIG_DEBUG(("Register new option=\"%s\" "
"type=%u cb=0x%08x context=0x%08x",
name, type, (SilcUInt32) cb, (SilcUInt32) context));
/* if we are registering a block, make sure there is a specified sub-table */
if (!ent || !name || ((type == SILC_CONFIG_ARG_BLOCK) && !subtable))
return FALSE;
/* don't register a reserved tag */
if (!strcasecmp(name, "include"))
return FALSE;
/* check if an option was previously registered */
if (silc_config_find_option(ent, name)) {
SILC_LOG_DEBUG(("Error: Can't register \"%s\" twice.", name));
return FALSE;
}
/* allocate and append the new option */
newopt = silc_calloc(1, sizeof(*newopt));
newopt->name = strdup(name);
newopt->type = type;
newopt->cb = cb;
newopt->subtable = subtable;
newopt->context = context;
/* append this option to the list */
if (!ent->opts)
ent->opts = newopt;
else {
SilcConfigOption *tmp;
for (tmp = ent->opts; tmp->next; tmp = tmp->next);
tmp->next = newopt;
}
return TRUE;
}