aqhome: more work on http server.
This commit is contained in:
65
aqhome/http/urlhandler.h
Normal file
65
aqhome/http/urlhandler.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqHome.
|
||||
* AqHome (c) by 2023 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef AQH_HTTP_URLHANDLER_H
|
||||
#define AQH_HTTP_URLHANDLER_H
|
||||
|
||||
|
||||
#include <aqhome/api.h>
|
||||
#include <aqhome/http/httprequest.h>
|
||||
#include <aqhome/http/content.h>
|
||||
#include <aqhome/service/service.h>
|
||||
|
||||
#include <gwenhywfar/inherit.h>
|
||||
#include <gwenhywfar/stringlist.h>
|
||||
#include <gwenhywfar/endpoint.h>
|
||||
#include <gwenhywfar/msg.h>
|
||||
|
||||
|
||||
typedef struct AQH_HTTP_URLHANDLER AQH_HTTP_URLHANDLER;
|
||||
GWEN_INHERIT_FUNCTION_LIB_DEFS(AQH_HTTP_URLHANDLER, AQHOME_API)
|
||||
GWEN_LIST_FUNCTION_LIB_DEFS(AQH_HTTP_URLHANDLER, AQH_HttpUrlHandler, AQHOME_API)
|
||||
|
||||
|
||||
typedef int (*AQH_HTTP_URLHANDLER_HANDLE_FN)(AQH_HTTP_URLHANDLER *uh, AQH_HTTP_REQUEST *rq);
|
||||
|
||||
AQHOME_API AQH_HTTP_URLHANDLER *AQH_HttpUrlHandler_new(AQH_SERVICE *sv);
|
||||
AQHOME_API void AQH_HttpUrlHandler_free(AQH_HTTP_URLHANDLER *uh);
|
||||
|
||||
AQHOME_API AQH_SERVICE *AQH_HttpUrlHandler_GetHttpService(const AQH_HTTP_URLHANDLER *uh);
|
||||
|
||||
AQHOME_API void AQH_HttpUrlHandler_AddUrlPattern(AQH_HTTP_URLHANDLER *uh, const char *s);
|
||||
AQHOME_API int AQH_HttpUrlHandler_UrlMatches(const AQH_HTTP_URLHANDLER *uh, const char *s);
|
||||
|
||||
AQHOME_API AQH_HTTP_CONTENT *AQH_HttpUrlHandler_GetContentProvider(const AQH_HTTP_URLHANDLER *uh);
|
||||
AQHOME_API void AQH_HttpUrlHandler_SetContentProvider(AQH_HTTP_URLHANDLER *uh, AQH_HTTP_CONTENT *cp);
|
||||
|
||||
AQHOME_API void AQH_HttpUrlHandler_SetHandleFn(AQH_HTTP_URLHANDLER *uh, AQH_HTTP_URLHANDLER_HANDLE_FN fn);
|
||||
|
||||
AQHOME_API int AQH_HttpUrlHandler_AddContentHeaders(AQH_HTTP_URLHANDLER *uh, int m, GWEN_BUFFER *dbuf);
|
||||
AQHOME_API int AQH_HttpUrlHandler_AddContentFooters(AQH_HTTP_URLHANDLER *uh, int m, GWEN_BUFFER *dbuf);
|
||||
|
||||
|
||||
AQHOME_API int AQH_HttpUrlHandler_HandleMessage(AQH_HTTP_URLHANDLER *uh, AQH_HTTP_REQUEST *rq);
|
||||
|
||||
|
||||
|
||||
typedef int (*AQH_HTTP_URLHANDLER_WRITEPAGE_CB)(AQH_HTTP_URLHANDLER *uh,
|
||||
AQH_HTTP_REQUEST *rq,
|
||||
GWEN_BUFFER *pageBuf);
|
||||
AQHOME_API GWEN_MSG *AQH_HttpUrlHandler_CreatePageMessage(AQH_HTTP_URLHANDLER *uh,
|
||||
AQH_HTTP_REQUEST *rq,
|
||||
const char *statusTextColor, const char *statusMsg,
|
||||
int withHeadersAndFooters,
|
||||
AQH_HTTP_URLHANDLER_WRITEPAGE_CB cb);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user