From 57043eacd8c2354d538edaa184dbb16ab451b651 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Wed, 20 May 2026 12:08:51 +0200 Subject: [PATCH] nwconn all conn debug --- src/nwconn.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 1 deletion(-) diff --git a/src/nwconn.c b/src/nwconn.c index 06ecafb..b086a31 100644 --- a/src/nwconn.c +++ b/src/nwconn.c @@ -147,6 +147,21 @@ static int ncp_response(int sequence, int task, (int)completition, (int)ncpresponse->task, visable_ipx_adr((ipxAddr_t *) ud.addr.buf))); } + if (ncprequest->function == 0x41 || ncprequest->function == 0x4c || + ncprequest->function == 0x4e || ncprequest->function == 0x4f || + ncprequest->function == 0x50 || ncprequest->function == 0x57 || + ncprequest->function == 0x60 || ncprequest->function == 0x61 || + ncprequest->function == 0x62 || ncprequest->function == 0x63 || + ncprequest->function == 0x64 || ncprequest->function == 0x65 || + ncprequest->function == 0x66) { + XDPRINTF((2,0, + "NWC FILEOP RESP func=0x%02x compl=0x%x data_len=%d seq=%d task=%d", + (int)ncprequest->function, + (int)completition, + data_len, + (int)sequence, + (int)task)); + } ud.udata.len = ud.udata.maxlen = sizeof(NCPRESPONSE) + data_len; if (t_sndudata(FD_NCP_OUT, &ud) < 0){ if (nw_debug) t_error("t_sndudata in NWCONN !OK"); @@ -191,12 +206,97 @@ static int call_nwbind(int mode) return(0); } + +static void debug_nwconn_fileop(uint8 func, uint8 *data, int len) +{ + int shown = len; + char ascii[260]; + int i; + + if (shown > 120) + shown = 120; + if (shown < 0) + shown = 0; + + for (i = 0; i < shown && i < (int)sizeof(ascii) - 1; i++) { + int c = data ? data[i] : 0; + ascii[i] = (c >= 32 && c < 127) ? (char)c : '.'; + } + ascii[(shown < (int)sizeof(ascii) - 1) ? shown : ((int)sizeof(ascii) - 1)] = '\0'; + + XDPRINTF((2,0, + "NWC FILEOP func=0x%02x ncp_type=0x%x req_len=%d task=%d ascii='%s'", + (int)func, + ncp_type, + len, + (int)ncprequest->task, + ascii)); + + if (data && len > 0) { + int j = len; + uint8 *p = data; + XDPRINTF((2, 2, "NWC FILEOP HEX func=0x%02x len %d, DATA:", (int)func, j)); + while (j--) { + int c = *p++; + if (c > 32 && c < 127) + XDPRINTF((2, 3, ",\'%c\'", (char)c)); + else + XDPRINTF((2, 3, ",0x%x", c)); + } + XDPRINTF((2, 1, NULL)); + } +} + static void pr_debug_request() { if (req_printed++) return; if (ncp_type == 0x2222) { int ufunc = 0; - switch (ncprequest->function) { + +switch (ncprequest->function) { + case 0x0e: + case 0x0f: + case 0x16: + case 0x17: + case 0x18: + case 0x22: + case 0x3b: + case 0x3c: + case 0x3d: + case 0x3e: + case 0x41: + case 0x42: + case 0x43: + case 0x44: + case 0x45: + case 0x46: + case 0x47: + case 0x48: + case 0x49: + case 0x4a: + case 0x4b: + case 0x4c: + case 0x4d: + case 0x4e: + case 0x4f: + case 0x50: + case 0x56: + case 0x57: + case 0x60: + case 0x61: + case 0x62: + case 0x63: + case 0x64: + case 0x65: + case 0x66: + case 0x67: + case 0x68: + case 0x6b: + debug_nwconn_fileop(ncprequest->function, requestdata, requestlen); + break; + default: + break; + } case 0x16 : case 0x17 : ufunc = (int) *(requestdata+2); break; case 0x57 : ufunc = (int) *(requestdata); break;