]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: fcgi: Add function to get the string representation of a record type
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Oct 2019 13:20:47 +0000 (15:20 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Oct 2019 14:12:02 +0000 (16:12 +0200)
This function will be used to emit traces in the FCGI multiplexer.

include/common/fcgi.h

index 3560e0cd553504b0be88cda79c71002ea0eade5c..d85e118f3741641e54bf679b51b747bf65019b2d 100644 (file)
@@ -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);