xref: /freebsd/contrib/wpa/src/eap_common/eap_wsc_common.c (revision 87c1627502a5dde91e5284118eec8682b60f27a2)
1 /*
2  * EAP-WSC common routines for Wi-Fi Protected Setup
3  * Copyright (c) 2007, 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 #include "includes.h"
16 
17 #include "common.h"
18 #include "eap_defs.h"
19 #include "eap_common.h"
20 #include "wps/wps.h"
21 #include "eap_wsc_common.h"
22 
23 struct wpabuf * eap_wsc_build_frag_ack(u8 id, u8 code)
24 {
25 	struct wpabuf *msg;
26 
27 	msg = eap_msg_alloc(EAP_VENDOR_WFA, EAP_VENDOR_TYPE_WSC, 2, code, id);
28 	if (msg == NULL) {
29 		wpa_printf(MSG_ERROR, "EAP-WSC: Failed to allocate memory for "
30 			   "FRAG_ACK");
31 		return NULL;
32 	}
33 
34 	wpa_printf(MSG_DEBUG, "EAP-WSC: Send WSC/FRAG_ACK");
35 	wpabuf_put_u8(msg, WSC_FRAG_ACK); /* Op-Code */
36 	wpabuf_put_u8(msg, 0); /* Flags */
37 
38 	return msg;
39 }
40