libwifi 0.0.3
An 802.11 Frame Parsing and Generation library in C
atim.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 "atim.h"
17
18#include <stdlib.h>
19#include <string.h>
20
22 const unsigned char transmitter[6],
23 const unsigned char receiver[6],
24 const unsigned char address3[6]) {
25 memset(atim, 0, sizeof(struct libwifi_atim));
26
29 memcpy(&atim->frame_header.addr1, transmitter, 6);
30 memcpy(&atim->frame_header.addr2, receiver, 6);
31 memcpy(&atim->frame_header.addr3, address3, 6);
33 atim->frame_header.duration = (rand() % 4096);
34 atim->frame_header.seq_control.sequence_number = (rand() % 4096);
35
36 return 0;
37}
int libwifi_create_atim(struct libwifi_atim *atim, const unsigned char transmitter[6], const unsigned char receiver[6], const unsigned char address3[6])
Generate a populated ATIM frame.
Definition: atim.c:21
@ SUBTYPE_ATIM
Definition: frame.h:46
@ TYPE_MANAGEMENT
Definition: frame.h:31
struct libwifi_mgmt_unordered_frame_header frame_header
Definition: atim.h:30
unsigned int power_mgmt
Definition: frame.h:112
unsigned int type
Definition: frame.h:123
struct libwifi_frame_ctrl_flags flags
Definition: frame.h:125
unsigned int subtype
Definition: frame.h:124
struct libwifi_seq_control seq_control
Definition: frame.h:213
struct libwifi_frame_ctrl frame_control
Definition: frame.h:208
unsigned int sequence_number
Definition: frame.h:133