Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP: add Frame type enumeration #1853

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions src/http/FrameType.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (C) 1996-2024 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
* Please see the COPYING and CONTRIBUTORS files for details.
*/

#ifndef SQUID_SRC_HTTP_FRAMETYPE_H
#define SQUID_SRC_HTTP_FRAMETYPE_H

#include "sbuf/SBuf.h"

namespace Http
{

/// HTTP Frame Type registrations
typedef enum : uint8_t {
/* RFC 9113 section 6.1 */
FRAME_DATA = 0x00,
FRAME_HEADERS = 0x01,
FRAME_PRIORITY = 0x02,
FRAME_RST_STREAM = 0x03,
FRAME_SETTINGS = 0x04,
FRAME_PUSH_PROMISE = 0x05,
FRAME_PING = 0x06,
FRAME_GOAWAY = 0x07,
FRAME_WINDOW_UPDATE = 0x08,
FRAME_CONTINUATION = 0x09,

/* RFC 7838 section 4 */
FRAME_ALTSVC = 0x0A,

/* RFC 8336 section 2.1 */
FRAME_ORIGIN = 0x0C,

/* RFC 9114 section 7.2 */
FRAME_CANCEL_PUSH = FRAME_RST_STREAM,
FRAME_MAX_PUSH_ID = 0x0D

/* types 0x1f * N + 0x21 reserved for experimental use */
/* types 0xf0-0xff reserved for experimental use */
} FrameType;

extern const SBuf FrameType_sb[];

inline const SBuf &
FrameTypeStr(const FrameType m)
{
return FrameType_sb[m];
}

} // namespace Http

#endif /* SQUID_SRC_HTTP_FRAMETYPE_H */
8 changes: 7 additions & 1 deletion src/http/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ noinst_LTLIBRARIES = libhttp.la
libhttp_la_SOURCES = \
ContentLengthInterpreter.cc \
ContentLengthInterpreter.h \
FrameType.cc \
FrameType.h \
Message.cc \
Message.h \
MethodType.cc \
Expand All @@ -35,10 +37,14 @@ libhttp_la_SOURCES = \

libhttp_la_LIBADD= one/libhttp1.la

FrameType.cc: FrameType.h $(top_srcdir)/src/mk-string-arrays.awk
($(AWK) -f $(top_srcdir)/src/mk-string-arrays.awk sbuf=1 < $(srcdir)/FrameType.h | \
sed -e 's%FRAME_%%' >$@) || ($(RM) -f $@ && exit 1)

MethodType.cc: MethodType.h $(top_srcdir)/src/mk-string-arrays.awk
($(AWK) -f $(top_srcdir)/src/mk-string-arrays.awk sbuf=1 < $(srcdir)/MethodType.h | \
sed -e 's%METHOD_%%' -e 's%_C%-C%' >$@) || ($(RM) -f $@ && exit 1)

CLEANFILES += MethodType.cc
CLEANFILES += FrameType.cc MethodType.cc

EXTRA_DIST = RegisteredHeadersHash.gperf
Loading