148 bool child_matched =
false;
157 if (!json_object_is_type(
object, json_type_object))
return 0;
158 if (!json_object_object_get_ex(
object, node->
selector->field, &
object))
return 0;
166 for (selector = node->
selector; selector; selector = selector->
next)
switch (selector->
type) {
169 struct array_list *array_obj;
173 if (!json_object_is_type(
object, json_type_array))
return 0;
174 array_obj = json_object_get_array(
object);
175 if ((selector->slice[0] < 0) ||
176 (selector->slice[0] >= (int32_t)(array_obj->length & INT32_MAX)))
continue;
179 array_obj->array[selector->slice[0]], node->
next);
180 if (ret < 0)
return ret;
181 if (ret == 1) child_matched =
true;
187 struct array_list *array_obj;
188 int32_t start, end, step, i;
190 if (!json_object_is_type(
object, json_type_array))
return 0;
191 array_obj = json_object_get_array(
object);
197 step = selector->slice[2];
200 start = selector->slice[0];
202 (int32_t)((array_obj->length - 1) & INT32_MAX) : 0;
203 else if (start < 0) start = array_obj->length + start;
205 end = selector->slice[1];
207 -1 : (int32_t)((array_obj->length - 1) & INT32_MAX);
208 else if (end < 0) end = array_obj->length + end;
213 if (step < 0)
for (i = start; (i > end) && (i >= 0); i += step) {
214 fr_assert((i >= 0) && (i < (int32_t)(array_obj->length & INT32_MAX)));
216 array_obj->array[i], node->
next);
217 if (ret < 0)
return ret;
218 if (ret == 1) child_matched =
true;
222 }
else for (i = start; (i < end) && (i < (int32_t)(array_obj->length & INT32_MAX)); i += step) {
223 fr_assert((i >= 0) && (i < (int32_t)(array_obj->length & INT32_MAX)));
225 array_obj->array[i], node->
next);
226 if (ret < 0)
return ret;
227 if (ret == 1) child_matched =
true;
236 return child_matched ? 1 : 0;
245 if (json_object_is_type(
object, json_type_array)) {
246 struct array_list *array_obj;
248 array_obj = json_object_get_array(
object);
249 for (i = 0; i < (int32_t)(array_obj->length & INT32_MAX); i++) {
251 array_obj->array[i], node->
next);
252 if (ret < 0)
return ret;
253 if (ret == 1) child_matched =
true;
255 return child_matched ? 1 : 0;
256 }
else if (json_object_is_type(
object, json_type_object)) {
257 json_object_object_foreach(
object, field_name, field_value) {
264 field_value, node->
next);
265 if (ret < 0)
return ret;
266 if (ret == 1) child_matched =
true;
268 return child_matched ? 1 : 0;
279 if (json_object_is_type(
object, json_type_array)) {
280 struct array_list *array_obj;
285 array_obj = json_object_get_array(
object);
286 for (i = 0; i < (int32_t)(array_obj->length & INT32_MAX); i++) {
288 array_obj->array[i], node);
289 if (ret < 0)
return ret;
290 if (ret == 1) child_matched =
true;
298 if (ret < 0)
return ret;
299 if (ret == 1) child_matched =
true;
301 return child_matched ? 1 : 0;
302 }
else if (json_object_is_type(
object, json_type_object)) {
306 json_object_object_foreach(
object, field_name, field_value) {
314 if (ret < 0)
return ret;
315 if (ret == 1) child_matched =
true;
323 if (ret < 0)
return ret;
324 if (ret == 1) child_matched =
true;
326 return child_matched ? 1 : 0;
363 fr_value_box_list_insert_tail(tail,
value);
417 p = talloc_zero_array(ctx,
char, 1);
421 p = talloc_strdup_append_buffer(p,
"$");
425 p = talloc_strdup_append_buffer(p,
"@");
429 p = talloc_strdup_append_buffer(p,
".*");
437 p = talloc_asprintf_append_buffer(p,
".%s",
buffer);
448 p = talloc_strdup_append_buffer(p,
"[");
449 for (selector = node->
selector; selector; selector = selector->
next)
switch (selector->
type) {
451 p = talloc_asprintf_append_buffer(p,
"%i%s", selector->slice[0], selector->
next ?
"," :
"");
456 p = talloc_strdup_append_buffer(p,
":");
458 p = talloc_asprintf_append_buffer(p,
"%i:", selector->slice[0]);
461 p = talloc_strdup_append_buffer(p,
":");
463 p = talloc_asprintf_append_buffer(p,
"%i", selector->slice[1]);
465 p = talloc_asprintf_append_buffer(p,
"%i:", selector->slice[1]);
468 p = talloc_asprintf_append_buffer(p,
"%i", selector->slice[2]);
470 if (selector->
next) p = talloc_strdup_append_buffer(p,
",");
477 p = talloc_strdup_append_buffer(p,
"]");
484 p = talloc_strdup_append_buffer(p,
"..");
488 p = talloc_strdup_append_buffer(p,
".");