2009-04-24 14:13:52 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2009 Martin Willi
|
2018-05-23 14:04:50 +00:00
|
|
|
* HSR Hochschule fuer Technik Rapperswil
|
2009-04-24 14:13:52 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup attribute_handler attribute_handler
|
|
|
|
* @{ @ingroup attributes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ATTRIBUTE_HANDLER_H_
|
|
|
|
#define ATTRIBUTE_HANDLER_H_
|
|
|
|
|
2014-11-04 14:53:50 +00:00
|
|
|
typedef struct attribute_handler_t attribute_handler_t;
|
|
|
|
|
|
|
|
#include <sa/ike_sa.h>
|
2012-10-16 13:53:49 +00:00
|
|
|
#include <utils/chunk.h>
|
2012-10-16 12:54:16 +00:00
|
|
|
#include <collections/linked_list.h>
|
2009-10-13 11:46:27 +00:00
|
|
|
|
|
|
|
#include "attributes.h"
|
2009-04-24 14:13:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface to handle configuration payload attributes.
|
|
|
|
*/
|
|
|
|
struct attribute_handler_t {
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2009-04-24 14:13:52 +00:00
|
|
|
/**
|
|
|
|
* Handle a configuration attribute.
|
|
|
|
*
|
2020-02-05 04:30:52 +00:00
|
|
|
* After receiving a configuration attribute, it is passed to each
|
2009-04-24 14:13:52 +00:00
|
|
|
* attribute handler until it is handled.
|
|
|
|
*
|
2014-11-04 14:53:50 +00:00
|
|
|
* @param ike_sa IKE_SA under which attribute is received
|
2009-04-24 14:13:52 +00:00
|
|
|
* @param type type of configuration attribute to handle
|
|
|
|
* @param data associated attribute data
|
|
|
|
* @return TRUE if attribute handled
|
|
|
|
*/
|
2014-11-04 14:53:50 +00:00
|
|
|
bool (*handle)(attribute_handler_t *this, ike_sa_t *ike_sa,
|
2009-04-24 14:13:52 +00:00
|
|
|
configuration_attribute_type_t type, chunk_t data);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2009-04-24 14:13:52 +00:00
|
|
|
/**
|
|
|
|
* Release an attribute handled during handle().
|
|
|
|
*
|
|
|
|
* A handler that handle()d an attribute gets a call to release() when the
|
2009-10-13 11:46:27 +00:00
|
|
|
* connection gets closed. Depending on the implementation, this is required
|
2009-04-24 14:13:52 +00:00
|
|
|
* to remove the attribute.
|
2014-11-04 14:53:50 +00:00
|
|
|
*
|
|
|
|
* @param ike_sa IKE_SA which releases attribute
|
|
|
|
* @param type type of configuration attribute to release
|
|
|
|
* @param data associated attribute data
|
2009-04-24 14:13:52 +00:00
|
|
|
*/
|
2014-11-04 14:53:50 +00:00
|
|
|
void (*release)(attribute_handler_t *this, ike_sa_t *ike_sa,
|
2009-04-24 14:13:52 +00:00
|
|
|
configuration_attribute_type_t type, chunk_t data);
|
2009-11-17 13:51:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumerate attributes to request from a server.
|
|
|
|
*
|
2014-11-04 14:53:50 +00:00
|
|
|
* @param ike_sa IKE_SA to request attributes for
|
2012-08-27 12:09:47 +00:00
|
|
|
* @param vips list of virtual IPs (host_t*) we are requesting
|
2009-11-17 13:51:50 +00:00
|
|
|
* @return enumerator (configuration_attribute_type_t, chunk_t)
|
|
|
|
*/
|
|
|
|
enumerator_t* (*create_attribute_enumerator)(attribute_handler_t *this,
|
2014-11-04 14:53:50 +00:00
|
|
|
ike_sa_t *ike_sa, linked_list_t *vips);
|
2009-04-24 14:13:52 +00:00
|
|
|
};
|
|
|
|
|
2009-10-22 12:34:10 +00:00
|
|
|
#endif /** ATTRIBUTE_HANDLER_H_ @}*/
|