static void pan_req(const struct req *req) { const char *stp; VSB_printf(pan_vsp, "req = %p {\n", req); VSB_printf(pan_vsp, " sp = %p, vxid = %u,", req->sp, VXID(req->vsl->wid)); switch (req->req_step) { #define REQ_STEP(l, u, arg) case R_STP_##u: stp = "R_STP_" #u; break; #include "tbl/steps.h" #undef REQ_STEP default: stp = NULL; } if (stp != NULL) VSB_printf(pan_vsp, " step = %s,\n", stp); else VSB_printf(pan_vsp, " step = 0x%x,\n", req->req_step); VSB_printf(pan_vsp, " req_body = %s,\n", reqbody_status_2str(req->req_body_status)); if (req->err_code) VSB_printf(pan_vsp, " err_code = %d, err_reason = %s,\n", req->err_code, req->err_reason ? req->err_reason : "(null)"); VSB_printf(pan_vsp, " restarts = %d, esi_level = %d\n", req->restarts, req->esi_level); if (req->sp != NULL) pan_sess(req->sp); if (req->wrk != NULL) pan_wrk(req->wrk); pan_ws(req->ws, 2); pan_http("req", req->http, 2); if (req->resp->ws != NULL) pan_http("resp", req->resp, 2); if (VALID_OBJ(req->vcl, VCL_CONF_MAGIC)) pan_vcl(req->vcl); if (req->objcore != NULL) { pan_objcore("REQ", req->objcore); if (req->objcore->busyobj != NULL) pan_busyobj(req->objcore->busyobj); } VSB_printf(pan_vsp, "},\n"); }
static void pan_sess(const struct sess *sp) { const char *stp, *hand; VSB_printf(pan_vsp, "sp = %p {\n", sp); VSB_printf(pan_vsp, " fd = %d, id = %u, xid = %u,\n", sp->fd, sp->vsl_id & VSL_IDENTMASK, sp->req->xid); VSB_printf(pan_vsp, " client = %s %s,\n", sp->addr ? sp->addr : "?.?.?.?", sp->port ? sp->port : "?"); switch (sp->step) { #define STEP(l, u, arg) case STP_##u: stp = "STP_" #u; break; #include "tbl/steps.h" #undef STEP default: stp = NULL; } hand = VCL_Return_Name(sp->req->handling); if (stp != NULL) VSB_printf(pan_vsp, " step = %s,\n", stp); else VSB_printf(pan_vsp, " step = 0x%x,\n", sp->step); if (hand != NULL) VSB_printf(pan_vsp, " handling = %s,\n", hand); else VSB_printf(pan_vsp, " handling = 0x%x,\n", sp->req->handling); if (sp->req->err_code) VSB_printf(pan_vsp, " err_code = %d, err_reason = %s,\n", sp->req->err_code, sp->req->err_reason ? sp->req->err_reason : "(null)"); VSB_printf(pan_vsp, " restarts = %d, esi_level = %d\n", sp->req->restarts, sp->req->esi_level); if (sp->wrk->busyobj != NULL) pan_busyobj(sp->wrk->busyobj); pan_ws(sp->req->ws, 2); pan_http("req", sp->req->http, 2); if (sp->req->resp->ws != NULL) pan_http("resp", sp->req->resp, 4); if (sp->wrk != NULL) pan_wrk(sp->wrk); if (VALID_OBJ(sp->req->vcl, VCL_CONF_MAGIC)) pan_vcl(sp->req->vcl); if (VALID_OBJ(sp->req->obj, OBJECT_MAGIC)) pan_object(sp->req->obj); VSB_printf(pan_vsp, "},\n"); }
static void pan_wrk(const struct worker *wrk) { VSB_printf(pan_vsp, " worker = %p {\n", wrk); pan_ws(wrk->ws, 4); if (wrk->busyobj != NULL && wrk->busyobj->bereq->ws != NULL) pan_http("bereq", wrk->busyobj->bereq, 4); if (wrk->busyobj != NULL && wrk->busyobj->beresp->ws != NULL) pan_http("beresp", wrk->busyobj->beresp, 4); VSB_printf(pan_vsp, " },\n"); }
static void pan_busyobj(const struct busyobj *bo) { struct vfp_entry *vfe; VSB_printf(pan_vsp, " busyobj = %p {\n", bo); pan_ws(bo->ws, 4); VSB_printf(pan_vsp, " refcnt = %u\n", bo->refcount); VSB_printf(pan_vsp, " retries = %d\n", bo->retries); VSB_printf(pan_vsp, " failed = %d\n", bo->vfc->failed); VSB_printf(pan_vsp, " state = %d\n", (int)bo->state); #define BO_FLAG(l, r, w, d) if(bo->l) VSB_printf(pan_vsp, " is_" #l "\n"); #include "tbl/bo_flags.h" #undef BO_FLAG VSB_printf(pan_vsp, " bodystatus = %d (%s),\n", bo->htc.body_status, body_status_2str(bo->htc.body_status)); if (!VTAILQ_EMPTY(&bo->vfc->vfp)) { VSB_printf(pan_vsp, " filters ="); VTAILQ_FOREACH(vfe, &bo->vfc->vfp, list) VSB_printf(pan_vsp, " %s=%d", vfe->vfp->name, (int)vfe->closed); VSB_printf(pan_vsp, "\n"); } VSB_printf(pan_vsp, " },\n"); if (VALID_OBJ(bo->vbc, BACKEND_MAGIC)) pan_vbc(bo->vbc); if (bo->bereq->ws != NULL) pan_http("bereq", bo->bereq, 4); if (bo->beresp->ws != NULL) pan_http("beresp", bo->beresp, 4); pan_ws(bo->ws_o, 4); if (bo->fetch_objcore) pan_objcore("FETCH", bo->fetch_objcore); if (bo->fetch_obj) pan_object("FETCH", bo->fetch_obj); if (bo->ims_obj) pan_object("IMS", bo->ims_obj); VSB_printf(pan_vsp, " }\n"); }
static void pan_busyobj(struct vsb *vsb, const struct busyobj *bo) { struct vfp_entry *vfe; const char *p; VSB_printf(vsb, "busyobj = %p {\n", bo); VSB_indent(vsb, 2); pan_ws(vsb, bo->ws); VSB_printf(vsb, "refcnt = %u,\n", bo->refcount); VSB_printf(vsb, "retries = %d, ", bo->retries); VSB_printf(vsb, "failed = %d, ", bo->vfc->failed); VSB_printf(vsb, "state = %d,\n", (int)bo->state); VSB_printf(vsb, "flags = {"); p = ""; /*lint -save -esym(438,p) */ #define BO_FLAG(l, r, w, d) \ if(bo->l) { VSB_printf(vsb, "%s" #l, p); p = ", "; } #include "tbl/bo_flags.h" #undef BO_FLAG /*lint -restore */ VSB_printf(vsb, "},\n"); if (VALID_OBJ(bo->htc, HTTP_CONN_MAGIC)) pan_htc(vsb, bo->htc); if (!VTAILQ_EMPTY(&bo->vfc->vfp)) { VSB_printf(vsb, "filters ="); VTAILQ_FOREACH(vfe, &bo->vfc->vfp, list) VSB_printf(vsb, " %s=%d", vfe->vfp->name, (int)vfe->closed); VSB_printf(vsb, "\n"); } VDI_Panic(bo->director_req, vsb, "director_req"); if (bo->director_resp == bo->director_req) VSB_printf(vsb, "director_resp = director_req,\n"); else VDI_Panic(bo->director_resp, vsb, "director_resp"); if (bo->bereq != NULL && bo->bereq->ws != NULL) pan_http(vsb, "bereq", bo->bereq); if (bo->beresp != NULL && bo->beresp->ws != NULL) pan_http(vsb, "beresp", bo->beresp); if (bo->fetch_objcore) pan_objcore(vsb, "fetch", bo->fetch_objcore); if (bo->stale_oc) pan_objcore(vsb, "ims", bo->stale_oc); VCL_Panic(vsb, bo->vcl); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); }
static void pan_wrk(struct vsb *vsb, const struct worker *wrk) { const char *hand; unsigned m, u; const char *p; VSB_printf(vsb, "worker = %p {\n", wrk); if (pan_already(vsb, wrk)) return; VSB_indent(vsb, 2); VSB_printf(vsb, "stack = {0x%jx -> 0x%jx},\n", (uintmax_t)wrk->stack_start, (uintmax_t)wrk->stack_end); pan_ws(vsb, wrk->aws); m = wrk->cur_method; VSB_printf(vsb, "VCL::method = "); if (m == 0) { VSB_printf(vsb, "none,\n"); return; } if (!(m & 1)) VSB_printf(vsb, "inside "); m &= ~1; hand = VCL_Method_Name(m); if (hand != NULL) VSB_printf(vsb, "%s,\n", hand); else VSB_printf(vsb, "0x%x,\n", m); hand = VCL_Return_Name(wrk->handling); if (hand != NULL) VSB_printf(vsb, "VCL::return = %s,\n", hand); else VSB_printf(vsb, "VCL::return = 0x%x,\n", wrk->handling); VSB_printf(vsb, "VCL::methods = {"); m = wrk->seen_methods; p = ""; for (u = 1; m ; u <<= 1) { if (m & u) { VSB_printf(vsb, "%s%s", p, VCL_Method_Name(u)); m &= ~u; p = ", "; } } VSB_printf(vsb, "},\n"); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); }
static void pan_object(const struct object *o) { const struct storage *st; VSB_printf(pan_vsp, " obj = %p {\n", o); VSB_printf(pan_vsp, " vxid = %u,\n", o->vxid); pan_ws(o->ws_o, 4); pan_http("obj", o->http, 4); VSB_printf(pan_vsp, " len = %jd,\n", (intmax_t)o->len); VSB_printf(pan_vsp, " store = {\n"); VTAILQ_FOREACH(st, &o->store, list) pan_storage(st); VSB_printf(pan_vsp, " },\n"); VSB_printf(pan_vsp, " },\n"); }
static void pan_wrk(const struct worker *wrk) { const char *hand; VSB_printf(pan_vsp, " worker = %p {\n", wrk); pan_ws(wrk->aws, 4); hand = VCL_Method_Name(wrk->cur_method); if (hand != NULL) VSB_printf(pan_vsp, " VCL::method = %s,\n", hand); else VSB_printf(pan_vsp, " VCL::method = 0x%x,\n", wrk->cur_method); hand = VCL_Return_Name(wrk->handling); if (hand != NULL) VSB_printf(pan_vsp, " VCL::return = %s,\n", hand); else VSB_printf(pan_vsp, " VCL::return = 0x%x,\n", wrk->handling); VSB_printf(pan_vsp, " },\n"); }
static void pan_wrk(const struct worker *wrk) { const char *hand; unsigned m, u; const char *p; VSB_printf(pan_vsp, " worker = %p {\n", wrk); pan_ws(wrk->aws, 4); m = wrk->cur_method; VSB_printf(pan_vsp, " VCL::method = "); if (m == 0) { VSB_printf(pan_vsp, "none,\n"); return; } if (!(m & 1)) VSB_printf(pan_vsp, "*"); m &= ~1; hand = VCL_Method_Name(m); if (hand != NULL) VSB_printf(pan_vsp, "%s,\n", hand); else VSB_printf(pan_vsp, "0x%x,\n", m); hand = VCL_Return_Name(wrk->handling); if (hand != NULL) VSB_printf(pan_vsp, " VCL::return = %s,\n", hand); else VSB_printf(pan_vsp, " VCL::return = 0x%x,\n", wrk->handling); VSB_printf(pan_vsp, " VCL::methods = {"); m = wrk->seen_methods; p = ""; for (u = 1; m ; u <<= 1) { if (m & u) { VSB_printf(pan_vsp, "%s%s", p, VCL_Method_Name(u)); m &= ~u; p = ", "; } } VSB_printf(pan_vsp, "},\n },\n"); }
static void pan_busyobj(const struct busyobj *bo) { VSB_printf(pan_vsp, " busyobj = %p {\n", bo); pan_ws(bo->ws, 4); if (bo->is_gzip) VSB_printf(pan_vsp, " is_gzip\n"); if (bo->is_gunzip) VSB_printf(pan_vsp, " is_gunzip\n"); if (bo->do_gzip) VSB_printf(pan_vsp, " do_gzip\n"); if (bo->do_gunzip) VSB_printf(pan_vsp, " do_gunzip\n"); if (bo->do_esi) VSB_printf(pan_vsp, " do_esi\n"); if (bo->do_stream) VSB_printf(pan_vsp, " do_stream\n"); if (bo->should_close) VSB_printf(pan_vsp, " should_close\n"); VSB_printf(pan_vsp, " bodystatus = %d (%s),\n", bo->htc.body_status, body_status_2str(bo->htc.body_status)); VSB_printf(pan_vsp, " },\n"); if (VALID_OBJ(bo->vbc, BACKEND_MAGIC)) pan_vbc(bo->vbc); if (bo->bereq->ws != NULL) pan_http("bereq", bo->bereq, 4); if (bo->beresp->ws != NULL) pan_http("beresp", bo->beresp, 4); VSB_printf(pan_vsp, " }\n"); }
static void pan_req(struct vsb *vsb, const struct req *req) { const char *stp; VSB_printf(vsb, "req = %p {\n", req); VSB_indent(vsb, 2); VSB_printf(vsb, "vxid = %u, ", VXID(req->vsl->wid)); switch (req->req_step) { #define REQ_STEP(l, u, arg) case R_STP_##u: stp = "R_STP_" #u; break; #include "tbl/steps.h" #undef REQ_STEP default: stp = NULL; } if (stp != NULL) VSB_printf(vsb, "step = %s,\n", stp); else VSB_printf(vsb, "step = 0x%x,\n", req->req_step); VSB_printf(vsb, "req_body = %s,\n", reqbody_status_2str(req->req_body_status)); if (req->err_code) VSB_printf(vsb, "err_code = %d, err_reason = %s,\n", req->err_code, req->err_reason ? req->err_reason : "(null)"); VSB_printf(vsb, "restarts = %d, esi_level = %d,\n", req->restarts, req->esi_level); if (req->sp != NULL) pan_sess(vsb, req->sp); if (req->wrk != NULL) pan_wrk(vsb, req->wrk); pan_ws(vsb, req->ws); if (VALID_OBJ(req->htc, HTTP_CONN_MAGIC)) pan_htc(vsb, req->htc); pan_http(vsb, "req", req->http); if (req->resp->ws != NULL) pan_http(vsb, "resp", req->resp); VCL_Panic(vsb, req->vcl); if (req->objcore != NULL) { pan_objcore(vsb, "REQ", req->objcore); if (req->objcore->busyobj != NULL) pan_busyobj(vsb, req->objcore->busyobj); } VSB_printf(vsb, "flags = {\n"); VSB_indent(vsb, 2); #define REQ_FLAG(l, r, w, d) if(req->l) VSB_printf(vsb, #l ",\n"); #include "tbl/req_flags.h" #undef REQ_FLAG VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); }
static void pan_sess(const struct sess *sp) { const char *stp, *hand; VSB_printf(vsp, "sp = %p {\n", sp); VSB_printf(vsp, " fd = %d, id = %d, xid = %u,\n", sp->fd, sp->vsl_id & VSL_IDENTMASK, sp->xid); VSB_printf(vsp, " client = %s %s,\n", sp->addr ? sp->addr : "?.?.?.?", sp->port ? sp->port : "?"); switch (sp->step) { #define STEP(l, u) case STP_##u: stp = "STP_" #u; break; #include "tbl/steps.h" #undef STEP default: stp = NULL; } hand = VCC_Return_Name(sp->handling); if (stp != NULL) VSB_printf(vsp, " step = %s,\n", stp); else VSB_printf(vsp, " step = 0x%x,\n", sp->step); if (hand != NULL) VSB_printf(vsp, " handling = %s,\n", hand); else VSB_printf(vsp, " handling = 0x%x,\n", sp->handling); if (sp->err_code) VSB_printf(vsp, " err_code = %d, err_reason = %s,\n", sp->err_code, sp->err_reason ? sp->err_reason : "(null)"); VSB_printf(vsp, " restarts = %d, esi_level = %d\n", sp->restarts, sp->esi_level); VSB_printf(vsp, " flags = "); if (sp->wrk->do_stream) VSB_printf(vsp, " do_stream"); if (sp->wrk->do_gzip) VSB_printf(vsp, " do_gzip"); if (sp->wrk->do_gunzip) VSB_printf(vsp, " do_gunzip"); if (sp->wrk->do_esi) VSB_printf(vsp, " do_esi"); if (sp->wrk->do_close) VSB_printf(vsp, " do_close"); if (sp->wrk->is_gzip) VSB_printf(vsp, " is_gzip"); if (sp->wrk->is_gunzip) VSB_printf(vsp, " is_gunzip"); VSB_printf(vsp, "\n"); VSB_printf(vsp, " bodystatus = %d\n", sp->wrk->body_status); pan_ws(sp->ws, 2); pan_http("req", sp->http, 2); if (sp->wrk != NULL) pan_wrk(sp->wrk); if (VALID_OBJ(sp->vcl, VCL_CONF_MAGIC)) pan_vcl(sp->vcl); if (VALID_OBJ(sp->wrk->vbc, BACKEND_MAGIC)) pan_vbc(sp->wrk->vbc); if (VALID_OBJ(sp->obj, OBJECT_MAGIC)) pan_object(sp->obj); VSB_printf(vsp, "},\n"); }