FST: Convert Boolean to C99 bool

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
master
Jouni Malinen 4 years ago committed by Jouni Malinen
parent 3dc69721e8
commit 37e3501bf7

@ -1772,7 +1772,7 @@ static void fst_hostapd_update_mb_ie_cb(void *ctx, const u8 *addr,
static const u8 * fst_hostapd_get_sta(struct fst_get_peer_ctx **get_ctx, static const u8 * fst_hostapd_get_sta(struct fst_get_peer_ctx **get_ctx,
Boolean mb_only) bool mb_only)
{ {
struct sta_info *s = (struct sta_info *) *get_ctx; struct sta_info *s = (struct sta_info *) *get_ctx;
@ -1794,7 +1794,7 @@ static const u8 * fst_hostapd_get_sta(struct fst_get_peer_ctx **get_ctx,
static const u8 * fst_hostapd_get_peer_first(void *ctx, static const u8 * fst_hostapd_get_peer_first(void *ctx,
struct fst_get_peer_ctx **get_ctx, struct fst_get_peer_ctx **get_ctx,
Boolean mb_only) bool mb_only)
{ {
struct hostapd_data *hapd = ctx; struct hostapd_data *hapd = ctx;
@ -1806,7 +1806,7 @@ static const u8 * fst_hostapd_get_peer_first(void *ctx,
static const u8 * fst_hostapd_get_peer_next(void *ctx, static const u8 * fst_hostapd_get_peer_next(void *ctx,
struct fst_get_peer_ctx **get_ctx, struct fst_get_peer_ctx **get_ctx,
Boolean mb_only) bool mb_only)
{ {
return fst_hostapd_get_sta(get_ctx, mb_only); return fst_hostapd_get_sta(get_ctx, mb_only);
} }

@ -20,7 +20,7 @@ struct dl_list fst_global_ctrls_list;
static void fst_ctrl_iface_notify_peer_state_change(struct fst_iface *iface, static void fst_ctrl_iface_notify_peer_state_change(struct fst_iface *iface,
Boolean connected, bool connected,
const u8 *peer_addr) const u8 *peer_addr)
{ {
union fst_event_extra extra; union fst_event_extra extra;
@ -42,7 +42,7 @@ struct fst_iface * fst_attach(const char *ifname, const u8 *own_addr,
struct fst_group *g; struct fst_group *g;
struct fst_group *group = NULL; struct fst_group *group = NULL;
struct fst_iface *iface = NULL; struct fst_iface *iface = NULL;
Boolean new_group = FALSE; bool new_group = false;
WPA_ASSERT(ifname != NULL); WPA_ASSERT(ifname != NULL);
WPA_ASSERT(iface_obj != NULL); WPA_ASSERT(iface_obj != NULL);
@ -62,7 +62,7 @@ struct fst_iface * fst_attach(const char *ifname, const u8 *own_addr,
cfg->group_id); cfg->group_id);
return NULL; return NULL;
} }
new_group = TRUE; new_group = true;
} }
iface = fst_iface_create(group, ifname, own_addr, iface_obj, cfg); iface = fst_iface_create(group, ifname, own_addr, iface_obj, cfg);
@ -166,7 +166,7 @@ void fst_global_del_ctrl(struct fst_ctrl_handle *h)
void fst_rx_action(struct fst_iface *iface, const struct ieee80211_mgmt *mgmt, void fst_rx_action(struct fst_iface *iface, const struct ieee80211_mgmt *mgmt,
size_t len) size_t len)
{ {
if (fst_iface_is_connected(iface, mgmt->sa, FALSE)) if (fst_iface_is_connected(iface, mgmt->sa, false))
fst_session_on_action_rx(iface, mgmt, len); fst_session_on_action_rx(iface, mgmt, len);
else else
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
@ -187,7 +187,7 @@ void fst_notify_peer_connected(struct fst_iface *iface, const u8 *addr)
fst_printf_iface(iface, MSG_DEBUG, MACSTR " became connected", fst_printf_iface(iface, MSG_DEBUG, MACSTR " became connected",
MAC2STR(addr)); MAC2STR(addr));
fst_ctrl_iface_notify_peer_state_change(iface, TRUE, addr); fst_ctrl_iface_notify_peer_state_change(iface, true, addr);
} }
@ -203,12 +203,12 @@ void fst_notify_peer_disconnected(struct fst_iface *iface, const u8 *addr)
fst_printf_iface(iface, MSG_DEBUG, MACSTR " became disconnected", fst_printf_iface(iface, MSG_DEBUG, MACSTR " became disconnected",
MAC2STR(addr)); MAC2STR(addr));
fst_ctrl_iface_notify_peer_state_change(iface, FALSE, addr); fst_ctrl_iface_notify_peer_state_change(iface, false, addr);
} }
Boolean fst_are_ifaces_aggregated(struct fst_iface *iface1, bool fst_are_ifaces_aggregated(struct fst_iface *iface1,
struct fst_iface *iface2) struct fst_iface *iface2)
{ {
return fst_iface_get_group(iface1) == fst_iface_get_group(iface2); return fst_iface_get_group(iface1) == fst_iface_get_group(iface2);
} }

@ -113,24 +113,24 @@ struct fst_wpa_obj {
* get_peer_first - Get MAC address of the 1st connected STA * get_peer_first - Get MAC address of the 1st connected STA
* @ctx: User context %ctx * @ctx: User context %ctx
* @get_ctx: Context to be used for %get_peer_next call * @get_ctx: Context to be used for %get_peer_next call
* @mb_only: %TRUE if only multi-band capable peer should be reported * @mb_only: %true if only multi-band capable peer should be reported
* Returns: Address of the 1st connected STA, %NULL if no STAs connected * Returns: Address of the 1st connected STA, %NULL if no STAs connected
*/ */
const u8 * (*get_peer_first)(void *ctx, const u8 * (*get_peer_first)(void *ctx,
struct fst_get_peer_ctx **get_ctx, struct fst_get_peer_ctx **get_ctx,
Boolean mb_only); bool mb_only);
/** /**
* get_peer_next - Get MAC address of the next connected STA * get_peer_next - Get MAC address of the next connected STA
* @ctx: User context %ctx * @ctx: User context %ctx
* @get_ctx: Context received from %get_peer_first or previous * @get_ctx: Context received from %get_peer_first or previous
* %get_peer_next call * %get_peer_next call
* @mb_only: %TRUE if only multi-band capable peer should be reported * @mb_only: %true if only multi-band capable peer should be reported
* Returns: Address of the next connected STA, %NULL if no more STAs * Returns: Address of the next connected STA, %NULL if no more STAs
* connected * connected
*/ */
const u8 * (*get_peer_next)(void *ctx, const u8 * (*get_peer_next)(void *ctx,
struct fst_get_peer_ctx **get_ctx, struct fst_get_peer_ctx **get_ctx,
Boolean mb_only); bool mb_only);
}; };
/** /**
@ -273,11 +273,11 @@ void fst_notify_peer_disconnected(struct fst_iface *iface, const u8 *addr);
* @iface1: 1st FST interface object * @iface1: 1st FST interface object
* @iface1: 2nd FST interface object * @iface1: 2nd FST interface object
* *
* Returns: %TRUE if the interfaces belong to the same FST group, * Returns: %true if the interfaces belong to the same FST group,
* %FALSE otherwise * %false otherwise
*/ */
Boolean fst_are_ifaces_aggregated(struct fst_iface *iface1, bool fst_are_ifaces_aggregated(struct fst_iface *iface1,
struct fst_iface *iface2); struct fst_iface *iface2);
/** /**
* fst_update_mac_addr - Notify FST about MAC address change * fst_update_mac_addr - Notify FST about MAC address change

@ -54,12 +54,12 @@ enum fst_initiator {
union fst_event_extra { union fst_event_extra {
struct fst_event_extra_iface_state { struct fst_event_extra_iface_state {
Boolean attached; bool attached;
char ifname[FST_MAX_INTERFACE_SIZE]; char ifname[FST_MAX_INTERFACE_SIZE];
char group_id[FST_MAX_GROUP_ID_SIZE]; char group_id[FST_MAX_GROUP_ID_SIZE];
} iface_state; /* for EVENT_FST_IFACE_STATE_CHANGED */ } iface_state; /* for EVENT_FST_IFACE_STATE_CHANGED */
struct fst_event_extra_peer_state { struct fst_event_extra_peer_state {
Boolean connected; bool connected;
char ifname[FST_MAX_INTERFACE_SIZE]; char ifname[FST_MAX_INTERFACE_SIZE];
u8 addr[ETH_ALEN]; u8 addr[ETH_ALEN];
} peer_state; /* for EVENT_PEER_STATE_CHANGED */ } peer_state; /* for EVENT_PEER_STATE_CHANGED */

@ -32,8 +32,8 @@ static struct fst_group * get_fst_group_by_id(const char *id)
/* notifications */ /* notifications */
static Boolean format_session_state_extra(const union fst_event_extra *extra, static bool format_session_state_extra(const union fst_event_extra *extra,
char *buffer, size_t size) char *buffer, size_t size)
{ {
int len; int len;
char reject_str[32] = FST_CTRL_PVAL_NONE; char reject_str[32] = FST_CTRL_PVAL_NONE;
@ -42,7 +42,7 @@ static Boolean format_session_state_extra(const union fst_event_extra *extra,
ss = &extra->session_state; ss = &extra->session_state;
if (ss->new_state != FST_SESSION_STATE_INITIAL) if (ss->new_state != FST_SESSION_STATE_INITIAL)
return TRUE; return true;
switch (ss->extra.to_initial.reason) { switch (ss->extra.to_initial.reason) {
case REASON_REJECT: case REASON_REJECT:
@ -183,10 +183,10 @@ static int session_get(const char *session_id, char *buf, size_t buflen)
return os_snprintf(buf, buflen, "FAIL\n"); return os_snprintf(buf, buflen, "FAIL\n");
} }
old_peer_addr = fst_session_get_peer_addr(s, TRUE); old_peer_addr = fst_session_get_peer_addr(s, true);
new_peer_addr = fst_session_get_peer_addr(s, FALSE); new_peer_addr = fst_session_get_peer_addr(s, false);
new_iface = fst_session_get_iface(s, FALSE); new_iface = fst_session_get_iface(s, false);
old_iface = fst_session_get_iface(s, TRUE); old_iface = fst_session_get_iface(s, true);
return os_snprintf(buf, buflen, return os_snprintf(buf, buflen,
FST_CSG_PNAME_OLD_PEER_ADDR "=" MACSTR "\n" FST_CSG_PNAME_OLD_PEER_ADDR "=" MACSTR "\n"
@ -227,13 +227,13 @@ static int session_set(const char *session_id, char *buf, size_t buflen)
p++; p++;
if (os_strncasecmp(p, FST_CSS_PNAME_OLD_IFNAME, q - p) == 0) { if (os_strncasecmp(p, FST_CSS_PNAME_OLD_IFNAME, q - p) == 0) {
ret = fst_session_set_str_ifname(s, q + 1, TRUE); ret = fst_session_set_str_ifname(s, q + 1, true);
} else if (os_strncasecmp(p, FST_CSS_PNAME_NEW_IFNAME, q - p) == 0) { } else if (os_strncasecmp(p, FST_CSS_PNAME_NEW_IFNAME, q - p) == 0) {
ret = fst_session_set_str_ifname(s, q + 1, FALSE); ret = fst_session_set_str_ifname(s, q + 1, false);
} else if (os_strncasecmp(p, FST_CSS_PNAME_OLD_PEER_ADDR, q - p) == 0) { } else if (os_strncasecmp(p, FST_CSS_PNAME_OLD_PEER_ADDR, q - p) == 0) {
ret = fst_session_set_str_peer_addr(s, q + 1, TRUE); ret = fst_session_set_str_peer_addr(s, q + 1, true);
} else if (os_strncasecmp(p, FST_CSS_PNAME_NEW_PEER_ADDR, q - p) == 0) { } else if (os_strncasecmp(p, FST_CSS_PNAME_NEW_PEER_ADDR, q - p) == 0) {
ret = fst_session_set_str_peer_addr(s, q + 1, FALSE); ret = fst_session_set_str_peer_addr(s, q + 1, false);
} else if (os_strncasecmp(p, FST_CSS_PNAME_LLT, q - p) == 0) { } else if (os_strncasecmp(p, FST_CSS_PNAME_LLT, q - p) == 0) {
ret = fst_session_set_str_llt(s, q + 1); ret = fst_session_set_str_llt(s, q + 1);
} else { } else {
@ -539,8 +539,8 @@ static int iface_peers(const char *group_id, char *buf, size_t buflen)
if (!found) if (!found)
return os_snprintf(buf, buflen, "FAIL\n"); return os_snprintf(buf, buflen, "FAIL\n");
addr = fst_iface_get_peer_first(f, &ctx, FALSE); addr = fst_iface_get_peer_first(f, &ctx, false);
for (; addr != NULL; addr = fst_iface_get_peer_next(f, &ctx, FALSE)) { for (; addr != NULL; addr = fst_iface_get_peer_next(f, &ctx, false)) {
int res; int res;
res = os_snprintf(buf + ret, buflen - ret, MACSTR "\n", res = os_snprintf(buf + ret, buflen - ret, MACSTR "\n",
@ -692,7 +692,7 @@ static int print_band(unsigned num, struct fst_iface *iface, const u8 *addr,
static void fst_ctrl_iface_on_iface_state_changed(struct fst_iface *i, static void fst_ctrl_iface_on_iface_state_changed(struct fst_iface *i,
Boolean attached) bool attached)
{ {
union fst_event_extra extra; union fst_event_extra extra;
@ -710,14 +710,14 @@ static void fst_ctrl_iface_on_iface_state_changed(struct fst_iface *i,
static int fst_ctrl_iface_on_iface_added(struct fst_iface *i) static int fst_ctrl_iface_on_iface_added(struct fst_iface *i)
{ {
fst_ctrl_iface_on_iface_state_changed(i, TRUE); fst_ctrl_iface_on_iface_state_changed(i, true);
return 0; return 0;
} }
static void fst_ctrl_iface_on_iface_removed(struct fst_iface *i) static void fst_ctrl_iface_on_iface_removed(struct fst_iface *i)
{ {
fst_ctrl_iface_on_iface_state_changed(i, FALSE); fst_ctrl_iface_on_iface_state_changed(i, false);
} }
@ -749,7 +749,7 @@ int fst_ctrl_iface_mb_info(const u8 *addr, char *buf, size_t buflen)
foreach_fst_group(g) { foreach_fst_group(g) {
foreach_fst_group_iface(g, f) { foreach_fst_group_iface(g, f) {
if (fst_iface_is_connected(f, addr, TRUE)) { if (fst_iface_is_connected(f, addr, true)) {
ret += print_band(num++, f, addr, ret += print_band(num++, f, addr,
buf + ret, buflen - ret); buf + ret, buflen - ret);
} }
@ -789,7 +789,7 @@ int fst_ctrl_iface_receive(const char *cmd, char *reply, size_t reply_size)
const struct fst_command *c; const struct fst_command *c;
const char *p; const char *p;
const char *temp; const char *temp;
Boolean non_spaces_found; bool non_spaces_found;
for (c = commands; c->name; c++) { for (c = commands; c->name; c++) {
if (os_strncasecmp(cmd, c->name, os_strlen(c->name)) != 0) if (os_strncasecmp(cmd, c->name, os_strlen(c->name)) != 0)
@ -800,10 +800,10 @@ int fst_ctrl_iface_receive(const char *cmd, char *reply, size_t reply_size)
return os_snprintf(reply, reply_size, "FAIL\n"); return os_snprintf(reply, reply_size, "FAIL\n");
p++; p++;
temp = p; temp = p;
non_spaces_found = FALSE; non_spaces_found = false;
while (*temp) { while (*temp) {
if (!isspace(*temp)) { if (!isspace(*temp)) {
non_spaces_found = TRUE; non_spaces_found = true;
break; break;
} }
temp++; temp++;
@ -818,18 +818,18 @@ int fst_ctrl_iface_receive(const char *cmd, char *reply, size_t reply_size)
} }
int fst_read_next_int_param(const char *params, Boolean *valid, char **endp) int fst_read_next_int_param(const char *params, bool *valid, char **endp)
{ {
int ret = -1; int ret = -1;
const char *curp; const char *curp;
*valid = FALSE; *valid = false;
*endp = (char *) params; *endp = (char *) params;
curp = params; curp = params;
if (*curp) { if (*curp) {
ret = (int) strtol(curp, endp, 0); ret = (int) strtol(curp, endp, 0);
if (!**endp || isspace(**endp)) if (!**endp || isspace(**endp))
*valid = TRUE; *valid = true;
} }
return ret; return ret;
@ -887,7 +887,7 @@ int fst_parse_attach_command(const char *cmd, char *ifname, size_t ifname_size,
{ {
char *pos; char *pos;
char *endp; char *endp;
Boolean is_valid; bool is_valid;
int val; int val;
if (fst_read_next_text_param(cmd, ifname, ifname_size, &endp) || if (fst_read_next_text_param(cmd, ifname, ifname_size, &endp) ||

@ -30,7 +30,7 @@ fst_ctrl_iface_mb_info(const u8 *addr, char *buf, size_t buflen)
#endif /* CONFIG_FST */ #endif /* CONFIG_FST */
int fst_read_next_int_param(const char *params, Boolean *valid, char **endp); int fst_read_next_int_param(const char *params, bool *valid, char **endp);
int fst_read_next_text_param(const char *params, char *buf, size_t buflen, int fst_read_next_text_param(const char *params, char *buf, size_t buflen,
char **endp); char **endp);
int fst_read_peer_addr(const char *mac, u8 *peer_addr); int fst_read_peer_addr(const char *mac, u8 *peer_addr);

@ -305,7 +305,7 @@ fst_group_get_peer_other_connection_1(struct fst_iface *iface,
if (other_iface == iface || if (other_iface == iface ||
band_id != fst_iface_get_band_id(other_iface)) band_id != fst_iface_get_band_id(other_iface))
continue; continue;
if (fst_iface_is_connected(other_iface, tmp_peer_addr, FALSE)) { if (fst_iface_is_connected(other_iface, tmp_peer_addr, false)) {
os_memcpy(other_peer_addr, tmp_peer_addr, ETH_ALEN); os_memcpy(other_peer_addr, tmp_peer_addr, ETH_ALEN);
return other_iface; return other_iface;
} }
@ -347,10 +347,10 @@ fst_group_get_peer_other_connection_2(struct fst_iface *iface,
band_id != fst_iface_get_band_id(other_iface)) band_id != fst_iface_get_band_id(other_iface))
continue; continue;
cur_peer_addr = fst_iface_get_peer_first(other_iface, &ctx, cur_peer_addr = fst_iface_get_peer_first(other_iface, &ctx,
TRUE); true);
for (; cur_peer_addr; for (; cur_peer_addr;
cur_peer_addr = fst_iface_get_peer_next(other_iface, &ctx, cur_peer_addr = fst_iface_get_peer_next(other_iface, &ctx,
TRUE)) { true)) {
cur_mbie = fst_iface_get_peer_mb_ie(other_iface, cur_mbie = fst_iface_get_peer_mb_ie(other_iface,
cur_peer_addr); cur_peer_addr);
if (!cur_mbie) if (!cur_mbie)
@ -493,9 +493,9 @@ void fst_group_delete(struct fst_group *group)
} }
Boolean fst_group_delete_if_empty(struct fst_group *group) bool fst_group_delete_if_empty(struct fst_group *group)
{ {
Boolean is_empty = !fst_group_has_ifaces(group) && bool is_empty = !fst_group_has_ifaces(group) &&
!fst_session_global_get_first_by_group(group); !fst_session_global_get_first_by_group(group);
if (is_empty) if (is_empty)

@ -29,7 +29,7 @@ void fst_group_delete(struct fst_group *g);
void fst_group_update_ie(struct fst_group *g); void fst_group_update_ie(struct fst_group *g);
static inline Boolean fst_group_has_ifaces(struct fst_group *g) static inline bool fst_group_has_ifaces(struct fst_group *g)
{ {
return !dl_list_empty(&g->ifaces); return !dl_list_empty(&g->ifaces);
} }
@ -44,7 +44,7 @@ static inline const char * fst_group_get_id(struct fst_group *g)
return g->group_id; return g->group_id;
} }
Boolean fst_group_delete_if_empty(struct fst_group *group); bool fst_group_delete_if_empty(struct fst_group *group);
struct fst_iface * fst_group_get_iface_by_name(struct fst_group *g, struct fst_iface * fst_group_get_iface_by_name(struct fst_group *g,
const char *ifname); const char *ifname);
struct fst_iface * struct fst_iface *

@ -49,17 +49,17 @@ void fst_iface_delete(struct fst_iface *i)
} }
Boolean fst_iface_is_connected(struct fst_iface *iface, const u8 *addr, bool fst_iface_is_connected(struct fst_iface *iface, const u8 *addr,
Boolean mb_only) bool mb_only)
{ {
struct fst_get_peer_ctx *ctx; struct fst_get_peer_ctx *ctx;
const u8 *a = fst_iface_get_peer_first(iface, &ctx, mb_only); const u8 *a = fst_iface_get_peer_first(iface, &ctx, mb_only);
for (; a != NULL; a = fst_iface_get_peer_next(iface, &ctx, mb_only)) for (; a != NULL; a = fst_iface_get_peer_next(iface, &ctx, mb_only))
if (os_memcmp(addr, a, ETH_ALEN) == 0) if (os_memcmp(addr, a, ETH_ALEN) == 0)
return TRUE; return true;
return FALSE; return false;
} }

@ -111,20 +111,20 @@ static inline void fst_iface_update_mb_ie(struct fst_iface *i,
static inline const u8 * fst_iface_get_peer_first(struct fst_iface *i, static inline const u8 * fst_iface_get_peer_first(struct fst_iface *i,
struct fst_get_peer_ctx **ctx, struct fst_get_peer_ctx **ctx,
Boolean mb_only) bool mb_only)
{ {
return i->iface_obj.get_peer_first(i->iface_obj.ctx, ctx, mb_only); return i->iface_obj.get_peer_first(i->iface_obj.ctx, ctx, mb_only);
} }
static inline const u8 * fst_iface_get_peer_next(struct fst_iface *i, static inline const u8 * fst_iface_get_peer_next(struct fst_iface *i,
struct fst_get_peer_ctx **ctx, struct fst_get_peer_ctx **ctx,
Boolean mb_only) bool mb_only)
{ {
return i->iface_obj.get_peer_next(i->iface_obj.ctx, ctx, mb_only); return i->iface_obj.get_peer_next(i->iface_obj.ctx, ctx, mb_only);
} }
Boolean fst_iface_is_connected(struct fst_iface *iface, const u8 *addr, bool fst_iface_is_connected(struct fst_iface *iface, const u8 *addr,
Boolean mb_only); bool mb_only);
void fst_iface_attach_mbie(struct fst_iface *i, struct wpabuf *mbie); void fst_iface_attach_mbie(struct fst_iface *i, struct wpabuf *mbie);
enum mb_band_id fst_iface_get_band_id(struct fst_iface *i); enum mb_band_id fst_iface_get_band_id(struct fst_iface *i);

@ -71,7 +71,7 @@ struct fst_session {
* specific session object */ * specific session object */
struct fst_group *group; struct fst_group *group;
enum fst_session_state state; enum fst_session_state state;
Boolean stt_armed; bool stt_armed;
}; };
static struct dl_list global_sessions_list; static struct dl_list global_sessions_list;
@ -145,12 +145,12 @@ static u32 fst_find_free_session_id(void)
struct fst_session *s; struct fst_session *s;
for (i = 0; i < (u32) -1; i++) { for (i = 0; i < (u32) -1; i++) {
Boolean in_use = FALSE; bool in_use = false;
foreach_fst_session(s) { foreach_fst_session(s) {
if (s->id == global_session_id) { if (s->id == global_session_id) {
fst_session_global_inc_id(); fst_session_global_inc_id();
in_use = TRUE; in_use = true;
break; break;
} }
} }
@ -184,7 +184,7 @@ static void fst_session_stt_arm(struct fst_session *s)
/* Action frames sometimes get delayed. Use relaxed timeout (2*) */ /* Action frames sometimes get delayed. Use relaxed timeout (2*) */
eloop_register_timeout(0, 2 * TU_TO_US(FST_DEFAULT_SESSION_TIMEOUT_TU), eloop_register_timeout(0, 2 * TU_TO_US(FST_DEFAULT_SESSION_TIMEOUT_TU),
fst_session_timeout_handler, NULL, s); fst_session_timeout_handler, NULL, s);
s->stt_armed = TRUE; s->stt_armed = true;
} }
@ -192,12 +192,12 @@ static void fst_session_stt_disarm(struct fst_session *s)
{ {
if (s->stt_armed) { if (s->stt_armed) {
eloop_cancel_timeout(fst_session_timeout_handler, NULL, s); eloop_cancel_timeout(fst_session_timeout_handler, NULL, s);
s->stt_armed = FALSE; s->stt_armed = false;
} }
} }
static Boolean fst_session_is_in_transition(struct fst_session *s) static bool fst_session_is_in_transition(struct fst_session *s)
{ {
/* See spec, 10.32.2.2 Transitioning between states */ /* See spec, 10.32.2.2 Transitioning between states */
return s->stt_armed; return s->stt_armed;
@ -267,7 +267,7 @@ static void fst_session_reset_ex(struct fst_session *s, enum fst_reason reason)
} }
static int fst_session_send_action(struct fst_session *s, Boolean old_iface, static int fst_session_send_action(struct fst_session *s, bool old_iface,
const void *payload, size_t size, const void *payload, size_t size,
const struct wpabuf *extra_buf) const struct wpabuf *extra_buf)
{ {
@ -344,11 +344,11 @@ static int fst_session_send_tear_down(struct fst_session *s)
td.action = FST_ACTION_TEAR_DOWN; td.action = FST_ACTION_TEAR_DOWN;
td.fsts_id = host_to_le32(s->data.fsts_id); td.fsts_id = host_to_le32(s->data.fsts_id);
res = fst_session_send_action(s, TRUE, &td, sizeof(td), NULL); res = fst_session_send_action(s, true, &td, sizeof(td), NULL);
if (!res) if (!res)
fst_printf_sframe(s, TRUE, MSG_INFO, "FST TearDown sent"); fst_printf_sframe(s, true, MSG_INFO, "FST TearDown sent");
else else
fst_printf_sframe(s, TRUE, MSG_ERROR, fst_printf_sframe(s, true, MSG_ERROR,
"failed to send FST TearDown"); "failed to send FST TearDown");
return res; return res;
@ -481,10 +481,10 @@ static void fst_session_handle_setup_request(struct fst_iface *iface,
return; return;
} }
fst_session_set_iface(s, iface, TRUE); fst_session_set_iface(s, iface, true);
fst_session_set_peer_addr(s, mgmt->sa, TRUE); fst_session_set_peer_addr(s, mgmt->sa, true);
fst_session_set_iface(s, new_iface, FALSE); fst_session_set_iface(s, new_iface, false);
fst_session_set_peer_addr(s, new_iface_peer_addr, FALSE); fst_session_set_peer_addr(s, new_iface_peer_addr, false);
fst_session_set_llt(s, FST_LLT_VAL_TO_MS(le_to_host32(req->llt))); fst_session_set_llt(s, FST_LLT_VAL_TO_MS(le_to_host32(req->llt)));
s->data.pending_setup_req_dlgt = req->dialog_token; s->data.pending_setup_req_dlgt = req->dialog_token;
s->data.fsts_id = le_to_host32(req->stie.fsts_id); s->data.fsts_id = le_to_host32(req->stie.fsts_id);
@ -687,8 +687,8 @@ static void fst_session_handle_ack_request(struct fst_session *s,
res.dialog_token = req->dialog_token; res.dialog_token = req->dialog_token;
res.fsts_id = req->fsts_id; res.fsts_id = req->fsts_id;
if (!fst_session_send_action(s, FALSE, &res, sizeof(res), NULL)) { if (!fst_session_send_action(s, false, &res, sizeof(res), NULL)) {
fst_printf_sframe(s, FALSE, MSG_INFO, "FST Ack Response sent"); fst_printf_sframe(s, false, MSG_INFO, "FST Ack Response sent");
fst_session_stt_disarm(s); fst_session_stt_disarm(s);
fst_session_set_state(s, FST_SESSION_STATE_TRANSITION_DONE, fst_session_set_state(s, FST_SESSION_STATE_TRANSITION_DONE,
NULL); NULL);
@ -785,7 +785,7 @@ struct fst_session * fst_session_create(struct fst_group *g)
void fst_session_set_iface(struct fst_session *s, struct fst_iface *iface, void fst_session_set_iface(struct fst_session *s, struct fst_iface *iface,
Boolean is_old) bool is_old)
{ {
if (is_old) if (is_old)
s->data.old_iface = iface; s->data.old_iface = iface;
@ -802,7 +802,7 @@ void fst_session_set_llt(struct fst_session *s, u32 llt)
void fst_session_set_peer_addr(struct fst_session *s, const u8 *addr, void fst_session_set_peer_addr(struct fst_session *s, const u8 *addr,
Boolean is_old) bool is_old)
{ {
u8 *a = is_old ? s->data.old_peer_addr : s->data.new_peer_addr; u8 *a = is_old ? s->data.old_peer_addr : s->data.new_peer_addr;
@ -850,14 +850,14 @@ int fst_session_initiate_setup(struct fst_session *s)
} }
if (!fst_iface_is_connected(s->data.old_iface, s->data.old_peer_addr, if (!fst_iface_is_connected(s->data.old_iface, s->data.old_peer_addr,
FALSE)) { false)) {
fst_printf_session(s, MSG_ERROR, fst_printf_session(s, MSG_ERROR,
"The preset old peer address is not connected"); "The preset old peer address is not connected");
return -EINVAL; return -EINVAL;
} }
if (!fst_iface_is_connected(s->data.new_iface, s->data.new_peer_addr, if (!fst_iface_is_connected(s->data.new_iface, s->data.new_peer_addr,
FALSE)) { false)) {
fst_printf_session(s, MSG_ERROR, fst_printf_session(s, MSG_ERROR,
"The preset new peer address is not connected"); "The preset new peer address is not connected");
return -EINVAL; return -EINVAL;
@ -905,12 +905,12 @@ int fst_session_initiate_setup(struct fst_session *s)
req.stie.old_band_op = 1; req.stie.old_band_op = 1;
req.stie.old_band_setup = 0; req.stie.old_band_setup = 0;
res = fst_session_send_action(s, TRUE, &req, sizeof(req), res = fst_session_send_action(s, true, &req, sizeof(req),
fst_iface_get_mbie(s->data.old_iface)); fst_iface_get_mbie(s->data.old_iface));
if (!res) { if (!res) {
s->data.fsts_id = fsts_id; s->data.fsts_id = fsts_id;
s->data.pending_setup_req_dlgt = dialog_token; s->data.pending_setup_req_dlgt = dialog_token;
fst_printf_sframe(s, TRUE, MSG_INFO, "FST Setup Request sent"); fst_printf_sframe(s, true, MSG_INFO, "FST Setup Request sent");
fst_session_set_state(s, FST_SESSION_STATE_SETUP_COMPLETION, fst_session_set_state(s, FST_SESSION_STATE_SETUP_COMPLETION,
NULL); NULL);
@ -955,7 +955,7 @@ int fst_session_respond(struct fst_session *s, u8 status_code)
} }
if (!fst_iface_is_connected(s->data.old_iface, if (!fst_iface_is_connected(s->data.old_iface,
s->data.old_peer_addr, FALSE)) { s->data.old_peer_addr, false)) {
fst_printf_session(s, MSG_ERROR, fst_printf_session(s, MSG_ERROR,
"The preset peer address is not in the peer list"); "The preset peer address is not in the peer list");
return -EINVAL; return -EINVAL;
@ -1000,15 +1000,15 @@ int fst_session_respond(struct fst_session *s, u8 status_code)
status_code); status_code);
} }
if (fst_session_send_action(s, TRUE, &res, sizeof(res), if (fst_session_send_action(s, true, &res, sizeof(res),
fst_iface_get_mbie(s->data.old_iface))) { fst_iface_get_mbie(s->data.old_iface))) {
fst_printf_sframe(s, TRUE, MSG_ERROR, fst_printf_sframe(s, true, MSG_ERROR,
"cannot send FST Setup Response with code %d", "cannot send FST Setup Response with code %d",
status_code); status_code);
return -EINVAL; return -EINVAL;
} }
fst_printf_sframe(s, TRUE, MSG_INFO, "FST Setup Response sent"); fst_printf_sframe(s, true, MSG_INFO, "FST Setup Response sent");
if (status_code != WLAN_STATUS_SUCCESS) { if (status_code != WLAN_STATUS_SUCCESS) {
union fst_session_state_switch_extra evext = { union fst_session_state_switch_extra evext = {
@ -1053,14 +1053,14 @@ int fst_session_initiate_switch(struct fst_session *s)
req.dialog_token = dialog_token; req.dialog_token = dialog_token;
req.fsts_id = host_to_le32(s->data.fsts_id); req.fsts_id = host_to_le32(s->data.fsts_id);
res = fst_session_send_action(s, FALSE, &req, sizeof(req), NULL); res = fst_session_send_action(s, false, &req, sizeof(req), NULL);
if (!res) { if (!res) {
fst_printf_sframe(s, FALSE, MSG_INFO, "FST Ack Request sent"); fst_printf_sframe(s, false, MSG_INFO, "FST Ack Request sent");
fst_session_set_state(s, FST_SESSION_STATE_TRANSITION_DONE, fst_session_set_state(s, FST_SESSION_STATE_TRANSITION_DONE,
NULL); NULL);
fst_session_stt_arm(s); fst_session_stt_arm(s);
} else { } else {
fst_printf_sframe(s, FALSE, MSG_ERROR, fst_printf_sframe(s, false, MSG_ERROR,
"Cannot send FST Ack Request"); "Cannot send FST Ack Request");
} }
@ -1091,7 +1091,7 @@ void fst_session_handle_action(struct fst_session *s,
break; break;
case FST_ACTION_ON_CHANNEL_TUNNEL: case FST_ACTION_ON_CHANNEL_TUNNEL:
default: default:
fst_printf_sframe(s, FALSE, MSG_ERROR, fst_printf_sframe(s, false, MSG_ERROR,
"Unsupported FST Action frame"); "Unsupported FST Action frame");
break; break;
} }
@ -1137,7 +1137,7 @@ struct fst_group * fst_session_get_group(struct fst_session *s)
} }
struct fst_iface * fst_session_get_iface(struct fst_session *s, Boolean is_old) struct fst_iface * fst_session_get_iface(struct fst_session *s, bool is_old)
{ {
return is_old ? s->data.old_iface : s->data.new_iface; return is_old ? s->data.old_iface : s->data.new_iface;
} }
@ -1149,7 +1149,7 @@ u32 fst_session_get_id(struct fst_session *s)
} }
const u8 * fst_session_get_peer_addr(struct fst_session *s, Boolean is_old) const u8 * fst_session_get_peer_addr(struct fst_session *s, bool is_old)
{ {
return is_old ? s->data.old_peer_addr : s->data.new_peer_addr; return is_old ? s->data.old_peer_addr : s->data.new_peer_addr;
} }
@ -1232,7 +1232,7 @@ void fst_session_on_action_rx(struct fst_iface *iface,
int fst_session_set_str_ifname(struct fst_session *s, const char *ifname, int fst_session_set_str_ifname(struct fst_session *s, const char *ifname,
Boolean is_old) bool is_old)
{ {
struct fst_group *g = fst_session_get_group(s); struct fst_group *g = fst_session_get_group(s);
struct fst_iface *i; struct fst_iface *i;
@ -1252,7 +1252,7 @@ int fst_session_set_str_ifname(struct fst_session *s, const char *ifname,
int fst_session_set_str_peer_addr(struct fst_session *s, const char *mac, int fst_session_set_str_peer_addr(struct fst_session *s, const char *mac,
Boolean is_old) bool is_old)
{ {
u8 peer_addr[ETH_ALEN]; u8 peer_addr[ETH_ALEN];
int res = fst_read_peer_addr(mac, peer_addr); int res = fst_read_peer_addr(mac, peer_addr);
@ -1330,11 +1330,11 @@ static int get_group_fill_session(struct fst_group **g, struct fst_session *s)
if (!s->data.old_iface) if (!s->data.old_iface)
return -EINVAL; return -EINVAL;
old_addr = fst_iface_get_peer_first(s->data.old_iface, &ctx, TRUE); old_addr = fst_iface_get_peer_first(s->data.old_iface, &ctx, true);
if (!old_addr) if (!old_addr)
return -EINVAL; return -EINVAL;
new_addr = fst_iface_get_peer_first(s->data.new_iface, &ctx, TRUE); new_addr = fst_iface_get_peer_first(s->data.new_iface, &ctx, true);
if (!new_addr) if (!new_addr)
return -EINVAL; return -EINVAL;
@ -1350,7 +1350,7 @@ static int get_group_fill_session(struct fst_group **g, struct fst_session *s)
int fst_test_req_send_fst_request(const char *params) int fst_test_req_send_fst_request(const char *params)
{ {
int fsts_id; int fsts_id;
Boolean is_valid; bool is_valid;
char *endp; char *endp;
struct fst_setup_req req; struct fst_setup_req req;
struct fst_session s; struct fst_session s;
@ -1394,7 +1394,7 @@ int fst_test_req_send_fst_request(const char *params)
req.stie.new_band_id = req.stie.old_band_id; req.stie.new_band_id = req.stie.old_band_id;
} }
return fst_session_send_action(&s, TRUE, &req, sizeof(req), return fst_session_send_action(&s, true, &req, sizeof(req),
s.data.old_iface->mb_ie); s.data.old_iface->mb_ie);
} }
@ -1402,7 +1402,7 @@ int fst_test_req_send_fst_request(const char *params)
int fst_test_req_send_fst_response(const char *params) int fst_test_req_send_fst_response(const char *params)
{ {
int fsts_id; int fsts_id;
Boolean is_valid; bool is_valid;
char *endp; char *endp;
struct fst_setup_res res; struct fst_setup_res res;
struct fst_session s; struct fst_session s;
@ -1437,7 +1437,7 @@ int fst_test_req_send_fst_response(const char *params)
* If some session has just received an FST Setup Request, then * If some session has just received an FST Setup Request, then
* use the correct dialog token copied from this request. * use the correct dialog token copied from this request.
*/ */
_s = fst_find_session_in_progress(fst_session_get_peer_addr(&s, TRUE), _s = fst_find_session_in_progress(fst_session_get_peer_addr(&s, true),
g); g);
res.dialog_token = (_s && fst_session_is_ready_pending(_s)) ? res.dialog_token = (_s && fst_session_is_ready_pending(_s)) ?
_s->data.pending_setup_req_dlgt : g->dialog_token; _s->data.pending_setup_req_dlgt : g->dialog_token;
@ -1469,7 +1469,7 @@ int fst_test_req_send_fst_response(const char *params)
res.stie.new_band_id = res.stie.old_band_id; res.stie.new_band_id = res.stie.old_band_id;
} }
return fst_session_send_action(&s, TRUE, &res, sizeof(res), return fst_session_send_action(&s, true, &res, sizeof(res),
s.data.old_iface->mb_ie); s.data.old_iface->mb_ie);
} }
@ -1477,7 +1477,7 @@ int fst_test_req_send_fst_response(const char *params)
int fst_test_req_send_ack_request(const char *params) int fst_test_req_send_ack_request(const char *params)
{ {
int fsts_id; int fsts_id;
Boolean is_valid; bool is_valid;
char *endp; char *endp;
struct fst_ack_req req; struct fst_ack_req req;
struct fst_session s; struct fst_session s;
@ -1498,14 +1498,14 @@ int fst_test_req_send_ack_request(const char *params)
req.dialog_token = g->dialog_token; req.dialog_token = g->dialog_token;
req.fsts_id = host_to_le32(fsts_id); req.fsts_id = host_to_le32(fsts_id);
return fst_session_send_action(&s, FALSE, &req, sizeof(req), NULL); return fst_session_send_action(&s, false, &req, sizeof(req), NULL);
} }
int fst_test_req_send_ack_response(const char *params) int fst_test_req_send_ack_response(const char *params)
{ {
int fsts_id; int fsts_id;
Boolean is_valid; bool is_valid;
char *endp; char *endp;
struct fst_ack_res res; struct fst_ack_res res;
struct fst_session s; struct fst_session s;
@ -1526,14 +1526,14 @@ int fst_test_req_send_ack_response(const char *params)
res.dialog_token = g->dialog_token; res.dialog_token = g->dialog_token;
res.fsts_id = host_to_le32(fsts_id); res.fsts_id = host_to_le32(fsts_id);
return fst_session_send_action(&s, FALSE, &res, sizeof(res), NULL); return fst_session_send_action(&s, false, &res, sizeof(res), NULL);
} }
int fst_test_req_send_tear_down(const char *params) int fst_test_req_send_tear_down(const char *params)
{ {
int fsts_id; int fsts_id;
Boolean is_valid; bool is_valid;
char *endp; char *endp;
struct fst_tear_down td; struct fst_tear_down td;
struct fst_session s; struct fst_session s;
@ -1553,14 +1553,14 @@ int fst_test_req_send_tear_down(const char *params)
td.action = FST_ACTION_TEAR_DOWN; td.action = FST_ACTION_TEAR_DOWN;
td.fsts_id = host_to_le32(fsts_id); td.fsts_id = host_to_le32(fsts_id);
return fst_session_send_action(&s, TRUE, &td, sizeof(td), NULL); return fst_session_send_action(&s, true, &td, sizeof(td), NULL);
} }
u32 fst_test_req_get_fsts_id(const char *params) u32 fst_test_req_get_fsts_id(const char *params)
{ {
int sid; int sid;
Boolean is_valid; bool is_valid;
char *endp; char *endp;
struct fst_session *s; struct fst_session *s;

@ -24,10 +24,10 @@ fst_session_global_get_first_by_group(struct fst_group *g);
struct fst_session * fst_session_create(struct fst_group *g); struct fst_session * fst_session_create(struct fst_group *g);
void fst_session_set_iface(struct fst_session *s, struct fst_iface *iface, void fst_session_set_iface(struct fst_session *s, struct fst_iface *iface,
Boolean is_old); bool is_old);
void fst_session_set_llt(struct fst_session *s, u32 llt); void fst_session_set_llt(struct fst_session *s, u32 llt);
void fst_session_set_peer_addr(struct fst_session *s, const u8 *addr, void fst_session_set_peer_addr(struct fst_session *s, const u8 *addr,
Boolean is_old); bool is_old);
int fst_session_initiate_setup(struct fst_session *s); int fst_session_initiate_setup(struct fst_session *s);
int fst_session_respond(struct fst_session *s, u8 status_code); int fst_session_respond(struct fst_session *s, u8 status_code);
int fst_session_initiate_switch(struct fst_session *s); int fst_session_initiate_switch(struct fst_session *s);
@ -39,8 +39,8 @@ void fst_session_reset(struct fst_session *s);
void fst_session_delete(struct fst_session *s); void fst_session_delete(struct fst_session *s);
struct fst_group * fst_session_get_group(struct fst_session *s); struct fst_group * fst_session_get_group(struct fst_session *s);
struct fst_iface * fst_session_get_iface(struct fst_session *s, Boolean is_old); struct fst_iface * fst_session_get_iface(struct fst_session *s, bool is_old);
const u8 * fst_session_get_peer_addr(struct fst_session *s, Boolean is_old); const u8 * fst_session_get_peer_addr(struct fst_session *s, bool is_old);
u32 fst_session_get_id(struct fst_session *s); u32 fst_session_get_id(struct fst_session *s);
u32 fst_session_get_llt(struct fst_session *s); u32 fst_session_get_llt(struct fst_session *s);
enum fst_session_state fst_session_get_state(struct fst_session *s); enum fst_session_state fst_session_get_state(struct fst_session *s);
@ -57,9 +57,9 @@ void fst_session_on_action_rx(struct fst_iface *iface,
int fst_session_set_str_ifname(struct fst_session *s, const char *ifname, int fst_session_set_str_ifname(struct fst_session *s, const char *ifname,
Boolean is_old); bool is_old);
int fst_session_set_str_peer_addr(struct fst_session *s, const char *mac, int fst_session_set_str_peer_addr(struct fst_session *s, const char *mac,
Boolean is_old); bool is_old);
int fst_session_set_str_llt(struct fst_session *s, const char *llt_str); int fst_session_set_str_llt(struct fst_session *s, const char *llt_str);
#ifdef CONFIG_FST_TEST #ifdef CONFIG_FST_TEST

@ -5475,7 +5475,7 @@ static void wpas_fst_update_mb_ie_cb(void *ctx, const u8 *addr,
static const u8 * wpas_fst_get_peer_first(void *ctx, static const u8 * wpas_fst_get_peer_first(void *ctx,
struct fst_get_peer_ctx **get_ctx, struct fst_get_peer_ctx **get_ctx,
Boolean mb_only) bool mb_only)
{ {
struct wpa_supplicant *wpa_s = ctx; struct wpa_supplicant *wpa_s = ctx;
@ -5489,7 +5489,7 @@ static const u8 * wpas_fst_get_peer_first(void *ctx,
static const u8 * wpas_fst_get_peer_next(void *ctx, static const u8 * wpas_fst_get_peer_next(void *ctx,
struct fst_get_peer_ctx **get_ctx, struct fst_get_peer_ctx **get_ctx,
Boolean mb_only) bool mb_only)
{ {
return NULL; return NULL;
} }

Loading…
Cancel
Save