]> git.ipfire.org Git - thirdparty/strongswan.git/blame - src/libipsec/ipsec_processor.h
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libipsec / ipsec_processor.h
CommitLineData
a113d7f2
TB
1/*
2 * Copyright (C) 2012 Tobias Brunner
19ef2aec
TB
3 *
4 * Copyright (C) secunet Security Networks AG
a113d7f2
TB
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17/**
18 * @defgroup ipsec_processor ipsec_processor
19 * @{ @ingroup libipsec
20 */
21
22#ifndef IPSEC_PROCESSOR_H_
23#define IPSEC_PROCESSOR_H_
24
25#include "ip_packet.h"
26#include "esp_packet.h"
27
28typedef struct ipsec_processor_t ipsec_processor_t;
29
30/**
31 * Callback called to deliver an inbound plaintext packet.
32 *
33 * @param data data supplied during registration of the callback
34 * @param packet plaintext IP packet to deliver
35 */
36typedef void (*ipsec_inbound_cb_t)(void *data, ip_packet_t *packet);
37
38/**
39 * Callback called to send an ESP packet.
40 *
41 * @note The ESP packet currently comes without IP header (and without UDP
42 * header in case of UDP encapsulation)
43 *
44 * @param data data supplied during registration of the callback
45 * @param packet ESP packet to send
46 */
47typedef void (*ipsec_outbound_cb_t)(void *data, esp_packet_t *packet);
48
49/**
50 * IPsec processor
51 */
52struct ipsec_processor_t {
53
54 /**
55 * Queue an inbound ESP packet for processing.
56 *
57 * @param packet the ESP packet to process
58 */
59 void (*queue_inbound)(ipsec_processor_t *this, esp_packet_t *packet);
60
61 /**
62 * Queue an outbound plaintext IP packet for processing.
63 *
64 * @param packet the plaintext IP packet
65 */
66 void (*queue_outbound)(ipsec_processor_t *this, ip_packet_t *packet);
67
68 /**
69 * Register the callback used to deliver inbound plaintext packets.
70 *
71 * @param cb the inbound callback function
72 * @param data optional data provided to callback
73 */
74 void (*register_inbound)(ipsec_processor_t *this, ipsec_inbound_cb_t cb,
75 void *data);
76
77 /**
78 * Unregister a previously registered inbound callback.
79 *
80 * @param cb previously registered callback function
81 */
82 void (*unregister_inbound)(ipsec_processor_t *this,
83 ipsec_inbound_cb_t cb);
84
85 /**
86 * Register the callback used to send outbound ESP packets.
87 *
88 * @param cb the outbound callback function
89 * @param data optional data provided to callback
90 */
91 void (*register_outbound)(ipsec_processor_t *this, ipsec_outbound_cb_t cb,
92 void *data);
93
94 /**
95 * Unregister a previously registered outbound callback.
96 *
97 * @param cb previously registered callback function
98 */
99 void (*unregister_outbound)(ipsec_processor_t *this,
100 ipsec_outbound_cb_t cb);
101
102 /**
103 * Destroy an ipsec_processor_t.
104 */
105 void (*destroy)(ipsec_processor_t *this);
106
107};
108
109/**
110 * Create an ipsec_processor_t instance
111 *
112 * @return IPsec processor instance
113 */
114ipsec_processor_t *ipsec_processor_create();
115
116#endif /** IPSEC_PROCESSOR_H_ @}*/