Lines Matching refs:token

191 static int json_check_tree_state(struct json_token *token)
193 if (!token)
195 if (json_check_tree_state(token->child) < 0 ||
196 json_check_tree_state(token->sibling) < 0)
198 if (token->state != JSON_COMPLETED) {
200 "JSON: Unexpected token state %d (name=%s type=%d)",
201 token->state, token->name ? token->name : "N/A",
202 token->type);
213 wpa_printf(MSG_DEBUG, "JSON: Maximum token limit exceeded");
222 struct json_token *root = NULL, *curr_token = NULL, *token = NULL;
237 token = json_alloc_token(&tokens);
238 if (!token)
241 root = token;
243 token = curr_token;
248 token = curr_token;
260 token->type = *pos == '[' ? JSON_ARRAY : JSON_OBJECT;
261 token->state = JSON_STARTED;
262 token->child = json_alloc_token(&tokens);
263 if (!token->child)
265 curr_token = token->child;
266 curr_token->parent = token;
290 /* Remove pending child token since the
302 token = json_alloc_token(&tokens);
303 if (!token)
305 token->type = JSON_STRING;
306 token->string = str;
307 token->state = JSON_COMPLETED;
372 token = json_alloc_token(&tokens);
373 if (!token)
375 curr_token = token;
424 token = json_alloc_token(&tokens);
425 if (!token)
427 token->type = JSON_NUMBER;
428 token->number = num;
429 token->state = JSON_COMPLETED;
461 root = token;
463 curr_token = token;
467 wpa_printf(MSG_DEBUG, "JSON: Incomplete token in the tree");
493 struct json_token *token, *ret = NULL;
498 for (token = json->child; token; token = token->sibling) {
499 if (token->name && os_strcmp(token->name, name) == 0)
500 ret = token;
509 struct json_token *token;
514 token = json_get_member(json, name);
515 if (!token || token->type != JSON_STRING)
517 buf = base64_url_decode((const unsigned char *) token->string,
518 os_strlen(token->string), &buflen);
551 static void json_print_token(struct json_token *token, int depth,
557 if (!token)
561 depth, json_type_str(token->type),
562 token->name ? token->name : "");
567 json_print_token(token->child, depth + 1, buf, buflen);
568 json_print_token(token->sibling, depth, buf, buflen);