summaryrefslogtreecommitdiffstats
path: root/src/plugins/http/http.h
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2023-10-30 08:21:36 +0100
committerFlorin Coras <florin.coras@gmail.com>2024-01-02 12:07:04 +0000
commitb1ea30e5639adb4290df2bfb493729cc0d5f3b70 (patch)
treea8baeea895dddc2482523698086bb08582854ec5 /src/plugins/http/http.h
parentb7e66f4a30bbde62595615f72a386383d931eeae (diff)
http: unify client/server state machines
Type: improvement Change-Id: I57a816fbed8b681dec201edc8d5950a34a555a2b Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/plugins/http/http.h')
-rw-r--r--src/plugins/http/http.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/plugins/http/http.h b/src/plugins/http/http.h
index 50203dcd2f9..dbae5ac4611 100644
--- a/src/plugins/http/http.h
+++ b/src/plugins/http/http.h
@@ -61,9 +61,13 @@ typedef enum http_conn_state_
typedef enum http_state_
{
- HTTP_STATE_WAIT_METHOD,
- HTTP_STATE_WAIT_APP,
- HTTP_STATE_IO_MORE_DATA,
+ HTTP_STATE_IDLE = 0,
+ HTTP_STATE_WAIT_APP_METHOD,
+ HTTP_STATE_WAIT_CLIENT_METHOD,
+ HTTP_STATE_WAIT_SERVER_REPLY,
+ HTTP_STATE_WAIT_APP_REPLY,
+ HTTP_STATE_CLIENT_IO_MORE_DATA,
+ HTTP_STATE_APP_IO_MORE_DATA,
HTTP_N_STATES,
} http_state_t;
@@ -232,7 +236,6 @@ typedef struct http_tc_
u8 *rx_buf;
u32 rx_buf_offset;
http_buffer_t tx_buf;
- u8 is_client;
u32 to_recv;
u32 bytes_dequeued;
} http_conn_t;
@@ -263,6 +266,16 @@ typedef struct http_main_
u32 fifo_size;
} http_main_t;
+static inline int
+http_state_is_tx_valid (http_conn_t *hc)
+{
+ http_state_t state = hc->http_state;
+ return (state == HTTP_STATE_APP_IO_MORE_DATA ||
+ state == HTTP_STATE_CLIENT_IO_MORE_DATA ||
+ state == HTTP_STATE_WAIT_APP_REPLY ||
+ state == HTTP_STATE_WAIT_APP_METHOD);
+}
+
#endif /* SRC_PLUGINS_HTTP_HTTP_H_ */
/*