71 lines
3.0 KiB
C
71 lines
3.0 KiB
C
/****************************************************************************
|
|
* 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 const char *AQH_HttpUrlHandler_GetFolder(const AQH_HTTP_URLHANDLER *uh);
|
|
AQHOME_API void AQH_HttpUrlHandler_SetFolder(AQH_HTTP_URLHANDLER *uh, const char *s);
|
|
|
|
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_DB_NODE *dbValues,
|
|
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,
|
|
GWEN_DB_NODE *dbValues,
|
|
AQH_HTTP_URLHANDLER_WRITEPAGE_CB cb);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|