Lines Matching defs:universe
47 static int prepare_option_buffer(struct universe *universe, struct buffer *bp,
124 int parse_option_buffer (options, buffer, length, universe)
128 struct universe *universe;
144 (offset + universe->tag_size) <= length &&
145 (code = universe->get_tag(buffer + offset)) != universe->end; ) {
147 offset += universe->tag_size;
154 if ((offset + universe->length_size) > length) {
167 if (universe->get_length != NULL)
168 len = universe->get_length(buffer + offset);
169 else if (universe->length_size == 0)
170 len = length - universe->tag_size;
175 universe->name);
181 offset += universe->length_size;
183 if (!option_code_hash_lookup(&option, universe->code_hash,
196 "%s.%s (code %u): %s.", universe->name,
215 universe, NULL);
218 if (universe == &dhcp_universe && code == DHO_HOST_NAME &&
229 op = lookup_option(universe, options, code);
232 if (save_option_buffer(universe, options, bp,
242 } else if (universe->concat_duplicates) {
306 struct universe *find_option_universe (struct option *eopt, const char *uname)
310 struct universe *universe = (struct universe *)0;
318 /* Look for the universe name in the option format. */
329 universe = universes [i];
338 universe = universes [i];
343 return universe;
354 unsigned len, struct universe *eu,
358 struct universe *universe = find_option_universe (eopt, uname);
360 /* If we didn't find the universe, we can't do anything with it
363 if (!universe)
368 if (!universe -> decode)
371 i = (*universe -> decode) (options, buffer, len, universe);
382 unsigned length, struct universe *u)
808 universes[i]->enc_opt->universe == &dhcp_universe) {
907 struct universe *universe,
917 total_len = ds.len + universe->tag_size + universe->length_size;
919 if (universe->tag_size == 1) {
921 } else if (universe->tag_size == 2) {
925 } else if (universe->tag_size == 4) {
930 if (universe->length_size == 1) {
932 } else if (universe->length_size == 2) {
936 } else if (universe->length_size == 4) {
945 oc->option->code, universe->name);
950 oc->option->code, universe->name);
993 * Find the universe for the requested option and if it exists
998 * entire value of the option is in the option universe. This is
1019 /* We need to extract the name of the universe
1041 * option/universe. A return of 0 means no option information was
1051 * Stores the options from the DHCPv6 universe into the buffer given.
1080 * Find the option code for the VSIO universe.
1085 if (o->universe == &dhcpv6_universe) {
1089 o = o->universe->enc_opt;
1182 * have an universe to encapsulate into an option.
1203 (o->universe == &vsio_universe)) {
1346 struct universe *u;
1395 /* A zero-length universe name means the vendor
1399 tmp = lookup_option (vendor_cfg_option -> universe,
1418 /* If we found a universe, and there are options configured
1419 for that universe, try to encapsulate it. */
1861 /* Skip the universe name. */
2290 int get_option (result, universe, packet, lease, client_state,
2293 struct universe *universe;
2307 if (!universe -> lookup_func)
2309 oc = ((*universe -> lookup_func) (universe, options, code));
2325 int get_option_int (result, universe, packet, lease, client_state,
2328 struct universe *universe;
2345 if ((options == NULL) || (universe->lookup_func == NULL))
2349 oc = ((*universe->lookup_func)(universe, options, code));
2370 void set_option (universe, options, option, op)
2371 struct universe *universe;
2388 oc = lookup_option (universe, options,
2392 save_option (universe, options, option);
2398 save_option (universe, options, option);
2403 oc = lookup_option (universe, options,
2406 save_option (universe, options, option);
2464 save_option (universe, options, noc);
2470 struct option_cache *lookup_option (universe, options, code)
2471 struct universe *universe;
2477 if (universe -> lookup_func)
2478 return (*universe -> lookup_func) (universe, options, code);
2481 universe -> name);
2485 struct option_cache *lookup_hashed_option (universe, options, code)
2486 struct universe *universe;
2495 if (universe -> index >= options -> universe_count ||
2496 !(options -> universes [universe -> index]))
2499 hash = options -> universes [universe -> index];
2512 save_option_buffer(struct universe *universe, struct option_state *options,
2519 status = prepare_option_buffer(universe, bp, buffer, length, code,
2525 save_option(universe, options, op);
2536 append_option_buffer(struct universe *universe, struct option_state *options,
2543 status = prepare_option_buffer(universe, bp, buffer, length, code,
2549 also_save_option(universe, options, op);
2560 prepare_option_buffer(struct universe *universe, struct buffer *bp,
2570 switch(universe->tag_size) {
2585 log_fatal("Inconsistent universe tag size at %s:%d.", MDL);
2588 option_code_hash_lookup(&option, universe->code_hash, &code, 0, MDL);
2608 option->universe = universe;
2617 universe->name, option->name);
2692 struct universe *dummy_universe,
2707 struct universe *dummy_universe,
2739 if (o->universe == &dhcpv6_universe) {
2743 o = o->universe->enc_opt;
2769 if (o->universe == &dhcpv6_universe) {
2777 o = o->universe->enc_opt;
2785 save_option(struct universe *universe, struct option_state *options,
2788 if (universe->save_func)
2789 (*universe->save_func)(universe, options, oc, ISC_FALSE);
2791 log_error("can't store options in %s space.", universe->name);
2796 also_save_option(struct universe *universe, struct option_state *options,
2799 if (universe->save_func)
2800 (*universe->save_func)(universe, options, oc, ISC_TRUE);
2802 log_error("can't store options in %s space.", universe->name);
2806 save_hashed_option(struct universe *universe, struct option_state *options,
2811 pair *hash = options -> universes [universe -> index];
2825 universe -> name, oc -> option -> name);
2829 options -> universes [universe -> index] = (void *)hash;
2873 void delete_option (universe, options, code)
2874 struct universe *universe;
2878 if (universe -> delete_func)
2879 (*universe -> delete_func) (universe, options, code);
2882 universe -> name);
2885 void delete_hashed_option (universe, options, code)
2886 struct universe *universe;
2892 pair *hash = options -> universes [universe -> index];
2970 int hashed_option_state_dereference (universe, state, file, line)
2971 struct universe *universe;
2981 heads = (pair *)(state -> universes [universe -> index]);
2998 state -> universes [universe -> index] = (void *)0;
3008 append_option(struct data_string *dst, struct universe *universe,
3022 (dst->len + universe->length_size +
3023 universe->tag_size + src->len), MDL)) {
3041 (*universe->store_tag)(tmp.buffer->data + tmp.len, option->code);
3042 tmp.len += universe->tag_size;
3043 (*universe->store_length)(tmp.buffer->data + tmp.len, src->len);
3044 tmp.len += universe->length_size;
3058 store_option(struct data_string *result, struct universe *universe,
3065 struct universe *subu=NULL;
3080 /* Skip forward to the universe name. */
3119 status = append_option(result, universe, oc->option, &tmp);
3139 struct universe *u = NULL;
3164 * the space over-rides any values in the child universe).
3167 * options in any universe. So it is faster to traverse the
3169 * current universe, and if so attempting to do so.
3171 * For each configured universe for this configuration option space,
3172 * which is encapsulated within the current universe, can not be found
3173 * by the lookup function (the universe-specific encapsulation
3183 struct universe *universe)
3186 struct universe *subu;
3197 subu->enc_opt->universe == universe &&
3200 lookup_option(universe, cfg_options,
3205 if (append_option(result, universe,
3217 in_options, cfg_options, scope, universe)
3225 struct universe *universe;
3231 if (universe -> index >= cfg_options -> universe_count)
3234 hash = cfg_options -> universes [universe -> index];
3240 * format appropriate to the universe.
3245 if (store_option(result, universe, packet, lease,
3253 in_options, cfg_options, scope, universe))
3260 in_options, cfg_options, scope, universe)
3268 struct universe *universe;
3276 if (universe -> index >= cfg_options -> universe_count)
3285 if (store_option (result, universe, packet,
3311 if (store_option (result, universe, packet, lease,
3385 in_options, cfg_options, scope, universe)
3393 struct universe *universe;
3403 /* If there's no FQDN universe, don't encapsulate. */
3501 lookup_fqdn6_option(struct universe *universe, struct option_state *options,
3512 save_fqdn6_option(struct universe *universe, struct option_state *options,
3519 * Trap invalid attempts to delete an option out of the FQDN6 universe.
3522 delete_fqdn6_option(struct universe *universe, struct option_state *options,
3533 * foreach on the normal fqdn universe, so this is superfluous.
3541 struct universe *u, void *stuff,
3549 struct universe *, void *))
3564 struct universe *universe)
3659 struct universe *u)
3761 struct universe *u, void *stuff,
3768 struct universe *, void *))
3780 struct universe *u, void *stuff,
3787 struct universe *, void *),
3791 struct universe *universe = find_option_universe (oc -> option,
3793 if (universe -> foreach)
3794 (*universe -> foreach) (packet, lease, client_state,
3796 scope, universe, stuff, func);
3804 struct universe *u, void *stuff,
3812 struct universe *, void *))
3836 save_linked_option(struct universe *universe, struct option_state *options,
3843 if (universe -> index >= options -> universe_count)
3846 options -> universes [universe -> index]);
3850 [universe -> index]), MDL))
3853 options -> universes [universe -> index]);
3881 in_options, cfg_options, scope, universe)
3889 struct universe *universe;
3895 if (universe -> index >= cfg_options -> universe_count)
3898 cfg_options -> universes [universe -> index]);
3903 if (store_option (result, universe, packet,
3910 in_options, cfg_options, scope, universe))
3916 void delete_linked_option (universe, options, code)
3917 struct universe *universe;
3924 if (universe -> index >= options -> universe_count)
3927 options -> universes [universe -> index]);
3945 struct option_cache *lookup_linked_option (universe, options, code)
3946 struct universe *universe;
3953 if (universe -> index >= options -> universe_count)
3956 options -> universes [universe -> index]);
3970 int linked_option_state_dereference (universe, state, file, line)
3971 struct universe *universe;
3978 (&state -> universes [universe -> index]), MDL));
3986 struct universe *u, void *stuff,
3994 struct universe *, void *))
4550 * then try and find the proper universe for the vendor-option-space and
4551 * parse the vendor option string based on that universe.
4553 * If the information isn't available (no vendor space, no universe for the
4567 * use that to find the name of the vendor universe to use
4595 oc = lookup_option(vendor_cfg_option->universe,