xref: /freebsd/contrib/wpa/src/eap_common/eap_wsc_common.c (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1 /*
2  * EAP-WSC common routines for Wi-Fi Protected Setup
3  * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #include "includes.h"
10 
11 #include "common.h"
12 #include "eap_defs.h"
13 #include "eap_common.h"
14 #include "wps/wps.h"
15 #include "eap_wsc_common.h"
16 
17 struct wpabuf * eap_wsc_build_frag_ack(u8 id, u8 code)
18 {
19 	struct wpabuf *msg;
20 
21 	msg = eap_msg_alloc(EAP_VENDOR_WFA, EAP_VENDOR_TYPE_WSC, 2, code, id);
22 	if (msg == NULL) {
23 		wpa_printf(MSG_ERROR, "EAP-WSC: Failed to allocate memory for "
24 			   "FRAG_ACK");
25 		return NULL;
26 	}
27 
28 	wpa_printf(MSG_DEBUG, "EAP-WSC: Send WSC/FRAG_ACK");
29 	wpabuf_put_u8(msg, WSC_FRAG_ACK); /* Op-Code */
30 	wpabuf_put_u8(msg, 0); /* Flags */
31 
32 	return msg;
33 }
34