From fdb5a5a0e4aad887add68985191be114dcc99e38 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Fri, 28 Jan 2022 15:26:39 -0800 Subject: http_static: incorporate builtinurl plugin External handlers can still be registered via hss_register_url_handler but url handlers must be enabled when server is created. builtinurl plugin to be removed in a future patch Type: refactor Signed-off-by: Florin Coras Change-Id: I94e103d908b9e118c7927b997a21ce3f67809889 --- src/plugins/http_static/http_static.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/plugins/http_static/http_static.h') diff --git a/src/plugins/http_static/http_static.h b/src/plugins/http_static/http_static.h index a1eaa6e1144..05d6ee05a4c 100644 --- a/src/plugins/http_static/http_static.h +++ b/src/plugins/http_static/http_static.h @@ -67,9 +67,10 @@ typedef struct int inuse; } hss_cache_entry_t; +typedef int (*hss_url_handler_t) (http_req_method_t, u8 *, hss_session_t *); + /** \brief Main data structure */ - typedef struct { /** Per thread vector of session pools */ @@ -127,14 +128,20 @@ typedef struct u8 *uri; /** Threshold for switching to ptr data in http msgs */ u32 use_ptr_thresh; + /** Enable the use of builtinurls */ + u8 enable_url_handlers; } hss_main_t; extern hss_main_t hss_main; int hss_create (vlib_main_t *vm); -void http_static_server_register_builtin_handler (void *fp, char *url, - http_req_method_t type); +/** + * Register a GET or POST URL handler + */ +void hss_register_url_handler (hss_url_handler_t fp, const char *url, + http_req_method_t type); +void hss_builtinurl_json_handlers_init (void); #endif /* __included_http_static_h__ */ -- cgit 1.2.3-korg