struct in_addr foo;
isc_result_t status;
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_connect(%s, port=%d)", server_name, port);
+#endif
+
if (!inet_aton (server_name, &foo)) {
/* If we didn't get a numeric address, try for a domain
name. It's okay for this call to block. */
{
omapi_connection_object_t *c;
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_disconnect(%s)", force ? "force" : "");
+#endif
+
c = (omapi_connection_object_t *)h;
if (c -> type != omapi_type_connection)
return ISC_R_INVALIDARG;
c = (omapi_connection_object_t *)h;
if (c -> state == omapi_connection_disconnecting &&
- c -> out_bytes == 0)
+ c -> out_bytes == 0) {
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_connection_reaper(): disconnect");
+#endif
omapi_disconnect (h, 1);
- if (c -> state == omapi_connection_closed)
+ }
+ if (c -> state == omapi_connection_closed) {
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_connection_reaper(): closed");
+#endif
return ISC_R_NOTCONNECTED;
+ }
return ISC_R_SUCCESS;
}
{
omapi_connection_object_t *c;
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_connection_destroy()");
+#endif
+
if (h -> type != omapi_type_connection)
return ISC_R_UNEXPECTED;
c = (omapi_connection_object_t *)(h);
{
if (h -> type != omapi_type_connection)
return ISC_R_INVALIDARG;
+
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_connection_signal_handler(%s)", name);
+#endif
if (h -> inner && h -> inner -> type -> signal_handler)
return (*(h -> inner -> type -> signal_handler)) (h -> inner,
int max)
{
omapi_addr_t addr;
+
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_listen(port=%d, max=%d)", port, max);
+#endif
+
addr.addrtype = AF_INET;
addr.addrlen = sizeof (struct in_addr);
memset (addr.address, 0, sizeof addr.address); /* INADDR_ANY */
if (h -> type != omapi_type_listener)
return ISC_R_INVALIDARG;
listener = (omapi_listener_object_t *)h;
+
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_accept()");
+#endif
/* Get the handle. */
obj = (omapi_connection_object_t *)0;
if (h -> type != omapi_type_listener)
return ISC_R_INVALIDARG;
l = (omapi_listener_object_t *)h;
+
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_listener_destroy()");
+#endif
if (l -> socket != -1) {
close (l -> socket);
return ISC_R_SUCCESS;
}
+#ifdef DEBUG_PROTOCOL
+static const char *omapi_message_op_name(int op) {
+ switch (op) {
+ case OMAPI_OP_OPEN: return "OMAPI_OP_OPEN";
+ case OMAPI_OP_REFRESH: return "OMAPI_OP_REFRESH";
+ case OMAPI_OP_UPDATE: return "OMAPI_OP_UPDATE";
+ case OMAPI_OP_STATUS: return "OMAPI_OP_STATUS";
+ case OMAPI_OP_DELETE: return "OMAPI_OP_DELETE";
+ case OMAPI_OP_NOTIFY: return "OMAPI_OP_NOTIFY";
+ default: return "(unknown op)";
+ }
+}
+#endif
+
isc_result_t omapi_message_process (omapi_object_t *mo, omapi_object_t *po)
{
omapi_message_object_t *message, *m;
return ISC_R_INVALIDARG;
message = (omapi_message_object_t *)mo;
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_message_process(): "
+ "op=%s handle=%#x id=%#x rid=%#x",
+ omapi_message_op_name (message -> op),
+ message -> h, message -> id, message -> rid);
+#endif
+
if (message -> rid) {
for (m = omapi_registered_messages; m; m = m -> next)
if (m -> id == message -> rid)
isc_result_t status;
omapi_protocol_object_t *obj;
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_protocol_connect(%s port=%d)", server_name, port);
+#endif
+
obj = (omapi_protocol_object_t *)0;
status = omapi_protocol_allocate (&obj, MDL);
if (status != ISC_R_SUCCESS)
isc_result_t status;
omapi_protocol_object_t *p;
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_protocol_send_intro()");
+#endif
+
if (h -> type != omapi_type_protocol)
return ISC_R_INVALIDARG;
p = (omapi_protocol_object_t *)h;
m = (omapi_message_object_t *)mo;
om = (omapi_message_object_t *)omo;
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_protocol_send_message()"
+ "op=%ld handle=%#lx id=%#lx rid=%#lx",
+ (long)m -> op,
+ (long)(m -> object ? m -> object -> handle : m -> handle),
+ (long)p -> next_xid, (long)m -> rid);
+#endif
+
/* Find the authid to use for this message. */
if (id) {
for (ra = p -> remote_auth_list; ra; ra = ra -> next) {
return ISC_R_INVALIDARG;
p = (omapi_protocol_object_t *)po;
+#ifdef DEBUG_PROTOCOL
+ log_debug ("omapi_protocol_add_auth(name=%s)",
+ ((omapi_auth_key_t *)ao) -> name);
+#endif
+
if (p -> verify_auth) {
status = (p -> verify_auth) (po, (omapi_auth_key_t *)ao);
if (status != ISC_R_SUCCESS)