Lines Matching defs:ddp

53 find_dhcp_confopt(dhcp_confopt_t *ddp, const char *key)
57 if (ddp == NULL || key == NULL)
60 for (i = 0; ddp[i].co_type != DHCP_END; i++) {
61 if (ddp[i].co_type == DHCP_KEY &&
62 strcasecmp(ddp[i].co_key, key) == 0)
63 return (&ddp[i]);
118 * freeing ddp.
128 dhcp_confopt_t confopt, *tdp, *ddp = NULL;
189 tdp = realloc(ddp, (entry + 2) * sizeof (dhcp_confopt_t));
195 ddp = tdp;
199 if (ddp == NULL)
202 *ddpp = ddp;
206 if (ddp != NULL)
207 free_dsvc_conf(ddp);
248 * Writes ddp array to the configuration file. If the configuration file
249 * already exists, its contents are replaced with the contents of the ddp
256 write_dsvc_conf(dhcp_confopt_t *ddp, mode_t mode)
264 if (ddp == NULL) {
270 for (i = 0, size = 0; ddp[i].co_type != DHCP_END; i++) {
271 if (ddp[i].co_type == DHCP_KEY) {
272 size += strlen(ddp[i].co_key) + 1; /* include = */
273 size += strlen(ddp[i].co_value) + 1; /* include \n */
275 size += strlen(ddp[i].co_comment) + 2; /* inc # + \n */
293 for (i = 0; ddp[i].co_type != DHCP_END; i++) {
294 if (ddp[i].co_type == DHCP_KEY)
295 (void) snprintf(tmpbuf, size, "%s=%s\n", ddp[i].co_key,
296 ddp[i].co_value);
299 ddp[i].co_comment);
322 * Frees the memory associated with the ddp array.
325 free_dsvc_conf(dhcp_confopt_t *ddp)
329 if (ddp == NULL)
332 for (i = 0; ddp[i].co_type != DHCP_END; i++) {
333 if (ddp[i].co_type == DHCP_KEY) {
334 free(ddp[i].co_key);
335 free(ddp[i].co_value);
337 free(ddp[i].co_comment);
339 free(ddp);
361 query_dsvc_conf(dhcp_confopt_t *ddp, const char *key, char **value)
369 if ((tdp = find_dhcp_confopt(ddp, key)) != NULL) {
388 confopt_to_datastore(dhcp_confopt_t *ddp, dsvc_datastore_t *dsp)
392 if (ddp == NULL || dsp == NULL)
395 tdp = find_dhcp_confopt(ddp, DSVC_CK_CONVER);
400 if (query_dsvc_conf(ddp, DSVC_CK_RESOURCE, &dsp->d_resource) == -1)
403 if (query_dsvc_conf(ddp, DSVC_CK_PATH, &dsp->d_location) == -1) {
412 (void) query_dsvc_conf(ddp, DSVC_CK_RESOURCE_CONFIG, &dsp->d_config);