- added destroy_all to job_t
authorJan Hutter <jhutter@hsr.ch>
Thu, 17 Nov 2005 12:49:56 +0000 (12:49 -0000)
committerJan Hutter <jhutter@hsr.ch>
Thu, 17 Nov 2005 12:49:56 +0000 (12:49 -0000)
Source/charon/jobs/incoming_packet_job.c
Source/charon/jobs/initiate_ike_sa_job.c
Source/charon/jobs/job.c
Source/charon/jobs/job.h

index c7758fa..fe311d2 100644 (file)
@@ -68,6 +68,21 @@ static status_t get_packet(private_incoming_packet_job_t *this,packet_t **packet
 }
 
 
 }
 
 
+
+/**
+ * Implements job_t's and destroy_all function.
+ * See #job_t.destroy_all description.
+ */
+static status_t destroy_all(private_incoming_packet_job_t *this)
+{
+       if (this->packet != NULL)
+       {
+               this->packet->destroy(this->packet);
+       }
+       allocator_free(this);
+       return SUCCESS;
+}
+
 /**
  * Implements job_t's and incoming_packet_job_t's destroy function.
  * See #job_t.destroy or #incoming_packet_job_t.destroy for description.
 /**
  * Implements job_t's and incoming_packet_job_t's destroy function.
  * See #job_t.destroy or #incoming_packet_job_t.destroy for description.
@@ -93,6 +108,7 @@ incoming_packet_job_t *incoming_packet_job_create(packet_t *packet)
        
        /* interface functions */
        this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
        
        /* interface functions */
        this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
+       this->public.job_interface.destroy_all = (status_t (*) (job_t *)) destroy_all;
        this->public.job_interface.destroy = destroy;
        
        /* public functions */
        this->public.job_interface.destroy = destroy;
        
        /* public functions */
index d14de48..0bf0cca 100644 (file)
@@ -64,7 +64,6 @@ static char * get_configuration_name(private_initiate_ike_sa_job_t *this)
        return this->configuration_name;
 }
 
        return this->configuration_name;
 }
 
-
 /**
  * Implements job_t's and initiate_ike_sa_job_t's destroy function.
  * See #job_t.destroy or #initiate_ike_sa_job_t.destroy for description.
 /**
  * Implements job_t's and initiate_ike_sa_job_t's destroy function.
  * See #job_t.destroy or #initiate_ike_sa_job_t.destroy for description.
@@ -91,6 +90,8 @@ initiate_ike_sa_job_t *initiate_ike_sa_job_create(char *configuration_name)
        
        /* interface functions */
        this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
        
        /* interface functions */
        this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
+       /* same as destroy */
+       this->public.job_interface.destroy_all = (status_t (*) (job_t *)) destroy;
        this->public.job_interface.destroy = destroy;
        
        /* public functions */
        this->public.job_interface.destroy = destroy;
        
        /* public functions */
index 2188003..a7df3ec 100644 (file)
@@ -20,6 +20,7 @@
  * for more details.
  */
 
  * for more details.
  */
 
+
 #include "job.h"
 
 
 #include "job.h"
 
 
index ae2d271..2563390 100644 (file)
@@ -72,6 +72,14 @@ struct job_s{
        job_type_t (*get_type) (job_t *this);
 
        /**
        job_type_t (*get_type) (job_t *this);
 
        /**
+        * @brief Destroys a job_t object and all assigned data!
+        * 
+        * @param job_t calling object
+        * @returns SUCCESS if succeeded, FAILED otherwise
+        */
+       status_t (*destroy_all) (job_t *job);
+
+       /**
         * @brief Destroys a job_t object
         * 
         * @param job_t calling object
         * @brief Destroys a job_t object
         * 
         * @param job_t calling object