2 * @file incoming_packet_job.h
4 * @brief Implementation of incoming_packet_job_t.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 #include "incoming_packet_job.h"
28 typedef struct private_incoming_packet_job_t private_incoming_packet_job_t
;
31 * Private data of an incoming_packet_job_t Object
33 struct private_incoming_packet_job_t
{
35 * public incoming_packet_job_t interface
37 incoming_packet_job_t
public;
46 * Implements job_t.get_type.
48 static job_type_t
get_type(private_incoming_packet_job_t
*this)
50 return INCOMING_PACKET
;
54 * Implements incoming_packet_job_t.get_packet.
56 static packet_t
*get_packet(private_incoming_packet_job_t
*this)
62 * Implements job_t.destroy_all.
64 static void destroy_all(private_incoming_packet_job_t
*this)
66 if (this->packet
!= NULL
)
68 this->packet
->destroy(this->packet
);
74 * Implements job_t.destroy.
76 static void destroy(job_t
*job
)
78 private_incoming_packet_job_t
*this = (private_incoming_packet_job_t
*) job
;
85 incoming_packet_job_t
*incoming_packet_job_create(packet_t
*packet
)
87 private_incoming_packet_job_t
*this = malloc_thing(private_incoming_packet_job_t
);
89 /* interface functions */
90 this->public.job_interface
.get_type
= (job_type_t (*) (job_t
*)) get_type
;
91 this->public.job_interface
.destroy_all
= (void (*) (job_t
*)) destroy_all
;
92 this->public.job_interface
.destroy
= destroy
;
94 /* public functions */
95 this->public.get_packet
= (packet_t
* (*)(incoming_packet_job_t
*)) get_packet
;
96 this->public.destroy
= (void (*)(incoming_packet_job_t
*)) destroy
;
98 /* private variables */
99 this->packet
= packet
;
101 return &(this->public);