From c5a3eb4e3adc1a8c4a3645b3d2f26d915c00b344 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 4 Oct 2019 15:20:47 +0200 Subject: [PATCH] MINOR: fcgi: Add function to get the string representation of a record type This function will be used to emit traces in the FCGI multiplexer. --- include/common/fcgi.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/common/fcgi.h b/include/common/fcgi.h index 3560e0cd5..d85e118f3 100644 --- a/include/common/fcgi.h +++ b/include/common/fcgi.h @@ -51,6 +51,7 @@ enum fcgi_record_type { FCGI_ENTRIES } __attribute__((packed)); + enum fcgi_role { FCGI_RESPONDER = 1, FCGI_AUTHORIZER = 2, /* Unsupported */ @@ -95,6 +96,24 @@ struct fcgi_unknown_type { }; +static inline const char *fcgi_rt_str(int type) +{ + switch (type) { + case FCGI_BEGIN_REQUEST : return "BEGIN_REQUEST"; + case FCGI_ABORT_REQUEST : return "ABORT_REQUEST"; + case FCGI_END_REQUEST : return "END_REQUEST"; + case FCGI_PARAMS : return "PARAMS"; + case FCGI_STDIN : return "STDIN"; + case FCGI_STDOUT : return "STDOUT"; + case FCGI_STDERR : return "STDERR"; + case FCGI_DATA : return "DATA"; + case FCGI_GET_VALUES : return "GET_VALUES"; + case FCGI_GET_VALUES_RESULT : return "GET_VALUES_RESULT"; + case FCGI_UNKNOWN_TYPE : return "UNKNOWN_TYPE"; + default : return "_UNKNOWN_"; + } +} + int fcgi_encode_record_hdr(struct buffer *out, const struct fcgi_header *h); size_t fcgi_decode_record_hdr(const struct buffer *in, size_t o, struct fcgi_header *h);