Always use a transform number of 1 when encoding a single transform
[strongswan.git] / src / libcharon / processing / jobs / initiate_xauth_job.c
1 /*
2 * Copyright (C) 2007-2008 Tobias Brunner
3 * Hochschule fuer Technik Rapperswil
4 *
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>.
9 *
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
13 * for more details.
14 */
15
16 #include "initiate_xauth_job.h"
17
18 #include <sa/ike_sa.h>
19 #include <daemon.h>
20
21
22 typedef struct private_initiate_xauth_job_t private_initiate_xauth_job_t;
23
24 /**
25 * Private data of an initiate_xauth_job_t Object
26 */
27 struct private_initiate_xauth_job_t {
28 /**
29 * public initiate_xauth_job_t interface
30 */
31 initiate_xauth_job_t public;
32
33 /**
34 * ID of the IKE_SA of the mediated connection.
35 */
36 ike_sa_id_t *ike_sa_id;
37 };
38
39 METHOD(job_t, destroy, void,
40 private_initiate_xauth_job_t *this)
41 {
42 DESTROY_IF(this->ike_sa_id);
43 free(this);
44 }
45
46 METHOD(job_t, initiate, void,
47 private_initiate_xauth_job_t *this)
48 {
49 ike_sa_t *ike_sa;
50
51 ike_sa = charon->ike_sa_manager->checkout(charon->ike_sa_manager,
52 this->ike_sa_id);
53 if (ike_sa)
54 {
55 ike_sa->initiate_xauth(ike_sa, TRUE);
56 charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa);
57 }
58 destroy(this);
59 }
60
61 METHOD(job_t, get_priority, job_priority_t,
62 private_initiate_xauth_job_t *this)
63 {
64 return JOB_PRIO_MEDIUM;
65 }
66
67 /**
68 * Creates an empty job
69 */
70 initiate_xauth_job_t *initiate_xauth_job_create(ike_sa_id_t *ike_sa_id)
71 {
72 private_initiate_xauth_job_t *this;
73 INIT(this,
74 .public = {
75 .job_interface = {
76 .get_priority = _get_priority,
77 .destroy = _destroy,
78 .execute = _initiate,
79 },
80 },
81 .ike_sa_id = ike_sa_id->clone(ike_sa_id),
82 );
83 return &this->public;
84 }