int tmr_status(struct re_printf *pf, void *unused) { struct list *tmrl = tmrl_get(); struct le *le; uint32_t n; int err; (void)unused; n = list_count(tmrl); if (!n) return 0; err = re_hprintf(pf, "Timers (%u):\n", n); for (le = tmrl->head; le; le = le->next) { const struct tmr *tmr = le->data; err |= re_hprintf(pf, " %p: th=%p expire=%llums\n", tmr, tmr->th, (unsigned long long)tmr_get_expire(tmr)); } if (n > 100) err |= re_hprintf(pf, " (Dumped Timers: %u)\n", n); return err; }
static int print_substate(struct re_printf *pf, const struct sipnot *not) { int err; if (not->terminated) { err = re_hprintf(pf, "terminated;reason=%s", sipevent_reason_name(not->reason)); if (not->retry_after) err |= re_hprintf(pf, ";retry-after=%u", not->retry_after); } else { uint32_t expires; expires = (uint32_t)(tmr_get_expire(¬->tmr) / 1000); err = re_hprintf(pf, "%s;expires=%u", sipevent_substate_name(not->substate), expires); } return err; }
static bool debug_handler(struct le *le, void *arg) { struct sip_ctrans *ct = le->data; struct re_printf *pf = arg; (void)re_hprintf(pf, " %-10s %-10s %2llus (%s)\n", ct->met, statename(ct->state), tmr_get_expire(&ct->tmr)/1000, ct->branch); return false; }
int sipnot_reply(struct sipnot *not, const struct sip_msg *msg, uint16_t scode, const char *reason) { struct sip_contact contact; uint32_t expires; expires = (uint32_t)(tmr_get_expire(¬->tmr) / 1000); sip_contact_set(&contact, not->cuser, &msg->dst, msg->tp); return sip_treplyf(NULL, NULL, not->sip, msg, true, scode, reason, "%H" "Expires: %u\r\n" "Content-Length: 0\r\n" "\r\n", sip_contact_print, &contact, expires); }
static bool allocation_status(struct le *le, void *arg) { const uint32_t bsize = hash_bsize(turnd.ht_alloc); struct allocation *al = le->data; struct mbuf *mb = arg; (void)mbuf_printf(mb, "- %04u %s/%J/%J - %J \"%s\" %us (drop %llu/%llu)\n", sa_hash(&al->cli_addr, SA_ALL) & (bsize - 1), net_proto2name(al->proto), &al->cli_addr, &al->srv_addr, &al->rel_addr, al->username, (uint32_t)tmr_get_expire(&al->tmr) / 1000, al->dropc_tx, al->dropc_rx); perm_status(al->perms, mb); chan_status(al->chans, mb); return false; }