]> git.ipfire.org Git - thirdparty/strongswan.git/blame - src/libtnccs/plugins/tnccs_20/tnccs_20_handler.h
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libtnccs / plugins / tnccs_20 / tnccs_20_handler.h
CommitLineData
80322d2c
AS
1/*
2 * Copyright (C) 2015 Andreas Steffen
19ef2aec
TB
3 *
4 * Copyright (C) secunet Security Networks AG
80322d2c
AS
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 tnccs_20_handler_h tnccs_20_handler
48087e09 19 * @{ @ingroup tnccs_20
80322d2c
AS
20 */
21
22#ifndef TNCCS_20_HANDLER_H_
23#define TNCCS_20_HANDLER_H_
24
25#include <library.h>
26
27#include "batch/pb_tnc_batch.h"
28#include "messages/pb_tnc_msg.h"
29
30typedef struct tnccs_20_handler_t tnccs_20_handler_t;
31
32/**
33 * Interface for an IF-TNCCS 2.0 protocol handler
34 */
35struct tnccs_20_handler_t {
36
37 /**
38 * Process content of received PB-TNC batch
39 *
40 * @param batch PB-TNC batch to be processed
41 * @return status
42 */
43 status_t (*process)(tnccs_20_handler_t *this, pb_tnc_batch_t *batch);
44
45 /**
46 * Build PB-TNC batch to be sent
47 *
48 * @param buf buffer to write PB-TNC batch to
49 * @param buflen size of buffer, receives bytes written
50 * @param msglen receives size of all PB-TNCH batch
51 * @return status
52 */
53 status_t (*build)(tnccs_20_handler_t *this, void *buf, size_t *buflen,
54 size_t *msglen);
55
56 /**
57 * Put the IMCs or IMVs into the handshake state
7b4a96b2
AS
58 *
59 * @param mutual TRUE if PB-TNC mutual mode is already established
80322d2c 60 */
7b4a96b2 61 void (*begin_handshake)(tnccs_20_handler_t *this, bool mutual);
80322d2c
AS
62
63 /**
64 * Indicates if IMCs or IMVs are allowed to send PA-TNC messages
65 *
66 * @return TRUE if allowed to send
67 */
68 bool (*get_send_flag)(tnccs_20_handler_t *this);
69
c6aed8aa
AS
70 /**
71 * Indicates if the PB-TNC mutual protocol has been enabled
72 *
73 * @return TRUE if enabled
74 */
75 bool (*get_mutual)(tnccs_20_handler_t *this);
76
7b4a96b2
AS
77 /**
78 * Get state of the PB-TNC protocol
79 *
80 * @return PB-TNC state
81 */
82 pb_tnc_state_t (*get_state)(tnccs_20_handler_t *this);
83
80322d2c
AS
84 /**
85 * Add a PB-PA message to the handler's message queue
86 *
87 * @param msg PB-PA message to be added
88 */
89 void (*add_msg)(tnccs_20_handler_t *this, pb_tnc_msg_t *msg);
90
91 /**
92 * Handle errors that occurred during PB-TNC batch header processing
93 *
619e0b42
AS
94 * @param batch batch where a fatal error occurred
95 * @param fatal_header_error TRUE if fatal error in batch header
80322d2c 96 */
619e0b42
AS
97 void (*handle_errors)(tnccs_20_handler_t *this, pb_tnc_batch_t *batch,
98 bool fatal_header_error);
80322d2c
AS
99
100 /**
101 * Destroys a tnccs_20_handler_t object.
102 */
103 void (*destroy)(tnccs_20_handler_t *this);
104};
105
106#endif /** TNCCS_20_HANDLER_H_ @}*/