diff options
Diffstat (limited to 'src/libwifi/gen/management/authentication.h')
-rw-r--r-- | src/libwifi/gen/management/authentication.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/libwifi/gen/management/authentication.h b/src/libwifi/gen/management/authentication.h new file mode 100644 index 0000000..4328f95 --- /dev/null +++ b/src/libwifi/gen/management/authentication.h | |||
@@ -0,0 +1,64 @@ | |||
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 | #ifndef LIBWIFI_GEN_AUTH_H | ||
17 | #define LIBWIFI_GEN_AUTH_H | ||
18 | |||
19 | #include <stdint.h> | ||
20 | |||
21 | #include "../../core/frame/management/authentication.h" | ||
22 | |||
23 | /** | ||
24 | * Calculate the length of a given libwifi_auth | ||
25 | * | ||
26 | * @param auth A libwifi_auth | ||
27 | * @return The length of the given auth | ||
28 | */ | ||
29 | size_t libwifi_get_auth_length(struct libwifi_auth *auth); | ||
30 | |||
31 | /** | ||
32 | * Generate a populated libwifi auth. | ||
33 | * | ||
34 | * A generated libwifi auth can be "dumped" into a buffer for packet injection | ||
35 | * via the libwifi_dump_auth. | ||
36 | * | ||
37 | * @param auth A libwifi_auth | ||
38 | * @param receiver The receiver MAC address, aka address 1 | ||
39 | * @param transmitter The source MAC address, aka address 2 | ||
40 | * @param algorithm_number Algorithm type to use | ||
41 | * | ||
42 | */ | ||
43 | void libwifi_create_auth(struct libwifi_auth *auth, const unsigned char receiver[6], | ||
44 | const unsigned char transmitter[6], uint16_t algorithm_number, | ||
45 | uint16_t transaction_sequence, uint16_t status_code); | ||
46 | |||
47 | /** | ||
48 | * Dump a libwifi_auth into a raw format for packet injection. | ||
49 | * | ||
50 | * @param auth A libwifi_auth | ||
51 | * @param buf The output buffer for the frame data | ||
52 | * @param buf_len The length of the output buffer | ||
53 | * @return The length of the dumped auth | ||
54 | */ | ||
55 | size_t libwifi_dump_auth(struct libwifi_auth *auth, unsigned char *buf, size_t buf_len); | ||
56 | |||
57 | /** | ||
58 | * Free any memory claimed by a libwifi_auth back to the system. | ||
59 | * | ||
60 | * @param auth A libwifi_auth | ||
61 | */ | ||
62 | void libwifi_free_auth(struct libwifi_auth *auth); | ||
63 | |||
64 | #endif /* LIBWIFI_GEN_AUTH_H */ | ||