Annotation of embedaddon/strongswan/src/libcharon/processing/jobs/acquire_job.c, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2006-2009 Martin Willi
! 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 "acquire_job.h"
! 17:
! 18: #include <daemon.h>
! 19:
! 20:
! 21: typedef struct private_acquire_job_t private_acquire_job_t;
! 22:
! 23: /**
! 24: * Private data of an acquire_job_t object.
! 25: */
! 26: struct private_acquire_job_t {
! 27: /**
! 28: * Public acquire_job_t interface.
! 29: */
! 30: acquire_job_t public;
! 31:
! 32: /**
! 33: * reqid of the child to rekey
! 34: */
! 35: uint32_t reqid;
! 36:
! 37: /**
! 38: * acquired source traffic selector
! 39: */
! 40: traffic_selector_t *src_ts;
! 41:
! 42: /**
! 43: * acquired destination traffic selector
! 44: */
! 45: traffic_selector_t *dst_ts;
! 46: };
! 47:
! 48: METHOD(job_t, destroy, void,
! 49: private_acquire_job_t *this)
! 50: {
! 51: DESTROY_IF(this->src_ts);
! 52: DESTROY_IF(this->dst_ts);
! 53: free(this);
! 54: }
! 55:
! 56: METHOD(job_t, execute, job_requeue_t,
! 57: private_acquire_job_t *this)
! 58: {
! 59: charon->traps->acquire(charon->traps, this->reqid,
! 60: this->src_ts, this->dst_ts);
! 61: return JOB_REQUEUE_NONE;
! 62: }
! 63:
! 64: METHOD(job_t, get_priority, job_priority_t,
! 65: private_acquire_job_t *this)
! 66: {
! 67: return JOB_PRIO_MEDIUM;
! 68: }
! 69:
! 70: /*
! 71: * Described in header
! 72: */
! 73: acquire_job_t *acquire_job_create(uint32_t reqid,
! 74: traffic_selector_t *src_ts,
! 75: traffic_selector_t *dst_ts)
! 76: {
! 77: private_acquire_job_t *this;
! 78:
! 79: INIT(this,
! 80: .public = {
! 81: .job_interface = {
! 82: .execute = _execute,
! 83: .get_priority = _get_priority,
! 84: .destroy = _destroy,
! 85: },
! 86: },
! 87: .reqid = reqid,
! 88: .src_ts = src_ts,
! 89: .dst_ts = dst_ts,
! 90: );
! 91:
! 92: return &this->public;
! 93: }
! 94:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>