2 * Copyright (C) 2015 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
17 * @defgroup tnccs_20_handler_h tnccs_20_handler
18 * @{ @ingroup tnccs_20_handler
21 #ifndef TNCCS_20_HANDLER_H_
22 #define TNCCS_20_HANDLER_H_
26 #include "batch/pb_tnc_batch.h"
27 #include "messages/pb_tnc_msg.h"
29 typedef struct tnccs_20_handler_t tnccs_20_handler_t
;
32 * Interface for an IF-TNCCS 2.0 protocol handler
34 struct tnccs_20_handler_t
{
37 * Process content of received PB-TNC batch
39 * @param batch PB-TNC batch to be processed
42 status_t (*process
)(tnccs_20_handler_t
*this, pb_tnc_batch_t
*batch
);
45 * Build PB-TNC batch to be sent
47 * @param buf buffer to write PB-TNC batch to
48 * @param buflen size of buffer, receives bytes written
49 * @param msglen receives size of all PB-TNCH batch
52 status_t (*build
)(tnccs_20_handler_t
*this, void *buf
, size_t *buflen
,
56 * Put the IMCs or IMVs into the handshake state
58 * @param mutual TRUE if PB-TNC mutual mode is already established
60 void (*begin_handshake
)(tnccs_20_handler_t
*this, bool mutual
);
63 * Indicates if IMCs or IMVs are allowed to send PA-TNC messages
65 * @return TRUE if allowed to send
67 bool (*get_send_flag
)(tnccs_20_handler_t
*this);
70 * Indicates if the PB-TNC mutual protocol has been enabled
72 * @return TRUE if enabled
74 bool (*get_mutual
)(tnccs_20_handler_t
*this);
77 * Get state of the PB-TNC protocol
79 * @return PB-TNC state
81 pb_tnc_state_t (*get_state
)(tnccs_20_handler_t
*this);
84 * Add a PB-PA message to the handler's message queue
86 * @param msg PB-PA message to be added
88 void (*add_msg
)(tnccs_20_handler_t
*this, pb_tnc_msg_t
*msg
);
91 * Handle errors that occurred during PB-TNC batch header processing
93 * @param batch batch where a fatal error occured
95 void (*handle_errors
)(tnccs_20_handler_t
*this, pb_tnc_batch_t
*batch
);
98 * Destroys a tnccs_20_handler_t object.
100 void (*destroy
)(tnccs_20_handler_t
*this);
103 #endif /** TNCCS_20_HANDLER_H_ @}*/