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.
This commit is contained in:
Christopher Faulet 2019-10-04 15:20:47 +02:00
parent 660f6f34d7
commit c5a3eb4e3a

View 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);