OMAPI, public API for iterating over values
Frode Nordahl
frode at nordahl.net
Tue Nov 18 19:27:13 UTC 2008
Hello,
I am writing a remote administration / lookup tool for our ISC DHCP
installation, and need a way to iterate over name / value pairs.
I did not find the necessary function calls / data structures in the
documentation / public header files, so I have temporarily solved it
by defining omapi_generic_object_t from includes/omapip/omapip_p.h in
my application and mimic the behaviour of omshell.
Am I missing something?
Is there anything prohibiting the promotion of the
omapi_generic_object_t definition from omapi_p.h to the public omapip/
omapi.h header file?
Example:
#ifndef omapi_generic_object_t
typedef struct __omapi_generic_object {
OMAPI_OBJECT_PREAMBLE;
omapi_value_t **values;
u_int8_t *changed;
int nvalues, va_max;
} omapi_generic_object_t;
#endif
dhcpctl_remote_object_t *ro = (dhcpctl_remote_object_t*)object;
omapi_generic_object_t *rp = (omapi_generic_object_t*)ro->inner;
int i;
for (i = 0; i < rp->nvalues; i++) {
omapi_value_t *v = rp->values[i];
printf("%.*s = ", (int)v->name->len, v->name->value);
switch (v->value->type) {
...
}
}
--
Frode Nordahl
More information about the dhcp-hackers
mailing list