Annotation of embedaddon/strongswan/src/libcharon/sa/ikev2/tasks/ike_reauth_complete.c, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2014 Martin Willi
                      3:  * Copyright (C) 2014 revosec AG
                      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 "ike_reauth_complete.h"
                     17: 
                     18: #include <daemon.h>
                     19: #include <processing/jobs/delete_ike_sa_job.h>
                     20: 
                     21: 
                     22: typedef struct private_ike_reauth_complete_t private_ike_reauth_complete_t;
                     23: 
                     24: /**
                     25:  * Private members of a ike_reauth_complete_t task.
                     26:  */
                     27: struct private_ike_reauth_complete_t {
                     28: 
                     29:        /**
                     30:         * Public methods and task_t interface.
                     31:         */
                     32:        ike_reauth_complete_t public;
                     33: 
                     34:        /**
                     35:         * Assigned IKE_SA.
                     36:         */
                     37:        ike_sa_t *ike_sa;
                     38: 
                     39:        /**
                     40:         * Reauthenticated IKE_SA identifier
                     41:         */
                     42:        ike_sa_id_t *id;
                     43: };
                     44: 
                     45: METHOD(task_t, build_i, status_t,
                     46:        private_ike_reauth_complete_t *this, message_t *message)
                     47: {
                     48:        message->set_exchange_type(message, EXCHANGE_TYPE_UNDEFINED);
                     49:        lib->processor->queue_job(lib->processor,
                     50:                                                          (job_t*)delete_ike_sa_job_create(this->id, TRUE));
                     51:        return SUCCESS;
                     52: }
                     53: 
                     54: METHOD(task_t, process_i, status_t,
                     55:        private_ike_reauth_complete_t *this, message_t *message)
                     56: {
                     57:        return DESTROY_ME;
                     58: }
                     59: 
                     60: METHOD(task_t, get_type, task_type_t,
                     61:        private_ike_reauth_complete_t *this)
                     62: {
                     63:        return TASK_IKE_REAUTH_COMPLETE;
                     64: }
                     65: 
                     66: METHOD(task_t, migrate, void,
                     67:        private_ike_reauth_complete_t *this, ike_sa_t *ike_sa)
                     68: {
                     69:        this->ike_sa = ike_sa;
                     70: }
                     71: 
                     72: METHOD(task_t, destroy, void,
                     73:        private_ike_reauth_complete_t *this)
                     74: {
                     75:        this->id->destroy(this->id);
                     76:        free(this);
                     77: }
                     78: 
                     79: /*
                     80:  * Described in header.
                     81:  */
                     82: ike_reauth_complete_t *ike_reauth_complete_create(ike_sa_t *ike_sa,
                     83:                                                                                                  ike_sa_id_t *id)
                     84: {
                     85:        private_ike_reauth_complete_t *this;
                     86: 
                     87:        INIT(this,
                     88:                .public = {
                     89:                        .task = {
                     90:                                .get_type = _get_type,
                     91:                                .migrate = _migrate,
                     92:                                .build = _build_i,
                     93:                                .process = _process_i,
                     94:                                .destroy = _destroy,
                     95:                        },
                     96:                },
                     97:                .ike_sa = ike_sa,
                     98:                .id = id->clone(id),
                     99:        );
                    100: 
                    101:        return &this->public;
                    102: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>