eap_wsc_common.c 784 B

123456789101112131415161718192021222324252627282930313233
  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. #include "includes.h"
  9. #include "common.h"
  10. #include "eap_defs.h"
  11. #include "eap_common.h"
  12. #include "wps/wps.h"
  13. #include "eap_wsc_common.h"
  14. struct wpabuf * eap_wsc_build_frag_ack(u8 id, u8 code)
  15. {
  16. struct wpabuf *msg;
  17. msg = eap_msg_alloc(EAP_VENDOR_WFA, EAP_VENDOR_TYPE_WSC, 2, code, id);
  18. if (msg == NULL) {
  19. wpa_printf(MSG_ERROR, "EAP-WSC: Failed to allocate memory for "
  20. "FRAG_ACK");
  21. return NULL;
  22. }
  23. wpa_printf(MSG_DEBUG, "EAP-WSC: Send WSC/FRAG_ACK");
  24. wpabuf_put_u8(msg, WSC_FRAG_ACK); /* Op-Code */
  25. wpabuf_put_u8(msg, 0); /* Flags */
  26. return msg;
  27. }