- implemented jobs DELETE_HALF_OPEN_IKE_SA and DELETE_ESTABLISHED_IKE_SA
This commit is contained in:
@@ -14,8 +14,12 @@
|
||||
|
||||
JOBS_DIR= $(QUEUES_DIR)jobs/
|
||||
|
||||
OBJS+= $(BUILD_DIR)delete_ike_sa_job.o
|
||||
$(BUILD_DIR)delete_ike_sa_job.o : $(JOBS_DIR)delete_ike_sa_job.c $(JOBS_DIR)delete_ike_sa_job.h
|
||||
OBJS+= $(BUILD_DIR)delete_half_open_ike_sa_job.o
|
||||
$(BUILD_DIR)delete_half_open_ike_sa_job.o : $(JOBS_DIR)delete_half_open_ike_sa_job.c $(JOBS_DIR)delete_half_open_ike_sa_job.h
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
OBJS+= $(BUILD_DIR)delete_established_ike_sa_job.o
|
||||
$(BUILD_DIR)delete_established_ike_sa_job.o : $(JOBS_DIR)delete_established_ike_sa_job.c $(JOBS_DIR)delete_established_ike_sa_job.h
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
OBJS+= $(BUILD_DIR)incoming_packet_job.o
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* @file delete_established_ike_sa_job.c
|
||||
*
|
||||
* @brief Implementation of delete_established_ike_sa_job_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2005 Jan Hutter, Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include "delete_established_ike_sa_job.h"
|
||||
|
||||
#include <utils/allocator.h>
|
||||
|
||||
|
||||
typedef struct private_delete_established_ike_sa_job_t private_delete_established_ike_sa_job_t;
|
||||
|
||||
/**
|
||||
* Private data of an delete_established_ike_sa_job_t object.
|
||||
*/
|
||||
struct private_delete_established_ike_sa_job_t {
|
||||
/**
|
||||
* Public delete_established_ike_sa_job_t interface.
|
||||
*/
|
||||
delete_established_ike_sa_job_t public;
|
||||
|
||||
/**
|
||||
* ID of the ike_sa to delete.
|
||||
*/
|
||||
ike_sa_id_t *ike_sa_id;
|
||||
};
|
||||
|
||||
/**
|
||||
* Implementation of job_t.get_type.
|
||||
*/
|
||||
static job_type_t get_type(private_delete_established_ike_sa_job_t *this)
|
||||
{
|
||||
return DELETE_ESTABLISHED_IKE_SA;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of delete_established_ike_sa_job_t.get_ike_sa_id
|
||||
*/
|
||||
static ike_sa_id_t *get_ike_sa_id(private_delete_established_ike_sa_job_t *this)
|
||||
{
|
||||
return this->ike_sa_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of job_t.destroy.
|
||||
*/
|
||||
static void destroy(job_t *job)
|
||||
{
|
||||
private_delete_established_ike_sa_job_t *this = (private_delete_established_ike_sa_job_t *) job;
|
||||
this->ike_sa_id->destroy(this->ike_sa_id);
|
||||
allocator_free(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in header
|
||||
*/
|
||||
delete_established_ike_sa_job_t *delete_established_ike_sa_job_create(ike_sa_id_t *ike_sa_id)
|
||||
{
|
||||
private_delete_established_ike_sa_job_t *this = allocator_alloc_thing(private_delete_established_ike_sa_job_t);
|
||||
|
||||
/* interface functions */
|
||||
this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
|
||||
/* same as destroy */
|
||||
this->public.job_interface.destroy_all = (void (*) (job_t *)) destroy;
|
||||
this->public.job_interface.destroy = destroy;
|
||||
|
||||
/* public functions */
|
||||
this->public.get_ike_sa_id = (ike_sa_id_t * (*)(delete_established_ike_sa_job_t *)) get_ike_sa_id;
|
||||
this->public.destroy = (void (*)(delete_established_ike_sa_job_t *)) destroy;
|
||||
|
||||
/* private variables */
|
||||
this->ike_sa_id = ike_sa_id->clone(ike_sa_id);
|
||||
|
||||
return &(this->public);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* @file delete_established_ike_sa_job.h
|
||||
*
|
||||
* @brief Interface of delete_established_ike_sa_job_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2005 Jan Hutter, Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef DELETE_ESTABLISHED_IKE_SA_JOB_H_
|
||||
#define DELETE_ESTABLISHED_IKE_SA_JOB_H_
|
||||
|
||||
#include <types.h>
|
||||
#include <sa/ike_sa_id.h>
|
||||
#include <queues/jobs/job.h>
|
||||
|
||||
|
||||
typedef struct delete_established_ike_sa_job_t delete_established_ike_sa_job_t;
|
||||
|
||||
/**
|
||||
* @brief Class representing an DELETE_ESTABLISHED_IKE_SA Job.
|
||||
*
|
||||
* @b Constructors:
|
||||
* - delete_established_ike_sa_job_create()
|
||||
*
|
||||
* @ingroup jobs
|
||||
*/
|
||||
struct delete_established_ike_sa_job_t {
|
||||
/**
|
||||
* The job_t interface.
|
||||
*/
|
||||
job_t job_interface;
|
||||
|
||||
/**
|
||||
* @brief Returns the currently set ike_sa_id.
|
||||
*
|
||||
* @warning Returned object is not copied.
|
||||
*
|
||||
* @param this calling delete_established_ike_sa_job_t object
|
||||
* @return ike_sa_id_t object
|
||||
*/
|
||||
ike_sa_id_t * (*get_ike_sa_id) (delete_established_ike_sa_job_t *this);
|
||||
|
||||
/**
|
||||
* @brief Destroys an delete_established_ike_sa_job_t object (including assigned data).
|
||||
*
|
||||
* @param this delete_established_ike_sa_job_t object to destroy
|
||||
*/
|
||||
void (*destroy) (delete_established_ike_sa_job_t *this);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Creates a job of type DELETE_ESTABLISHED_IKE_SA.
|
||||
*
|
||||
* @param ike_sa_id id of the IKE_SA to delete
|
||||
* @return created delete_established_ike_sa_job_t object
|
||||
*
|
||||
* @ingroup jobs
|
||||
*/
|
||||
delete_established_ike_sa_job_t *delete_established_ike_sa_job_create(ike_sa_id_t *ike_sa_id);
|
||||
|
||||
#endif /*DELETE_ESTABLISHED_IKE_SA_JOB_H_*/
|
||||
Binary file not shown.
+16
-16
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file delete_ike_sa_job.h
|
||||
* @file delete_half_open_ike_sa_job.c
|
||||
*
|
||||
* @brief Implementation of delete_ike_sa_job_t.
|
||||
* @brief Implementation of delete_half_open_ike_sa_job_t.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -20,21 +20,21 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include "delete_ike_sa_job.h"
|
||||
#include "delete_half_open_ike_sa_job.h"
|
||||
|
||||
#include <utils/allocator.h>
|
||||
|
||||
|
||||
typedef struct private_delete_ike_sa_job_t private_delete_ike_sa_job_t;
|
||||
typedef struct private_delete_half_open_ike_sa_job_t private_delete_half_open_ike_sa_job_t;
|
||||
|
||||
/**
|
||||
* Private data of an delete_ike_sa_job_t Object
|
||||
* Private data of an delete_half_open_ike_sa_job_t Object
|
||||
*/
|
||||
struct private_delete_ike_sa_job_t {
|
||||
struct private_delete_half_open_ike_sa_job_t {
|
||||
/**
|
||||
* public delete_ike_sa_job_t interface
|
||||
* public delete_half_open_ike_sa_job_t interface
|
||||
*/
|
||||
delete_ike_sa_job_t public;
|
||||
delete_half_open_ike_sa_job_t public;
|
||||
|
||||
/**
|
||||
* ID of the ike_sa to delete
|
||||
@@ -45,15 +45,15 @@ struct private_delete_ike_sa_job_t {
|
||||
/**
|
||||
* Implements job_t.get_type.
|
||||
*/
|
||||
static job_type_t get_type(private_delete_ike_sa_job_t *this)
|
||||
static job_type_t get_type(private_delete_half_open_ike_sa_job_t *this)
|
||||
{
|
||||
return DELETE_IKE_SA;
|
||||
return DELETE_HALF_OPEN_IKE_SA;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements elete_ike_sa_job_t.get_ike_sa_id
|
||||
*/
|
||||
static ike_sa_id_t *get_ike_sa_id(private_delete_ike_sa_job_t *this)
|
||||
static ike_sa_id_t *get_ike_sa_id(private_delete_half_open_ike_sa_job_t *this)
|
||||
{
|
||||
return this->ike_sa_id;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ static ike_sa_id_t *get_ike_sa_id(private_delete_ike_sa_job_t *this)
|
||||
*/
|
||||
static void destroy(job_t *job)
|
||||
{
|
||||
private_delete_ike_sa_job_t *this = (private_delete_ike_sa_job_t *) job;
|
||||
private_delete_half_open_ike_sa_job_t *this = (private_delete_half_open_ike_sa_job_t *) job;
|
||||
this->ike_sa_id->destroy(this->ike_sa_id);
|
||||
allocator_free(this);
|
||||
}
|
||||
@@ -71,9 +71,9 @@ static void destroy(job_t *job)
|
||||
/*
|
||||
* Described in header
|
||||
*/
|
||||
delete_ike_sa_job_t *delete_ike_sa_job_create(ike_sa_id_t *ike_sa_id)
|
||||
delete_half_open_ike_sa_job_t *delete_half_open_ike_sa_job_create(ike_sa_id_t *ike_sa_id)
|
||||
{
|
||||
private_delete_ike_sa_job_t *this = allocator_alloc_thing(private_delete_ike_sa_job_t);
|
||||
private_delete_half_open_ike_sa_job_t *this = allocator_alloc_thing(private_delete_half_open_ike_sa_job_t);
|
||||
|
||||
/* interface functions */
|
||||
this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
|
||||
@@ -82,8 +82,8 @@ delete_ike_sa_job_t *delete_ike_sa_job_create(ike_sa_id_t *ike_sa_id)
|
||||
this->public.job_interface.destroy = destroy;
|
||||
|
||||
/* public functions */
|
||||
this->public.get_ike_sa_id = (ike_sa_id_t * (*)(delete_ike_sa_job_t *)) get_ike_sa_id;
|
||||
this->public.destroy = (void (*)(delete_ike_sa_job_t *)) destroy;
|
||||
this->public.get_ike_sa_id = (ike_sa_id_t * (*)(delete_half_open_ike_sa_job_t *)) get_ike_sa_id;
|
||||
this->public.destroy = (void (*)(delete_half_open_ike_sa_job_t *)) destroy;
|
||||
|
||||
/* private variables */
|
||||
this->ike_sa_id = ike_sa_id->clone(ike_sa_id);
|
||||
+20
-17
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file delete_ike_sa_job.h
|
||||
* @file delete_half_open_ike_sa_job.h
|
||||
*
|
||||
* @brief Interface of delete_ike_sa_job_t.
|
||||
* @brief Interface of delete_half_open_ike_sa_job_t.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -20,24 +20,27 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef DELETE_IKE_SA_JOB_H_
|
||||
#define DELETE_IKE_SA_JOB_H_
|
||||
#ifndef DELETE_HALF_OPEN_IKE_SA_JOB_H_
|
||||
#define DELETE_HALF_OPEN_IKE_SA_JOB_H_
|
||||
|
||||
#include <types.h>
|
||||
#include <sa/ike_sa_id.h>
|
||||
#include <queues/jobs/job.h>
|
||||
|
||||
|
||||
typedef struct delete_ike_sa_job_t delete_ike_sa_job_t;
|
||||
typedef struct delete_half_open_ike_sa_job_t delete_half_open_ike_sa_job_t;
|
||||
|
||||
/**
|
||||
* @brief Class representing an DELETE_IKE_SA Job.
|
||||
* @brief Class representing an DELETE_HALF_OPEN_IKE_SA Job.
|
||||
*
|
||||
* @b Constructors:
|
||||
* - delete_half_open_ike_sa_job_create()
|
||||
*
|
||||
* @ingroup jobs
|
||||
*/
|
||||
struct delete_ike_sa_job_t {
|
||||
struct delete_half_open_ike_sa_job_t {
|
||||
/**
|
||||
* implements job_t interface
|
||||
* The job_t interface.
|
||||
*/
|
||||
job_t job_interface;
|
||||
|
||||
@@ -46,27 +49,27 @@ struct delete_ike_sa_job_t {
|
||||
*
|
||||
* @warning Returned object is not copied.
|
||||
*
|
||||
* @param this calling delete_ike_sa_job_t object
|
||||
* @param this calling delete_half_open_ike_sa_job_t object
|
||||
* @return ike_sa_id_t object
|
||||
*/
|
||||
ike_sa_id_t * (*get_ike_sa_id) (delete_ike_sa_job_t *this);
|
||||
ike_sa_id_t * (*get_ike_sa_id) (delete_half_open_ike_sa_job_t *this);
|
||||
|
||||
/**
|
||||
* @brief Destroys an delete_ike_sa_job_t object (including assigned data).
|
||||
* @brief Destroys an delete_half_open_ike_sa_job_t object (including assigned data).
|
||||
*
|
||||
* @param this delete_ike_sa_job_t object to destroy
|
||||
* @param this delete_half_open_ike_sa_job_t object to destroy
|
||||
*/
|
||||
void (*destroy) (delete_ike_sa_job_t *this);
|
||||
void (*destroy) (delete_half_open_ike_sa_job_t *this);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Creates a job of type DELETE_IKE_SA.
|
||||
* @brief Creates a job of type DELETE_HALF_OPEN_IKE_SA.
|
||||
*
|
||||
* @param ike_sa_id id of the IKE_SA to delete
|
||||
* @return created delete_ike_sa_job_t object
|
||||
* @return created delete_half_open_ike_sa_job_t object
|
||||
*
|
||||
* @ingroup jobs
|
||||
*/
|
||||
delete_ike_sa_job_t *delete_ike_sa_job_create(ike_sa_id_t *ike_sa_id);
|
||||
delete_half_open_ike_sa_job_t *delete_half_open_ike_sa_job_create(ike_sa_id_t *ike_sa_id);
|
||||
|
||||
#endif /*DELETE_IKE_SA_JOB_H_*/
|
||||
#endif /*DELETE_HALF_OPEN_IKE_SA_JOB_H_*/
|
||||
@@ -28,6 +28,7 @@ mapping_t job_type_m[] = {
|
||||
{INCOMING_PACKET, "INCOMING_PACKET"},
|
||||
{RETRANSMIT_REQUEST, "RETRANSMIT_REQUEST"},
|
||||
{INITIATE_IKE_SA, "INITIATE_IKE_SA"},
|
||||
{DELETE_IKE_SA, "DELETE_IKE_SA"},
|
||||
{DELETE_HALF_OPEN_IKE_SA, "DELETE_HALF_OPEN_IKE_SA"},
|
||||
{DELETE_ESTABLISHED_IKE_SA, "DELETE_ESTABLISHED_IKE_SA"},
|
||||
{MAPPING_END, NULL}
|
||||
};
|
||||
|
||||
@@ -36,30 +36,37 @@ typedef enum job_type_t job_type_t;
|
||||
*/
|
||||
enum job_type_t {
|
||||
/**
|
||||
* Process an incoming IKEv2-Message
|
||||
* Process an incoming IKEv2-Message.
|
||||
*
|
||||
* Job is implemented in class type incoming_packet_job_t
|
||||
*/
|
||||
INCOMING_PACKET,
|
||||
|
||||
/**
|
||||
* Retransmit an IKEv2-Message
|
||||
* Retransmit an IKEv2-Message.
|
||||
*/
|
||||
RETRANSMIT_REQUEST,
|
||||
|
||||
/**
|
||||
* Establish an ike sa as initiator
|
||||
* Establish an ike sa as initiator.
|
||||
*
|
||||
* Job is implemented in class type initiate_ike_sa_job_t
|
||||
*/
|
||||
|
||||
INITIATE_IKE_SA,
|
||||
/**
|
||||
* Delete an ike sa
|
||||
* Delete an ike sa which is still not established.
|
||||
*
|
||||
* Job is implemented in class type delete_ike_sa_job_t
|
||||
* Job is implemented in class type delete_half_open_ike_sa_job_t
|
||||
*/
|
||||
DELETE_IKE_SA
|
||||
DELETE_HALF_OPEN_IKE_SA,
|
||||
|
||||
/**
|
||||
* Delete an ike sa which is established.
|
||||
*
|
||||
* Job is implemented in class type delete_established_ike_sa_job_t
|
||||
*/
|
||||
DELETE_ESTABLISHED_IKE_SA
|
||||
|
||||
|
||||
/* more job types have to be inserted here */
|
||||
|
||||
Reference in New Issue
Block a user