vmod_port(const struct vrt_ctx *ctx, VCL_IP ip) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (ip == NULL) return (0); return (VSA_Port(ip)); }
vmod_port(VRT_CTX, VCL_IP ip) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (ip == NULL) return (0); return (VSA_Port(ip)); }
static void vpx_enc_port(struct vsb *vsb, const struct suckaddr *s) { uint8_t b[2]; vbe16enc(b, (uint16_t)VSA_Port(s)); VSB_bcat(vsb, b, sizeof(b)); }
VCL_VOID vmod_resp(VRT_CTX, VCL_STRING val) { //thread check if(ctx->req == NULL || ctx->req->magic != REQ_MAGIC){ VSLb(ctx->vsl, SLT_Error,"vmod-dump: dump.resp work only at client-thread."); return; } VSLb(ctx->vsl, SLT_Debug,"%s-I: %s %d %s %d", VMOD_DUMP_PRE, VRT_IP_string(ctx, VRT_r_client_ip(ctx)), VSA_Port(VRT_r_client_ip(ctx)), VRT_IP_string(ctx, VRT_r_server_ip(ctx)), VSA_Port(VRT_r_server_ip(ctx)) ); VDP_push(ctx->req, VDP_dump, (void*)val, 1); }
long VRT_r_beresp_backend_port(const struct vrt_ctx *ctx) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo->vbc, VBC_MAGIC); return (VSA_Port(ctx->bo->vbc->addr)); }
VCL_VOID vmod_req(VRT_CTX, VCL_STRING val) { //thread check if(ctx->req == NULL || ctx->req->magic != REQ_MAGIC){ VSLb(ctx->vsl, SLT_Error,"vmod-dump: dump.req work only at client-thread."); return; } //remote client local server //VRT_r_remote_ip //VRT_r_client_ip //VRT_r_local_ip //VRT_r_server_ip //VRT_IP_string(IP) ip->str //VSA_Port(IP) ip->port VSLb(ctx->vsl, SLT_Debug,"%s-I: %s %d %s %d", VMOD_DUMP_PRE, VRT_IP_string(ctx, VRT_r_client_ip(ctx)), VSA_Port(VRT_r_client_ip(ctx)), VRT_IP_string(ctx, VRT_r_server_ip(ctx)), VSA_Port(VRT_r_server_ip(ctx)) ); VSLb(ctx->vsl, SLT_Debug,"%s-S: REQ", VMOD_DUMP_PRE); VSLb(ctx->vsl, SLT_Debug,"%s-V: %s", VMOD_DUMP_PRE, val); unsigned u; //reserve work-space u = WS_Reserve(ctx->req->ws, 0); if(u <= VMOD_DUMP_KEY_LEN) { //no space. WS_Release(ctx->req->ws, 0); return; } work_head(ctx->req,ctx->req->ws->f, u, ctx->req->http0,HTTP1_Req); //free work-space WS_Release(ctx->req->ws, 0); VRB_Iterate(ctx->req, vbf_printRequestBody, NULL); VSLb(ctx->vsl, SLT_Debug,"%s-S: END", VMOD_DUMP_PRE); }