Annotation of embedaddon/strongswan/src/libcharon/processing/jobs/send_keepalive_job.c, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2006 Tobias Brunner, Daniel Roethlisberger
! 3: * HSR 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 <stdlib.h>
! 17:
! 18: #include "send_keepalive_job.h"
! 19:
! 20: #include <sa/ike_sa.h>
! 21: #include <daemon.h>
! 22:
! 23:
! 24: typedef struct private_send_keepalive_job_t private_send_keepalive_job_t;
! 25:
! 26: /**
! 27: * Private data of an send_keepalive_job_t Object
! 28: */
! 29: struct private_send_keepalive_job_t {
! 30: /**
! 31: * public send_keepalive_job_t interface
! 32: */
! 33: send_keepalive_job_t public;
! 34:
! 35: /**
! 36: * ID of the IKE_SA which the message belongs to.
! 37: */
! 38: ike_sa_id_t *ike_sa_id;
! 39: };
! 40:
! 41: METHOD(job_t, destroy, void,
! 42: private_send_keepalive_job_t *this)
! 43: {
! 44: this->ike_sa_id->destroy(this->ike_sa_id);
! 45: free(this);
! 46: }
! 47:
! 48: METHOD(job_t, execute, job_requeue_t,
! 49: private_send_keepalive_job_t *this)
! 50: {
! 51: ike_sa_t *ike_sa;
! 52:
! 53: ike_sa = charon->ike_sa_manager->checkout(charon->ike_sa_manager,
! 54: this->ike_sa_id);
! 55: if (ike_sa)
! 56: {
! 57: ike_sa->send_keepalive(ike_sa, TRUE);
! 58: charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa);
! 59: }
! 60: return JOB_REQUEUE_NONE;
! 61: }
! 62:
! 63: METHOD(job_t, get_priority, job_priority_t,
! 64: private_send_keepalive_job_t *this)
! 65: {
! 66: return JOB_PRIO_HIGH;
! 67: }
! 68:
! 69: /*
! 70: * Described in header
! 71: */
! 72: send_keepalive_job_t *send_keepalive_job_create(ike_sa_id_t *ike_sa_id)
! 73: {
! 74: private_send_keepalive_job_t *this;
! 75:
! 76: INIT(this,
! 77: .public = {
! 78: .job_interface = {
! 79: .execute = _execute,
! 80: .get_priority = _get_priority,
! 81: .destroy = _destroy,
! 82: },
! 83: },
! 84: .ike_sa_id = ike_sa_id->clone(ike_sa_id),
! 85: );
! 86:
! 87: return &this->public;
! 88: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>