mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-01 06:45:27 +00:00
Added a number of (#ifdef-guarded) debugging statements.
This commit is contained in:
@@ -57,6 +57,10 @@ isc_result_t omapi_connect (omapi_object_t *c,
|
|||||||
struct in_addr foo;
|
struct in_addr foo;
|
||||||
isc_result_t status;
|
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 (!inet_aton (server_name, &foo)) {
|
||||||
/* If we didn't get a numeric address, try for a domain
|
/* If we didn't get a numeric address, try for a domain
|
||||||
name. It's okay for this call to block. */
|
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;
|
omapi_connection_object_t *c;
|
||||||
|
|
||||||
|
#ifdef DEBUG_PROTOCOL
|
||||||
|
log_debug ("omapi_disconnect(%s)", force ? "force" : "");
|
||||||
|
#endif
|
||||||
|
|
||||||
c = (omapi_connection_object_t *)h;
|
c = (omapi_connection_object_t *)h;
|
||||||
if (c -> type != omapi_type_connection)
|
if (c -> type != omapi_type_connection)
|
||||||
return ISC_R_INVALIDARG;
|
return ISC_R_INVALIDARG;
|
||||||
@@ -399,10 +407,18 @@ isc_result_t omapi_connection_reaper (omapi_object_t *h)
|
|||||||
|
|
||||||
c = (omapi_connection_object_t *)h;
|
c = (omapi_connection_object_t *)h;
|
||||||
if (c -> state == omapi_connection_disconnecting &&
|
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);
|
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_NOTCONNECTED;
|
||||||
|
}
|
||||||
return ISC_R_SUCCESS;
|
return ISC_R_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -664,6 +680,10 @@ isc_result_t omapi_connection_destroy (omapi_object_t *h,
|
|||||||
{
|
{
|
||||||
omapi_connection_object_t *c;
|
omapi_connection_object_t *c;
|
||||||
|
|
||||||
|
#ifdef DEBUG_PROTOCOL
|
||||||
|
log_debug ("omapi_connection_destroy()");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (h -> type != omapi_type_connection)
|
if (h -> type != omapi_type_connection)
|
||||||
return ISC_R_UNEXPECTED;
|
return ISC_R_UNEXPECTED;
|
||||||
c = (omapi_connection_object_t *)(h);
|
c = (omapi_connection_object_t *)(h);
|
||||||
@@ -682,6 +702,10 @@ isc_result_t omapi_connection_signal_handler (omapi_object_t *h,
|
|||||||
if (h -> type != omapi_type_connection)
|
if (h -> type != omapi_type_connection)
|
||||||
return ISC_R_INVALIDARG;
|
return ISC_R_INVALIDARG;
|
||||||
|
|
||||||
|
#ifdef DEBUG_PROTOCOL
|
||||||
|
log_debug ("omapi_connection_signal_handler(%s)", name);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (h -> inner && h -> inner -> type -> signal_handler)
|
if (h -> inner && h -> inner -> type -> signal_handler)
|
||||||
return (*(h -> inner -> type -> signal_handler)) (h -> inner,
|
return (*(h -> inner -> type -> signal_handler)) (h -> inner,
|
||||||
name, ap);
|
name, ap);
|
||||||
|
@@ -51,6 +51,11 @@ isc_result_t omapi_listen (omapi_object_t *h,
|
|||||||
int max)
|
int max)
|
||||||
{
|
{
|
||||||
omapi_addr_t addr;
|
omapi_addr_t addr;
|
||||||
|
|
||||||
|
#ifdef DEBUG_PROTOCOL
|
||||||
|
log_debug ("omapi_listen(port=%d, max=%d)", port, max);
|
||||||
|
#endif
|
||||||
|
|
||||||
addr.addrtype = AF_INET;
|
addr.addrtype = AF_INET;
|
||||||
addr.addrlen = sizeof (struct in_addr);
|
addr.addrlen = sizeof (struct in_addr);
|
||||||
memset (addr.address, 0, sizeof addr.address); /* INADDR_ANY */
|
memset (addr.address, 0, sizeof addr.address); /* INADDR_ANY */
|
||||||
@@ -191,6 +196,10 @@ isc_result_t omapi_accept (omapi_object_t *h)
|
|||||||
return ISC_R_INVALIDARG;
|
return ISC_R_INVALIDARG;
|
||||||
listener = (omapi_listener_object_t *)h;
|
listener = (omapi_listener_object_t *)h;
|
||||||
|
|
||||||
|
#ifdef DEBUG_PROTOCOL
|
||||||
|
log_debug ("omapi_accept()");
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Get the handle. */
|
/* Get the handle. */
|
||||||
obj = (omapi_connection_object_t *)0;
|
obj = (omapi_connection_object_t *)0;
|
||||||
status = omapi_connection_allocate (&obj, MDL);
|
status = omapi_connection_allocate (&obj, MDL);
|
||||||
@@ -301,6 +310,10 @@ isc_result_t omapi_listener_destroy (omapi_object_t *h,
|
|||||||
return ISC_R_INVALIDARG;
|
return ISC_R_INVALIDARG;
|
||||||
l = (omapi_listener_object_t *)h;
|
l = (omapi_listener_object_t *)h;
|
||||||
|
|
||||||
|
#ifdef DEBUG_PROTOCOL
|
||||||
|
log_debug ("omapi_listener_destroy()");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (l -> socket != -1) {
|
if (l -> socket != -1) {
|
||||||
close (l -> socket);
|
close (l -> socket);
|
||||||
l -> socket = -1;
|
l -> socket = -1;
|
||||||
|
@@ -355,6 +355,20 @@ isc_result_t omapi_message_unregister (omapi_object_t *mo)
|
|||||||
return ISC_R_SUCCESS;
|
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)
|
isc_result_t omapi_message_process (omapi_object_t *mo, omapi_object_t *po)
|
||||||
{
|
{
|
||||||
omapi_message_object_t *message, *m;
|
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;
|
return ISC_R_INVALIDARG;
|
||||||
message = (omapi_message_object_t *)mo;
|
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) {
|
if (message -> rid) {
|
||||||
for (m = omapi_registered_messages; m; m = m -> next)
|
for (m = omapi_registered_messages; m; m = m -> next)
|
||||||
if (m -> id == message -> rid)
|
if (m -> id == message -> rid)
|
||||||
|
@@ -56,6 +56,10 @@ isc_result_t omapi_protocol_connect (omapi_object_t *h,
|
|||||||
isc_result_t status;
|
isc_result_t status;
|
||||||
omapi_protocol_object_t *obj;
|
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;
|
obj = (omapi_protocol_object_t *)0;
|
||||||
status = omapi_protocol_allocate (&obj, MDL);
|
status = omapi_protocol_allocate (&obj, MDL);
|
||||||
if (status != ISC_R_SUCCESS)
|
if (status != ISC_R_SUCCESS)
|
||||||
@@ -114,6 +118,10 @@ isc_result_t omapi_protocol_send_intro (omapi_object_t *h,
|
|||||||
isc_result_t status;
|
isc_result_t status;
|
||||||
omapi_protocol_object_t *p;
|
omapi_protocol_object_t *p;
|
||||||
|
|
||||||
|
#ifdef DEBUG_PROTOCOL
|
||||||
|
log_debug ("omapi_protocol_send_intro()");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (h -> type != omapi_type_protocol)
|
if (h -> type != omapi_type_protocol)
|
||||||
return ISC_R_INVALIDARG;
|
return ISC_R_INVALIDARG;
|
||||||
p = (omapi_protocol_object_t *)h;
|
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;
|
m = (omapi_message_object_t *)mo;
|
||||||
om = (omapi_message_object_t *)omo;
|
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. */
|
/* Find the authid to use for this message. */
|
||||||
if (id) {
|
if (id) {
|
||||||
for (ra = p -> remote_auth_list; ra; ra = ra -> next) {
|
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;
|
return ISC_R_INVALIDARG;
|
||||||
p = (omapi_protocol_object_t *)po;
|
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) {
|
if (p -> verify_auth) {
|
||||||
status = (p -> verify_auth) (po, (omapi_auth_key_t *)ao);
|
status = (p -> verify_auth) (po, (omapi_auth_key_t *)ao);
|
||||||
if (status != ISC_R_SUCCESS)
|
if (status != ISC_R_SUCCESS)
|
||||||
|
Reference in New Issue
Block a user