removed IKE_SA_ID (%J) printf hook, two more to go
This commit is contained in:
@@ -0,0 +1,64 @@
|
|||||||
|
/**
|
||||||
|
* @file controller.h
|
||||||
|
*
|
||||||
|
* @brief Interface of controller_t.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2007 Martin Willi
|
||||||
|
* Hochschule fuer Technik Rapperswil
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONTROLLER_H_
|
||||||
|
#define CONTROLLER_H_
|
||||||
|
|
||||||
|
typedef struct controller_t controller_t;
|
||||||
|
|
||||||
|
#include <config/backends/local_backend.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief controller is a configuration and control interface which
|
||||||
|
* allows other processes to modify charons behavior.
|
||||||
|
*
|
||||||
|
* controller_t allows config manipulation (as whack in pluto). Configurations
|
||||||
|
* are stored in a special backend, the in-memory local_backend_t.
|
||||||
|
* Messages of type controller_msg_t's are sent over a unix socket
|
||||||
|
* (/var/run/charon.ctl).
|
||||||
|
*
|
||||||
|
* @b Constructors:
|
||||||
|
* - controller_create()
|
||||||
|
*
|
||||||
|
* @ingroup control
|
||||||
|
*/
|
||||||
|
struct controller_t {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Destroy a controller_t instance.
|
||||||
|
*
|
||||||
|
* @param this controller_t objec to destroy
|
||||||
|
*/
|
||||||
|
void (*destroy) (controller_t *this);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create a controller instance.
|
||||||
|
*
|
||||||
|
* @return controller_t object
|
||||||
|
*
|
||||||
|
* @ingroup control
|
||||||
|
*/
|
||||||
|
controller_t *controller_create();
|
||||||
|
|
||||||
|
#endif /* CONTROLLER_H_ */
|
||||||
|
|||||||
@@ -970,6 +970,7 @@ static void stroke_del_ca(private_stroke_interface_t *this,
|
|||||||
static void log_ike_sa(FILE *out, ike_sa_t *ike_sa, bool all)
|
static void log_ike_sa(FILE *out, ike_sa_t *ike_sa, bool all)
|
||||||
{
|
{
|
||||||
peer_cfg_t *cfg = ike_sa->get_peer_cfg(ike_sa);
|
peer_cfg_t *cfg = ike_sa->get_peer_cfg(ike_sa);
|
||||||
|
ike_sa_id_t *id = ike_sa->get_id(ike_sa);
|
||||||
u_int32_t next, now = time(NULL);
|
u_int32_t next, now = time(NULL);
|
||||||
|
|
||||||
fprintf(out, "%12s[%d]: %N, %H[%D]...%H[%D]\n",
|
fprintf(out, "%12s[%d]: %N, %H[%D]...%H[%D]\n",
|
||||||
@@ -980,9 +981,10 @@ static void log_ike_sa(FILE *out, ike_sa_t *ike_sa, bool all)
|
|||||||
|
|
||||||
if (all)
|
if (all)
|
||||||
{
|
{
|
||||||
fprintf(out, "%12s[%d]: IKE SPIs: %J, ",
|
fprintf(out, "%12s[%d]: IKE SPIs: 0x%0llx_i%s 0x%0llx_r%s, ",
|
||||||
ike_sa->get_name(ike_sa), ike_sa->get_unique_id(ike_sa),
|
ike_sa->get_name(ike_sa), ike_sa->get_unique_id(ike_sa),
|
||||||
ike_sa->get_id(ike_sa));
|
id->get_initiator_spi(id), id->is_initiator(id) ? "*" : "",
|
||||||
|
id->get_responder_spi(id), id->is_initiator(id) ? "" : "");
|
||||||
|
|
||||||
ike_sa->get_stats(ike_sa, &next);
|
ike_sa->get_stats(ike_sa, &next);
|
||||||
if (next)
|
if (next)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ static status_t execute(private_rekey_ike_sa_job_t *this)
|
|||||||
this->ike_sa_id);
|
this->ike_sa_id);
|
||||||
if (ike_sa == NULL)
|
if (ike_sa == NULL)
|
||||||
{
|
{
|
||||||
DBG2(DBG_JOB, "IKE_SA %J to rekey not found", this->ike_sa_id);
|
DBG2(DBG_JOB, "IKE_SA to rekey not found");
|
||||||
return DESTROY_ME;
|
return DESTROY_ME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include "ike_sa_id.h"
|
#include "ike_sa_id.h"
|
||||||
|
|
||||||
#include <printf.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -152,33 +151,6 @@ static ike_sa_id_t* clone_(private_ike_sa_id_t *this)
|
|||||||
return ike_sa_id_create(this->initiator_spi, this->responder_spi, this->is_initiator_flag);
|
return ike_sa_id_create(this->initiator_spi, this->responder_spi, this->is_initiator_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* output handler in printf()
|
|
||||||
*/
|
|
||||||
static int print(FILE *stream, const struct printf_info *info,
|
|
||||||
const void *const *args)
|
|
||||||
{
|
|
||||||
private_ike_sa_id_t *this = *((private_ike_sa_id_t**)(args[0]));
|
|
||||||
|
|
||||||
if (this == NULL)
|
|
||||||
{
|
|
||||||
return fprintf(stream, "(null)");
|
|
||||||
}
|
|
||||||
return fprintf(stream, "0x%0llx_i%s 0x%0llx_r%s",
|
|
||||||
this->initiator_spi,
|
|
||||||
this->is_initiator_flag ? "*" : "",
|
|
||||||
this->responder_spi,
|
|
||||||
this->is_initiator_flag ? "" : "*");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* register printf() handlers
|
|
||||||
*/
|
|
||||||
static void __attribute__ ((constructor))print_register()
|
|
||||||
{
|
|
||||||
register_printf_function(PRINTF_IKE_SA_ID, print, arginfo_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of ike_sa_id_t.destroy.
|
* Implementation of ike_sa_id_t.destroy.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -322,8 +322,8 @@ static ike_sa_t* checkout(private_ike_sa_manager_t *this, ike_sa_id_t *ike_sa_id
|
|||||||
ike_sa_t *ike_sa = NULL;
|
ike_sa_t *ike_sa = NULL;
|
||||||
entry_t *entry;
|
entry_t *entry;
|
||||||
|
|
||||||
DBG2(DBG_MGR, "checkout IKE_SA: %J, %d IKE_SAs in manager",
|
DBG2(DBG_MGR, "checkout IKE_SA, %d IKE_SAs in manager",
|
||||||
ike_sa_id, this->ike_sa_list->get_count(this->ike_sa_list));
|
this->ike_sa_list->get_count(this->ike_sa_list));
|
||||||
|
|
||||||
pthread_mutex_lock(&(this->mutex));
|
pthread_mutex_lock(&(this->mutex));
|
||||||
if (get_entry_by_id(this, ike_sa_id, &entry) == SUCCESS)
|
if (get_entry_by_id(this, ike_sa_id, &entry) == SUCCESS)
|
||||||
@@ -357,13 +357,13 @@ static ike_sa_t *checkout_new(private_ike_sa_manager_t* this, bool initiator)
|
|||||||
id = ike_sa_id_create(0, get_next_spi(this), FALSE);
|
id = ike_sa_id_create(0, get_next_spi(this), FALSE);
|
||||||
}
|
}
|
||||||
entry = entry_create(id);
|
entry = entry_create(id);
|
||||||
|
id->destroy(id);
|
||||||
pthread_mutex_lock(&this->mutex);
|
pthread_mutex_lock(&this->mutex);
|
||||||
this->ike_sa_list->insert_last(this->ike_sa_list, entry);
|
this->ike_sa_list->insert_last(this->ike_sa_list, entry);
|
||||||
entry->checked_out = TRUE;
|
entry->checked_out = TRUE;
|
||||||
pthread_mutex_unlock(&this->mutex);
|
pthread_mutex_unlock(&this->mutex);
|
||||||
DBG2(DBG_MGR, "created IKE_SA: %J, %d IKE_SAs in manager",
|
DBG2(DBG_MGR, "created IKE_SA, %d IKE_SAs in manager",
|
||||||
id, this->ike_sa_list->get_count(this->ike_sa_list));
|
this->ike_sa_list->get_count(this->ike_sa_list));
|
||||||
id->destroy(id);
|
|
||||||
return entry->ike_sa;
|
return entry->ike_sa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,8 +379,8 @@ static ike_sa_t* checkout_by_message(private_ike_sa_manager_t* this,
|
|||||||
id = id->clone(id);
|
id = id->clone(id);
|
||||||
id->switch_initiator(id);
|
id->switch_initiator(id);
|
||||||
|
|
||||||
DBG2(DBG_MGR, "checkout IKE_SA: %J by message, %d IKE_SAs in manager",
|
DBG2(DBG_MGR, "checkout IKE_SA by message, %d IKE_SAs in manager",
|
||||||
id, this->ike_sa_list->get_count(this->ike_sa_list));
|
this->ike_sa_list->get_count(this->ike_sa_list));
|
||||||
|
|
||||||
if (message->get_request(message) &&
|
if (message->get_request(message) &&
|
||||||
message->get_exchange_type(message) == IKE_SA_INIT)
|
message->get_exchange_type(message) == IKE_SA_INIT)
|
||||||
@@ -440,7 +440,7 @@ static ike_sa_t* checkout_by_message(private_ike_sa_manager_t* this,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DBG1(DBG_MGR, "ignoring message for %J, no such IKE_SA", id);
|
DBG1(DBG_MGR, "ignoring message, no such IKE_SA");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -555,7 +555,7 @@ static ike_sa_t* checkout_by_peer(private_ike_sa_manager_t *this,
|
|||||||
|
|
||||||
/* create entry */
|
/* create entry */
|
||||||
new_entry = entry_create(new_ike_sa_id);
|
new_entry = entry_create(new_ike_sa_id);
|
||||||
DBG2(DBG_MGR, "created IKE_SA: %J", new_ike_sa_id);
|
DBG2(DBG_MGR, "created IKE_SA");
|
||||||
new_ike_sa_id->destroy(new_ike_sa_id);
|
new_ike_sa_id->destroy(new_ike_sa_id);
|
||||||
|
|
||||||
this->ike_sa_list->insert_last(this->ike_sa_list, new_entry);
|
this->ike_sa_list->insert_last(this->ike_sa_list, new_entry);
|
||||||
@@ -721,7 +721,7 @@ static status_t checkin(private_ike_sa_manager_t *this, ike_sa_t *ike_sa)
|
|||||||
|
|
||||||
ike_sa_id = ike_sa->get_id(ike_sa);
|
ike_sa_id = ike_sa->get_id(ike_sa);
|
||||||
|
|
||||||
DBG2(DBG_MGR, "checkin IKE_SA: %J", ike_sa_id);
|
DBG2(DBG_MGR, "checkin IKE_SA");
|
||||||
|
|
||||||
pthread_mutex_lock(&(this->mutex));
|
pthread_mutex_lock(&(this->mutex));
|
||||||
|
|
||||||
@@ -768,7 +768,7 @@ static status_t checkin_and_destroy(private_ike_sa_manager_t *this, ike_sa_t *ik
|
|||||||
ike_sa_id_t *ike_sa_id;
|
ike_sa_id_t *ike_sa_id;
|
||||||
|
|
||||||
ike_sa_id = ike_sa->get_id(ike_sa);
|
ike_sa_id = ike_sa->get_id(ike_sa);
|
||||||
DBG2(DBG_MGR, "checkin and destroy IKE_SA: %J", ike_sa_id);
|
DBG2(DBG_MGR, "checkin and destroy IKE_SA");
|
||||||
|
|
||||||
pthread_mutex_lock(&(this->mutex));
|
pthread_mutex_lock(&(this->mutex));
|
||||||
|
|
||||||
|
|||||||
@@ -38,20 +38,18 @@
|
|||||||
#define PRINTF_IDENTIFICATION 'D'
|
#define PRINTF_IDENTIFICATION 'D'
|
||||||
/** 1 argumnet: host_t *host; use #-modifier to include port number */
|
/** 1 argumnet: host_t *host; use #-modifier to include port number */
|
||||||
#define PRINTF_HOST 'H'
|
#define PRINTF_HOST 'H'
|
||||||
/** 1 argument: ike_sa_id_t *id */
|
|
||||||
#define PRINTF_IKE_SA_ID 'J'
|
|
||||||
/** 1 argument: ike_sa_t *ike_sa */
|
/** 1 argument: ike_sa_t *ike_sa */
|
||||||
#define PRINTF_ENUM 'N'
|
#define PRINTF_ENUM 'N'
|
||||||
/** 1 argument: child_sa_t *child_sa */
|
/** 1 argument: child_sa_t *child_sa */
|
||||||
#define PRINTF_TRAFFIC_SELECTOR 'R'
|
#define PRINTF_TRAFFIC_SELECTOR 'R'
|
||||||
/** 1 argument: time_t *time; with #-modifier 2 arguments: time_t *time, bool utc */
|
/** 1 argument: time_t *time; with #-modifier 2 arguments: time_t *time, bool utc */
|
||||||
#define PRINTF_TIME 'T'
|
#define PRINTF_TIME 'T'
|
||||||
|
/** 2 arguments: time_t *begin, time_t *end */
|
||||||
|
#define PRINTF_TIME_DELTA 'V'
|
||||||
/** 1 argument: x509_t *cert; with #-modifier 2 arguments: x509_t *cert, bool utc */
|
/** 1 argument: x509_t *cert; with #-modifier 2 arguments: x509_t *cert, bool utc */
|
||||||
#define PRINTF_X509 'Q'
|
#define PRINTF_X509 'Q'
|
||||||
/** 1 argument: crl_t *crl; with #-modifier 2 arguments: crl_t *crl, bool utc */
|
/** 1 argument: crl_t *crl; with #-modifier 2 arguments: crl_t *crl, bool utc */
|
||||||
#define PRINTF_CRL 'U'
|
#define PRINTF_CRL 'U'
|
||||||
/** 2 arguments: time_t *begin, time_t *end */
|
|
||||||
#define PRINTF_TIME_DELTA 'V'
|
|
||||||
/** 1 argument: ca_info_t *ca_info; with #-modifier 2 arguments: ca_info_t *ca_info, bool utc */
|
/** 1 argument: ca_info_t *ca_info; with #-modifier 2 arguments: ca_info_t *ca_info, bool utc */
|
||||||
#define PRINTF_CAINFO 'W'
|
#define PRINTF_CAINFO 'W'
|
||||||
/** 1 argument: certinfo_t *certinfo; with #-modifier 2 arguments: certinfo_t *certinfo, bool utc */
|
/** 1 argument: certinfo_t *certinfo; with #-modifier 2 arguments: certinfo_t *certinfo, bool utc */
|
||||||
|
|||||||
Reference in New Issue
Block a user