nxt_conf_validation.c (137:b2f0a28e0141) nxt_conf_validation.c (180:3453139f9728)
1
2/*
3 * Copyright (C) Valentin V. Bartenev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8#include <nxt_conf.h>

--- 23 unchanged lines hidden (view full) ---

32static nxt_int_t nxt_conf_vldt_object_iterator(nxt_conf_value_t *conf,
33 nxt_conf_value_t *value, void *data);
34
35
36static nxt_conf_vldt_object_t nxt_conf_vldt_root_members[] = {
37 { nxt_string("listeners"),
38 NXT_CONF_OBJECT,
39 &nxt_conf_vldt_object_iterator,
1
2/*
3 * Copyright (C) Valentin V. Bartenev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8#include <nxt_conf.h>

--- 23 unchanged lines hidden (view full) ---

32static nxt_int_t nxt_conf_vldt_object_iterator(nxt_conf_value_t *conf,
33 nxt_conf_value_t *value, void *data);
34
35
36static nxt_conf_vldt_object_t nxt_conf_vldt_root_members[] = {
37 { nxt_string("listeners"),
38 NXT_CONF_OBJECT,
39 &nxt_conf_vldt_object_iterator,
40 &nxt_conf_vldt_listener },
40 (void *) &nxt_conf_vldt_listener },
41
42 { nxt_string("applications"),
43 NXT_CONF_OBJECT,
44 &nxt_conf_vldt_object_iterator,
41
42 { nxt_string("applications"),
43 NXT_CONF_OBJECT,
44 &nxt_conf_vldt_object_iterator,
45 &nxt_conf_vldt_app },
45 (void *) &nxt_conf_vldt_app },
46
47 { nxt_null_string, 0, NULL, NULL }
48};
49
50
51static nxt_conf_vldt_object_t nxt_conf_vldt_listener_members[] = {
52 { nxt_string("application"),
53 NXT_CONF_STRING,

--- 242 unchanged lines hidden (view full) ---

296nxt_conf_vldt_object_iterator(nxt_conf_value_t *conf, nxt_conf_value_t *value,
297 void *data)
298{
299 uint32_t index;
300 nxt_str_t name;
301 nxt_conf_value_t *member;
302 nxt_conf_vldt_member_t validator;
303
46
47 { nxt_null_string, 0, NULL, NULL }
48};
49
50
51static nxt_conf_vldt_object_t nxt_conf_vldt_listener_members[] = {
52 { nxt_string("application"),
53 NXT_CONF_STRING,

--- 242 unchanged lines hidden (view full) ---

296nxt_conf_vldt_object_iterator(nxt_conf_value_t *conf, nxt_conf_value_t *value,
297 void *data)
298{
299 uint32_t index;
300 nxt_str_t name;
301 nxt_conf_value_t *member;
302 nxt_conf_vldt_member_t validator;
303
304 validator = data;
304 validator = (nxt_conf_vldt_member_t) data;
305 index = 0;
306
307 for ( ;; ) {
308 member = nxt_conf_next_object_member(value, &name, &index);
309
310 if (member == NULL) {
311 return NXT_OK;
312 }
313
314 if (validator(conf, &name, member) != NXT_OK) {
315 return NXT_ERROR;
316 }
317 }
305 index = 0;
306
307 for ( ;; ) {
308 member = nxt_conf_next_object_member(value, &name, &index);
309
310 if (member == NULL) {
311 return NXT_OK;
312 }
313
314 if (validator(conf, &name, member) != NXT_OK) {
315 return NXT_ERROR;
316 }
317 }
318
319 return NXT_OK;
320}
318}