2 * Copyright (C) 2007 Tobias Brunner
3 * Copyright (C) 2007 Martin Willi
4 * Hochschule fuer Technik Rapperswil
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
17 #include "task_manager.h"
22 #include <sa/tasks/ike_init.h>
23 #include <sa/tasks/ike_natd.h>
24 #include <sa/tasks/ike_mobike.h>
25 #include <sa/tasks/ike_auth.h>
26 #include <sa/tasks/ike_auth_lifetime.h>
27 #include <sa/tasks/ike_cert_pre.h>
28 #include <sa/tasks/ike_cert_post.h>
29 #include <sa/tasks/ike_rekey.h>
30 #include <sa/tasks/ike_delete.h>
31 #include <sa/tasks/ike_config.h>
32 #include <sa/tasks/ike_dpd.h>
33 #include <sa/tasks/child_create.h>
34 #include <sa/tasks/child_rekey.h>
35 #include <sa/tasks/child_delete.h>
36 #include <encoding/payloads/delete_payload.h>
37 #include <processing/jobs/retransmit_job.h>
40 #include <sa/tasks/ike_me.h>
43 typedef struct exchange_t exchange_t
;
46 * An exchange in the air, used do detect and handle retransmission
51 * Message ID used for this transaction
56 * generated packet for retransmission
61 typedef struct private_task_manager_t private_task_manager_t
;
64 * private data of the task manager
66 struct private_task_manager_t
{
71 task_manager_t
public;
74 * associated IKE_SA we are serving
79 * Exchange we are currently handling as responder
83 * Message ID of the exchange
88 * packet for retransmission
95 * Exchange we are currently handling as initiator
99 * Message ID of the exchange
104 * how many times we have retransmitted so far
109 * packet for retransmission
114 * type of the initated exchange
116 exchange_type_t type
;
121 * List of queued tasks not yet in action
123 linked_list_t
*queued_tasks
;
126 * List of active tasks, initiated by ourselve
128 linked_list_t
*active_tasks
;
131 * List of tasks initiated by peer
133 linked_list_t
*passive_tasks
;
136 * the task manager has been reset
142 * flush all tasks in the task manager
144 static void flush(private_task_manager_t
*this)
146 this->queued_tasks
->destroy_offset(this->queued_tasks
,
147 offsetof(task_t
, destroy
));
148 this->passive_tasks
->destroy_offset(this->passive_tasks
,
149 offsetof(task_t
, destroy
));
150 this->active_tasks
->destroy_offset(this->active_tasks
,
151 offsetof(task_t
, destroy
));
152 this->queued_tasks
= linked_list_create();
153 this->passive_tasks
= linked_list_create();
154 this->active_tasks
= linked_list_create();
158 * move a task of a specific type from the queue to the active list
160 static bool activate_task(private_task_manager_t
*this, task_type_t type
)
162 iterator_t
*iterator
;
166 iterator
= this->queued_tasks
->create_iterator(this->queued_tasks
, TRUE
);
167 while (iterator
->iterate(iterator
, (void**)&task
))
169 if (task
->get_type(task
) == type
)
171 DBG2(DBG_IKE
, " activating %N task", task_type_names
, type
);
172 iterator
->remove(iterator
);
173 this->active_tasks
->insert_last(this->active_tasks
, task
);
178 iterator
->destroy(iterator
);
183 * Implementation of task_manager_t.retransmit
185 static status_t
retransmit(private_task_manager_t
*this, u_int32_t message_id
)
187 if (message_id
== this->initiating
.mid
)
191 iterator_t
*iterator
;
194 ike_mobike_t
*mobike
= NULL
;
196 /* check if we are retransmitting a MOBIKE routability check */
197 iterator
= this->active_tasks
->create_iterator(this->active_tasks
, TRUE
);
198 while (iterator
->iterate(iterator
, (void*)&task
))
200 if (task
->get_type(task
) == IKE_MOBIKE
)
202 mobike
= (ike_mobike_t
*)task
;
203 if (!mobike
->is_probing(mobike
))
210 iterator
->destroy(iterator
);
214 if (this->initiating
.retransmitted
<= RETRANSMIT_TRIES
)
216 timeout
= (u_int32_t
)(RETRANSMIT_TIMEOUT
*
217 pow(RETRANSMIT_BASE
, this->initiating
.retransmitted
));
221 DBG1(DBG_IKE
, "giving up after %d retransmits",
222 this->initiating
.retransmitted
- 1);
226 if (this->initiating
.retransmitted
)
228 DBG1(DBG_IKE
, "retransmit %d of request with message ID %d",
229 this->initiating
.retransmitted
, message_id
);
231 packet
= this->initiating
.packet
->clone(this->initiating
.packet
);
234 { /* for routeability checks, we use a more aggressive behavior */
235 if (this->initiating
.retransmitted
<= ROUTEABILITY_CHECK_TRIES
)
237 timeout
= ROUTEABILITY_CHECK_INTERVAL
;
241 DBG1(DBG_IKE
, "giving up after %d path probings",
242 this->initiating
.retransmitted
- 1);
246 if (this->initiating
.retransmitted
)
248 DBG1(DBG_IKE
, "path probing attempt %d",
249 this->initiating
.retransmitted
);
251 packet
= this->initiating
.packet
->clone(this->initiating
.packet
);
252 mobike
->transmit(mobike
, packet
);
255 charon
->sender
->send(charon
->sender
, packet
);
257 this->initiating
.retransmitted
++;
258 job
= (job_t
*)retransmit_job_create(this->initiating
.mid
,
259 this->ike_sa
->get_id(this->ike_sa
));
260 charon
->scheduler
->schedule_job_ms(charon
->scheduler
, job
, timeout
);
266 * build a request using the active task list
267 * Implementation of task_manager_t.initiate
269 static status_t
build_request(private_task_manager_t
*this)
271 iterator_t
*iterator
;
276 exchange_type_t exchange
= 0;
278 if (this->initiating
.type
!= EXCHANGE_TYPE_UNDEFINED
)
280 DBG2(DBG_IKE
, "delaying task initiation, exchange in progress");
281 /* do not initiate if we already have a message in the air */
285 if (this->active_tasks
->get_count(this->active_tasks
) == 0)
287 DBG2(DBG_IKE
, "activating new tasks");
288 switch (this->ike_sa
->get_state(this->ike_sa
))
291 if (activate_task(this, IKE_INIT
))
293 this->initiating
.mid
= 0;
294 exchange
= IKE_SA_INIT
;
295 activate_task(this, IKE_NATD
);
296 activate_task(this, IKE_CERT_PRE
);
298 /* this task has to be activated before the IKE_AUTHENTICATE
299 * task, because that task pregenerates the packet after
300 * which no payloads can be added to the message anymore.
302 activate_task(this, IKE_ME
);
304 activate_task(this, IKE_AUTHENTICATE
);
305 activate_task(this, IKE_CERT_POST
);
306 activate_task(this, IKE_CONFIG
);
307 activate_task(this, CHILD_CREATE
);
308 activate_task(this, IKE_AUTH_LIFETIME
);
309 activate_task(this, IKE_MOBIKE
);
312 case IKE_ESTABLISHED
:
313 if (activate_task(this, CHILD_CREATE
))
315 exchange
= CREATE_CHILD_SA
;
318 if (activate_task(this, CHILD_DELETE
))
320 exchange
= INFORMATIONAL
;
323 if (activate_task(this, CHILD_REKEY
))
325 exchange
= CREATE_CHILD_SA
;
328 if (activate_task(this, IKE_DELETE
))
330 exchange
= INFORMATIONAL
;
333 if (activate_task(this, IKE_REKEY
))
335 exchange
= CREATE_CHILD_SA
;
338 if (activate_task(this, IKE_REAUTH
))
340 exchange
= INFORMATIONAL
;
343 if (activate_task(this, IKE_MOBIKE
))
345 exchange
= INFORMATIONAL
;
348 if (activate_task(this, IKE_DPD
))
350 exchange
= INFORMATIONAL
;
354 if (activate_task(this, IKE_ME
))
356 exchange
= ME_CONNECT
;
361 if (activate_task(this, IKE_DELETE
))
363 exchange
= INFORMATIONAL
;
373 DBG2(DBG_IKE
, "reinitiating already active tasks");
374 iterator
= this->active_tasks
->create_iterator(this->active_tasks
, TRUE
);
375 while (iterator
->iterate(iterator
, (void**)&task
))
377 DBG2(DBG_IKE
, " %N task", task_type_names
, task
->get_type(task
));
378 switch (task
->get_type(task
))
381 exchange
= IKE_SA_INIT
;
383 case IKE_AUTHENTICATE
:
389 exchange
= CREATE_CHILD_SA
;
392 exchange
= INFORMATIONAL
;
398 iterator
->destroy(iterator
);
403 DBG2(DBG_IKE
, "nothing to initiate");
404 /* nothing to do yet... */
408 me
= this->ike_sa
->get_my_host(this->ike_sa
);
409 other
= this->ike_sa
->get_other_host(this->ike_sa
);
411 message
= message_create();
412 message
->set_message_id(message
, this->initiating
.mid
);
413 message
->set_source(message
, me
->clone(me
));
414 message
->set_destination(message
, other
->clone(other
));
415 message
->set_exchange_type(message
, exchange
);
416 this->initiating
.type
= exchange
;
417 this->initiating
.retransmitted
= 0;
419 iterator
= this->active_tasks
->create_iterator(this->active_tasks
, TRUE
);
420 while (iterator
->iterate(iterator
, (void*)&task
))
422 switch (task
->build(task
, message
))
425 /* task completed, remove it */
426 iterator
->remove(iterator
);
430 /* processed, but task needs another exchange */
434 /* critical failure, destroy IKE_SA */
435 iterator
->destroy(iterator
);
436 message
->destroy(message
);
441 iterator
->destroy(iterator
);
443 /* update exchange type if a task changed it */
444 this->initiating
.type
= message
->get_exchange_type(message
);
446 status
= this->ike_sa
->generate_message(this->ike_sa
, message
,
447 &this->initiating
.packet
);
448 if (status
!= SUCCESS
)
450 /* message generation failed. There is nothing more to do than to
452 message
->destroy(message
);
457 charon
->bus
->message(charon
->bus
, message
, FALSE
);
458 message
->destroy(message
);
460 return retransmit(this, this->initiating
.mid
);
464 * handle an incoming response message
466 static status_t
process_response(private_task_manager_t
*this,
469 iterator_t
*iterator
;
472 if (message
->get_exchange_type(message
) != this->initiating
.type
)
474 DBG1(DBG_IKE
, "received %N response, but expected %N",
475 exchange_type_names
, message
->get_exchange_type(message
),
476 exchange_type_names
, this->initiating
.type
);
480 /* catch if we get resetted while processing */
482 iterator
= this->active_tasks
->create_iterator(this->active_tasks
, TRUE
);
483 while (iterator
->iterate(iterator
, (void*)&task
))
485 switch (task
->process(task
, message
))
488 /* task completed, remove it */
489 iterator
->remove(iterator
);
493 /* processed, but task needs another exchange */
497 /* critical failure, destroy IKE_SA */
498 iterator
->remove(iterator
);
499 iterator
->destroy(iterator
);
504 { /* start all over again if we were reset */
506 iterator
->destroy(iterator
);
507 return build_request(this);
510 iterator
->destroy(iterator
);
512 this->initiating
.mid
++;
513 this->initiating
.type
= EXCHANGE_TYPE_UNDEFINED
;
514 this->initiating
.packet
->destroy(this->initiating
.packet
);
515 this->initiating
.packet
= NULL
;
517 return build_request(this);
521 * handle exchange collisions
523 static void handle_collisions(private_task_manager_t
*this, task_t
*task
)
525 iterator_t
*iterator
;
529 type
= task
->get_type(task
);
531 /* do we have to check */
532 if (type
== IKE_REKEY
|| type
== CHILD_REKEY
||
533 type
== CHILD_DELETE
|| type
== IKE_DELETE
|| type
== IKE_REAUTH
)
535 /* find an exchange collision, and notify these tasks */
536 iterator
= this->active_tasks
->create_iterator(this->active_tasks
, TRUE
);
537 while (iterator
->iterate(iterator
, (void**)&active
))
539 switch (active
->get_type(active
))
542 if (type
== IKE_REKEY
|| type
== IKE_DELETE
||
545 ike_rekey_t
*rekey
= (ike_rekey_t
*)active
;
546 rekey
->collide(rekey
, task
);
551 if (type
== CHILD_REKEY
|| type
== CHILD_DELETE
)
553 child_rekey_t
*rekey
= (child_rekey_t
*)active
;
554 rekey
->collide(rekey
, task
);
561 iterator
->destroy(iterator
);
564 iterator
->destroy(iterator
);
566 /* destroy task if not registered in any active task */
571 * build a response depending on the "passive" task list
573 static status_t
build_response(private_task_manager_t
*this, message_t
*request
)
575 iterator_t
*iterator
;
582 me
= request
->get_destination(request
);
583 other
= request
->get_source(request
);
585 message
= message_create();
586 message
->set_exchange_type(message
, request
->get_exchange_type(request
));
587 /* send response along the path the request came in */
588 message
->set_source(message
, me
->clone(me
));
589 message
->set_destination(message
, other
->clone(other
));
590 message
->set_message_id(message
, this->responding
.mid
);
591 message
->set_request(message
, FALSE
);
593 iterator
= this->passive_tasks
->create_iterator(this->passive_tasks
, TRUE
);
594 while (iterator
->iterate(iterator
, (void*)&task
))
596 switch (task
->build(task
, message
))
599 /* task completed, remove it */
600 iterator
->remove(iterator
);
601 handle_collisions(this, task
);
603 /* processed, but task needs another exchange */
607 /* destroy IKE_SA, but SEND response first */
616 iterator
->destroy(iterator
);
618 /* remove resonder SPI if IKE_SA_INIT failed */
619 if (delete && request
->get_exchange_type(request
) == IKE_SA_INIT
)
621 ike_sa_id_t
*id
= this->ike_sa
->get_id(this->ike_sa
);
622 id
->set_responder_spi(id
, 0);
625 /* message complete, send it */
626 DESTROY_IF(this->responding
.packet
);
627 status
= this->ike_sa
->generate_message(this->ike_sa
, message
,
628 &this->responding
.packet
);
629 charon
->bus
->message(charon
->bus
, message
, FALSE
);
630 message
->destroy(message
);
631 if (status
!= SUCCESS
)
636 charon
->sender
->send(charon
->sender
,
637 this->responding
.packet
->clone(this->responding
.packet
));
646 * handle an incoming request message
648 static status_t
process_request(private_task_manager_t
*this,
651 enumerator_t
*enumerator
;
652 iterator_t
*iterator
;
655 notify_payload_t
*notify
;
656 delete_payload_t
*delete;
658 if (this->passive_tasks
->get_count(this->passive_tasks
) == 0)
659 { /* create tasks depending on request type, if not already some queued */
660 switch (message
->get_exchange_type(message
))
664 task
= (task_t
*)ike_init_create(this->ike_sa
, FALSE
, NULL
);
665 this->passive_tasks
->insert_last(this->passive_tasks
, task
);
666 task
= (task_t
*)ike_natd_create(this->ike_sa
, FALSE
);
667 this->passive_tasks
->insert_last(this->passive_tasks
, task
);
668 task
= (task_t
*)ike_cert_pre_create(this->ike_sa
, FALSE
);
669 this->passive_tasks
->insert_last(this->passive_tasks
, task
);
671 task
= (task_t
*)ike_me_create(this->ike_sa
, FALSE
);
672 this->passive_tasks
->insert_last(this->passive_tasks
, task
);
674 task
= (task_t
*)ike_auth_create(this->ike_sa
, FALSE
);
675 this->passive_tasks
->insert_last(this->passive_tasks
, task
);
676 task
= (task_t
*)ike_cert_post_create(this->ike_sa
, FALSE
);
677 this->passive_tasks
->insert_last(this->passive_tasks
, task
);
678 task
= (task_t
*)ike_config_create(this->ike_sa
, FALSE
);
679 this->passive_tasks
->insert_last(this->passive_tasks
, task
);
680 task
= (task_t
*)child_create_create(this->ike_sa
, NULL
);
681 this->passive_tasks
->insert_last(this->passive_tasks
, task
);
682 task
= (task_t
*)ike_auth_lifetime_create(this->ike_sa
, FALSE
);
683 this->passive_tasks
->insert_last(this->passive_tasks
, task
);
684 task
= (task_t
*)ike_mobike_create(this->ike_sa
, FALSE
);
685 this->passive_tasks
->insert_last(this->passive_tasks
, task
);
688 case CREATE_CHILD_SA
:
689 { /* FIXME: we should prevent this on mediation connections */
690 bool notify_found
= FALSE
, ts_found
= FALSE
;
691 enumerator
= message
->create_payload_enumerator(message
);
692 while (enumerator
->enumerate(enumerator
, &payload
))
694 switch (payload
->get_type(payload
))
697 { /* if we find a rekey notify, its CHILD_SA rekeying */
698 notify
= (notify_payload_t
*)payload
;
699 if (notify
->get_notify_type(notify
) == REKEY_SA
&&
700 (notify
->get_protocol_id(notify
) == PROTO_AH
||
701 notify
->get_protocol_id(notify
) == PROTO_ESP
))
707 case TRAFFIC_SELECTOR_INITIATOR
:
708 case TRAFFIC_SELECTOR_RESPONDER
:
709 { /* if we don't find a TS, its IKE rekeying */
717 enumerator
->destroy(enumerator
);
723 task
= (task_t
*)child_rekey_create(this->ike_sa
,
728 task
= (task_t
*)child_create_create(this->ike_sa
, NULL
);
733 task
= (task_t
*)ike_rekey_create(this->ike_sa
, FALSE
);
735 this->passive_tasks
->insert_last(this->passive_tasks
, task
);
740 enumerator
= message
->create_payload_enumerator(message
);
741 while (enumerator
->enumerate(enumerator
, &payload
))
743 switch (payload
->get_type(payload
))
747 notify
= (notify_payload_t
*)payload
;
748 switch (notify
->get_notify_type(notify
))
750 case ADDITIONAL_IP4_ADDRESS
:
751 case ADDITIONAL_IP6_ADDRESS
:
752 case NO_ADDITIONAL_ADDRESSES
:
753 case UPDATE_SA_ADDRESSES
:
754 case NO_NATS_ALLOWED
:
755 case UNACCEPTABLE_ADDRESSES
:
756 case UNEXPECTED_NAT_DETECTED
:
758 case NAT_DETECTION_SOURCE_IP
:
759 case NAT_DETECTION_DESTINATION_IP
:
760 task
= (task_t
*)ike_mobike_create(
761 this->ike_sa
, FALSE
);
764 task
= (task_t
*)ike_auth_lifetime_create(
765 this->ike_sa
, FALSE
);
774 delete = (delete_payload_t
*)payload
;
775 if (delete->get_protocol_id(delete) == PROTO_IKE
)
777 task
= (task_t
*)ike_delete_create(this->ike_sa
,
782 task
= (task_t
*)child_delete_create(this->ike_sa
,
795 enumerator
->destroy(enumerator
);
799 task
= (task_t
*)ike_dpd_create(FALSE
);
801 this->passive_tasks
->insert_last(this->passive_tasks
, task
);
807 task
= (task_t
*)ike_me_create(this->ike_sa
, FALSE
);
808 this->passive_tasks
->insert_last(this->passive_tasks
, task
);
816 /* let the tasks process the message */
817 iterator
= this->passive_tasks
->create_iterator(this->passive_tasks
, TRUE
);
818 while (iterator
->iterate(iterator
, (void*)&task
))
820 switch (task
->process(task
, message
))
823 /* task completed, remove it */
824 iterator
->remove(iterator
);
828 /* processed, but task needs at least another call to build() */
832 /* critical failure, destroy IKE_SA */
833 iterator
->remove(iterator
);
834 iterator
->destroy(iterator
);
839 iterator
->destroy(iterator
);
841 return build_response(this, message
);
845 * Implementation of task_manager_t.process_message
847 static status_t
process_message(private_task_manager_t
*this, message_t
*msg
)
849 u_int32_t mid
= msg
->get_message_id(msg
);
851 if (msg
->get_request(msg
))
853 if (mid
== this->responding
.mid
)
855 charon
->bus
->message(charon
->bus
, msg
, TRUE
);
856 if (process_request(this, msg
) != SUCCESS
)
861 this->responding
.mid
++;
863 else if ((mid
== this->responding
.mid
- 1) && this->responding
.packet
)
868 DBG1(DBG_IKE
, "received retransmit of request with ID %d, "
869 "retransmitting response", mid
);
870 clone
= this->responding
.packet
->clone(this->responding
.packet
);
871 me
= msg
->get_destination(msg
);
872 other
= msg
->get_source(msg
);
873 clone
->set_source(clone
, me
->clone(me
));
874 clone
->set_destination(clone
, other
->clone(other
));
875 charon
->sender
->send(charon
->sender
, clone
);
879 DBG1(DBG_IKE
, "received message ID %d, expected %d. Ignored",
880 mid
, this->responding
.mid
);
885 if (mid
== this->initiating
.mid
)
887 if (process_response(this, msg
) != SUCCESS
)
895 DBG1(DBG_IKE
, "received message ID %d, expected %d. Ignored",
896 mid
, this->initiating
.mid
);
904 * Implementation of task_manager_t.queue_task
906 static void queue_task(private_task_manager_t
*this, task_t
*task
)
908 if (task
->get_type(task
) == IKE_MOBIKE
)
909 { /* there is no need to queue more than one mobike task */
910 iterator_t
*iterator
;
913 iterator
= this->queued_tasks
->create_iterator(this->queued_tasks
, TRUE
);
914 while (iterator
->iterate(iterator
, (void**)¤t
))
916 if (current
->get_type(current
) == IKE_MOBIKE
)
918 iterator
->destroy(iterator
);
923 iterator
->destroy(iterator
);
925 DBG2(DBG_IKE
, "queueing %N task", task_type_names
, task
->get_type(task
));
926 this->queued_tasks
->insert_last(this->queued_tasks
, task
);
930 * Implementation of task_manager_t.adopt_tasks
932 static void adopt_tasks(private_task_manager_t
*this, private_task_manager_t
*other
)
936 /* move queued tasks from other to this */
937 while (other
->queued_tasks
->remove_last(other
->queued_tasks
,
938 (void**)&task
) == SUCCESS
)
940 DBG2(DBG_IKE
, "migrating %N task", task_type_names
, task
->get_type(task
));
941 task
->migrate(task
, this->ike_sa
);
942 this->queued_tasks
->insert_first(this->queued_tasks
, task
);
947 * Implementation of task_manager_t.busy
949 static bool busy(private_task_manager_t
*this)
951 return (this->active_tasks
->get_count(this->active_tasks
) > 0);
955 * Implementation of task_manager_t.reset
957 static void reset(private_task_manager_t
*this,
958 u_int32_t initiate
, u_int32_t respond
)
962 /* reset message counters and retransmit packets */
963 DESTROY_IF(this->responding
.packet
);
964 DESTROY_IF(this->initiating
.packet
);
965 this->responding
.packet
= NULL
;
966 this->initiating
.packet
= NULL
;
967 if (initiate
!= UINT_MAX
)
969 this->initiating
.mid
= initiate
;
971 if (respond
!= UINT_MAX
)
973 this->responding
.mid
= respond
;
975 this->initiating
.type
= EXCHANGE_TYPE_UNDEFINED
;
977 /* reset active tasks */
978 while (this->active_tasks
->remove_last(this->active_tasks
,
979 (void**)&task
) == SUCCESS
)
981 task
->migrate(task
, this->ike_sa
);
982 this->queued_tasks
->insert_first(this->queued_tasks
, task
);
989 * Implementation of task_manager_t.destroy
991 static void destroy(private_task_manager_t
*this)
995 this->active_tasks
->destroy(this->active_tasks
);
996 this->queued_tasks
->destroy(this->queued_tasks
);
997 this->passive_tasks
->destroy(this->passive_tasks
);
999 DESTROY_IF(this->responding
.packet
);
1000 DESTROY_IF(this->initiating
.packet
);
1007 task_manager_t
*task_manager_create(ike_sa_t
*ike_sa
)
1009 private_task_manager_t
*this = malloc_thing(private_task_manager_t
);
1011 this->public.process_message
= (status_t(*)(task_manager_t
*,message_t
*))process_message
;
1012 this->public.queue_task
= (void(*)(task_manager_t
*,task_t
*))queue_task
;
1013 this->public.initiate
= (status_t(*)(task_manager_t
*))build_request
;
1014 this->public.retransmit
= (status_t(*)(task_manager_t
*,u_int32_t
))retransmit
;
1015 this->public.reset
= (void(*)(task_manager_t
*,u_int32_t
,u_int32_t
))reset
;
1016 this->public.adopt_tasks
= (void(*)(task_manager_t
*,task_manager_t
*))adopt_tasks
;
1017 this->public.busy
= (bool(*)(task_manager_t
*))busy
;
1018 this->public.destroy
= (void(*)(task_manager_t
*))destroy
;
1020 this->ike_sa
= ike_sa
;
1021 this->responding
.packet
= NULL
;
1022 this->initiating
.packet
= NULL
;
1023 this->responding
.mid
= 0;
1024 this->initiating
.mid
= 0;
1025 this->initiating
.type
= EXCHANGE_TYPE_UNDEFINED
;
1026 this->queued_tasks
= linked_list_create();
1027 this->active_tasks
= linked_list_create();
1028 this->passive_tasks
= linked_list_create();
1029 this->reset
= FALSE
;
1031 return &this->public;