45 status = omapi_message_allocate (&m, file, line);
46 if (status != ISC_R_SUCCESS)
51 if (status != ISC_R_SUCCESS) {
52 dfree (m, file, line);
56 if (status != ISC_R_SUCCESS) {
64 if (status != ISC_R_SUCCESS) {
71 omapi_message_dereference (&m, file, line);
73 if (status != ISC_R_SUCCESS)
95 if (m -> authenticator)
107 return ISC_R_SUCCESS;
112 if (m -> notify_object)
116 return ISC_R_SUCCESS;
122 m -> authid = value -> u.
integer;
123 return ISC_R_SUCCESS;
130 return ISC_R_SUCCESS;
137 return ISC_R_SUCCESS;
144 return ISC_R_SUCCESS;
151 return ISC_R_SUCCESS;
155 if (h -> inner && h -> inner -> type -> set_value) {
156 status = ((*(h -> inner -> type -> set_value))
157 (h -> inner, id, name, value));
158 if (status == ISC_R_SUCCESS)
162 return ISC_R_NOTFOUND;
180 if (m -> authenticator)
182 m -> authenticator,
MDL);
184 return ISC_R_NOTFOUND;
187 name, (
int)m -> authid,
MDL);
199 if (h -> inner && h -> inner -> type -> get_value)
200 return (*(h -> inner -> type -> get_value))
201 (h -> inner, id, name, value);
202 return ISC_R_NOTFOUND;
212 if (m -> authenticator) {
215 if (!m -> prev && omapi_registered_messages != m)
221 if (m -> notify_object)
223 if (m -> protocol_object)
224 omapi_protocol_dereference (&m -> protocol_object, file, line);
225 return ISC_R_SUCCESS;
229 const char *name, va_list ap)
236 if (!strcmp (name,
"status")) {
237 if (m -> notify_object &&
238 m -> notify_object -> type -> signal_handler)
239 return ((m -> notify_object -> type -> signal_handler))
240 (m -> notify_object, name, ap);
241 else if (m ->
object && m ->
object -> type -> signal_handler)
242 return ((m ->
object -> type -> signal_handler))
243 (m ->
object, name, ap);
245 if (h -> inner && h -> inner -> type -> signal_handler)
246 return (*(h -> inner -> type -> signal_handler)) (h -> inner,
248 return ISC_R_NOTFOUND;
261 if (m -> inner && m -> inner -> type -> stuff_values)
262 return (*(m -> inner -> type -> stuff_values)) (c, id,
264 return ISC_R_SUCCESS;
276 if (m -> prev || m -> next || omapi_registered_messages == m)
279 if (omapi_registered_messages) {
292 return ISC_R_SUCCESS;;
305 if (!m -> prev && omapi_registered_messages != m)
338 return ISC_R_SUCCESS;
341 #ifdef DEBUG_PROTOCOL 342 static const char *omapi_message_op_name(
int op) {
350 default:
return "(unknown op)";
361 #if defined (DEBUG_MEMORY_LEAKAGE) && 0 362 unsigned long previous_outstanding = dmalloc_outstanding;
365 status = omapi_message_process_internal (mo, po);
367 #if defined (DEBUG_MEMORY_LEAKAGE) && 0 368 log_info (
"generation %ld: %ld new, %ld outstanding, %ld long-term",
370 dmalloc_outstanding - previous_outstanding,
371 dmalloc_outstanding, dmalloc_longterm);
373 #if defined (DEBUG_MEMORY_LEAKAGE) && 0 374 dmalloc_dump_outstanding ();
376 #if defined (DEBUG_RC_HISTORY_EXHAUSTIVELY) && 0 389 unsigned long create, update, exclusive;
391 isc_result_t status, waitstatus;
398 #ifdef DEBUG_PROTOCOL 400 "op=%s handle=%#x id=%#x rid=%#x",
401 omapi_message_op_name (message -> op),
402 message -> h, message ->
id, message -> rid);
405 if (message -> rid) {
406 for (m = omapi_registered_messages; m; m = m -> next)
407 if (m ->
id == message -> rid)
413 return ISC_R_NOTFOUND;
416 if (message -> authid != m -> authid)
417 return ISC_R_NOTFOUND;
428 message->
id,
"No authenticator on message");
432 switch (message -> op) {
437 message->
id,
"OPEN can't be a response");
444 if (status == ISC_R_SUCCESS &&
448 type; type = type -> next)
464 message->
id,
"No authenticator on message");
470 if (status == ISC_R_SUCCESS) {
473 if (status != ISC_R_SUCCESS) {
475 (po, message -> id_object,
476 status, message ->
id,
477 "invalid create flag value");
485 if (status == ISC_R_SUCCESS) {
488 if (status != ISC_R_SUCCESS) {
490 (po, message -> id_object,
491 status, message ->
id,
492 "invalid update flag value");
500 if (status == ISC_R_SUCCESS) {
503 if (status != ISC_R_SUCCESS) {
505 (po, message -> id_object,
506 status, message ->
id,
507 "invalid exclusive flag value");
520 "type required on create");
527 if (!type -> lookup) {
529 (po, message -> id_object,
530 ISC_R_NOTIMPLEMENTED, message ->
id,
531 "unsearchable object type");
534 status = (*(type -> lookup)) (&object, message -> id_object,
537 if (status != ISC_R_SUCCESS &&
538 status != ISC_R_NOTFOUND &&
541 (po, message -> id_object,
542 status, message ->
id,
543 "object lookup failed");
548 if (status == ISC_R_NOTFOUND && !create) {
550 (po, message -> id_object,
551 ISC_R_NOTFOUND, message ->
id,
552 "no object matches specification");
558 if (status == ISC_R_SUCCESS && create && exclusive) {
561 (po, message -> id_object,
562 ISC_R_EXISTS, message ->
id,
563 "specified object already exists");
569 message -> id_object,
571 if (status != ISC_R_SUCCESS) {
573 (po, message -> id_object,
574 status, message ->
id,
575 "can't create new object");
580 if (create || update) {
585 (po, message -> id_object,
586 status, message ->
id,
587 "can't update object");
591 message -> id_object,
594 if (status != ISC_R_SUCCESS) {
597 (po, message -> id_object,
598 status, message ->
id,
599 "can't update object");
608 if (status != ISC_R_SUCCESS) {
611 (po, message -> id_object,
612 status, message ->
id,
613 "can't select authenticator");
617 if (status != ISC_R_SUCCESS) {
620 (po, message -> id_object,
621 status, message ->
id,
622 "can't select authenticator");
633 if (status != ISC_R_SUCCESS) {
635 (po, message -> id_object,
636 status, message ->
id,
637 "no matching handle");
641 message ->
id,
object);
646 if (m && m ->
object) {
651 if (status != ISC_R_SUCCESS) {
653 (po, message -> id_object,
654 status, message ->
id,
655 "no matching handle");
665 (po, message -> id_object,
666 status, message ->
id,
667 "cannot update authenticator");
674 message -> id_object,
678 if (status != ISC_R_SUCCESS) {
682 (po, message -> id_object,
683 status, message ->
id,
684 "can't update object");
689 return ISC_R_SUCCESS;
693 (po, message -> id_object, ISC_R_SUCCESS,
694 message ->
id, (
char *)0);
697 "status", ISC_R_SUCCESS,
708 (po, message -> id_object, ISC_R_NOTIMPLEMENTED,
709 message ->
id,
"notify not implemented yet");
714 return ISC_R_UNEXPECTED;
719 if (status == ISC_R_SUCCESS) {
723 if (status != ISC_R_SUCCESS)
724 waitstatus = ISC_R_UNEXPECTED;
726 waitstatus = ISC_R_UNEXPECTED;
731 if (status == ISC_R_SUCCESS)
736 return ISC_R_SUCCESS;
740 if (status != ISC_R_SUCCESS) {
742 (po, message -> id_object,
743 status, message ->
id,
744 "no matching handle");
747 if (!
object -> type ->
remove)
749 (po, message -> id_object,
750 ISC_R_NOTIMPLEMENTED, message ->
id,
751 "no remove method for object");
753 status = (*(
object -> type ->
remove)) (object,
754 message -> id_object);
758 status, message ->
id,
761 return ISC_R_NOTIMPLEMENTED;
isc_result_t omapi_message_destroy(omapi_object_t *h, const char *file, int line)
omapi_message_object_t * omapi_registered_messages
isc_result_t omapi_make_int_value(omapi_value_t **, omapi_data_string_t *, int, const char *, int)
isc_result_t omapi_message_new(omapi_object_t **, const char *, int)
isc_result_t omapi_object_reference(omapi_object_t **, omapi_object_t *, const char *, int)
isc_result_t omapi_message_signal_handler(omapi_object_t *h, const char *name, va_list ap)
#define DHCP_R_INVALIDARG
int int int log_debug(const char *,...) __attribute__((__format__(__printf__
isc_result_t omapi_protocol_send_status(omapi_object_t *, omapi_object_t *, isc_result_t, unsigned, const char *)
isc_result_t omapi_protocol_add_auth(omapi_object_t *, omapi_object_t *, omapi_handle_t)
isc_result_t omapi_get_value_str(omapi_object_t *, omapi_object_t *, const char *, omapi_value_t **)
omapi_object_type_t * omapi_object_types
isc_result_t omapi_message_set_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_typed_data_t *value)
isc_result_t omapi_object_create(omapi_object_t **, omapi_object_t *, omapi_object_type_t *)
isc_result_t omapi_object_dereference(omapi_object_t **, const char *, int)
isc_result_t omapi_message_register(omapi_object_t *mo)
isc_result_t omapi_signal(omapi_object_t *, const char *,...)
isc_result_t omapi_generic_new(omapi_object_t **, const char *, int)
isc_result_t omapi_get_int_value(unsigned long *, omapi_typed_data_t *)
void dfree(void *, const char *, int)
isc_result_t omapi_make_value(omapi_value_t **, omapi_data_string_t *, omapi_typed_data_t *, const char *, int)
isc_boolean_t omapi_protocol_authenticated(omapi_object_t *)
int int log_info(const char *,...) __attribute__((__format__(__printf__
isc_result_t omapi_object_handle(omapi_handle_t *, omapi_object_t *)
isc_result_t omapi_typed_data_reference(omapi_typed_data_t **, omapi_typed_data_t *, const char *, int)
isc_result_t omapi_handle_lookup(omapi_object_t **, omapi_handle_t)
unsigned int omapi_handle_t
isc_result_t omapi_value_dereference(omapi_value_t **, const char *, int)
isc_result_t omapi_message_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *m)
omapi_object_t * id_object
int omapi_td_strcmp(omapi_typed_data_t *, const char *)
isc_result_t omapi_message_get_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value)
int omapi_ds_strcmp(omapi_data_string_t *, const char *)
isc_result_t omapi_message_unregister(omapi_object_t *mo)
OMAPI_OBJECT_ALLOC(omapi_message, omapi_message_object_t, omapi_type_message)
isc_result_t omapi_protocol_send_update(omapi_object_t *, omapi_object_t *, unsigned, omapi_object_t *)
omapi_object_type_t * omapi_type_message
omapi_object_type_t * omapi_type_auth_key
isc_result_t omapi_typed_data_dereference(omapi_typed_data_t **, const char *, int)
isc_result_t omapi_object_update(omapi_object_t *, omapi_object_t *, omapi_object_t *, omapi_handle_t)
isc_result_t omapi_message_process(omapi_object_t *mo, omapi_object_t *po)