mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-29 05:17:57 +00:00
Added a number of (#ifdef-guarded) debugging statements.
This commit is contained in:
parent
4244dfb75f
commit
e11a162ff4
@ -57,6 +57,10 @@ isc_result_t omapi_connect (omapi_object_t *c,
|
||||
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. */
|
||||
@ -209,6 +213,10 @@ isc_result_t omapi_disconnect (omapi_object_t *h,
|
||||
{
|
||||
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;
|
||||
@ -399,10 +407,18 @@ isc_result_t omapi_connection_reaper (omapi_object_t *h)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -664,6 +680,10 @@ isc_result_t omapi_connection_destroy (omapi_object_t *h,
|
||||
{
|
||||
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);
|
||||
@ -681,6 +701,10 @@ isc_result_t omapi_connection_signal_handler (omapi_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,
|
||||
|
@ -51,6 +51,11 @@ isc_result_t omapi_listen (omapi_object_t *h,
|
||||
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 */
|
||||
@ -190,6 +195,10 @@ isc_result_t omapi_accept (omapi_object_t *h)
|
||||
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;
|
||||
@ -300,6 +309,10 @@ isc_result_t omapi_listener_destroy (omapi_object_t *h,
|
||||
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);
|
||||
|
@ -355,6 +355,20 @@ isc_result_t omapi_message_unregister (omapi_object_t *mo)
|
||||
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;
|
||||
@ -369,6 +383,13 @@ isc_result_t omapi_message_process (omapi_object_t *mo, omapi_object_t *po)
|
||||
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)
|
||||
|
@ -56,6 +56,10 @@ isc_result_t omapi_protocol_connect (omapi_object_t *h,
|
||||
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)
|
||||
@ -114,6 +118,10 @@ isc_result_t omapi_protocol_send_intro (omapi_object_t *h,
|
||||
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;
|
||||
@ -167,6 +175,14 @@ isc_result_t omapi_protocol_send_message (omapi_object_t *po,
|
||||
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) {
|
||||
@ -697,6 +713,11 @@ isc_result_t omapi_protocol_add_auth (omapi_object_t *po,
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user