destroy(this);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_acquire_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header
*/
.public = {
.job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
destroy(this);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_delete_child_sa_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header
*/
.public = {
.job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
destroy(this);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_delete_ike_sa_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header
*/
.public = {
.job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
}
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_inactivity_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/**
* See header
*/
INIT(this,
.public = {
- .job_interface = {
+ .job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
}
/**
+ * Implementation of job_t.get_priority.
+ */
+static job_priority_t get_priority(private_initiate_mediation_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
+/**
* Creates an empty job
*/
static private_initiate_mediation_job_t *initiate_mediation_job_create_empty()
private_initiate_mediation_job_t *this = malloc_thing(private_initiate_mediation_job_t);
/* interface functions */
+ this->public.job_interface.get_priority = (job_priority_t (*) (job_t *)) get_priority;
this->public.job_interface.destroy = (void (*) (job_t *)) destroy;
/* private variables */
}
/**
+ * Implementation of job_t.get_priority.
+ */
+static job_priority_t get_priority(private_mediation_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
+/**
* Creates an empty mediation job
*/
static private_mediation_job_t *mediation_job_create_empty()
/* interface functions */
this->public.job_interface.execute = (void (*) (job_t *)) execute;
+ this->public.job_interface.get_priority = (job_priority_t (*) (job_t *)) get_priority;
this->public.job_interface.destroy = (void (*) (job_t *)) destroy;
/* private variables */
destroy(this);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_migrate_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header
*/
.public = {
.job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
destroy(this);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_process_message_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header
*/
.public = {
.job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
destroy(this);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_rekey_child_sa_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header
*/
.public = {
.job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
destroy(this);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_rekey_ike_sa_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header
*/
.public = {
.job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
destroy(this);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_retransmit_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header.
*/
.public = {
.job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
destroy(this);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_roam_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header
*/
.public = {
.job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
destroy(this);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_send_dpd_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header
*/
.public = {
.job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
destroy(this);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_send_keepalive_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header
*/
.public = {
.job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
destroy(this);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_start_action_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header
*/
.public = {
.job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
destroy(this);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_update_sa_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header
*/
.public = {
.job_interface = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
},
thread_cleanup_pop(cleanup);
}
+METHOD(job_t, get_priority, job_priority_t,
+ private_callback_job_t *this)
+{
+ return JOB_PRIO_MEDIUM;
+}
+
/*
* Described in header.
*/
.public = {
.job = {
.execute = _execute,
+ .get_priority = _get_priority,
.destroy = _destroy,
},
.cancel = _cancel,
#define JOB_H_
typedef struct job_t job_t;
+typedef enum job_priority_t job_priority_t;
#include <library.h>
/**
- * Job-Interface as it is stored in the job queue.
+ * Priority classes of jobs
+ */
+enum job_priority_t {
+ /** Short jobs executed with highest priority */
+ JOB_PRIO_HIGH = 0,
+ /** Default job priority */
+ JOB_PRIO_MEDIUM,
+ /** Low priority jobs with thread blocking operations */
+ JOB_PRIO_LOW,
+ JOB_PRIO_MAX
+};
+
+/**
+ * Job interface as it is stored in the job queue.
*/
struct job_t {
void (*execute) (job_t *this);
/**
+ * Get the priority of a job.
+ *
+ * @return job priority
+ */
+ job_priority_t (*get_priority)(job_t *this);
+
+ /**
* Destroy a job.
*
* Is only called whenever a job was not executed (e.g. due daemon shutdown).
* After execution, jobs destroy themself.
*/
- void (*destroy) (job_t *job);
+ void (*destroy) (job_t *this);
};
#endif /** JOB_H_ @}*/