From 8ba0d0d81ad454aac1e7d375fabe9d943bc82b95 Mon Sep 17 00:00:00 2001 From: Adam Fritzler Date: Sat, 28 Mar 2020 20:21:07 -0700 Subject: [PATCH] dprintf->tprintf --- gnr/core.c | 2 +- gnr/msg.c | 6 +- gnr/node.c | 6 +- include/naf/nafevents.h | 8 +-- modules/nafbasicmodule/basicmodule.c | 4 +- modules/nafconsole/nafconsole.c | 4 +- modules/timpsotr/timpsotr.c | 12 ++-- naf/conn.c | 82 ++++++++++++++-------------- naf/daemon.c | 16 +++--- naf/httpd.c | 30 +++++----- naf/ipv4/icmpv4.c | 8 +-- naf/ipv4/ipv4.c | 8 +-- naf/ipv4/linuxtun.c | 12 ++-- naf/ipv4/net.c | 10 ++-- naf/logging.c | 18 +++--- naf/memory.c | 20 +++---- naf/module.c | 10 ++-- naf/nafconfig.c | 22 ++++---- naf/processes.c | 4 +- naf/rpc.c | 4 +- timps/logging.c | 6 +- timps/oscar/ckcache.c | 6 +- timps/oscar/flap.c | 22 ++++---- timps/oscar/im.c | 8 +-- timps/oscar/oscar.c | 14 ++--- timps/oscar/snac.c | 16 +++--- timps/timps.c | 6 +- 27 files changed, 182 insertions(+), 182 deletions(-) diff --git a/gnr/core.c b/gnr/core.c index 03c7cc8..bca7179 100644 --- a/gnr/core.c +++ b/gnr/core.c @@ -190,7 +190,7 @@ static void freetag(struct nafmodule *mod, void *object, const char *tagname, ch } else { - dvprintf(mod, "freetag: unknown tag '%s'\n", tagname); + tvprintf(mod, "freetag: unknown tag '%s'\n", tagname); } diff --git a/gnr/msg.c b/gnr/msg.c index 91ef5ad..e7a6f4f 100644 --- a/gnr/msg.c +++ b/gnr/msg.c @@ -270,7 +270,7 @@ int gnr_msg_route(struct nafmodule *srcmod, struct gnrmsg *gm) /* Make sure we're routing a sane message... */ if (!gm || !gm->srcname || !gm->srcnameservice || !gm->destname || !gm->destnameservice) { - dvprintf(gnr__module, "gnr_msg_route: invalid args (%p/%s[%s]/%s[%s])\n", + tvprintf(gnr__module, "gnr_msg_route: invalid args (%p/%s[%s]/%s[%s])\n", gm, gm ? gm->srcname : NULL, gm ? gm->srcnameservice : NULL, @@ -283,7 +283,7 @@ int gnr_msg_route(struct nafmodule *srcmod, struct gnrmsg *gm) gmhi.destnode = gnr_node_findbyname(gm->destname, gm->destnameservice); if (gnr__debug > 0) { - dvprintf(gnr__module, "gnr_msg_route: from %s, %s[%s] -> %s[%s], msgtext = (%s) '%s', msgflags = %08lx, srconn = %d\n", + tvprintf(gnr__module, "gnr_msg_route: from %s, %s[%s] -> %s[%s], msgtext = (%s) '%s', msgflags = %08lx, srconn = %d\n", srcmod, gm->srcname, gm->srcnameservice, gm->destname, gm->destnameservice, @@ -330,7 +330,7 @@ int gnr_msg_route(struct nafmodule *srcmod, struct gnrmsg *gm) timersub(&tvout, &tvin, &tv); el = (double)tv.tv_sec + ((double)tv.tv_usec / 1000000); el *= 1000; /* milliseconds */ - dvprintf(gnr__module, "gnr_msg_route: time elapsed since message input: %gms\n", el); + tvprintf(gnr__module, "gnr_msg_route: time elapsed since message input: %gms\n", el); } #endif return 0; diff --git a/gnr/node.c b/gnr/node.c index 493a54f..f1c104a 100644 --- a/gnr/node.c +++ b/gnr/node.c @@ -190,7 +190,7 @@ static void freenode(struct gnrnode *gn, int reason) } #if 0 - dvprintf(gnr__module, "user offline: %s[%s][%s][%s%s%s] -- %s%s%s\n", + tvprintf(gnr__module, "user offline: %s[%s][%s][%s%s%s] -- %s%s%s\n", gn->name, gn->service, gn->ownermod ? gn->ownermod->name : "unknown", @@ -424,7 +424,7 @@ struct gnrnode *gnr_node_online(struct nafmodule *owner, const char *name, const gnr__nodestats.peered++; #if 0 - dvprintf(gnr__module, "user online: %s[%s][%s][%s%s%s]\n", + tvprintf(gnr__module, "user online: %s[%s][%s][%s%s%s]\n", gn->name, gn->service, gn->ownermod ? gn->ownermod->name : "unknown", @@ -458,7 +458,7 @@ int gnr_node_remetric(struct gnrnode *gn, int newmetric) return -1; if (gn->metric < newmetric) - dvprintf(gnr__module, "BUG: gnr_node_remetric asked to make node %s[%s] farther away (new = %d, old = %d)\n", gn->name, gn->service, newmetric, gn->metric); + tvprintf(gnr__module, "BUG: gnr_node_remetric asked to make node %s[%s] farther away (new = %d, old = %d)\n", gn->name, gn->service, newmetric, gn->metric); if (gn->metric == GNR_NODE_METRIC_LOCAL) diff --git a/include/naf/nafevents.h b/include/naf/nafevents.h index f7c5a35..4d2cc76 100644 --- a/include/naf/nafevents.h +++ b/include/naf/nafevents.h @@ -47,13 +47,13 @@ int nafeventv(struct nafmodule *source, naf_event_t event, va_list inap); int nafevent(struct nafmodule *mod, naf_event_t event, ...); -#define dprintf(p, x) nafevent(p, NAF_EVENT_GENERICOUTPUT, x) +#define tprintf(p, x) nafevent(p, NAF_EVENT_GENERICOUTPUT, x) #ifdef NOVAMACROS -int dvprintf(struct nafmodule *mod, ...); +int tvprintf(struct nafmodule *mod, ...); #else -#define dvprintf(p, x, y...) nafevent(p, NAF_EVENT_GENERICOUTPUT, x, y) +#define tvprintf(p, x, y...) nafevent(p, NAF_EVENT_GENERICOUTPUT, x, y) #endif -#define dperror(p, x) nafevent(p, NAF_EVENT_DEBUGOUTPUT, "%s: %s\n", x, strerror(errno)) +#define tperror(p, x) nafevent(p, NAF_EVENT_DEBUGOUTPUT, "%s: %s\n", x, strerror(errno)) #endif /* __NAF_EVENTS_H__ */ diff --git a/modules/nafbasicmodule/basicmodule.c b/modules/nafbasicmodule/basicmodule.c index 2443b73..26f4f17 100644 --- a/modules/nafbasicmodule/basicmodule.c +++ b/modules/nafbasicmodule/basicmodule.c @@ -27,7 +27,7 @@ static struct nafmodule *ourmodule = NULL; static int modinit(struct nafmodule *mod) { - dprintf(mod, "module initializing!\n"); + tprintf(mod, "module initializing!\n"); return 0; } @@ -35,7 +35,7 @@ static int modinit(struct nafmodule *mod) static int modshutdown(struct nafmodule *mod) { - dprintf(mod, "module shutting down!\n"); + tprintf(mod, "module shutting down!\n"); return 0; } diff --git a/modules/nafconsole/nafconsole.c b/modules/nafconsole/nafconsole.c index cbd4919..0f8c30b 100644 --- a/modules/nafconsole/nafconsole.c +++ b/modules/nafconsole/nafconsole.c @@ -588,7 +588,7 @@ static int modinit(struct nafmodule *mod) * Yay for "everything's a file". */ if (!(in = naf_conn_addconn(mod, STDIN_FILENO, NAF_CONN_TYPE_RAW|NAF_CONN_TYPE_SERVER|NAF_CONN_TYPE_READRAW))) { - dprintf(mod, "unable to create nafconn for stdin\n"); + tprintf(mod, "unable to create nafconn for stdin\n"); return -1; } @@ -673,7 +673,7 @@ static void macro_syncconf__addnew(const char *inlist) def = macro_syncconf__getexpansion(c); if (!def) { - dvprintf(nafconsole__module, "configuration error: macro '%s' enabled but not defined\n", c); + tvprintf(nafconsole__module, "configuration error: macro '%s' enabled but not defined\n", c); continue; } diff --git a/modules/timpsotr/timpsotr.c b/modules/timpsotr/timpsotr.c index 00af7bb..189fc62 100644 --- a/modules/timpsotr/timpsotr.c +++ b/modules/timpsotr/timpsotr.c @@ -189,7 +189,7 @@ totr_uiop__create_privkey(void *opdata, const char *accountname, const char *pro char *fingerprint; if (timps_otr__debug > 0) - dvprintf(mod, "creating private key for %s[%s]\n", accountname, protocol); + tvprintf(mod, "creating private key for %s[%s]\n", accountname, protocol); if (!(pkfn = totr_mkfilename(mod, TOTR_PRIVATEKEYFN))) return; @@ -253,7 +253,7 @@ totr_uiop__notify(void *opdata, OtrlNotifyLevel level, const char *title, const primary ? primary : "", secondary ? secondary : ""); #else - dvprintf(mod, "notification from libotr: %s%s%s: %s (%s)\n", + tvprintf(mod, "notification from libotr: %s%s%s: %s (%s)\n", (level == OTRL_NOTIFY_ERROR) ? "ERROR" : "", (level == OTRL_NOTIFY_WARNING) ? "WARNING" : "", (level == OTRL_NOTIFY_INFO) ? "Note" : "", @@ -304,7 +304,7 @@ totr_uiop__confirm_fingerprint(void *opdata, const char *username, const char *p otrl_privkey_hash_to_human(fingerprint, kem->key_fingerprint); if (timps_otr__debug > 0) { - dvprintf(mod, "received fingerprint for %s[%s]: %s\n", + tvprintf(mod, "received fingerprint for %s[%s]: %s\n", username, protocol, fingerprint); } @@ -408,7 +408,7 @@ totr_uiop__log_message(void *opdata, const char *message) * directly to them. */ /* Comes with \n on the end */ - dvprintf(mod, "message from libotr: %s", message); + tvprintf(mod, "message from libotr: %s", message); return; } @@ -612,7 +612,7 @@ freetag(struct nafmodule *mod, void *object, const char *tagname, char tagtype, if (strcmp(tagname, "gnrmsg.newotrmsgtext") == 0) naf_free(mod, (char *)tagdata); else - dvprintf(mod, "freetag: unknown tagname '%s'\n", tagname); + tvprintf(mod, "freetag: unknown tagname '%s'\n", tagname); return; } @@ -624,7 +624,7 @@ modinit(struct nafmodule *mod) timps_otr__module = mod; if (gnr_msg_register(mod, totr_gnroutputfunc) == -1) { - dprintf(mod, "modinit: gsr_msg_register failed\n"); + tprintf(mod, "modinit: gsr_msg_register failed\n"); return -1; } gnr_msg_addmsghandler(mod, GNR_MSG_MSGHANDLER_STAGE_ROUTING, 30, totr_msgroutinghandler, "Off-the-record messaging"); diff --git a/naf/conn.c b/naf/conn.c index b25318c..05d5ae1 100644 --- a/naf/conn.c +++ b/naf/conn.c @@ -105,7 +105,7 @@ int naf_conn_tag_add(struct nafmodule *mod, struct nafconn *conn, const char *na { if (naf_conn__debug) - dvprintf(ourmodule, "naf_conn_tag_add: module = %s, conn = %d, name = %s, type = %c, data = %p\n", mod->name, conn ? conn->cid : -1, name, type, data); + tvprintf(ourmodule, "naf_conn_tag_add: module = %s, conn = %d, name = %s, type = %c, data = %p\n", mod->name, conn ? conn->cid : -1, name, type, data); if (!conn) return -1; @@ -117,7 +117,7 @@ int naf_conn_tag_remove(struct nafmodule *mod, struct nafconn *conn, const char { if (naf_conn__debug) - dvprintf(ourmodule, "naf_conn_tag_remove: module = %s, conn = %d, name = %s\n", mod->name, conn ? conn->cid : -1, name); + tvprintf(ourmodule, "naf_conn_tag_remove: module = %s, conn = %d, name = %s\n", mod->name, conn ? conn->cid : -1, name); if (!conn) return -1; @@ -129,7 +129,7 @@ int naf_conn_tag_ispresent(struct nafmodule *mod, struct nafconn *conn, const ch { if (naf_conn__debug) - dvprintf(ourmodule, "naf_conn_tag_ispresent: module = %s, conn = %d, name = %s\n", mod->name, conn ? conn->cid : -1, name); + tvprintf(ourmodule, "naf_conn_tag_ispresent: module = %s, conn = %d, name = %s\n", mod->name, conn ? conn->cid : -1, name); if (!conn) return -1; @@ -141,7 +141,7 @@ int naf_conn_tag_fetch(struct nafmodule *mod, struct nafconn *conn, const char * { if (naf_conn__debug) - dvprintf(ourmodule, "naf_conn_tag_fetch: module = %s, conn = %d, name = %s\n", mod->name, conn ? conn->cid : -1, name); + tvprintf(ourmodule, "naf_conn_tag_fetch: module = %s, conn = %d, name = %s\n", mod->name, conn ? conn->cid : -1, name); if (!conn) return -1; @@ -256,7 +256,7 @@ static void naf_conn_free(struct nafconn *dead) { if (naf_conn__debug) - dvprintf(ourmodule, "naf_conn_free(%p [cid %d])\n", dead, dead->cid); + tvprintf(ourmodule, "naf_conn_free(%p [cid %d])\n", dead, dead->cid); naf_conn__openconns--; @@ -365,7 +365,7 @@ static int connhandler_read(nbio_fd_t *fdt) } else { - dvprintf(ourmodule, "no known protocol found on %d\n", conn->fdt->fd); + tvprintf(ourmodule, "no known protocol found on %d\n", conn->fdt->fd); naf_conn_free(conn); } @@ -377,7 +377,7 @@ static int connhandler_read(nbio_fd_t *fdt) updaterawmode(conn); } else { - dvprintf(ourmodule, "READ on %d\n", conn->fdt->fd); + tvprintf(ourmodule, "READ on %d\n", conn->fdt->fd); naf_conn_free(conn); } @@ -399,7 +399,7 @@ static int connhandler_write(nbio_fd_t *fdt) naf_conn_free(conn); } else { - dvprintf(ourmodule, "WRITE on %d\n", conn->fdt->fd); + tvprintf(ourmodule, "WRITE on %d\n", conn->fdt->fd); naf_conn_free(conn); } @@ -415,7 +415,7 @@ static int connhandler_eof(nbio_fd_t *fdt) die = 1; if (naf_conn__debug) { - dvprintf(ourmodule, "connhandler_eof(%p [fd %d, cid %d]) -- %s|%s|%s\n", + tvprintf(ourmodule, "connhandler_eof(%p [fd %d, cid %d]) -- %s|%s|%s\n", fdt, fdt->fd, conn->cid, (conn->type & NAF_CONN_TYPE_SERVER) ? "SERVER" : "", (conn->type & NAF_CONN_TYPE_CLIENT) ? "CLIENT" : "", @@ -439,7 +439,7 @@ static int connhandler_incomingconn(nbio_fd_t *fdt) lconn->lasttx_hard++; if (naf_conn__debug > 1) - dvprintf(ourmodule, "connhandler_incomingconn(%p [fd %d, cid %d])\n", fdt, fdt->fd, lconn->cid); + tvprintf(ourmodule, "connhandler_incomingconn(%p [fd %d, cid %d])\n", fdt, fdt->fd, lconn->cid); sfd = nbio_getincomingconn(&gnb, fdt, &sa, &salen); @@ -447,7 +447,7 @@ static int connhandler_incomingconn(nbio_fd_t *fdt) #ifdef EMFILE if (errno == EMFILE) { /* too many open files */ - dprintf(ourmodule, "cannot accept incoming connection; too many open files\n"); + tprintf(ourmodule, "cannot accept incoming connection; too many open files\n"); return 0; } #endif @@ -458,7 +458,7 @@ static int connhandler_incomingconn(nbio_fd_t *fdt) NAF_CONN_TYPE_CLIENT|NAF_CONN_TYPE_DETECTING); if (!nconn) { if (naf_conn__debug > 0) - dprintf(ourmodule, "connhandler_incoming: addconn failed\n"); + tprintf(ourmodule, "connhandler_incoming: addconn failed\n"); nbio_sfd_close(&gnb, sfd); return 0; } @@ -466,7 +466,7 @@ static int connhandler_incomingconn(nbio_fd_t *fdt) if (lconn->owner) { if (naf_conn__debug > 0) { - dvprintf(ourmodule, "[fd %d, cid %lu] forcing ownership to %s\n", nconn->fdt->fd, nconn->cid, lconn->owner); + tvprintf(ourmodule, "[fd %d, cid %lu] forcing ownership to %s\n", nconn->fdt->fd, nconn->cid, lconn->owner); } nconn->owner = lconn->owner; @@ -499,7 +499,7 @@ static int connhandler(void *nbv, int event, nbio_fd_t *fdt) return -1; if (naf_conn__debug) - dvprintf(ourmodule, "connhandler(event = %d, fdt = %p [fd %d])\n", event, fdt, fdt->fd); + tvprintf(ourmodule, "connhandler(event = %d, fdt = %p [fd %d])\n", event, fdt, fdt->fd); if (event == NBIO_EVENT_READ) return connhandler_read(fdt); @@ -524,7 +524,7 @@ static struct nafconn *naf_conn_alloc(void) nc->cid = naf_conn__nextcid++; if (naf_conn__debug) - dvprintf(ourmodule, "naf_conn_alloc: %p (cid %d)\n", nc, nc->cid); + tvprintf(ourmodule, "naf_conn_alloc: %p (cid %d)\n", nc, nc->cid); naf_conn__openconns++; @@ -549,14 +549,14 @@ static int fillendpoints(struct nafconn *conn) if ((getsockname(conn->fdt->fd, (struct sockaddr *)&conn->localendpoint, &localsize) == 0)) { if (naf_conn__debug) { - dvprintf(ourmodule, "[fd %d, cid %d] local = %s:%u\n", conn->fdt->fd, conn->cid, inet_ntoa(((struct sockaddr_in *)&conn->localendpoint)->sin_addr), ntohs(((struct sockaddr_in *)&conn->localendpoint)->sin_port)); + tvprintf(ourmodule, "[fd %d, cid %d] local = %s:%u\n", conn->fdt->fd, conn->cid, inet_ntoa(((struct sockaddr_in *)&conn->localendpoint)->sin_addr), ntohs(((struct sockaddr_in *)&conn->localendpoint)->sin_port)); } } /* This won't work for listeners */ if ((getpeername(conn->fdt->fd, (struct sockaddr *)&conn->remoteendpoint, &remotesize) == 0)) { if (naf_conn__debug) { - dvprintf(ourmodule, "[fd %d, cid %d] remote = %s:%u\n", conn->fdt->fd, conn->cid, inet_ntoa(((struct sockaddr_in *)&conn->remoteendpoint)->sin_addr), ntohs(((struct sockaddr_in *)&conn->remoteendpoint)->sin_port)); + tvprintf(ourmodule, "[fd %d, cid %d] remote = %s:%u\n", conn->fdt->fd, conn->cid, inet_ntoa(((struct sockaddr_in *)&conn->remoteendpoint)->sin_addr), ntohs(((struct sockaddr_in *)&conn->remoteendpoint)->sin_port)); } } @@ -570,7 +570,7 @@ static int fillendpoints(struct nafconn *conn) #ifdef HAVE_LINUX_NETFILTER_IPV4_H if ((getsockopt(conn->fdt->fd, IPPROTO_IP, SO_ORIGINAL_DST, &conn->origremoteendpoint, &origremotesize) == 0)) { if (naf_conn__debug) { - dvprintf(ourmodule, "[fd %d, cid %d] original remote = %s:%u\n", conn->fdt->fd, conn->cid, inet_ntoa(((struct sockaddr_in *)&conn->origremoteendpoint)->sin_addr), ntohs(((struct sockaddr_in *)&conn->origremoteendpoint)->sin_port)); + tvprintf(ourmodule, "[fd %d, cid %d] original remote = %s:%u\n", conn->fdt->fd, conn->cid, inet_ntoa(((struct sockaddr_in *)&conn->origremoteendpoint)->sin_addr), ntohs(((struct sockaddr_in *)&conn->origremoteendpoint)->sin_port)); } } #else @@ -603,7 +603,7 @@ struct nafconn *naf_conn_addconn(struct nafmodule *mod, nbio_sockfd_t fd, naf_u3 * a crappy solution.) */ if (!(newconn->fdt = nbio_addfd(&gnb, nbtype, fd, 0, connhandler, (void *)newconn, 1, 220))) { - dperror(NULL, "nbio_addfd"); + tperror(NULL, "nbio_addfd"); naf_conn_free(newconn); return NULL; } @@ -669,7 +669,7 @@ static void dumpbox(struct nafmodule *mod, const char *prefix, naf_conn_cid_t ci } else break; } - dvprintf(mod, "%s\n", tmpstr); + tvprintf(mod, "%s\n", tmpstr); } } @@ -680,7 +680,7 @@ int naf_conn_reqread(struct nafconn *conn, unsigned char *buf, int buflen, int o return -1; if (naf_conn__debug > 2) - dvprintf(ourmodule, "adding read buffer (%p) of length %d (offset %d) to cid %ld\n", buf, buflen, offset, conn->cid); + tvprintf(ourmodule, "adding read buffer (%p) of length %d (offset %d) to cid %ld\n", buf, buflen, offset, conn->cid); return nbio_addrxvector(&gnb, conn->fdt, buf, buflen, offset); } @@ -775,7 +775,7 @@ static int finishconnect(struct nafconn *conn) * return zero, anything else means it didn't connect. */ if (nbio_sfd_read(&gnb, conn->fdt->fd, &blah, 0) != 0) { - dperror(ourmodule, "delayed connect (false alarm)"); + tperror(ourmodule, "delayed connect (false alarm)"); return -1; } @@ -786,11 +786,11 @@ static int finishconnect(struct nafconn *conn) if (conn->owner && conn->owner->connready) { if (conn->owner->connready(conn->owner, conn, NAF_CONN_READY_CONNECTED) == -1) { - dvprintf(ourmodule, "error on %d (CONNECTED)\n", conn->fdt->fd); + tvprintf(ourmodule, "error on %d (CONNECTED)\n", conn->fdt->fd); return -1; } } else { - dvprintf(ourmodule, "no owner for %d!\n", conn->fdt->fd); + tvprintf(ourmodule, "no owner for %d!\n", conn->fdt->fd); return -1; } @@ -850,16 +850,16 @@ int naf_conn_startconnect(struct nafmodule *mod, struct nafconn *localconn, cons } if (naf_conn__debug) - dvprintf(mod, "starting non-blocking connect to %s port %d\n", newhost, port); + tvprintf(mod, "starting non-blocking connect to %s port %d\n", newhost, port); /* XXX XXX XXX this blocks!!! */ if (!(h = gethostbyname(newhost))) { - dvprintf(mod, "gethostbyname failed for %s\n", newhost); + tvprintf(mod, "gethostbyname failed for %s\n", newhost); return -1; } if (naf_conn__debug) - dvprintf(mod, "gethostbyname finished (%s)\n", newhost); + tvprintf(mod, "gethostbyname finished (%s)\n", newhost); memset(&sai, 0, sizeof(struct sockaddr_in)); memcpy(&sai.sin_addr.s_addr, h->h_addr, 4); @@ -875,19 +875,19 @@ int naf_conn_startconnect(struct nafmodule *mod, struct nafconn *localconn, cons * though. */ if ((sfd = nbio_sfd_new_stream(&gnb)) == -1) { - dvprintf(mod, "nbio_sock_new_stream() failed: %s\n", strerror(errno)); + tvprintf(mod, "nbio_sock_new_stream() failed: %s\n", strerror(errno)); return -1; } if (nbio_sfd_setnonblocking(&gnb, sfd) == -1) { - dvprintf(mod, "nbio_sfd_setnonblocking() failed: %s\n", strerror(errno)); + tvprintf(mod, "nbio_sfd_setnonblocking() failed: %s\n", strerror(errno)); nbio_sfd_close(&gnb, sfd); return -1; } status = nbio_sfd_connect(&gnb, sfd, (struct sockaddr *)&sai, sizeof(sai)); if ((status == -1) && (errno != EINPROGRESS)) { - dvprintf(mod, "nbio_sfd_connect() failed: %s\n", strerror(errno)); + tvprintf(mod, "nbio_sfd_connect() failed: %s\n", strerror(errno)); nbio_sfd_close(&gnb, sfd); return -1; } else if (status == 0) @@ -919,7 +919,7 @@ int naf_conn_startconnect(struct nafmodule *mod, struct nafconn *localconn, cons localconn->endpoint->endpoint = localconn; if (naf_conn__debug) - dvprintf(mod, "connection started (%d)\n", !!inprogress); + tvprintf(mod, "connection started (%d)\n", !!inprogress); return 0; } @@ -1137,7 +1137,7 @@ static int timerhandler_matcher(struct nafmodule *mod, struct nafconn *conn, con naf_conn_setraw(conn, 0); /* clear raw mode */ if (naf_module__protocoldetecttimeout(mod, conn) <= 0) { - dvprintf(mod, "no one wants to deal with timed out protocol detect on %d\n", conn->fdt->fd); + tvprintf(mod, "no one wants to deal with timed out protocol detect on %d\n", conn->fdt->fd); naf_conn_schedulekill(conn); } @@ -1160,12 +1160,12 @@ static struct nafconn *listenestablish(struct nafmodule *mod, const char *addr, struct nafconn *retconn = NULL; if ((sfd = nbio_sfd_newlistener(&gnb, addr, portnum)) == -1) { - dprintf(mod, "unable to create listener socket\n"); + tprintf(mod, "unable to create listener socket\n"); return NULL; } if (!(retconn = naf_conn_addconn(nowner, sfd, NAF_CONN_TYPE_LISTENER))) { - dprintf(mod, "unable to add connection for listener\n"); + tprintf(mod, "unable to add connection for listener\n"); nbio_sfd_close(&gnb, sfd); return NULL; } @@ -1257,7 +1257,7 @@ static int cleanlisteners_matcher(struct nafmodule *mod, struct nafconn *conn, c return 0; if (!listenport_isconfigured(mod, addr, port)) { - dvprintf(mod, "removing unconfigured listen port %s:%u\n", addr ? addr : "any", port); + tvprintf(mod, "removing unconfigured listen port %s:%u\n", addr ? addr : "any", port); naf_conn_free(conn); } @@ -1280,7 +1280,7 @@ static void cleanlisteners(struct nafmodule *mod) /* Add newly configured ports */ if (!(conf = naf_config_getmodparmstr(mod, "listenports"))) { - dprintf(mod, "WARNING: no listen ports configured\n"); + tprintf(mod, "WARNING: no listen ports configured\n"); return; } @@ -1314,17 +1314,17 @@ static void cleanlisteners(struct nafmodule *mod) } if (owner && !nconnowner) { - dvprintf(mod, "unable to find module '%s' for listener port %d\n", owner, portnum); + tvprintf(mod, "unable to find module '%s' for listener port %d\n", owner, portnum); goahead = 0; } if (portnum == -1) { - dprintf(mod, "invalid listener port specification\n"); + tprintf(mod, "invalid listener port specification\n"); goahead = 0; } if (findlistenport(mod, addr, (naf_u16_t)atoi(cur))) { - dvprintf(mod, "duplicate listener specified on port %d\n", portnum); + tvprintf(mod, "duplicate listener specified on port %d\n", portnum); goahead = 0; } @@ -1332,7 +1332,7 @@ static void cleanlisteners(struct nafmodule *mod) nconn = listenestablish(mod, addr, (naf_u16_t)portnum, nconnowner); if (nconn) { - dvprintf(mod, "listening on port %d (for %s)\n", + tvprintf(mod, "listening on port %d (for %s)\n", portnum, nconnowner ? nconnowner->name : "all"); } @@ -1351,7 +1351,7 @@ static void signalhandler(struct nafmodule *mod, struct nafmodule *source, int s char *extip; if ((extip = naf_config_getmodparmstr(mod, "extipaddr"))) - dvprintf(mod, "assuming incoming connections on %s\n", extip); + tvprintf(mod, "assuming incoming connections on %s\n", extip); NAFCONFIG_UPDATEINTMODPARMDEF(mod, "debug", naf_conn__debug, NAF_CONN_DEBUG_DEFAULT); diff --git a/naf/daemon.c b/naf/daemon.c index c4dafe9..ff9c96b 100644 --- a/naf/daemon.c +++ b/naf/daemon.c @@ -372,7 +372,7 @@ int naf_init1(int argc, char **argv) #ifndef NOUNIXRLIMITS if (setnofilelimit() == -1) - dprintf(NULL, "WARNING: unable to increase file descriptor ulimit\n"); + tprintf(NULL, "WARNING: unable to increase file descriptor ulimit\n"); setcorelimit(); #endif @@ -406,7 +406,7 @@ int naf_init1(int argc, char **argv) #endif if (!conffn) { - dprintf(NULL, "no config file specified (use -c)\n"); + tprintf(NULL, "no config file specified (use -c)\n"); fprintf(stderr, "no config file specified (use -c)\n"); naf_uninit(); return -1; @@ -432,7 +432,7 @@ int naf_init1(int argc, char **argv) #ifndef NOUNIXDAEMONIZATION if (daemonize && (dodaemonize() == -1)) { - dprintf(NULL, "unable to daemonize"); + tprintf(NULL, "unable to daemonize"); naf_uninit(); return -1; } @@ -450,13 +450,13 @@ int naf_init_final(void) /* make sure everything is sane. */ nafsignal(NULL, NAF_SIGNAL_CONFCHANGE); - dprintf(NULL, "started\n"); + tprintf(NULL, "started\n"); #ifndef NOUNIXDAEMONIZATION - dvprintf(NULL, "running as pid %d\n", getpid()); + tvprintf(NULL, "running as pid %d\n", getpid()); #endif #ifndef NOUNIXRLIMITS - dvprintf(NULL, "maximum number of open file descriptors: %d\n", getnofilelimit()); - dvprintf(NULL, "maximum core file size: %d bytes\n", getcorelimit()); + tvprintf(NULL, "maximum number of open file descriptors: %d\n", getnofilelimit()); + tvprintf(NULL, "maximum core file size: %d bytes\n", getcorelimit()); #endif return 0; @@ -484,7 +484,7 @@ int naf_main(void) } /* should be unreachable */ - dvprintf(NULL, "died for some reason (possibly because of %s)\n", strerror(errno)); + tvprintf(NULL, "died for some reason (possibly because of %s)\n", strerror(errno)); naf_uninit(); diff --git a/naf/httpd.c b/naf/httpd.c index bec063d..395c535 100644 --- a/naf/httpd.c +++ b/naf/httpd.c @@ -179,7 +179,7 @@ static int handlefirstreqline(struct nafmodule *mod, struct nafconn *conn, char if ((strncmp(buf, "GET ", 4) != 0) && (strncmp(buf, "POST ", 5) != 0) && (naf_httpd__debug > 0)) { - dvprintf(mod, "unrecognized request: \"%s\"\n", buf); + tvprintf(mod, "unrecognized request: \"%s\"\n", buf); return -1; } @@ -189,7 +189,7 @@ static int handlefirstreqline(struct nafmodule *mod, struct nafconn *conn, char prot = http_getnextarg(mod, &cur); if (naf_httpd__debug > 0) - dvprintf(mod, "request: req = '%s', file = '%s', prot = '%s'\n", req, file, prot); + tvprintf(mod, "request: req = '%s', file = '%s', prot = '%s'\n", req, file, prot); if ((strcasecmp(req, "GET") == 0) && file && strlen(file)) { @@ -225,7 +225,7 @@ static int handleheaderline(struct nafmodule *mod, struct nafconn *conn, char *b value = nextnonwhite(value); if (naf_httpd__debug > 0) - dvprintf(mod, "header: name = '%s', value = '%s'\n", name, value); + tvprintf(mod, "header: name = '%s', value = '%s'\n", name, value); if (!name || !strlen(name)) return 0; @@ -234,12 +234,12 @@ static int handleheaderline(struct nafmodule *mod, struct nafconn *conn, char *b int clen; if (!value || ((clen = atoi(value)) < 0)) { - dprintf(mod, "invalid Content-Length header\n"); + tprintf(mod, "invalid Content-Length header\n"); return -1; } if (clen > SOAPMAXREQPAYLOADLEN) { - dvprintf(mod, "rejecting request with huge Content-Length (wanted %d)\n", clen); + tvprintf(mod, "rejecting request with huge Content-Length (wanted %d)\n", clen); return -1; } @@ -431,7 +431,7 @@ static int dorequest_get(struct nafmodule *mod, struct nafconn *conn, char *file hp = naf_httpd_page__find_loose(mod, file); if (!hp) { if (naf_httpd__debug > 0) - dvprintf(mod, "no handler matching page '%s'\n", file); + tvprintf(mod, "no handler matching page '%s'\n", file); return send404(mod, conn); } } @@ -486,7 +486,7 @@ static void handlenafrpc_startelement(void *userdata, const char *name, const ch if (strcasecmp(name, "SOAP-ENV:Envelope") != 0) { if (naf_httpd__debug > 0) - dvprintf(info->mod, "(start) unknown outer tag '%s'\n", name); + tvprintf(info->mod, "(start) unknown outer tag '%s'\n", name); return; } @@ -553,7 +553,7 @@ static void handlenafrpc_endelement(void *userdata, const char *name) if (strcasecmp(name, "SOAP-ENV:Envelope") != 0) { if (naf_httpd__debug > 0) - dvprintf(info->mod, "(end) unknown outer tag '%s'\n", name); + tvprintf(info->mod, "(end) unknown outer tag '%s'\n", name); } /* info.x is picked up and returned to the caller later */ @@ -793,7 +793,7 @@ static int handlenafrpc(struct nafmodule *mod, struct nafconn *conn, unsigned ch } else { - dvprintf(mod, "unknown datatype '%s'\n", parmtype); + tvprintf(mod, "unknown datatype '%s'\n", parmtype); } } @@ -863,7 +863,7 @@ static int connready(struct nafmodule *mod, struct nafconn *conn, naf_u16_t what int buflen; if (naf_conn_takewrite(conn, &buf, &buflen) < 0) { - dprintf(mod, "connready: takewrite failed\n"); + tprintf(mod, "connready: takewrite failed\n"); return -1; } naf_free(mod, buf); @@ -876,7 +876,7 @@ static int connready(struct nafmodule *mod, struct nafconn *conn, naf_u16_t what int buflen; if (naf_conn_takeread(conn, &buf, &buflen) == -1) { - dprintf(mod, "connready: takeread failed\n"); + tprintf(mod, "connready: takeread failed\n"); return -1; } @@ -949,7 +949,7 @@ static int connready(struct nafmodule *mod, struct nafconn *conn, naf_u16_t what int ret; if (naf_httpd__debug > 0) - dvprintf(mod, "received %d bytes of HTTP payload\n", buflen); + tvprintf(mod, "received %d bytes of HTTP payload\n", buflen); conn->state = SOAPCONN_STATE_PROCESSING; if (reqmonitorbuf(mod, conn) == -1) return -1; @@ -962,12 +962,12 @@ static int connready(struct nafmodule *mod, struct nafconn *conn, naf_u16_t what } else if (conn->state == SOAPCONN_STATE_PROCESSING) { - dprintf(mod, "received data from client while in processing state\n"); + tprintf(mod, "received data from client while in processing state\n"); return -1; } else { - dvprintf(mod, "connection in unknown state %d\n", conn->state); + tvprintf(mod, "connection in unknown state %d\n", conn->state); return -1; } @@ -995,7 +995,7 @@ static void freetag(struct nafmodule *mod, void *object, const char *tagname, ch } else { - dvprintf(mod, "XXX unknown tag '%s'\n", tagname); + tvprintf(mod, "XXX unknown tag '%s'\n", tagname); } diff --git a/naf/ipv4/icmpv4.c b/naf/ipv4/icmpv4.c index c3eec45..4916f2c 100644 --- a/naf/ipv4/icmpv4.c +++ b/naf/ipv4/icmpv4.c @@ -144,23 +144,23 @@ naf_icmpv4_input(struct nafmodule *mod, struct nafnet_ip *ip) if (ic.ic_type == ICMP_TYPE_ECHOREPLY) { if (naf_icmpv4__debug) - dvprintf(mod, "ICMP echo reply from 0x%08lx\n", ip->ip_saddr); + tvprintf(mod, "ICMP echo reply from 0x%08lx\n", ip->ip_saddr); } else if (ic.ic_type == ICMP_TYPE_DESTUNREACHABLE) { if (naf_icmpv4__debug) - dvprintf(mod, "ICMP Destination Unreachable from 0x%08lx (code %d)\n", ip->ip_saddr, ic.ic_code); + tvprintf(mod, "ICMP Destination Unreachable from 0x%08lx (code %d)\n", ip->ip_saddr, ic.ic_code); } else if (ic.ic_type == ICMP_TYPE_ECHO) { if (naf_icmpv4__debug) - dvprintf(mod, "ICMP Echo Request from 0x%08lx\n", ip->ip_saddr); + tvprintf(mod, "ICMP Echo Request from 0x%08lx\n", ip->ip_saddr); sendechoreply(mod, ip, &ic); } else { - dvprintf(mod, "unknown ICMP type %d from 0x%08lx\n", ic.ic_type, ip->ip_saddr); + tvprintf(mod, "unknown ICMP type %d from 0x%08lx\n", ic.ic_type, ip->ip_saddr); ret = -1; } diff --git a/naf/ipv4/ipv4.c b/naf/ipv4/ipv4.c index aeab1e6..3abd077 100644 --- a/naf/ipv4/ipv4.c +++ b/naf/ipv4/ipv4.c @@ -130,7 +130,7 @@ naf_ipv4_route_add(naf_u32_t dest, naf_u32_t gw, naf_u32_t mask, naf_u16_t flags rt = naf_ipv4_route_find(dest, gw, mask, metric); if (rt) { if (naf_ipv4__debug) - dvprintf(naf_ipv4__module, "route already exists (%08lx/%08lx via %08lx metric %d\n",dest, mask, gw, metric); + tvprintf(naf_ipv4__module, "route already exists (%08lx/%08lx via %08lx metric %d\n",dest, mask, gw, metric); return -1; } rt = naf_ipv4_route__alloc(); @@ -408,7 +408,7 @@ naf_ipv4__parseoptions(naf_sbuf_t *sb, struct nafnet_ip *ip) } else { if (naf_ipv4__debug) - dvprintf(naf_ipv4__module, "unknown IP option 0x%02x from 0x%08lx\n", type, ip->ip_saddr); + tvprintf(naf_ipv4__module, "unknown IP option 0x%02x from 0x%08lx\n", type, ip->ip_saddr); break; /* can't continue */ } @@ -478,7 +478,7 @@ naf_ipv4_input(struct nafmodule *inmod, struct nafnet_if *recvif, naf_u8_t *buf, sb.sbuf_buflen = hdrlen; /* trim down this sbuf */ if (naf_ipv4__debug > 1) { - dvprintf(naf_ipv4__module, "received IP packet: ver = %d, ihl = %d, tot_len = %d, ttl = %d, saddr = 0x%08lx, daddr = 0x%08lx, protocol %d, csum 0x%04x\n", + tvprintf(naf_ipv4__module, "received IP packet: ver = %d, ihl = %d, tot_len = %d, ttl = %d, saddr = 0x%08lx, daddr = 0x%08lx, protocol %d, csum 0x%04x\n", iph.ip_v, iph.ip_hl, iph.ip_len, iph.ip_ttl, iph.ip_src.s_addr, @@ -493,7 +493,7 @@ naf_ipv4_input(struct nafmodule *inmod, struct nafnet_if *recvif, naf_u8_t *buf, goto out; if (naf_ipv4__hdrcsum(buf, hdrlen) != iph.ip_sum) { if (naf_ipv4__debug) - dvprintf(naf_ipv4__module, "bad IPv4 checksum from 0x%08lx\n", iph.ip_src.s_addr); + tvprintf(naf_ipv4__module, "bad IPv4 checksum from 0x%08lx\n", iph.ip_src.s_addr); goto out; } diff --git a/naf/ipv4/linuxtun.c b/naf/ipv4/linuxtun.c index 6037e15..8910ccf 100644 --- a/naf/ipv4/linuxtun.c +++ b/naf/ipv4/linuxtun.c @@ -97,7 +97,7 @@ opentun(void) fd = open("/dev/net/tun", O_RDWR); if (fd == -1) { - dvprintf(naf_linuxtun__module, "open(/dev/net/tun): %s\n", strerror(errno)); + tvprintf(naf_linuxtun__module, "open(/dev/net/tun): %s\n", strerror(errno)); return -1; } @@ -105,12 +105,12 @@ opentun(void) ifr.ifr_flags = IFF_TUN | IFF_NO_PI; if (ioctl(fd, TUNSETIFF, &ifr) == -1) { - dvprintf(naf_linuxtun__module, "ioctl(TUNSETIFF): %s\n", strerror(errno)); + tvprintf(naf_linuxtun__module, "ioctl(TUNSETIFF): %s\n", strerror(errno)); close(fd); return -1; } - dvprintf(naf_linuxtun__module, "opened Linux tun device %s\n", ifr.ifr_name); + tvprintf(naf_linuxtun__module, "opened Linux tun device %s\n", ifr.ifr_name); naf_linuxtun__ifconn = naf_conn_addconn(naf_linuxtun__module, fd, @@ -141,12 +141,12 @@ connready(struct nafmodule *mod, struct nafconn *conn, naf_u16_t what) err = read(conn->fdt->fd, dg, sizeof(dg)); if (err <= 0) { - dvprintf(naf_linuxtun__module, "error reading from tun device: %s\n", (err == 0) ? "EOF" : strerror(err)); + tvprintf(naf_linuxtun__module, "error reading from tun device: %s\n", (err == 0) ? "EOF" : strerror(err)); naf_conn_schedulekill(conn); return -1; } - dvprintf(naf_linuxtun__module, "received %d octet datagram\n", err); + tvprintf(naf_linuxtun__module, "received %d octet datagram\n", err); naf_ipv4_input(naf_linuxtun__module, naf_linuxtun__if, dg, err); return 0; @@ -162,7 +162,7 @@ modinit(struct nafmodule *mod) naf_linuxtun__module = mod; if (opentun() == -1) - dprintf(naf_linuxtun__module, "failed to open Linux TUN device\n"); + tprintf(naf_linuxtun__module, "failed to open Linux TUN device\n"); return 0; } diff --git a/naf/ipv4/net.c b/naf/ipv4/net.c index 8b8a00e..778a8c3 100644 --- a/naf/ipv4/net.c +++ b/naf/ipv4/net.c @@ -113,7 +113,7 @@ naf_net_if__configure(struct nafnet_if *iff) /* XXX do checking here? (make sure in isn't net or bcast) */ if ((ina.s_addr == 0) || (inam.s_addr == 0) || (naf_net_if_addr_add_ipv4(iff, ina.s_addr, inam.s_addr) == -1)) { - dvprintf(naf_net__module, "failed to add address %s to %s\n", inet_ntoa(ina), iff->if_name); + tvprintf(naf_net__module, "failed to add address %s to %s\n", inet_ntoa(ina), iff->if_name); } } #endif /* def NAFNET_USE_IPV4 */ @@ -128,7 +128,7 @@ naf_net_if__configure(struct nafnet_if *iff) p = naf_config_getmodparmstr(naf_net__module, pn); if (p) { if ((nmtu = atoi(p)) == -1) - dvprintf(naf_net__module, "invalid MTU configured for %s\n", iff->if_name); + tvprintf(naf_net__module, "invalid MTU configured for %s\n", iff->if_name); else iff->if_mtu = (naf_u16_t)nmtu; } @@ -145,14 +145,14 @@ naf_net_if__configure(struct nafnet_if *iff) else if (strcasecmp(p, "down") == 0) nstate = 0; else - dvprintf(naf_net__module, "unknown state configured for %s\n", iff->if_name); + tvprintf(naf_net__module, "unknown state configured for %s\n", iff->if_name); } if ((nstate == 1 && !(iff->if_flags & NAFNET_IFFLAG_UP))) { - dvprintf(naf_net__module, "bringing up interface %s\n", iff->if_name); + tvprintf(naf_net__module, "bringing up interface %s\n", iff->if_name); iff->if_flags |= NAFNET_IFFLAG_UP; naf_ipv4_event_ifup(iff); /* XXX need better API (this way will not update when addresses change without up/down */ } else if ((nstate == 0) && (iff->if_flags & NAFNET_IFFLAG_UP)) { - dvprintf(naf_net__module, "taking down interface %s\n", iff->if_name); + tvprintf(naf_net__module, "taking down interface %s\n", iff->if_name); iff->if_flags &= ~NAFNET_IFFLAG_UP; naf_ipv4_event_ifdown(iff); /* XXX need better API */ } else diff --git a/naf/logging.c b/naf/logging.c index 1e0ef53..6e79d32 100644 --- a/naf/logging.c +++ b/naf/logging.c @@ -62,13 +62,13 @@ /* LOGGING PLUGINS CAN NEVER USE DPRINTF WITH A NON-NULL FIRST ARG!! */ /* So we can't use the standard ones */ -#undef dprintf -#undef dperror +#undef tprintf +#undef tperror #ifndef NOVAMACROS -#undef dvprintf -#define dvprintf(p, x, y...) nafevent(NULL, NAF_EVENT_GENERICOUTPUT, x, y) +#undef tvprintf +#define tvprintf(p, x, y...) nafevent(NULL, NAF_EVENT_GENERICOUTPUT, x, y) #endif -#define dprintf(p, x) nafevent(NULL, NAF_EVENT_GENERICOUTPUT, x) +#define tprintf(p, x) nafevent(NULL, NAF_EVENT_GENERICOUTPUT, x) static struct nafmodule *ourmodule = NULL; @@ -370,17 +370,17 @@ static void signalhandler(struct nafmodule *mod, struct nafmodule *source, int s if (signum == NAF_SIGNAL_INFO) { - dprintf(NULL, "Logging module info:\n"); - dvprintf(NULL, " Output file: %s\n", outfilename ? outfilename : "stderr"); + tprintf(NULL, "Logging module info:\n"); + tvprintf(NULL, " Output file: %s\n", outfilename ? outfilename : "stderr"); } else if (signum == NAF_SIGNAL_RELOAD) { - dprintf(NULL, "reopening logfile...\n"); + tprintf(NULL, "reopening logfile...\n"); logging_restart(mod); } else if (signum == NAF_SIGNAL_SHUTDOWN) { - dprintf(NULL, "deferring shutdown of logging module...\n"); + tprintf(NULL, "deferring shutdown of logging module...\n"); } else if (signum == NAF_SIGNAL_CONFCHANGE) { diff --git a/naf/memory.c b/naf/memory.c index 7c947c0..1232b1d 100644 --- a/naf/memory.c +++ b/naf/memory.c @@ -194,7 +194,7 @@ void *naf_malloc_real(struct nafmodule *mod, int type, size_t reqsize, const cha static const naf_u8_t ftrmatch[] = FTR_MAGIC_END; if (naf_memory__debug >= 2) { - dvprintf(NULL, "[%s:%d] NAF_MALLOC(%p=%s, 0x%04x, %d)\n", + tvprintf(NULL, "[%s:%d] NAF_MALLOC(%p=%s, 0x%04x, %d)\n", file, line, mod, mod ? mod->name : "(none)", @@ -211,7 +211,7 @@ void *naf_malloc_real(struct nafmodule *mod, int type, size_t reqsize, const cha if (!(buf = malloc(buflen))) { if (naf_memory__debug) { - dvprintf(NULL, "[%s:%d] NAF_MALLOC(%p=%s, 0x%04x, %d) FAILED\n", + tvprintf(NULL, "[%s:%d] NAF_MALLOC(%p=%s, 0x%04x, %d) FAILED\n", file, line, mod, mod ? mod->name : "(none)", @@ -258,7 +258,7 @@ void *naf_malloc_real(struct nafmodule *mod, int type, size_t reqsize, const cha } if (naf_memory__debug >= 2) { - dvprintf(NULL, "[%s:%d] NAF_MALLOC(%p=%s, 0x%04x, %d) = %p/%p\n", + tvprintf(NULL, "[%s:%d] NAF_MALLOC(%p=%s, 0x%04x, %d) = %p/%p\n", file, line, mod, mod ? mod->name : "(none)", @@ -278,7 +278,7 @@ void naf_free_real(struct nafmodule *mod, void *ptr, const char *file, int line) static const char ftrmatch[] = FTR_MAGIC_END; if (naf_memory__debug >= 2) { - dvprintf(NULL, "[%s:%d] NAF_FREE(%p=%s, %p)\n", + tvprintf(NULL, "[%s:%d] NAF_FREE(%p=%s, %p)\n", file, line, mod, mod ? mod->name : "(none)", @@ -305,7 +305,7 @@ void naf_free_real(struct nafmodule *mod, void *ptr, const char *file, int line) (hdr->hdrmagic1 != HDR_MAGIC_START)) { if (naf_memory__debug) { - dvprintf(NULL, "[%s:%d] NAF_FREE(%p=%s, %p) -- buffer was not allocated with naf_malloc! 0x%08lx, 0x%08lx\n", + tvprintf(NULL, "[%s:%d] NAF_FREE(%p=%s, %p) -- buffer was not allocated with naf_malloc! 0x%08lx, 0x%08lx\n", file, line, mod, mod ? mod->name : "(none)", @@ -322,7 +322,7 @@ void naf_free_real(struct nafmodule *mod, void *ptr, const char *file, int line) if (naf_memory__debug && (mod && (strcmp(mod->name, "nafconsole") != 0))) { if (hdr->owner != mod) { - dvprintf(NULL, "[%s:%d] NAF_FREE(%p=%s, %p) -- buffer originally allocated by %p=%s... mismatch!\n", + tvprintf(NULL, "[%s:%d] NAF_FREE(%p=%s, %p) -- buffer originally allocated by %p=%s... mismatch!\n", file, line, mod, mod ? mod->name : "(none)", @@ -336,7 +336,7 @@ void naf_free_real(struct nafmodule *mod, void *ptr, const char *file, int line) ftr = ((unsigned char *)hdr) + hdr->hdrlen + hdr->buflen; if (memcmp(ftr, ftrmatch, sizeof(ftrmatch)) != 0) { - dvprintf(NULL, "[%s:%d] NAF_FREE(%p=%s, %p) -- footer magic corrupt, someone ran over us!\n", + tvprintf(NULL, "[%s:%d] NAF_FREE(%p=%s, %p) -- footer magic corrupt, someone ran over us!\n", file, line, mod, mod ? mod->name : "(none)", @@ -405,7 +405,7 @@ naf_flmempool_t *naf_flmp_alloc(struct nafmodule *owner, int memtype, int blklen flmp->flmp_allocmaplen = flmp->flmp_blkcount / 8; #ifdef CHATTYFLMP - dvprintf(NULL, "()()()() naf_flmp_alloc: allocating pool of %d blocks, %d bytes each, total region of %d bytes, map size of %d\n", + tvprintf(NULL, "()()()() naf_flmp_alloc: allocating pool of %d blocks, %d bytes each, total region of %d bytes, map size of %d\n", flmp->flmp_blkcount, flmp->flmp_blklen, flmp->flmp_regionlen, @@ -485,7 +485,7 @@ void *naf_flmp_blkalloc(struct nafmodule *owner, naf_flmempool_t *flmp) block = flmp->flmp_region + (((i * 8) + (7 - j)) * flmp->flmp_blklen); #ifdef CHATTYFLMP - dvprintf(NULL, "()()()() naf_flmp_blkalloc: returning block number %d, ptr %p, map index [%d,%d]\n", + tvprintf(NULL, "()()()() naf_flmp_blkalloc: returning block number %d, ptr %p, map index [%d,%d]\n", (i * 8) + (7 - j), block, i, j); @@ -510,7 +510,7 @@ void naf_flmp_blkfree(struct nafmodule *owner, naf_flmempool_t *flmp, void *bloc i = blknum / 8; j = 7 - (blknum % 8); #ifdef CHATTYFLMP - dvprintf(NULL, "()()()() naf_flmp_blkfree: block = %p, blknum = %d, map index [%d, %d]\n", + tvprintf(NULL, "()()()() naf_flmp_blkfree: block = %p, blknum = %d, map index [%d, %d]\n", block, blknum, i, j); diff --git a/naf/module.c b/naf/module.c index 860e3ff..c0be5a3 100644 --- a/naf/module.c +++ b/naf/module.c @@ -199,13 +199,13 @@ static int naf_module__load(struct modlist_item *mi) return -1; #else if (!(mi->dlhandle = dlopen(mi->filename, RTLD_NOW))) { - dvprintf(NULL, "%s: dlopen: %s\n", mi->filename, dlerror()); + tvprintf(NULL, "%s: dlopen: %s\n", mi->filename, dlerror()); mi->status = MOD_STATUS_ERROR; return -1; } if (!(mi->firstproc = dlsym(mi->dlhandle, "nafmodulemain"))) { - dvprintf(NULL, "%s: dlsym(nafmodulemain): %s\n", mi->filename, dlerror()); + tvprintf(NULL, "%s: dlsym(nafmodulemain): %s\n", mi->filename, dlerror()); dlclose(mi->dlhandle); mi->status = MOD_STATUS_ERROR; return -1; @@ -214,7 +214,7 @@ static int naf_module__load(struct modlist_item *mi) } if (!mi->firstproc || ((ret = mi->firstproc(&mi->module)) != 0)) { - dvprintf(NULL, "%s: nafmodulemain returned error %d\n", mi->filename, ret); + tvprintf(NULL, "%s: nafmodulemain returned error %d\n", mi->filename, ret); #ifndef NODYNAMICLOADING if (mi->dlhandle) dlclose(mi->dlhandle); @@ -228,7 +228,7 @@ static int naf_module__load(struct modlist_item *mi) if (mi->module.init) mi->module.init(&mi->module); - dvprintf(NULL, "loaded module %s [%s]\n", mi->module.name, mi->filename); + tvprintf(NULL, "loaded module %s [%s]\n", mi->module.name, mi->filename); mi->lasttimerrun = time(NULL); @@ -354,7 +354,7 @@ int nafevent(struct nafmodule *source, naf_event_t event, ...) } #ifdef NOVAMACROS -int dvprintf(struct nafmodule *mod, ...) +int tvprintf(struct nafmodule *mod, ...) { va_list ap; diff --git a/naf/nafconfig.c b/naf/nafconfig.c index db8ec05..874ec07 100644 --- a/naf/nafconfig.c +++ b/naf/nafconfig.c @@ -324,11 +324,11 @@ static int readconfig(struct nafmodule *mod, const char *cfn, int including) return -1; if (!(cf = fopen(cfn, "r"))) { - dvprintf(mod, "could not open %s: %s\n", cfn, strerror(errno)); + tvprintf(mod, "could not open %s: %s\n", cfn, strerror(errno)); return -1; } - dvprintf(mod, "reading configuration from %s...\n", cfn); + tvprintf(mod, "reading configuration from %s...\n", cfn); memset(secname, 0, sizeof(secname)); memset(modname, 0, sizeof(modname)); @@ -349,10 +349,10 @@ static int readconfig(struct nafmodule *mod, const char *cfn, int including) linestart += 8; if (readconfig(mod, linestart, 1) == -1) { - dvprintf(mod, "errors parsing included file %s\n", linestart); + tvprintf(mod, "errors parsing included file %s\n", linestart); } } else - dvprintf(mod, "unknown ! operand %s\n", linestart); + tvprintf(mod, "unknown ! operand %s\n", linestart); continue; } @@ -383,7 +383,7 @@ static int readconfig(struct nafmodule *mod, const char *cfn, int including) } if (!strchr(linestart, '=')) { - dvprintf(mod, "invalid line: %s\n", linestart); + tvprintf(mod, "invalid line: %s\n", linestart); continue; } @@ -415,7 +415,7 @@ static int readconfig(struct nafmodule *mod, const char *cfn, int including) naf_config_setparm(varname, (val && strlen(val)) ? val : NULL); } else { - dvprintf(mod, "unknown declaration outside section %s: %s\n", secname, linestart); + tvprintf(mod, "unknown declaration outside section %s: %s\n", secname, linestart); } } @@ -574,7 +574,7 @@ static int modinit(struct nafmodule *mod) ourmodule = mod; if (!(cfn = naf_config_getparmstr(CONFIG_PARM_FILENAME))) - dprintf(mod, "no config file specified, using defaults\n"); + tprintf(mod, "no config file specified, using defaults\n"); readconfig(mod, cfn, 0); @@ -597,11 +597,11 @@ static void signalhandler(struct nafmodule *mod, struct nafmodule *source, int s if (signum == NAF_SIGNAL_INFO) { - dprintf(mod, "NAF Config Info\n"); + tprintf(mod, "NAF Config Info\n"); if (conffilename) - dvprintf(mod, " Using config from %s\n", conffilename); + tvprintf(mod, " Using config from %s\n", conffilename); else - dprintf(mod, " Using defaults (no conf file)\n"); + tprintf(mod, " Using defaults (no conf file)\n"); { struct parm_s *cur; @@ -609,7 +609,7 @@ static void signalhandler(struct nafmodule *mod, struct nafmodule *source, int s for (cur = parmlist; cur; cur = cur->next) { /* only dump site parameters */ if (1 /*strncmp(cur->parm, "site.", strlen("site.")) == 0*/) { - dvprintf(mod, " %s: %s\n", cur->parm, cur->val); + tvprintf(mod, " %s: %s\n", cur->parm, cur->val); } } } diff --git a/naf/processes.c b/naf/processes.c index eb70e5b..66403b6 100644 --- a/naf/processes.c +++ b/naf/processes.c @@ -172,7 +172,7 @@ void naf_childproc__sigchild_handler(void) return; if (!(cp = naf_childproc__remove(pid))) { - dvprintf(NULL, "unknown child died (pid %d)\n", pid); + tvprintf(NULL, "unknown child died (pid %d)\n", pid); return; } @@ -186,7 +186,7 @@ void naf_childproc__sigchild_handler(void) cp->exitinfo.value = WTERMSIG(status); } - dvprintf(NULL, "child %d %s (%s %d) (owned by %s)\n", + tvprintf(NULL, "child %d %s (%s %d) (owned by %s)\n", cp->pid, (cp->exitinfo.status == NAF_CHILDPROC_EXITSTATUS_EXITED) ? "exited" : "terminated by signal", (cp->exitinfo.status == NAF_CHILDPROC_EXITSTATUS_EXITED) ? "returned code" : "signal number", diff --git a/naf/rpc.c b/naf/rpc.c index 30809a2..b4268f2 100644 --- a/naf/rpc.c +++ b/naf/rpc.c @@ -278,7 +278,7 @@ int naf_rpc_request_issue(struct nafmodule *mod, naf_rpc_req_t *req) } if (1) - dvprintf(ourmodule, "%s->%s() invoked by %s\n", req->target, req->method, mod->name); + tvprintf(ourmodule, "%s->%s() invoked by %s\n", req->target, req->method, mod->name); rm->func(target, req); /* will set req->status */ @@ -460,7 +460,7 @@ static void __rpc_rpc_help(struct nafmodule *mod, naf_rpc_req_t *req) } } - dvprintf(mod, "rpc: rpc->help invoked with module=%s\n", module ? module->data.string : "(none)"); + tvprintf(mod, "rpc: rpc->help invoked with module=%s\n", module ? module->data.string : "(none)"); if ((methods = naf_rpc_addarg_array(mod, &req->returnargs, "methods"))) { diff --git a/timps/logging.c b/timps/logging.c index 6a7343c..f8a27e2 100644 --- a/timps/logging.c +++ b/timps/logging.c @@ -270,7 +270,7 @@ tlogging_nodeeventhandler(struct nafmodule *mod, struct gnr_event_info *gei) fn = mkuserlogfn(mod, gei->gei_node); if (!fn || !(peruser = fopen(fn, "a")) || (gnr_node_tag_add(mod, gei->gei_node, "gnrnode.userlogstream", 'V', (void *)peruser) == -1)) { - dvprintf(mod, "unable to open log file '%s' for user '%s'\n", fn, gei->gei_node->name); + tvprintf(mod, "unable to open log file '%s' for user '%s'\n", fn, gei->gei_node->name); if (peruser) { fclose(peruser); peruser = NULL; @@ -317,7 +317,7 @@ freetag(struct nafmodule *mod, void *object, const char *tagname, char tagtype, } else { - dvprintf(mod, "freetag: unknown tagname '%s'\n", tagname); + tvprintf(mod, "freetag: unknown tagname '%s'\n", tagname); } return; @@ -330,7 +330,7 @@ modinit(struct nafmodule *mod) timps_logging__module = mod; if (gnr_msg_register(mod, NULL /* no outputfunc */) == -1) { - dprintf(mod, "modinit: gsr_msg_register failed\n"); + tprintf(mod, "modinit: gsr_msg_register failed\n"); return -1; } gnr_msg_addmsghandler(mod, GNR_MSG_MSGHANDLER_STAGE_POSTROUTING, 50, tlogging_msglogger, "Log messages"); diff --git a/timps/oscar/ckcache.c b/timps/oscar/ckcache.c index 5191dda..86da10c 100644 --- a/timps/oscar/ckcache.c +++ b/timps/oscar/ckcache.c @@ -113,7 +113,7 @@ toscar_ckcache_add(struct nafmodule *mod, naf_u8_t *ck, naf_u16_t cklen, const c if (toscar_ckcache__find(mod, ck, cklen)) { if (timps_oscar__debug > 0) - dprintf(mod, "ckcache: attempted to add duplicate cookie\n"); + tprintf(mod, "ckcache: attempted to add duplicate cookie\n"); return -1; /* dups are bad... */ } @@ -125,7 +125,7 @@ toscar_ckcache_add(struct nafmodule *mod, naf_u8_t *ck, naf_u16_t cklen, const c timps_oscar__ckcache = ckc; if (timps_oscar__debug > 1) { - dvprintf(mod, "ckcache: added cookie %02x %02x %02x %02x\n", + tvprintf(mod, "ckcache: added cookie %02x %02x %02x %02x\n", ckc->ck[0], ckc->ck[1], ckc->ck[2], ckc->ck[3]); } @@ -156,7 +156,7 @@ toscar_ckcache_rem(struct nafmodule *mod, naf_u8_t *ck, naf_u16_t cklen, char ** struct ckcache *ckc; if (timps_oscar__debug > 1) { - dvprintf(mod, "ckcache: looking to remove cookie %02x %02x %02x %02x\n", + tvprintf(mod, "ckcache: looking to remove cookie %02x %02x %02x %02x\n", ck[0], ck[1], ck[2], ck[3]); } diff --git a/timps/oscar/flap.c b/timps/oscar/flap.c index 4b21b60..7f40bd3 100644 --- a/timps/oscar/flap.c +++ b/timps/oscar/flap.c @@ -265,20 +265,20 @@ toscar_flap_handlechan1__newconn(struct nafmodule *mod, struct nafconn *conn, na if (!(cktlv = naf_tlv_get(mod, *tlvh, 0x0006))) { /* no cookie = wtf are we doing here? */ if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] cookie FLAP missing cookie\n", conn->cid); + tvprintf(mod, "[cid %lu] cookie FLAP missing cookie\n", conn->cid); return HRET_ERROR; } if (toscar_ckcache_rem(mod, cktlv->tlv_value, cktlv->tlv_length, &ip, &sn, &servtype) == -1) { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] received unknown cookie\n", conn->cid); + tvprintf(mod, "[cid %lu] received unknown cookie\n", conn->cid); ret = HRET_ERROR; goto out; } if (timps_oscar__debug > 1) - dvprintf(mod, "[cid %lu] matched cookie to sn '%s', ip '%s', servtype %d\n", conn->cid, sn, ip, servtype); + tvprintf(mod, "[cid %lu] matched cookie to sn '%s', ip '%s', servtype %d\n", conn->cid, sn, ip, servtype); if (naf_conn_startconnect(mod, conn, ip, TIMPS_OSCAR_DEFAULTPORT) == -1) { ret = HRET_ERROR; @@ -326,7 +326,7 @@ toscar_flap_handlechan1(struct nafmodule *mod, struct nafconn *conn, naf_u8_t *b flapver = naf_sbuf_get32(&sb); if (flapver != 0x00000001) { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] %s sent invalid FLAP version\n", conn->cid, !(conn->type & NAF_CONN_TYPE_CLIENT) ? "server" : "client"); + tvprintf(mod, "[cid %lu] %s sent invalid FLAP version\n", conn->cid, !(conn->type & NAF_CONN_TYPE_CLIENT) ? "server" : "client"); return HRET_ERROR; } @@ -345,7 +345,7 @@ toscar_flap_handlechan1(struct nafmodule *mod, struct nafconn *conn, naf_u8_t *b ret = toscar_flap_handlechan1__newconn(mod, conn, &tlvh); else { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] unable to determine purpose of channel 1 packet\n", conn->cid); + tvprintf(mod, "[cid %lu] unable to determine purpose of channel 1 packet\n", conn->cid); ret = HRET_ERROR; } @@ -377,7 +377,7 @@ toscar_flap_handleread(struct nafmodule *mod, struct nafconn *conn) if (FLAPHDR_MAGIC(buf) != FLAP_MAGIC) { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] FLAP packet did not start with correct magic\n", conn->cid); + tvprintf(mod, "[cid %lu] FLAP packet did not start with correct magic\n", conn->cid); goto errout; } @@ -388,27 +388,27 @@ toscar_flap_handleread(struct nafmodule *mod, struct nafconn *conn) (FLAPHDR_CHAN(buf) == 0x04) || (FLAPHDR_CHAN(buf) == 0x05) ) ) { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] FLAP packet on invalid channel\n", conn->cid); + tvprintf(mod, "[cid %lu] FLAP packet on invalid channel\n", conn->cid); goto errout; } if (FLAPHDR_LEN(buf) > MAXSNACLEN) { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] FLAP packet contained invalid length\n", conn->cid); + tvprintf(mod, "[cid %lu] FLAP packet contained invalid length\n", conn->cid); goto errout; } if (buflen != (FLAPHDR_LEN(buf) + FLAPHDRLEN)) { if (naf_conn_reqread(conn, buf, buflen + FLAPHDR_LEN(buf), buflen) == -1) { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] naf refused further read request\n", conn->cid); + tvprintf(mod, "[cid %lu] naf refused further read request\n", conn->cid); goto errout; } return 0; /* continue later */ } if (timps_oscar__debug > 1) - dvprintf(mod, "[cid %lu] received full FLAP packet on channel 0x%02x, seqnum 0x%04lx, length 0x%04lx (%d bytes)\n", conn->cid, FLAPHDR_CHAN(buf), FLAPHDR_SEQNUM(buf), FLAPHDR_LEN(buf), FLAPHDR_LEN(buf)); + tvprintf(mod, "[cid %lu] received full FLAP packet on channel 0x%02x, seqnum 0x%04lx, length 0x%04lx (%d bytes)\n", conn->cid, FLAPHDR_CHAN(buf), FLAPHDR_SEQNUM(buf), FLAPHDR_LEN(buf), FLAPHDR_LEN(buf)); if (FLAPHDR_CHAN(buf) == 0x01) @@ -553,7 +553,7 @@ toscar__detacholdconns__matcher(struct nafmodule *mod, struct nafconn *conn, con return 0; if (timps_oscar__debug) { - dvprintf(mod, "disconnecting old server connection %lu for '%s'\n", conn->cid, cursn); + tvprintf(mod, "disconnecting old server connection %lu for '%s'\n", conn->cid, cursn); } naf_conn_schedulekill(conn); diff --git a/timps/oscar/im.c b/timps/oscar/im.c index 69a3bec..f6d5bbf 100644 --- a/timps/oscar/im.c +++ b/timps/oscar/im.c @@ -308,7 +308,7 @@ toscar_snachandler_0004_0006(struct nafmodule *mod, struct nafconn *conn, struct if ((naf_conn_tag_fetch(mod, conn->endpoint, "conn.screenname", NULL, (void **)&srcsn) == -1) || !srcsn) { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] 0004/0006: unable to find conn.screenname tag\n", conn->cid); + tvprintf(mod, "[cid %lu] 0004/0006: unable to find conn.screenname tag\n", conn->cid); ret = HRET_ERROR; goto out; } @@ -357,7 +357,7 @@ toscar_snachandler_0004_0006(struct nafmodule *mod, struct nafconn *conn, struct } } else { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] [%s] ignoring outgoing message to '%s' on unknown channel %u\n", conn->cid, srcsn, destsn, msgchan); + tvprintf(mod, "[cid %lu] [%s] ignoring outgoing message to '%s' on unknown channel %u\n", conn->cid, srcsn, destsn, msgchan); ret = HRET_FORWARD; goto out; } @@ -419,7 +419,7 @@ toscar_snachandler_0004_0007(struct nafmodule *mod, struct nafconn *conn, struct if ((naf_conn_tag_fetch(mod, conn, "conn.screenname", NULL, (void **)&destsn) == -1) || !destsn) { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] 0004/0007: unable to find conn.screenname tag\n", conn->cid); + tvprintf(mod, "[cid %lu] 0004/0007: unable to find conn.screenname tag\n", conn->cid); ret = HRET_ERROR; goto out; } @@ -467,7 +467,7 @@ toscar_snachandler_0004_0007(struct nafmodule *mod, struct nafconn *conn, struct } } else { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] [%s] ignoring incoming message from '%s' on unknown channel %u\n", conn->cid, destsn, srcinfo->sn, msgchan); + tvprintf(mod, "[cid %lu] [%s] ignoring incoming message from '%s' on unknown channel %u\n", conn->cid, destsn, srcinfo->sn, msgchan); ret = HRET_FORWARD; goto out; } diff --git a/timps/oscar/oscar.c b/timps/oscar/oscar.c index f311ab9..874680b 100644 --- a/timps/oscar/oscar.c +++ b/timps/oscar/oscar.c @@ -113,7 +113,7 @@ toscar_gnroutputfunc(struct nafmodule *mod, struct gnrmsg *gm, struct gnrmsg_han { if (timps_oscar__debug > 1) { - dvprintf(mod, "toscar_gnroutputfunc: type = %d, to = '%s'[%s](%d), from = '%s'[%s](%d), msg = (%s) '%s'\n", + tvprintf(mod, "toscar_gnroutputfunc: type = %d, to = '%s'[%s](%d), from = '%s'[%s](%d), msg = (%s) '%s'\n", gm->type, gm->srcname, gm->srcnameservice, gmhi->srcnode ? gmhi->srcnode->metric : -1, @@ -128,7 +128,7 @@ toscar_gnroutputfunc(struct nafmodule *mod, struct gnrmsg *gm, struct gnrmsg_han if (!(conn = toscar__findconn(mod, gmhi->destnode->name))) { if (timps_oscar__debug > 0) - dvprintf(mod, "gnroutputfunc(local): unable to find connection for local node '%s'[%s]\n", gmhi->destnode->name, gmhi->destnode->service); + tvprintf(mod, "gnroutputfunc(local): unable to find connection for local node '%s'[%s]\n", gmhi->destnode->name, gmhi->destnode->service); return -1; } @@ -139,7 +139,7 @@ toscar_gnroutputfunc(struct nafmodule *mod, struct gnrmsg *gm, struct gnrmsg_han if (!(conn = toscar__findconn(mod, gmhi->srcnode->name))) { if (timps_oscar__debug > 0) - dvprintf(mod, "gnroutputfunc(forward): unable to find connection for local node '%s'[%s]\n", gmhi->srcnode->name, gmhi->srcnode->service); + tvprintf(mod, "gnroutputfunc(forward): unable to find connection for local node '%s'[%s]\n", gmhi->srcnode->name, gmhi->srcnode->service); return -1; } @@ -192,7 +192,7 @@ freetag(struct nafmodule *mod, void *object, const char *tagname, char tagtype, touserinfo_free(mod, toui); } else - dvprintf(mod, "freetag: unknown tagname '%s'\n", tagname); + tvprintf(mod, "freetag: unknown tagname '%s'\n", tagname); return; } @@ -258,7 +258,7 @@ modinit(struct nafmodule *mod) timps_oscar__module = mod; if (gnr_msg_register(mod, toscar_gnroutputfunc) == -1) { - dprintf(mod, "modinit: gsr_msg_register failed\n"); + tprintf(mod, "modinit: gsr_msg_register failed\n"); return -1; } gnr_msg_addmsghandler(mod, GNR_MSG_MSGHANDLER_STAGE_ROUTING, 75, toscar_msgrouting, "Route AIM/OSCAR messages"); @@ -326,7 +326,7 @@ toscar__keepalive_matcher(struct nafmodule *mod, struct nafconn *conn, const voi if ((now - conn->lasttx_soft) > timps_oscar__keepalive_frequency) { if (timps_oscar__debug > 1) { - dvprintf(mod, "[%lu] sending nop (%d seconds since last tx)\n", + tvprintf(mod, "[%lu] sending nop (%d seconds since last tx)\n", conn->cid, now - conn->lasttx_soft); } @@ -343,7 +343,7 @@ toscar__keepalive_matcher(struct nafmodule *mod, struct nafconn *conn, const voi * this often. */ if ((now - conn->lasttx_hard) > timps_oscar__txtimeout) { - dvprintf(mod, "[%lu] connection timed out, closing (%d seconds since last hard tx)\n", + tvprintf(mod, "[%lu] connection timed out, closing (%d seconds since last hard tx)\n", conn->cid, now - conn->lasttx_hard); naf_conn_schedulekill(conn); diff --git a/timps/oscar/snac.c b/timps/oscar/snac.c index c057526..5969fcb 100644 --- a/timps/oscar/snac.c +++ b/timps/oscar/snac.c @@ -158,7 +158,7 @@ toscar_snachandler_0001_0002(struct nafmodule *mod, struct nafconn *conn, struct if ((naf_conn_tag_fetch(mod, conn->endpoint, "conn.screenname", NULL, (void **)&sn) == -1) || !sn) { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] received Client Online on connection with no user info; killing\n", conn->cid); + tvprintf(mod, "[cid %lu] received Client Online on connection with no user info; killing\n", conn->cid); return HRET_ERROR; } @@ -174,7 +174,7 @@ toscar_snachandler_0001_0002(struct nafmodule *mod, struct nafconn *conn, struct GNR_NODE_FLAG_NONE, GNR_NODE_METRIC_LOCAL); if (!node) { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %lu] [%s] unable to create gnrnode; disconnecting\n", conn->cid, sn); + tvprintf(mod, "[cid %lu] [%s] unable to create gnrnode; disconnecting\n", conn->cid, sn); return HRET_ERROR; } @@ -194,7 +194,7 @@ toscar_snachandler_0001_0003(struct nafmodule *mod, struct nafconn *conn, struct conn->flags |= TOSCAR_FLAG_READY; if (timps_oscar__debug > 0) - dvprintf(mod, "[%lu] received Host Online\n", conn->cid); + tvprintf(mod, "[%lu] received Host Online\n", conn->cid); return HRET_FORWARD; } @@ -213,7 +213,7 @@ toscar_snachandler_0001_000b(struct nafmodule *mod, struct nafconn *conn, struct naf_conn_tag_fetch(mod, conn, "conn.screenname", NULL, (void **)&sn); - dvprintf(mod, "[cid %lu] [%s] received server pause; disconnecting for safety\n", conn->cid, sn); + tvprintf(mod, "[cid %lu] [%s] received server pause; disconnecting for safety\n", conn->cid, sn); return HRET_ERROR; } @@ -449,7 +449,7 @@ toscar_flap_handlesnac(struct nafmodule *mod, struct nafconn *conn, naf_u8_t *bu #define SNACHDRLEN 10 if (buflen < SNACHDRLEN) { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %ld] runt SNAC\n", conn->cid); + tvprintf(mod, "[cid %ld] runt SNAC\n", conn->cid); hret = HRET_ERROR; goto out; } @@ -468,13 +468,13 @@ toscar_flap_handlesnac(struct nafmodule *mod, struct nafconn *conn, naf_u8_t *bu buf + SNACHDRLEN + (exthdrlen ? (2 + exthdrlen) : 0), (naf_u16_t)(buflen - SNACHDRLEN - (exthdrlen ? (2 + exthdrlen) : 0))) == -1) { if (timps_oscar__debug > 0) - dvprintf(mod, "[cid %ld] failed to allocate sbuf for SNAC parsing\n", conn->cid); + tvprintf(mod, "[cid %ld] failed to allocate sbuf for SNAC parsing\n", conn->cid); hret = HRET_ERROR; goto out; } if (timps_oscar__debug > 1) { - dvprintf(mod, "[cid %lu] received SNAC %lx / %lx / %lx / %lx, %d bytes payload\n", + tvprintf(mod, "[cid %lu] received SNAC %lx / %lx / %lx / %lx, %d bytes payload\n", conn->cid, snac.group, snac.subtype, snac.flags, snac.id, @@ -506,7 +506,7 @@ toscar_flap_handlesnac(struct nafmodule *mod, struct nafconn *conn, naf_u8_t *bu out: if (timps_oscar__debug > 1) { - dvprintf(mod, "[cid %lu] SNAC handler returned %s%s%s (%d)\n", + tvprintf(mod, "[cid %lu] SNAC handler returned %s%s%s (%d)\n", conn->cid, (hret == HRET_ERROR) ? "ERROR" : "", (hret == HRET_DIGESTED) ? "DIGESTED" : "", diff --git a/timps/timps.c b/timps/timps.c index 1df8de1..ff654fa 100644 --- a/timps/timps.c +++ b/timps/timps.c @@ -75,7 +75,7 @@ static void dumpbox(struct nafmodule *mod, const char *prefix, naf_conn_cid_t ci } else break; } - dvprintf(mod, "%s\n", tmpstr); + tvprintf(mod, "%s\n", tmpstr); } } @@ -91,7 +91,7 @@ static void freetag(struct nafmodule *mod, void *object, const char *tagname, char tagtype, void *tagdata) { - dvprintf(mod, "freetag: unknown tagname '%s'\n", tagname); + tvprintf(mod, "freetag: unknown tagname '%s'\n", tagname); return; } @@ -103,7 +103,7 @@ modinit(struct nafmodule *mod) timps__module = mod; if (gnr_msg_register(mod, NULL /* no outputfunc */) == -1) { - dprintf(mod, "modinit: gsr_msg_register failed\n"); + tprintf(mod, "modinit: gsr_msg_register failed\n"); return -1; } gnr_msg_addmsghandler(mod, GNR_MSG_MSGHANDLER_STAGE_ROUTING, 75, timps_msgrouting, "Implement auditing rules.");