Add forgotten src/ap/utils.c file
[hostap-gosc2009.git] / src / ap / utils.c
blob0796107fe89c9f0dd7715b558c2bc8873070d626
1 /*
2 * AP mode helper functions
3 * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
12 * See README and COPYING for more details.
15 #include "includes.h"
17 #include "common.h"
18 #include "hostapd.h"
21 int hostapd_register_probereq_cb(struct hostapd_data *hapd,
22 void (*cb)(void *ctx, const u8 *sa,
23 const u8 *ie, size_t ie_len),
24 void *ctx)
26 struct hostapd_probereq_cb *n;
28 n = os_realloc(hapd->probereq_cb, (hapd->num_probereq_cb + 1) *
29 sizeof(struct hostapd_probereq_cb));
30 if (n == NULL)
31 return -1;
33 hapd->probereq_cb = n;
34 n = &hapd->probereq_cb[hapd->num_probereq_cb];
35 hapd->num_probereq_cb++;
37 n->cb = cb;
38 n->ctx = ctx;
40 return 0;