libwifi 0.0.3
An 802.11 Frame Parsing and Generation library in C
core.c
Go to the documentation of this file.
1/* Copyright 2021 The libwifi Authors
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#include "core.h"
17#include <stdlib.h>
18#include <string.h>
19#include <sys/random.h>
20
24void libwifi_random_mac(unsigned char buf[6], unsigned char prefix[3]) {
25 memset(buf, 0, 6);
26 if (prefix != NULL) {
27 memcpy(buf, prefix, 3);
28 getrandom(buf + 3, 3, 0);
29 } else {
30 getrandom(buf, 6, 0);
31 }
32}
33
37void libwifi_dummy(void) {
38 return;
39}
40
44const char *libwifi_get_version(void) {
45 return LIBWIFI_VERSION;
46}
void libwifi_dummy(void)
Dummy linker test function.
Definition: core.c:37
const char * libwifi_get_version(void)
Version.
Definition: core.c:44
void libwifi_random_mac(unsigned char buf[6], unsigned char prefix[3])
Random MAC addresses, achieved by obtaining 6 bytes of /dev/urandom via getrandom()
Definition: core.c:24
#define LIBWIFI_VERSION
Definition: core.h:20