fixed some rekey collision issues
[strongswan.git] / src / charon / sa / task_manager.c
1 /**
2 * @file task_manager.c
3 *
4 * @brief Implementation of task_manager_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2007 Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #include "task_manager.h"
24
25 #include <daemon.h>
26 #include <sa/tasks/ike_init.h>
27 #include <sa/tasks/ike_natd.h>
28 #include <sa/tasks/ike_auth.h>
29 #include <sa/tasks/ike_cert.h>
30 #include <sa/tasks/ike_rekey.h>
31 #include <sa/tasks/ike_delete.h>
32 #include <sa/tasks/ike_config.h>
33 #include <sa/tasks/ike_dpd.h>
34 #include <sa/tasks/child_create.h>
35 #include <sa/tasks/child_rekey.h>
36 #include <sa/tasks/child_delete.h>
37 #include <encoding/payloads/delete_payload.h>
38 #include <queues/jobs/retransmit_job.h>
39
40 typedef struct exchange_t exchange_t;
41
42 /**
43 * An exchange in the air, used do detect and handle retransmission
44 */
45 struct exchange_t {
46
47 /**
48 * Message ID used for this transaction
49 */
50 u_int32_t mid;
51
52 /**
53 * generated packet for retransmission
54 */
55 packet_t *packet;
56 };
57
58 typedef struct private_task_manager_t private_task_manager_t;
59
60 /**
61 * private data of the task manager
62 */
63 struct private_task_manager_t {
64
65 /**
66 * public functions
67 */
68 task_manager_t public;
69
70 /**
71 * associated IKE_SA we are serving
72 */
73 ike_sa_t *ike_sa;
74
75 /**
76 * Exchange we are currently handling as responder
77 */
78 struct {
79 /**
80 * Message ID of the exchange
81 */
82 u_int32_t mid;
83
84 /**
85 * packet for retransmission
86 */
87 packet_t *packet;
88
89 } responding;
90
91 /**
92 * Exchange we are currently handling as initiator
93 */
94 struct {
95 /**
96 * Message ID of the exchange
97 */
98 u_int32_t mid;
99
100 /**
101 * how many times we have retransmitted so far
102 */
103 u_int retransmitted;
104
105 /**
106 * packet for retransmission
107 */
108 packet_t *packet;
109
110 /**
111 * type of the initated exchange
112 */
113 exchange_type_t type;
114
115 } initiating;
116
117 /**
118 * List of queued tasks not yet in action
119 */
120 linked_list_t *queued_tasks;
121
122 /**
123 * List of active tasks, initiated by ourselve
124 */
125 linked_list_t *active_tasks;
126
127 /**
128 * List of tasks initiated by peer
129 */
130 linked_list_t *passive_tasks;
131 };
132
133 /**
134 * flush all tasks in the task manager
135 */
136 static void flush(private_task_manager_t *this)
137 {
138 task_t *task;
139
140 this->queued_tasks->destroy_offset(this->queued_tasks,
141 offsetof(task_t, destroy));
142 this->passive_tasks->destroy_offset(this->passive_tasks,
143 offsetof(task_t, destroy));
144
145 /* emmit outstanding signals for tasks */
146 while (this->active_tasks->remove_last(this->active_tasks,
147 (void**)&task) == SUCCESS)
148 {
149 switch (task->get_type(task))
150 {
151 case IKE_AUTH:
152 SIG(IKE_UP_FAILED, "establishing IKE_SA failed");
153 break;
154 case IKE_DELETE:
155 SIG(IKE_DOWN_FAILED, "IKE_SA deleted");
156 break;
157 case IKE_REKEY:
158 SIG(IKE_REKEY_FAILED, "rekeying IKE_SA failed");
159 break;
160 case CHILD_CREATE:
161 SIG(CHILD_UP_FAILED, "establishing CHILD_SA failed");
162 break;
163 case CHILD_DELETE:
164 SIG(CHILD_DOWN_FAILED, "deleting CHILD_SA failed");
165 break;
166 case CHILD_REKEY:
167 SIG(IKE_REKEY_FAILED, "rekeying CHILD_SA failed");
168 break;
169 default:
170 break;
171 }
172 task->destroy(task);
173 }
174 this->queued_tasks = linked_list_create();
175 this->passive_tasks = linked_list_create();
176 }
177
178 /**
179 * move a task of a specific type from the queue to the active list
180 */
181 static bool activate_task(private_task_manager_t *this, task_type_t type)
182 {
183 iterator_t *iterator;
184 task_t *task;
185 bool found = FALSE;
186
187 iterator = this->queued_tasks->create_iterator(this->queued_tasks, TRUE);
188 while (iterator->iterate(iterator, (void**)&task))
189 {
190 if (task->get_type(task) == type)
191 {
192 DBG2(DBG_IKE, " activating %N task", task_type_names, type);
193 iterator->remove(iterator);
194 this->active_tasks->insert_last(this->active_tasks, task);
195 found = TRUE;
196 break;
197 }
198 }
199 iterator->destroy(iterator);
200 return found;
201 }
202
203 /**
204 * Implementation of task_manager_t.retransmit
205 */
206 static status_t retransmit(private_task_manager_t *this, u_int32_t message_id)
207 {
208 if (message_id == this->initiating.mid)
209 {
210 u_int32_t timeout;
211 job_t *job;
212
213 timeout = charon->configuration->get_retransmit_timeout(
214 charon->configuration, this->initiating.retransmitted);
215 if (timeout == 0)
216 {
217 DBG1(DBG_IKE, "giving up after %d retransmits",
218 this->initiating.retransmitted - 1);
219 return DESTROY_ME;
220 }
221
222 if (this->initiating.retransmitted)
223 {
224 DBG1(DBG_IKE, "retransmit %d of request with message ID %d",
225 this->initiating.retransmitted, message_id);
226 }
227 this->initiating.retransmitted++;
228
229 charon->send_queue->add(charon->send_queue,
230 this->initiating.packet->clone(this->initiating.packet));
231 job = (job_t*)retransmit_job_create(this->initiating.mid,
232 this->ike_sa->get_id(this->ike_sa));
233 charon->event_queue->add_relative(charon->event_queue, job, timeout);
234 }
235 return SUCCESS;
236 }
237
238 /**
239 * build a request using the active task list
240 * Implementation of task_manager_t.initiate
241 */
242 static status_t build_request(private_task_manager_t *this)
243 {
244 iterator_t *iterator;
245 task_t *task;
246 message_t *message;
247 status_t status;
248 exchange_type_t exchange = 0;
249
250 if (this->initiating.type != EXCHANGE_TYPE_UNDEFINED)
251 {
252 DBG2(DBG_IKE, "delaying task initiation, exchange in progress");
253 /* do not initiate if we already have a message in the air */
254 return SUCCESS;
255 }
256
257 if (this->active_tasks->get_count(this->active_tasks) == 0)
258 {
259 DBG2(DBG_IKE, "activating new tasks");
260 switch (this->ike_sa->get_state(this->ike_sa))
261 {
262 case IKE_CREATED:
263 if (activate_task(this, IKE_INIT))
264 {
265 exchange = IKE_SA_INIT;
266 activate_task(this, IKE_NATD);
267 activate_task(this, IKE_CERT);
268 activate_task(this, IKE_AUTHENTICATE);
269 activate_task(this, IKE_CONFIG);
270 activate_task(this, CHILD_CREATE);
271 }
272 break;
273 case IKE_ESTABLISHED:
274 if (activate_task(this, CHILD_CREATE))
275 {
276 exchange = CREATE_CHILD_SA;
277 activate_task(this, IKE_CONFIG);
278 break;
279 }
280 if (activate_task(this, CHILD_DELETE))
281 {
282 exchange = INFORMATIONAL;
283 break;
284 }
285 if (activate_task(this, CHILD_REKEY))
286 {
287 exchange = CREATE_CHILD_SA;
288 break;
289 }
290 if (activate_task(this, IKE_DELETE))
291 {
292 exchange = INFORMATIONAL;
293 break;
294 }
295 if (activate_task(this, IKE_REKEY))
296 {
297 exchange = CREATE_CHILD_SA;
298 break;
299 }
300 if (activate_task(this, IKE_DEADPEER))
301 {
302 exchange = INFORMATIONAL;
303 break;
304 }
305 case IKE_REKEYING:
306 if (activate_task(this, IKE_DELETE))
307 {
308 exchange = INFORMATIONAL;
309 break;
310 }
311 case IKE_DELETING:
312 default:
313 break;
314 }
315 }
316 else
317 {
318 DBG2(DBG_IKE, "reinitiating already active tasks");
319 iterator = this->active_tasks->create_iterator(this->active_tasks, TRUE);
320 while (iterator->iterate(iterator, (void**)&task))
321 {
322 DBG2(DBG_IKE, " %N task", task_type_names, task->get_type(task));
323 switch (task->get_type(task))
324 {
325 case IKE_INIT:
326 exchange = IKE_SA_INIT;
327 break;
328 case IKE_AUTHENTICATE:
329 exchange = IKE_AUTH;
330 break;
331 default:
332 continue;
333 }
334 break;
335 }
336 iterator->destroy(iterator);
337 }
338
339 if (exchange == 0)
340 {
341 DBG2(DBG_IKE, "nothing to initiate");
342 /* nothing to do yet... */
343 return SUCCESS;
344 }
345
346 message = message_create();
347 message->set_message_id(message, this->initiating.mid);
348 message->set_exchange_type(message, exchange);
349 this->initiating.type = exchange;
350 this->initiating.retransmitted = 0;
351
352 iterator = this->active_tasks->create_iterator(this->active_tasks, TRUE);
353 while (iterator->iterate(iterator, (void*)&task))
354 {
355 switch (task->build(task, message))
356 {
357 case SUCCESS:
358 /* task completed, remove it */
359 iterator->remove(iterator);
360 task->destroy(task);
361 break;
362 case NEED_MORE:
363 /* processed, but task needs another exchange */
364 break;
365 case FAILED:
366 default:
367 /* critical failure, destroy IKE_SA */
368 iterator->destroy(iterator);
369 message->destroy(message);
370 flush(this);
371 return DESTROY_ME;
372 }
373 }
374 iterator->destroy(iterator);
375
376 DESTROY_IF(this->initiating.packet);
377 status = this->ike_sa->generate_message(this->ike_sa, message,
378 &this->initiating.packet);
379 message->destroy(message);
380 if (status != SUCCESS)
381 {
382 /* message generation failed. There is nothing more to do than to
383 * close the SA */
384 flush(this);
385 return DESTROY_ME;
386 }
387
388 return retransmit(this, this->initiating.mid);
389 }
390
391 /**
392 * handle an incoming response message
393 */
394 static status_t process_response(private_task_manager_t *this,
395 message_t *message)
396 {
397 iterator_t *iterator;
398 task_t *task;
399
400 if (message->get_exchange_type(message) != this->initiating.type)
401 {
402 DBG1(DBG_IKE, "received %N response, but expected %N",
403 exchange_type_names, message->get_exchange_type(message),
404 exchange_type_names, this->initiating.type);
405 return DESTROY_ME;
406 }
407
408 iterator = this->active_tasks->create_iterator(this->active_tasks, TRUE);
409 while (iterator->iterate(iterator, (void*)&task))
410 {
411 switch (task->process(task, message))
412 {
413 case SUCCESS:
414 /* task completed, remove it */
415 iterator->remove(iterator);
416 task->destroy(task);
417 break;
418 case NEED_MORE:
419 /* processed, but task needs another exchange */
420 break;
421 case FAILED:
422 default:
423 /* critical failure, destroy IKE_SA */
424 iterator->destroy(iterator);
425 return DESTROY_ME;
426 }
427 }
428 iterator->destroy(iterator);
429
430 this->initiating.mid++;
431 this->initiating.type = EXCHANGE_TYPE_UNDEFINED;
432
433 return build_request(this);
434 }
435
436 /**
437 * handle exchange collisions
438 */
439 static void handle_collisions(private_task_manager_t *this, task_t *task)
440 {
441 iterator_t *iterator;
442 task_t *active;
443 task_type_t type;
444
445 type = task->get_type(task);
446
447 /* do we have to check */
448 if (type == IKE_REKEY || type == CHILD_REKEY ||
449 type == CHILD_DELETE || type == IKE_DELETE)
450 {
451 /* find an exchange collision, and notify these tasks */
452 iterator = this->active_tasks->create_iterator(this->active_tasks, TRUE);
453 while (iterator->iterate(iterator, (void**)&active))
454 {
455 switch (active->get_type(active))
456 {
457 case IKE_REKEY:
458 if (type == IKE_REKEY || type == IKE_DELETE)
459 {
460 ike_rekey_t *rekey = (ike_rekey_t*)active;
461 rekey->collide(rekey, task);
462 break;
463 }
464 continue;
465 case CHILD_REKEY:
466 /* TODO: check if it is the SAME child we are talking about! */
467 if (type == CHILD_REKEY || type == CHILD_DELETE)
468 {
469 child_rekey_t *rekey = (child_rekey_t*)active;
470 rekey->collide(rekey, task);
471 break;
472 }
473 continue;
474 default:
475 continue;
476 }
477 iterator->destroy(iterator);
478 return;
479 }
480 iterator->destroy(iterator);
481 }
482 /* destroy task if not registered in any active task */
483 task->destroy(task);
484 }
485
486 /**
487 * build a response depending on the "passive" task list
488 */
489 static status_t build_response(private_task_manager_t *this,
490 exchange_type_t exchange)
491 {
492 iterator_t *iterator;
493 task_t *task;
494 message_t *message;
495 bool delete = FALSE;
496 status_t status;
497
498 message = message_create();
499 message->set_exchange_type(message, exchange);
500 message->set_message_id(message, this->responding.mid);
501 message->set_request(message, FALSE);
502
503 iterator = this->passive_tasks->create_iterator(this->passive_tasks, TRUE);
504 while (iterator->iterate(iterator, (void*)&task))
505 {
506 switch (task->build(task, message))
507 {
508 case SUCCESS:
509 /* task completed, remove it */
510 iterator->remove(iterator);
511 handle_collisions(this, task);
512 case NEED_MORE:
513 /* processed, but task needs another exchange */
514 break;
515 case FAILED:
516 default:
517 /* destroy IKE_SA, but SEND response first */
518 delete = TRUE;
519 break;
520 }
521 if (delete)
522 {
523 break;
524 }
525 }
526 iterator->destroy(iterator);
527
528 /* remove resonder SPI if IKE_SA_INIT failed */
529 if (delete && exchange == IKE_SA_INIT)
530 {
531 ike_sa_id_t *id = this->ike_sa->get_id(this->ike_sa);
532 id->set_responder_spi(id, 0);
533 }
534
535 /* message complete, send it */
536 DESTROY_IF(this->responding.packet);
537 status = this->ike_sa->generate_message(this->ike_sa, message,
538 &this->responding.packet);
539 message->destroy(message);
540 if (status != SUCCESS)
541 {
542 return DESTROY_ME;
543 }
544
545 charon->send_queue->add(charon->send_queue,
546 this->responding.packet->clone(this->responding.packet));
547 if (delete)
548 {
549 return DESTROY_ME;
550 }
551 return SUCCESS;
552 }
553
554 /**
555 * handle an incoming request message
556 */
557 static status_t process_request(private_task_manager_t *this,
558 message_t *message)
559 {
560 iterator_t *iterator;
561 task_t *task = NULL;
562 exchange_type_t exchange;
563 payload_t *payload;
564 notify_payload_t *notify;
565
566 exchange = message->get_exchange_type(message);
567
568 /* create tasks depending on request type */
569 switch (exchange)
570 {
571 case IKE_SA_INIT:
572 {
573 task = (task_t*)ike_init_create(this->ike_sa, FALSE, NULL);
574 this->passive_tasks->insert_last(this->passive_tasks, task);
575 task = (task_t*)ike_natd_create(this->ike_sa, FALSE);
576 this->passive_tasks->insert_last(this->passive_tasks, task);
577 task = (task_t*)ike_cert_create(this->ike_sa, FALSE);
578 this->passive_tasks->insert_last(this->passive_tasks, task);
579 task = (task_t*)ike_auth_create(this->ike_sa, FALSE);
580 this->passive_tasks->insert_last(this->passive_tasks, task);
581 task = (task_t*)ike_config_create(this->ike_sa, NULL);
582 this->passive_tasks->insert_last(this->passive_tasks, task);
583 task = (task_t*)child_create_create(this->ike_sa, NULL);
584 this->passive_tasks->insert_last(this->passive_tasks, task);
585 break;
586 }
587 case CREATE_CHILD_SA:
588 {
589 bool notify_found = FALSE, ts_found = FALSE;
590 iterator = message->get_payload_iterator(message);
591 while (iterator->iterate(iterator, (void**)&payload))
592 {
593 switch (payload->get_type(payload))
594 {
595 case NOTIFY:
596 {
597 /* if we find a rekey notify, its CHILD_SA rekeying */
598 notify = (notify_payload_t*)payload;
599 if (notify->get_notify_type(notify) == REKEY_SA &&
600 (notify->get_protocol_id(notify) == PROTO_AH ||
601 notify->get_protocol_id(notify) == PROTO_ESP))
602 {
603 notify_found = TRUE;
604 }
605 break;
606 }
607 case TRAFFIC_SELECTOR_INITIATOR:
608 case TRAFFIC_SELECTOR_RESPONDER:
609 {
610 /* if we don't find a TS, its IKE rekeying */
611 ts_found = TRUE;
612 break;
613 }
614 default:
615 break;
616 }
617 }
618 iterator->destroy(iterator);
619
620 if (ts_found)
621 {
622 if (notify_found)
623 {
624 task = (task_t*)child_rekey_create(this->ike_sa, NULL);
625 }
626 else
627 {
628 task = (task_t*)child_create_create(this->ike_sa, NULL);
629 }
630 }
631 else
632 {
633 task = (task_t*)ike_rekey_create(this->ike_sa, FALSE);
634 }
635 this->passive_tasks->insert_last(this->passive_tasks, task);
636 break;
637 }
638 case INFORMATIONAL:
639 {
640 delete_payload_t *delete;
641
642 delete = (delete_payload_t*)message->get_payload(message, DELETE);
643 if (delete)
644 {
645 if (delete->get_protocol_id(delete) == PROTO_IKE)
646 {
647 task = (task_t*)ike_delete_create(this->ike_sa, FALSE);
648 this->passive_tasks->insert_last(this->passive_tasks, task);
649 }
650 else
651 {
652 task = (task_t*)child_delete_create(this->ike_sa, NULL);
653 this->passive_tasks->insert_last(this->passive_tasks, task);
654 }
655 }
656 else
657 {
658 task = (task_t*)ike_dpd_create(FALSE);
659 this->passive_tasks->insert_last(this->passive_tasks, task);
660 }
661 break;
662 }
663 default:
664 break;
665 }
666
667 /* let the tasks process the message */
668 iterator = this->passive_tasks->create_iterator(this->passive_tasks, TRUE);
669 while (iterator->iterate(iterator, (void*)&task))
670 {
671 switch (task->process(task, message))
672 {
673 case SUCCESS:
674 /* task completed, remove it */
675 iterator->remove(iterator);
676 task->destroy(task);
677 break;
678 case NEED_MORE:
679 /* processed, but task needs at least another call to build() */
680 break;
681 case FAILED:
682 default:
683 /* critical failure, destroy IKE_SA */
684 iterator->destroy(iterator);
685 return DESTROY_ME;
686 }
687 }
688 iterator->destroy(iterator);
689
690 return build_response(this, exchange);
691 }
692
693 /**
694 * Implementation of task_manager_t.process_message
695 */
696 static status_t process_message(private_task_manager_t *this, message_t *msg)
697 {
698 u_int32_t mid = msg->get_message_id(msg);
699
700 if (msg->get_request(msg))
701 {
702 if (mid == this->responding.mid)
703 {
704 if (process_request(this, msg) != SUCCESS)
705 {
706 flush(this);
707 return DESTROY_ME;
708 }
709 this->responding.mid++;
710 }
711 else if ((mid == this->responding.mid - 1) && this->responding.packet)
712 {
713 DBG1(DBG_IKE, "received retransmit of request with ID %d, "
714 "retransmitting response", mid);
715 charon->send_queue->add(charon->send_queue,
716 this->responding.packet->clone(
717 this->responding.packet));
718 }
719 else
720 {
721 DBG1(DBG_IKE, "received message ID %d, excepted %d. Ignored",
722 mid, this->responding.mid);
723 }
724 }
725 else
726 {
727 if (mid == this->initiating.mid)
728 {
729 if (process_response(this, msg) != SUCCESS)
730 {
731 flush(this);
732 return DESTROY_ME;
733 }
734 }
735 else
736 {
737 DBG1(DBG_IKE, "received message ID %d, excepted %d. Ignored",
738 mid, this->initiating.mid);
739 return SUCCESS;
740 }
741 }
742 return SUCCESS;
743 }
744
745 /**
746 * Implementation of task_manager_t.queue_task
747 */
748 static void queue_task(private_task_manager_t *this, task_t *task)
749 {
750 DBG2(DBG_IKE, "queueing %N task", task_type_names, task->get_type(task));
751 this->queued_tasks->insert_last(this->queued_tasks, task);
752 }
753
754 /**
755 * Implementation of task_manager_t.adopt_tasks
756 */
757 static void adopt_tasks(private_task_manager_t *this, private_task_manager_t *other)
758 {
759 task_t *task;
760
761 /* move queued tasks from other to this */
762 while (other->queued_tasks->remove_last(other->queued_tasks,
763 (void**)&task) == SUCCESS)
764 {
765 task->migrate(task, this->ike_sa);
766 this->queued_tasks->insert_first(this->queued_tasks, task);
767 }
768
769 /* reset active tasks and move them to others queued tasks */
770 while (other->active_tasks->remove_last(other->active_tasks,
771 (void**)&task) == SUCCESS)
772 {
773 task->migrate(task, this->ike_sa);
774 this->queued_tasks->insert_first(this->queued_tasks, task);
775 }
776 }
777
778 /**
779 * Implementation of task_manager_t.busy
780 */
781 static bool busy(private_task_manager_t *this)
782 {
783 return (this->active_tasks->get_count(this->active_tasks) > 0);
784 }
785
786 /**
787 * Implementation of task_manager_t.reset
788 */
789 static void reset(private_task_manager_t *this)
790 {
791 task_t *task;
792
793 /* reset message counters and retransmit packets */
794 DESTROY_IF(this->responding.packet);
795 DESTROY_IF(this->initiating.packet);
796 this->responding.packet = NULL;
797 this->initiating.packet = NULL;
798 this->responding.mid = 0;
799 this->initiating.mid = 0;
800 this->initiating.type = EXCHANGE_TYPE_UNDEFINED;
801
802 /* reset active tasks */
803 while (this->active_tasks->remove_last(this->active_tasks,
804 (void**)&task) == SUCCESS)
805 {
806 task->migrate(task, this->ike_sa);
807 this->queued_tasks->insert_first(this->queued_tasks, task);
808 }
809 }
810
811 /**
812 * Implementation of task_manager_t.destroy
813 */
814 static void destroy(private_task_manager_t *this)
815 {
816 flush(this);
817
818 this->active_tasks->destroy(this->active_tasks);
819 this->queued_tasks->destroy(this->queued_tasks);
820 this->passive_tasks->destroy(this->passive_tasks);
821
822 DESTROY_IF(this->responding.packet);
823 DESTROY_IF(this->initiating.packet);
824 free(this);
825 }
826
827 /*
828 * see header file
829 */
830 task_manager_t *task_manager_create(ike_sa_t *ike_sa)
831 {
832 private_task_manager_t *this = malloc_thing(private_task_manager_t);
833
834 this->public.process_message = (status_t(*)(task_manager_t*,message_t*))process_message;
835 this->public.queue_task = (void(*)(task_manager_t*,task_t*))queue_task;
836 this->public.initiate = (status_t(*)(task_manager_t*))build_request;
837 this->public.retransmit = (status_t(*)(task_manager_t*,u_int32_t))retransmit;
838 this->public.reset = (void(*)(task_manager_t*))reset;
839 this->public.adopt_tasks = (void(*)(task_manager_t*,task_manager_t*))adopt_tasks;
840 this->public.busy = (bool(*)(task_manager_t*))busy;
841 this->public.destroy = (void(*)(task_manager_t*))destroy;
842
843 this->ike_sa = ike_sa;
844 this->responding.packet = NULL;
845 this->initiating.packet = NULL;
846 this->responding.mid = 0;
847 this->initiating.mid = 0;
848 this->initiating.type = EXCHANGE_TYPE_UNDEFINED;
849 this->queued_tasks = linked_list_create();
850 this->active_tasks = linked_list_create();
851 this->passive_tasks = linked_list_create();
852
853 return &this->public;
854 }