introduced printf() specifiers for:

host_t (%H)
  identification_t (%D)
  chunk pointers (%B)
  memory pointer/length (%b)
added a signaling bus:
  receives event and debug messages, sends them to its listeners
  stream_logger, sys_logger, file_logger added, listen to bus
some other tweaks here and there
This commit is contained in:
Martin Willi
2006-09-27 14:14:44 +00:00
parent f91513e333
commit 47f5027807
26 changed files with 1300 additions and 203 deletions
@@ -74,8 +74,9 @@ static connection_t *get_connection_by_hosts(private_local_connection_store_t *t
connection_t *candidate;
connection_t *found = NULL;
this->logger->log(this->logger, CONTROL|LEVEL1, "looking for connection for host pair %s...%s",
my_host->get_string(my_host), other_host->get_string(other_host));
this->logger->log(this->logger, CONTROL|LEVEL1,
"looking for connection for host pair %H...%H",
my_host, other_host);
pthread_mutex_lock(&(this->mutex));
iterator = this->connections->create_iterator(this->connections, TRUE);
@@ -106,10 +107,9 @@ static connection_t *get_connection_by_hosts(private_local_connection_store_t *t
}
this->logger->log(this->logger, CONTROL|LEVEL2,
"candidate connection \"%s\": %s...%s (prio=%d)",
"candidate connection \"%s\": %H...%H (prio=%d)",
candidate->get_name(candidate),
candidate_my_host->get_string(candidate_my_host),
candidate_other_host->get_string(candidate_other_host),
candidate_my_host, candidate_other_host,
prio);
if (prio > best_prio)
@@ -127,10 +127,9 @@ static connection_t *get_connection_by_hosts(private_local_connection_store_t *t
host_t *found_other_host = found->get_other_host(found);
this->logger->log(this->logger, CONTROL|LEVEL1,
"found matching connection \"%s\": %s...%s (prio=%d)",
"found matching connection \"%s\": %H...%H (prio=%d)",
found->get_name(found),
found_my_host->get_string(found_my_host),
found_other_host->get_string(found_other_host),
found_my_host, found_other_host,
best_prio);
/* give out a new reference to it */
@@ -242,10 +241,8 @@ void log_connections(private_local_connection_store_t *this, logger_t *logger, c
host_t *my_host = current->get_my_host(current);
host_t *other_host = current->get_other_host(current);
logger->log(logger, CONTROL, " \"%s\": %s...%s",
current->get_name(current),
my_host->get_string(my_host),
other_host->get_string(other_host));
logger->log(logger, CONTROL, " \"%s\": %H...%H",
current->get_name(current), my_host, other_host);
}
}
iterator->destroy(iterator);
@@ -504,8 +504,8 @@ static bool verify(private_local_credential_store_t *this, x509_t *cert, bool *f
identification_t *subject = cert->get_subject(cert);
identification_t *issuer = cert->get_issuer(cert);
this->logger->log(this->logger, CONTROL|LEVEL1, "subject: '%s'", subject->get_string(subject));
this->logger->log(this->logger, CONTROL|LEVEL1, "issuer: '%s'", issuer->get_string(issuer));
this->logger->log(this->logger, CONTROL|LEVEL1, "subject: '%D'", subject);
this->logger->log(this->logger, CONTROL|LEVEL1, "issuer: '%D'", issuer);
ugh = cert->is_valid(cert, &until);
if (ugh != NULL)
@@ -116,8 +116,8 @@ static policy_t *get_policy(private_local_policy_store_t *this,
policy_t *candidate;
policy_t *found = NULL;
this->logger->log(this->logger, CONTROL|LEVEL1, "searching policy for ID pair %s...%s",
my_id->get_string(my_id), other_id->get_string(other_id));
this->logger->log(this->logger, CONTROL|LEVEL1,
"searching policy for ID pair %D...%D", my_id, other_id);
pthread_mutex_lock(&(this->mutex));
iterator = this->policies->create_iterator(this->policies, TRUE);
@@ -151,19 +151,14 @@ static policy_t *get_policy(private_local_policy_store_t *this,
{
this->logger->log(this->logger, CONTROL|LEVEL2,
"candidate '%s' inacceptable due traffic selector mismatch",
candidate->get_name(candidate),
candidate_my_id->get_string(candidate_my_id),
candidate_other_id->get_string(candidate_other_id),
prio);
candidate->get_name(candidate));
continue;
}
this->logger->log(this->logger, CONTROL|LEVEL2,
"candidate policy '%s': %s...%s (prio=%d)",
"candidate policy '%s': %D...%D (prio=%d)",
candidate->get_name(candidate),
candidate_my_id->get_string(candidate_my_id),
candidate_other_id->get_string(candidate_other_id),
prio);
candidate_my_id, candidate_other_id, prio);
if (prio > best_prio)
{
@@ -180,11 +175,9 @@ static policy_t *get_policy(private_local_policy_store_t *this,
identification_t *found_other_id = found->get_other_id(found);
this->logger->log(this->logger, CONTROL,
"found matching policy '%s': %s...%s (prio=%d)",
"found matching policy '%s': %D...%D (prio=%d)",
found->get_name(found),
found_my_id->get_string(found_my_id),
found_other_id->get_string(found_other_id),
best_prio);
found_my_id, found_other_id, best_prio);
/* give out a new reference to it */
found->get_ref(found);
}