2020-08-04 16:53:01 +02:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Wireless daemon for Linux
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 Intel Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct ap_state;
|
|
|
|
struct iovec;
|
2021-03-11 14:07:23 +01:00
|
|
|
enum mpdu_management_subtype;
|
2020-08-04 16:53:01 +02:00
|
|
|
|
|
|
|
enum ap_event_type {
|
|
|
|
AP_EVENT_START_FAILED,
|
|
|
|
AP_EVENT_STARTED,
|
|
|
|
AP_EVENT_STOPPING,
|
|
|
|
AP_EVENT_STATION_ADDED,
|
|
|
|
AP_EVENT_STATION_REMOVED,
|
2020-08-28 14:46:46 +02:00
|
|
|
AP_EVENT_REGISTRATION_START,
|
|
|
|
AP_EVENT_REGISTRATION_SUCCESS,
|
|
|
|
AP_EVENT_PBC_MODE_EXIT,
|
2021-06-04 03:50:45 +02:00
|
|
|
AP_EVENT_DHCP_NEW_LEASE,
|
|
|
|
AP_EVENT_DHCP_LEASE_EXPIRED,
|
2020-08-04 16:53:01 +02:00
|
|
|
};
|
|
|
|
|
2021-05-28 02:47:34 +02:00
|
|
|
struct ap_event_start_failed_data {
|
|
|
|
int error;
|
|
|
|
};
|
|
|
|
|
2020-08-04 16:53:01 +02:00
|
|
|
struct ap_event_station_added_data {
|
|
|
|
const uint8_t *mac;
|
2021-03-10 23:06:31 +01:00
|
|
|
const uint8_t *assoc_ies;
|
|
|
|
size_t assoc_ies_len;
|
2020-08-04 16:53:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ap_event_station_removed_data {
|
|
|
|
const uint8_t *mac;
|
|
|
|
enum mmpdu_reason_code reason;
|
|
|
|
};
|
|
|
|
|
2020-08-28 14:46:46 +02:00
|
|
|
struct ap_event_registration_start_data {
|
|
|
|
const uint8_t *mac;
|
2021-03-10 23:06:31 +01:00
|
|
|
const uint8_t *assoc_ies;
|
|
|
|
size_t assoc_ies_len;
|
2020-08-28 14:46:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ap_event_registration_success_data {
|
|
|
|
const uint8_t *mac;
|
|
|
|
};
|
|
|
|
|
2020-08-04 16:53:01 +02:00
|
|
|
typedef void (*ap_stopped_func_t)(void *user_data);
|
|
|
|
|
2020-09-16 11:17:49 +02:00
|
|
|
struct ap_ops {
|
|
|
|
void (*handle_event)(enum ap_event_type type, const void *event_data,
|
|
|
|
void *user_data);
|
2021-03-11 14:07:23 +01:00
|
|
|
/*
|
|
|
|
* If .write_extra_ies is provided, this callback must return an upper
|
|
|
|
* bound on the buffer space needed for the extra IEs to be sent in
|
|
|
|
* the frame of given type and, if it's not a beacon frame, in
|
|
|
|
* response to a given client frame.
|
|
|
|
*/
|
|
|
|
size_t (*get_extra_ies_len)(enum mpdu_management_subtype type,
|
|
|
|
const struct mmpdu_header *client_frame,
|
|
|
|
size_t client_frame_len,
|
|
|
|
void *user_data);
|
|
|
|
/*
|
|
|
|
* If not null, writes extra IEs to be added to the outgoing frame of
|
|
|
|
* given type and, if it's not a beacon frame, in reponse to a given
|
|
|
|
* client frame. May also react to the extra IEs in that frame.
|
|
|
|
* Returns the number of bytes written which must be less than or
|
|
|
|
* equal to the number returned by .get_extra_ies_len when called
|
|
|
|
* with the same parameters.
|
|
|
|
*/
|
|
|
|
size_t (*write_extra_ies)(enum mpdu_management_subtype type,
|
|
|
|
const struct mmpdu_header *client_frame,
|
|
|
|
size_t client_frame_len,
|
|
|
|
uint8_t *out_buf, void *user_data);
|
2020-09-16 11:17:49 +02:00
|
|
|
};
|
|
|
|
|
2021-04-27 01:34:06 +02:00
|
|
|
struct ap_state *ap_start(struct netdev *netdev, struct l_settings *config,
|
2020-10-26 19:05:41 +01:00
|
|
|
const struct ap_ops *ops, int *err,
|
|
|
|
void *user_data);
|
2020-08-04 16:53:01 +02:00
|
|
|
void ap_shutdown(struct ap_state *ap, ap_stopped_func_t stopped_func,
|
|
|
|
void *user_data);
|
|
|
|
void ap_free(struct ap_state *ap);
|
|
|
|
|
|
|
|
bool ap_station_disconnect(struct ap_state *ap, const uint8_t *mac,
|
|
|
|
enum mmpdu_reason_code reason);
|
2020-08-28 14:46:46 +02:00
|
|
|
|
|
|
|
bool ap_push_button(struct ap_state *ap);
|
2021-03-10 23:06:30 +01:00
|
|
|
void ap_update_beacon(struct ap_state *ap);
|