moved initiate() code to the generic controller_t class
This commit is contained in:
@@ -23,18 +23,30 @@
|
||||
#ifndef CONTROLLER_H_
|
||||
#define CONTROLLER_H_
|
||||
|
||||
typedef struct controller_t controller_t;
|
||||
|
||||
#include <config/backends/local_backend.h>
|
||||
#include <bus/bus.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).
|
||||
* callback to log things triggered by controller
|
||||
*
|
||||
* @param param echoed parameter supplied when function invoked
|
||||
* @param signal type of signal
|
||||
* @param level verbosity level if log
|
||||
* @param ike_sa associated IKE_SA, if any
|
||||
* @param format printf like format string
|
||||
* @param args list of arguments to use for format
|
||||
* @return FALSE to return from invoked function
|
||||
* @ingroup control
|
||||
*/
|
||||
typedef bool(*controller_cb_t)(void* param, signal_t signal, level_t level,
|
||||
ike_sa_t* ike_sa, char* format, va_list args);
|
||||
|
||||
typedef struct controller_t controller_t;
|
||||
|
||||
/**
|
||||
* @brief The controller controls the daemon.
|
||||
*
|
||||
* The controller starts actions by creating jobs. It then tries to
|
||||
* evaluate the result of the operation by listening on the bus.
|
||||
*
|
||||
* @b Constructors:
|
||||
* - controller_create()
|
||||
@@ -42,6 +54,23 @@ typedef struct controller_t controller_t;
|
||||
* @ingroup control
|
||||
*/
|
||||
struct controller_t {
|
||||
|
||||
/**
|
||||
* @brief Initiate a CHILD_SA, and if required, an IKE_SA.
|
||||
*
|
||||
* @param this calling object
|
||||
* @param peer_cfg peer_cfg to use for IKE_SA setup
|
||||
* @param child_cfg child_cfg to set up CHILD_SA from
|
||||
* @param cb logging callback
|
||||
* @param param parameter to include in each call of cb
|
||||
* @return
|
||||
* - SUCCESS, if CHILD_SA established
|
||||
* - FAILED, if setup failed
|
||||
* - NEED_MORE, if callback returned FALSE
|
||||
*/
|
||||
status_t (*initiate)(controller_t *this,
|
||||
peer_cfg_t *peer_cfg, child_cfg_t *child_cfg,
|
||||
controller_cb_t callback, void *param);
|
||||
|
||||
/**
|
||||
* @brief Destroy a controller_t instance.
|
||||
|
||||
Reference in New Issue
Block a user