9deab6d80daea726279f1d9b6e04788050d15264
[strongswan.git] / Source / charon / jobs / incoming_packet_job.h
1 /**
2 * @file incoming_packet_job.h
3 *
4 * @brief Job of type INCOMING_PACKET
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
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>.
16 *
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
20 * for more details.
21 */
22
23 #ifndef INCOMING_PACKET_JOB_H_
24 #define INCOMING_PACKET_JOB_H_
25
26 #include <jobs/job.h>
27 #include <types.h>
28 #include <packet.h>
29
30 /**
31 * Object representing an INCOMING_PACKET Job
32 *
33 */
34 typedef struct incoming_packet_job_s incoming_packet_job_t;
35
36 struct incoming_packet_job_s {
37 /**
38 * implements job_t interface
39 */
40 job_t job_interface;
41
42 /**
43 * @brief Returns the assigned packet_t object
44 *
45 * @warning Returned packet is not cloned and has to get destroyed by the caller.
46 *
47 * @param this calling incoming_packet_job_t object
48 * @param[out] packet assigned packet will be written into this location
49 * @return
50 * - SUCCESS
51 * - FAILED if no packet is assigned
52 */
53 status_t (*get_packet) (incoming_packet_job_t *this, packet_t **packet);
54
55 /**
56 * @brief Destroys an incoming_packet_job_t object.
57 *
58 * @param this incoming_packet_job_t object to destroy
59 * @return
60 * SUCCESS in any case
61 */
62 status_t (*destroy) (incoming_packet_job_t *this);
63 };
64
65 /**
66 * Creates a job of type INCOMING_PACKET
67 *
68 * @param[in] packet packet to assign with this job
69 * @return
70 * - incoming_packet_job_t if successfully
71 * - NULL if out of ressources
72 */
73 incoming_packet_job_t *incoming_packet_job_create(packet_t *packet);
74
75
76 #endif /*INCOMING_PACKET_JOB_H_*/