6f47e56601fd9ad30e2e06d7783419a2fcf70257
[strongswan.git] / src / libcharon / plugins / tnccs_11 / batch / tnccs_batch.h
1 /*
2 * Copyright (C) 2010 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup tnccs_batch tnccs_batch
18 * @{ @ingroup tnccs_11
19 */
20
21 #ifndef TNCCS_BATCH_H_
22 #define TNCCS_BATCH_H_
23
24 typedef enum tnccs_batch_type_t tnccs_batch_type_t;
25 typedef struct tnccs_batch_t tnccs_batch_t;
26
27 #include "messages/tnccs_msg.h"
28
29 #include <library.h>
30
31 /**
32 * Interface for a TNCCS 1.x Batch.
33 */
34 struct tnccs_batch_t {
35
36 /**
37 * Get the encoding of the TNCCS 1.x Batch
38 *
39 * @return encoded TNCCS 1.x batch
40 */
41 chunk_t (*get_encoding)(tnccs_batch_t *this);
42
43 /**
44 * Add TNCCS message
45 *
46 * @param msg TNCCS message to be addedd
47 */
48 void (*add_msg)(tnccs_batch_t *this, tnccs_msg_t* msg);
49
50 /**
51 * Build the TNCCS 1.x Batch
52 */
53 void (*build)(tnccs_batch_t *this);
54
55 /**
56 * Process the TNCCS 1.x Batch
57 *
58 * @return return processing status
59 */
60 status_t (*process)(tnccs_batch_t *this);
61
62 /**
63 * Enumerates over all TNCCS Messages
64 *
65 * @return return message enumerator
66 */
67 enumerator_t* (*create_msg_enumerator)(tnccs_batch_t *this);
68
69 /**
70 * Destroys a tnccs_batch_t object.
71 */
72 void (*destroy)(tnccs_batch_t *this);
73 };
74
75 /**
76 * Create an empty TNCCS 1.x Batch
77 *
78 * @param is_server TRUE if server, FALSE if client
79 * @param batch_id number of the batch to be sent
80 */
81 tnccs_batch_t* tnccs_batch_create(bool is_server, int batch_id);
82
83 /**
84 * Create an unprocessed TNCCS 1.x Batch from data
85 *
86 * @param is_server TRUE if server, FALSE if client
87 * @param batch_id current Batch ID
88 * @param data encoded PB-TNC batch
89 */
90 tnccs_batch_t* tnccs_batch_create_from_data(bool is_server, int batch_id,
91 chunk_t data);
92
93 #endif /** TNCCS_BATCH_H_ @}*/