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