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
21
int
libwifi_create_atim
(
struct
libwifi_atim
*atim,
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
27
atim->
frame_header
.
frame_control
.
type
=
TYPE_MANAGEMENT
;
28
atim->
frame_header
.
frame_control
.
subtype
=
SUBTYPE_ATIM
;
29
memcpy(&atim->
frame_header
.
addr1
, transmitter, 6);
30
memcpy(&atim->
frame_header
.
addr2
, receiver, 6);
31
memcpy(&atim->
frame_header
.
addr3
, address3, 6);
32
atim->
frame_header
.
frame_control
.
flags
.
power_mgmt
= 1;
33
atim->
frame_header
.
duration
= (rand() % 4096);
34
atim->
frame_header
.
seq_control
.
sequence_number
= (rand() % 4096);
35
36
return
0;
37
}
libwifi_create_atim
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
@ SUBTYPE_ATIM
Definition:
frame.h:46
TYPE_MANAGEMENT
@ TYPE_MANAGEMENT
Definition:
frame.h:31
atim.h
libwifi_atim
Definition:
atim.h:29
libwifi_atim::frame_header
struct libwifi_mgmt_unordered_frame_header frame_header
Definition:
atim.h:30
libwifi_frame_ctrl_flags::power_mgmt
unsigned int power_mgmt
Definition:
frame.h:112
libwifi_frame_ctrl::type
unsigned int type
Definition:
frame.h:123
libwifi_frame_ctrl::flags
struct libwifi_frame_ctrl_flags flags
Definition:
frame.h:125
libwifi_frame_ctrl::subtype
unsigned int subtype
Definition:
frame.h:124
libwifi_mgmt_unordered_frame_header::addr3
unsigned char addr3[6]
Definition:
frame.h:212
libwifi_mgmt_unordered_frame_header::seq_control
struct libwifi_seq_control seq_control
Definition:
frame.h:213
libwifi_mgmt_unordered_frame_header::duration
uint16_t duration
Definition:
frame.h:209
libwifi_mgmt_unordered_frame_header::frame_control
struct libwifi_frame_ctrl frame_control
Definition:
frame.h:208
libwifi_mgmt_unordered_frame_header::addr2
unsigned char addr2[6]
Definition:
frame.h:211
libwifi_mgmt_unordered_frame_header::addr1
unsigned char addr1[6]
Definition:
frame.h:210
libwifi_seq_control::sequence_number
unsigned int sequence_number
Definition:
frame.h:133
libwifi
gen
management
atim.c
Generated by
1.9.3