xref: /freebsd/contrib/wpa/src/eap_server/tncs.h (revision 9a14aa017b21c292740c00ee098195cd46642730)
1 /*
2  * EAP-TNC - TNCS (IF-IMV, IF-TNCCS, and IF-TNCCS-SOH)
3  * Copyright (c) 2007-2008, Jouni Malinen <j@w1.fi>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * Alternatively, this software may be distributed under the terms of BSD
10  * license.
11  *
12  * See README and COPYING for more details.
13  */
14 
15 #ifndef TNCS_H
16 #define TNCS_H
17 
18 struct tncs_data;
19 
20 struct tncs_data * tncs_init(void);
21 void tncs_deinit(struct tncs_data *tncs);
22 void tncs_init_connection(struct tncs_data *tncs);
23 size_t tncs_total_send_len(struct tncs_data *tncs);
24 u8 * tncs_copy_send_buf(struct tncs_data *tncs, u8 *pos);
25 char * tncs_if_tnccs_start(struct tncs_data *tncs);
26 char * tncs_if_tnccs_end(void);
27 
28 enum tncs_process_res {
29 	TNCCS_PROCESS_ERROR = -1,
30 	TNCCS_PROCESS_OK_NO_RECOMMENDATION = 0,
31 	TNCCS_RECOMMENDATION_ERROR,
32 	TNCCS_RECOMMENDATION_ALLOW,
33 	TNCCS_RECOMMENDATION_NONE,
34 	TNCCS_RECOMMENDATION_ISOLATE,
35 	TNCCS_RECOMMENDATION_NO_ACCESS,
36 	TNCCS_RECOMMENDATION_NO_RECOMMENDATION
37 };
38 
39 enum tncs_process_res tncs_process_if_tnccs(struct tncs_data *tncs,
40 					    const u8 *msg, size_t len);
41 
42 int tncs_global_init(void);
43 void tncs_global_deinit(void);
44 
45 struct wpabuf * tncs_build_soh_request(void);
46 struct wpabuf * tncs_process_soh(const u8 *soh_tlv, size_t soh_tlv_len,
47 				 int *failure);
48 
49 #endif /* TNCS_H */
50