aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/http/http_status_codes.h
blob: 100095c8f4243f687aded1c0f9313b642a940446 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* SPDX-License-Identifier: Apache-2.0
 * Copyright(c) 2024 Cisco Systems, Inc.
 */

#ifndef SRC_PLUGINS_HTTP_HTTP_STATUS_CODES_H_
#define SRC_PLUGINS_HTTP_HTTP_STATUS_CODES_H_

#include <http/http.h>

static const char *http_status_code_str[] = {
#define _(c, s, str) str,
  foreach_http_status_code
#undef _
};

static inline u8 *
format_http_status_code (u8 *s, va_list *va)
{
  http_status_code_t status_code = va_arg (*va, http_status_code_t);
  if (status_code < HTTP_N_STATUS)
    s = format (s, "%s", http_status_code_str[status_code]);
  else
    s = format (s, "invalid status code %d", status_code);
  return s;
}

#endif /* SRC_PLUGINS_HTTP_HTTP_STATUS_CODES_H_ */