summaryrefslogtreecommitdiffstats
path: root/src/plugins/http_static/http_static.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/http_static/http_static.h')
-rw-r--r--src/plugins/http_static/http_static.h57
1 files changed, 54 insertions, 3 deletions
diff --git a/src/plugins/http_static/http_static.h b/src/plugins/http_static/http_static.h
index 05d6ee05a4c..d3fa29b068d 100644
--- a/src/plugins/http_static/http_static.h
+++ b/src/plugins/http_static/http_static.h
@@ -40,8 +40,10 @@ typedef struct
session_handle_t vpp_session_handle;
/** Fully-resolved file path */
u8 *path;
- /** File data, a vector */
+ /** Data to send */
u8 *data;
+ /** Data length */
+ u32 data_len;
/** Current data send offset */
u32 data_offset;
/** Need to free data in detach_cache_entry */
@@ -50,6 +52,21 @@ typedef struct
u32 cache_pool_index;
} hss_session_t;
+typedef struct hss_session_handle_
+{
+ union
+ {
+ struct
+ {
+ u32 session_index;
+ u32 thread_index;
+ };
+ u64 as_u64;
+ };
+} hss_session_handle_t;
+
+STATIC_ASSERT_SIZEOF (hss_session_handle_t, sizeof (u64));
+
/** \brief In-memory file data cache entry
*/
typedef struct
@@ -67,7 +84,40 @@ typedef struct
int inuse;
} hss_cache_entry_t;
-typedef int (*hss_url_handler_t) (http_req_method_t, u8 *, hss_session_t *);
+typedef struct hss_url_handler_args_
+{
+ hss_session_handle_t sh;
+
+ union
+ {
+ /* Request args */
+ struct
+ {
+ u8 *request;
+ http_req_method_t reqtype;
+ };
+
+ /* Reply args */
+ struct
+ {
+ u8 *data;
+ uword data_len;
+ u8 free_vec_data;
+ http_status_code_t sc;
+ };
+ };
+} hss_url_handler_args_t;
+
+typedef enum hss_url_handler_rc_
+{
+ HSS_URL_HANDLER_OK,
+ HSS_URL_HANDLER_ERROR,
+ HSS_URL_HANDLER_ASYNC,
+} hss_url_handler_rc_t;
+
+typedef hss_url_handler_rc_t (*hss_url_handler_fn) (hss_url_handler_args_t *);
+typedef void (*hss_register_url_fn) (hss_url_handler_fn, char *, int);
+typedef void (*hss_session_send_fn) (hss_url_handler_args_t *args);
/** \brief Main data structure
*/
@@ -139,8 +189,9 @@ int hss_create (vlib_main_t *vm);
/**
* Register a GET or POST URL handler
*/
-void hss_register_url_handler (hss_url_handler_t fp, const char *url,
+void hss_register_url_handler (hss_url_handler_fn fp, const char *url,
http_req_method_t type);
+void hss_session_send_data (hss_url_handler_args_t *args);
void hss_builtinurl_json_handlers_init (void);
#endif /* __included_http_static_h__ */