Lines Matching full:token
191 static int json_check_tree_state(struct json_token *token) in json_check_tree_state() argument
193 if (!token) in json_check_tree_state()
195 if (json_check_tree_state(token->child) < 0 || in json_check_tree_state()
196 json_check_tree_state(token->sibling) < 0) in json_check_tree_state()
198 if (token->state != JSON_COMPLETED) { in json_check_tree_state()
200 "JSON: Unexpected token state %d (name=%s type=%d)", in json_check_tree_state()
201 token->state, token->name ? token->name : "N/A", in json_check_tree_state()
202 token->type); in json_check_tree_state()
213 wpa_printf(MSG_DEBUG, "JSON: Maximum token limit exceeded"); in json_alloc_token()
222 struct json_token *root = NULL, *curr_token = NULL, *token = NULL; in json_parse() local
237 token = json_alloc_token(&tokens); in json_parse()
238 if (!token) in json_parse()
241 root = token; in json_parse()
243 token = curr_token; in json_parse()
248 token = curr_token; in json_parse()
260 token->type = *pos == '[' ? JSON_ARRAY : JSON_OBJECT; in json_parse()
261 token->state = JSON_STARTED; in json_parse()
262 token->child = json_alloc_token(&tokens); in json_parse()
263 if (!token->child) in json_parse()
265 curr_token = token->child; in json_parse()
266 curr_token->parent = token; in json_parse()
290 /* Remove pending child token since the in json_parse()
302 token = json_alloc_token(&tokens); in json_parse()
303 if (!token) { in json_parse()
307 token->type = JSON_STRING; in json_parse()
308 token->string = str; in json_parse()
309 token->state = JSON_COMPLETED; in json_parse()
374 token = json_alloc_token(&tokens); in json_parse()
375 if (!token) in json_parse()
377 curr_token = token; in json_parse()
426 token = json_alloc_token(&tokens); in json_parse()
427 if (!token) in json_parse()
429 token->type = JSON_NUMBER; in json_parse()
430 token->number = num; in json_parse()
431 token->state = JSON_COMPLETED; in json_parse()
463 root = token; in json_parse()
465 curr_token = token; in json_parse()
469 wpa_printf(MSG_DEBUG, "JSON: Incomplete token in the tree"); in json_parse()
495 struct json_token *token, *ret = NULL; in json_get_member() local
500 for (token = json->child; token; token = token->sibling) { in json_get_member()
501 if (token->name && os_strcmp(token->name, name) == 0) in json_get_member()
502 ret = token; in json_get_member()
511 struct json_token *token; in json_get_member_base64url() local
516 token = json_get_member(json, name); in json_get_member_base64url()
517 if (!token || token->type != JSON_STRING) in json_get_member_base64url()
519 buf = base64_url_decode(token->string, os_strlen(token->string), in json_get_member_base64url()
534 struct json_token *token; in json_get_member_base64() local
539 token = json_get_member(json, name); in json_get_member_base64()
540 if (!token || token->type != JSON_STRING) in json_get_member_base64()
542 buf = base64_decode(token->string, os_strlen(token->string), &buflen); in json_get_member_base64()
575 static void json_print_token(struct json_token *token, int depth, in json_print_token() argument
581 if (!token) in json_print_token()
585 depth, json_type_str(token->type), in json_print_token()
586 token->name ? token->name : ""); in json_print_token()
591 json_print_token(token->child, depth + 1, buf, buflen); in json_print_token()
592 json_print_token(token->sibling, depth, buf, buflen); in json_print_token()