2 * Copyright (C) 2010 Martin Willi
4 * Copyright (C) secunet Security Networks AG
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 #include <encoding/payloads/unknown_payload.h>
21 typedef struct private_set_ike_request_t private_set_ike_request_t
;
24 * Private data of an set_ike_request_t object.
26 struct private_set_ike_request_t
{
29 * Implements the hook_t interface.
34 * Alter requests or responses?
39 * ID of message to alter.
44 METHOD(listener_t
, message
, bool,
45 private_set_ike_request_t
*this, ike_sa_t
*ike_sa
, message_t
*message
,
46 bool incoming
, bool plain
)
48 if (!incoming
&& plain
&&
49 message
->get_request(message
) == this->req
&&
50 message
->get_message_id(message
) == this->id
)
52 DBG1(DBG_CFG
, "toggling IKE message request flag");
53 message
->set_request(message
, !this->req
);
58 METHOD(hook_t
, destroy
, void,
59 private_set_ike_request_t
*this)
65 * Create the IKE_AUTH fill hook
67 hook_t
*set_ike_request_hook_create(char *name
)
69 private_set_ike_request_t
*this;
78 .req
= conftest
->test
->get_bool(conftest
->test
,
79 "hooks.%s.request", TRUE
, name
),
80 .id
= conftest
->test
->get_int(conftest
->test
,
81 "hooks.%s.id", 0, name
),