2 * Copyright (C) 2010 Martin Willi
3 * Copyright (C) 2010 revosec AG
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 #include <encoding/payloads/id_payload.h>
20 typedef struct private_log_id_t private_log_id_t
;
23 * Private data of an log_id_t object.
25 struct private_log_id_t
{
28 * Implements the hook_t interface.
33 METHOD(listener_t
, message
, bool,
34 private_log_id_t
*this, ike_sa_t
*ike_sa
, message_t
*message
,
35 bool incoming
, bool plain
)
37 if (incoming
&& plain
)
39 enumerator_t
*enumerator
;
41 id_payload_t
*id_payload
;
45 enumerator
= message
->create_payload_enumerator(message
);
46 while (enumerator
->enumerate(enumerator
, &payload
))
48 if (payload
->get_type(payload
) == PLV2_ID_INITIATOR
||
49 payload
->get_type(payload
) == PLV2_ID_RESPONDER
)
51 id_payload
= (id_payload_t
*)payload
;
52 id
= id_payload
->get_identification(id_payload
);
53 data
= id
->get_encoding(id
);
55 DBG1(DBG_CFG
, "%N: %N %B",
56 payload_type_short_names
, payload
->get_type(payload
),
57 id_type_names
, id
->get_type(id
), &data
);
61 enumerator
->destroy(enumerator
);
66 METHOD(hook_t
, destroy
, void,
67 private_log_id_t
*this)
73 * Create the IKE_AUTH fill hook
75 hook_t
*log_id_hook_create(char *name
)
77 private_log_id_t
*this;