about summary refs log tree commit diff stats
path: root/data/maps/the_great/rooms
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-08-17 12:30:45 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2025-08-17 12:30:45 -0400
commit7f4eddaa7faf72b3eeee5c15eeaaeede7e1257c4 (patch)
treeaf64738e186331fa4b6084ef4c49abc91b7abc87 /data/maps/the_great/rooms
parenta70b3da0f179ad630087b3f3e8a1e92fc8011be7 (diff)
downloadlingo2-archipelago-7f4eddaa7faf72b3eeee5c15eeaaeede7e1257c4.tar.gz
lingo2-archipelago-7f4eddaa7faf72b3eeee5c15eeaaeede7e1257c4.tar.bz2
lingo2-archipelago-7f4eddaa7faf72b3eeee5c15eeaaeede7e1257c4.zip
Added the_parthenon
Diffstat (limited to 'data/maps/the_great/rooms')
0 files changed, 0 insertions, 0 deletions
c?id=8e09d29df19312583747a3de00fe4269c17e6586'>^
ae6c98a
cd1df65 ^
ae6c98a



4c1232a ^
ae6c98a
4c1232a ^




ae6c98a





4c1232a ^
ae6c98a




cd1df65 ^
cd1df65 ^

ae6c98a

































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
























                                                                           









                                                                                                             

                                                                 





                                                                                                             


                                                                                                  
                                         



                                                                        


                                                                 
                                                                                
 
               



                                                                                   
                                                                    
   




                                                                          





                                                                            
                                                           




                                                                                                    
                                                                      

               

































                                                                                                           
/* Copyright 2021 The libwifi Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "reassoc_response.h"
#include "../../core/frame/tag.h"
#include "../../core/frame/tag_iterator.h"
#include "../../core/misc/byteswap.h"
#include "../../core/misc/epoch.h"
#include "../../core/misc/types.h"
#include "common.h"

#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

/**
 * The length of a reassociation response frame is the sum of the header length, the fixed parameters length,
 * and the tagged parameters length.
 */
size_t libwifi_get_reassoc_resp_length(struct libwifi_reassoc_resp *reassoc_resp) {
    return sizeof(struct libwifi_mgmt_unordered_frame_header) +
           sizeof(struct libwifi_reassoc_resp_fixed_parameters) +
           reassoc_resp->tags.length;
}

/**
 * Simple helper to set the reassociation response DS tag by removing it and then adding it back with the new
 * value.
 */
int libwifi_set_reassoc_resp_channel(struct libwifi_reassoc_resp *reassoc_resp, uint8_t channel) {
    int ret = 0;

    if (reassoc_resp->tags.length != 0) {
        ret = libwifi_remove_tag(&reassoc_resp->tags, TAG_DS_PARAMETER);
        if (ret != 0) {
            return ret;
        }
    }

    const unsigned char *chan = (const unsigned char *) &channel;
    ret = libwifi_quick_add_tag(&reassoc_resp->tags, TAG_DS_PARAMETER, chan, 1);

    return ret;
}

/**
 * The generated reassoc_resp frame is made with sane defaults defined in common.h.
 * One tagged parameters is also added to the reassoc_resp: Channel.
 */
int libwifi_create_reassoc_resp(struct libwifi_reassoc_resp *reassoc_resp,
                                const unsigned char receiver[6],
                                const unsigned char transmitter[6],
                                const unsigned char address3[6],
                                uint8_t channel) {
    memset(reassoc_resp, 0, sizeof(struct libwifi_reassoc_resp));

    reassoc_resp->frame_header.frame_control.type = TYPE_MANAGEMENT;
    reassoc_resp->frame_header.frame_control.subtype = SUBTYPE_REASSOC_RESP;
    memcpy(&reassoc_resp->frame_header.addr1, receiver, 6);
    memcpy(&reassoc_resp->frame_header.addr2, transmitter, 6);
    memcpy(&reassoc_resp->frame_header.addr3, address3, 6);

    reassoc_resp->fixed_parameters.capabilities_information = BYTESWAP16(LIBWIFI_DEFAULT_AP_CAPABS);
    reassoc_resp->fixed_parameters.status_code = STATUS_SUCCESS;
    reassoc_resp->fixed_parameters.association_id = rand() % 4096;

    int ret = libwifi_set_reassoc_resp_channel(reassoc_resp, channel);

    return ret;
}

/**
 * Copy a libwifi_reassoc_resp into a regular unsigned char buffer. This is useful when injecting generated
 * libwifi frames.
 */
size_t libwifi_dump_reassoc_resp(struct libwifi_reassoc_resp *reassoc_resp, unsigned char *buf,
                                 size_t buf_len) {
    size_t reassoc_resp_len = libwifi_get_reassoc_resp_length(reassoc_resp);
    if (reassoc_resp_len > buf_len) {
        return -EINVAL;
    }

    size_t offset = 0;
    memcpy(buf + offset, &reassoc_resp->frame_header, sizeof(struct libwifi_mgmt_unordered_frame_header));
    offset += sizeof(struct libwifi_mgmt_unordered_frame_header);

    memcpy(buf + offset, &reassoc_resp->fixed_parameters,
           sizeof(struct libwifi_reassoc_resp_fixed_parameters));
    offset += sizeof(struct libwifi_reassoc_resp_fixed_parameters);

    memcpy(buf + offset, reassoc_resp->tags.parameters, reassoc_resp->tags.length);
    offset += reassoc_resp->tags.length;

    return reassoc_resp_len;
}

/**
 * Because the tagged parameters memory is managed inside of the library, the library must
 * be the one to free it, too.
 */
void libwifi_free_reassoc_resp(struct libwifi_reassoc_resp *reassoc_resp) {
    free(reassoc_resp->tags.parameters);
}