Browse code

core/tcp: Convert F_TCP_REQ_ flags to enum

Easier to recognize the correct flags in the forest of flags.

Alex Hermann authored on 09/06/2020 07:27:15 • Henning Westerholt committed on 20/10/2020 10:17:10
Showing 1 changed files
... ...
@@ -121,6 +121,27 @@ enum conn_cmds {
121 121
 /* CONN_RELEASE, EOF, ERROR, DESTROY can be used by "reader" processes
122 122
  * CONN_GET_FD, CONN_NEW*, CONN_QUEUED_WRITE only by writers */
123 123
 
124
+/* tcp_req flags */
125
+enum tcp_req_flags {
126
+	F_TCP_REQ_HAS_CLEN      = (1<<0),
127
+	F_TCP_REQ_COMPLETE      = (1<<1),
128
+#ifdef READ_HTTP11
129
+	F_TCP_REQ_BCHUNKED      = (1<<2),
130
+#endif
131
+#ifdef READ_MSRP
132
+	F_TCP_REQ_MSRP_NO       = (1<<3),
133
+	F_TCP_REQ_MSRP_FRAME    = (1<<4),
134
+	F_TCP_REQ_MSRP_BODY     = (1<<5),
135
+#endif
136
+	F_TCP_REQ_HEP3          = (1<<6),
137
+};
138
+
139
+#define TCP_REQ_HAS_CLEN(tr)  ((tr)->flags & F_TCP_REQ_HAS_CLEN)
140
+#define TCP_REQ_COMPLETE(tr)  ((tr)->flags & F_TCP_REQ_COMPLETE)
141
+#ifdef READ_HTTP11
142
+#define TCP_REQ_BCHUNKED(tr)  ((tr)->flags & F_TCP_REQ_BCHUNKED)
143
+#endif
144
+
124 145
 struct tcp_req{
125 146
 	struct tcp_req* next;
126 147
 	/* sockaddr ? */
... ...
@@ -135,32 +156,12 @@ struct tcp_req{
135 156
 #ifdef READ_HTTP11
136 157
 	int chunk_size;
137 158
 #endif
138
-	unsigned int flags; /* F_TCP_REQ_HAS_CLEN | F_TCP_REQ_COMPLETE */
159
+	enum tcp_req_flags flags; /* F_TCP_REQ_HAS_CLEN | F_TCP_REQ_COMPLETE */
139 160
 	int bytes_to_go; /* how many bytes we have still to read from the body*/
140 161
 	enum tcp_req_errors error;
141 162
 	enum tcp_req_states state;
142 163
 };
143 164
 
144
-/* tcp_req flags */
145
-#define F_TCP_REQ_HAS_CLEN 1
146
-#define F_TCP_REQ_COMPLETE 2
147
-#ifdef READ_HTTP11
148
-#define F_TCP_REQ_BCHUNKED 4
149
-#endif
150
-#ifdef READ_MSRP
151
-#define F_TCP_REQ_MSRP_NO     8
152
-#define F_TCP_REQ_MSRP_FRAME  16
153
-#define F_TCP_REQ_MSRP_BODY   32
154
-#endif
155
-#define F_TCP_REQ_HEP3        64
156
-
157
-#define TCP_REQ_HAS_CLEN(tr)  ((tr)->flags & F_TCP_REQ_HAS_CLEN)
158
-#define TCP_REQ_COMPLETE(tr)  ((tr)->flags & F_TCP_REQ_COMPLETE)
159
-#ifdef READ_HTTP11
160
-#define TCP_REQ_BCHUNKED(tr)  ((tr)->flags & F_TCP_REQ_BCHUNKED)
161
-#endif
162
-
163
-
164 165
 struct tcp_connection;
165 166
 
166 167
 /* tcp port alias structure */