diff --git a/aqhome/http/0BUILD b/aqhome/http/0BUILD
index 313db50..a185b6f 100644
--- a/aqhome/http/0BUILD
+++ b/aqhome/http/0BUILD
@@ -46,18 +46,12 @@
endpoint_http.h
- urlhandler.h
- content.h
- content_files.h
httpservice.h
endpoint_http_p.h
- urlhandler_p.h
- content_p.h
- content_files_p.h
httpservice_p.h
@@ -66,9 +60,6 @@
$(local/typefiles)
endpoint_http.c
- urlhandler.c
- content.c
- content_files.c
httpservice.c
diff --git a/aqhome/http/content.c b/aqhome/http/content.c
deleted file mode 100644
index ca5d7a4..0000000
--- a/aqhome/http/content.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
- * 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.
- ****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include
-#endif
-
-
-#include "aqhome/http/content_p.h"
-
-#include
-
-
-
-
-GWEN_INHERIT_FUNCTIONS(AQH_HTTP_CONTENT)
-GWEN_TREE2_FUNCTIONS(AQH_HTTP_CONTENT, AQH_HttpContent)
-
-
-
-
-
-AQH_HTTP_CONTENT *AQH_HttpContent_new(void)
-{
- AQH_HTTP_CONTENT *cp;
-
- GWEN_NEW_OBJECT(AQH_HTTP_CONTENT, cp);
- GWEN_INHERIT_INIT(AQH_HTTP_CONTENT, cp);
- GWEN_TREE2_INIT(AQH_HTTP_CONTENT, cp, AQH_HttpContent);
-
- return cp;
-}
-
-
-
-void AQH_HttpContent_free(AQH_HTTP_CONTENT *cp)
-{
- if (cp) {
- GWEN_TREE2_FINI(AQH_HTTP_CONTENT, cp, AQH_HttpContent);
- GWEN_INHERIT_FINI(AQH_HTTP_CONTENT, cp);
- GWEN_FREE_OBJECT(cp);
- }
-}
-
-
-
-int AQH_HttpContent_AddOpeningContent(AQH_HTTP_CONTENT *cp, int mode, GWEN_BUFFER *buffer)
-{
- return (cp && cp->addOpeningContentFn)?(cp->addOpeningContentFn(cp, mode, buffer)):0;
-}
-
-
-
-int AQH_HttpContent_AddClosingContent(AQH_HTTP_CONTENT *cp, int mode, GWEN_BUFFER *buffer)
-{
- return (cp && cp->addClosingContentFn)?(cp->addClosingContentFn(cp, mode, buffer)):0;
-}
-
-
-
-void AQH_HttpContent_SetAddOpeningContentFn(AQH_HTTP_CONTENT *cp, AQH_HTTP_CONTENT_ADD_OPENING_CONTENT_FN f)
-{
- if (cp)
- cp->addOpeningContentFn=f;
-}
-
-
-
-void AQH_HttpContent_SetAddClosingContentFn(AQH_HTTP_CONTENT *cp, AQH_HTTP_CONTENT_ADD_CLOSING_CONTENT_FN f)
-{
- if (cp)
- cp->addClosingContentFn=f;
-}
-
-
-
-
-
-
diff --git a/aqhome/http/content.h b/aqhome/http/content.h
deleted file mode 100644
index 6edb228..0000000
--- a/aqhome/http/content.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
- * 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 AQHOME_CONTENT_H
-#define AQHOME_CONTENT_H
-
-
-#include
-
-#include
-#include
-#include
-
-
-#define AQH_HTTP_CONTENT_MODE_DESKTOP 0
-#define AQH_HTTP_CONTENT_MODE_MOBILE 1
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-typedef struct AQH_HTTP_CONTENT AQH_HTTP_CONTENT;
-GWEN_INHERIT_FUNCTION_LIB_DEFS(AQH_HTTP_CONTENT, AQHOME_API)
-GWEN_TREE2_FUNCTION_LIB_DEFS(AQH_HTTP_CONTENT, AQH_HttpContent, AQHOME_API)
-
-
-typedef int (*AQH_HTTP_CONTENT_ADD_OPENING_CONTENT_FN)(AQH_HTTP_CONTENT *cp, int mode, GWEN_BUFFER *buffer);
-typedef int (*AQH_HTTP_CONTENT_ADD_CLOSING_CONTENT_FN)(AQH_HTTP_CONTENT *cp, int mode, GWEN_BUFFER *buffer);
-
-
-AQHOME_API AQH_HTTP_CONTENT *AQH_HttpContent_new(void);
-AQHOME_API void AQH_HttpContent_free(AQH_HTTP_CONTENT *cp);
-
-AQHOME_API int AQH_HttpContent_AddOpeningContent(AQH_HTTP_CONTENT *cp, int mode, GWEN_BUFFER *buffer);
-AQHOME_API int AQH_HttpContent_AddClosingContent(AQH_HTTP_CONTENT *cp, int mode, GWEN_BUFFER *buffer);
-
-
-AQHOME_API void AQH_HttpContent_SetAddOpeningContentFn(AQH_HTTP_CONTENT *cp, AQH_HTTP_CONTENT_ADD_OPENING_CONTENT_FN f);
-AQHOME_API void AQH_HttpContent_SetAddClosingContentFn(AQH_HTTP_CONTENT *cp, AQH_HTTP_CONTENT_ADD_CLOSING_CONTENT_FN f);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-
-#endif
diff --git a/aqhome/http/content_files.c b/aqhome/http/content_files.c
deleted file mode 100644
index dd711ef..0000000
--- a/aqhome/http/content_files.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
- * 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.
- ****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include
-#endif
-
-#include "aqhome/http/content_files_p.h"
-
-#include
-#include
-
-
-
-GWEN_INHERIT(AQH_HTTP_CONTENT, AQH_HTTP_CONTENT_FILES)
-
-
-/* ------------------------------------------------------------------------------------------------
- * forward declarations
- * ------------------------------------------------------------------------------------------------
- */
-
-static void _freeData(void *bp, void *p);
-static int _addOpeningContent(AQH_HTTP_CONTENT *cp, int mode, GWEN_BUFFER *buffer);
-static int _addClosingContent(AQH_HTTP_CONTENT *cp, int mode, GWEN_BUFFER *buffer);
-
-
-
-/* ------------------------------------------------------------------------------------------------
- * implementations
- * ------------------------------------------------------------------------------------------------
- */
-
-AQH_HTTP_CONTENT *AQH_HttpContentFiles_new(const char *headerFilename, const char *footerFilename)
-{
- AQH_HTTP_CONTENT *cp;
- AQH_HTTP_CONTENT_FILES *xcp;
-
- cp=AQH_HttpContent_new();
- GWEN_NEW_OBJECT(AQH_HTTP_CONTENT_FILES, xcp);
- GWEN_INHERIT_SETDATA(AQH_HTTP_CONTENT, AQH_HTTP_CONTENT_FILES, cp, xcp, _freeData);
-
- xcp->headerFilename=(headerFilename && *headerFilename)?strdup(headerFilename):NULL;
- xcp->footerFilename=(footerFilename && *footerFilename)?strdup(footerFilename):NULL;
-
- AQH_HttpContent_SetAddOpeningContentFn(cp, _addOpeningContent);
- AQH_HttpContent_SetAddClosingContentFn(cp, _addClosingContent);
-
- return cp;
-}
-
-
-
-void _freeData(void *bp, void *p)
-{
- AQH_HTTP_CONTENT_FILES *xcp;
-
- xcp=(AQH_HTTP_CONTENT_FILES*) p;
-
- free(xcp->footerData);
- free(xcp->headerData);
-
- free(xcp->footerFilename);
- free(xcp->headerFilename);
- GWEN_FREE_OBJECT(xcp);
-}
-
-
-
-int _addOpeningContent(AQH_HTTP_CONTENT *cp, int mode, GWEN_BUFFER *buffer)
-{
- if (cp) {
- AQH_HTTP_CONTENT_FILES *xcp;
-
- xcp=GWEN_INHERIT_GETDATA(AQH_HTTP_CONTENT, AQH_HTTP_CONTENT_FILES, cp);
- if (xcp) {
- if (xcp->headerData==NULL) {
- if (xcp->headerFilename) {
- int rv;
- GWEN_BUFFER *fileBuffer;
-
- fileBuffer=GWEN_Buffer_new(0, 256, 0, 1);
- rv=GWEN_SyncIo_Helper_ReadFile(xcp->headerFilename, fileBuffer);
- if (rv<0) {
- DBG_ERROR(AQH_LOGDOMAIN, "Error reading header file \"%s\": %d", xcp->headerFilename, rv);
- GWEN_Buffer_free(fileBuffer);
- return rv;
- }
- xcp->headerData=strdup(GWEN_Buffer_GetStart(fileBuffer));
- GWEN_Buffer_free(fileBuffer);
- }
- }
- if (xcp->headerData)
- GWEN_Buffer_AppendString(buffer, xcp->headerData);
- }
- }
-
- return 0;
-}
-
-
-
-int _addClosingContent(AQH_HTTP_CONTENT *cp, int mode, GWEN_BUFFER *buffer)
-{
- if (cp) {
- AQH_HTTP_CONTENT_FILES *xcp;
-
- xcp=GWEN_INHERIT_GETDATA(AQH_HTTP_CONTENT, AQH_HTTP_CONTENT_FILES, cp);
- if (xcp) {
- if (xcp->footerData==NULL) {
- if (xcp->footerFilename) {
- int rv;
- GWEN_BUFFER *fileBuffer;
-
- fileBuffer=GWEN_Buffer_new(0, 256, 0, 1);
- rv=GWEN_SyncIo_Helper_ReadFile(xcp->footerFilename, fileBuffer);
- if (rv<0) {
- DBG_ERROR(AQH_LOGDOMAIN, "Error reading footer file \"%s\": %d", xcp->footerFilename, rv);
- GWEN_Buffer_free(fileBuffer);
- return rv;
- }
- xcp->footerData=strdup(GWEN_Buffer_GetStart(fileBuffer));
- GWEN_Buffer_free(fileBuffer);
- }
- if (xcp->footerData)
- GWEN_Buffer_AppendString(buffer, xcp->footerData);
- }
- }
- }
-
- return 0;
-}
-
-
-
-
-
-
-
-
diff --git a/aqhome/http/content_files.h b/aqhome/http/content_files.h
deleted file mode 100644
index 402febc..0000000
--- a/aqhome/http/content_files.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/****************************************************************************
- * 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 AQHOME_CONTENT_FILES_H
-#define AQHOME_CONTENT_FILES_H
-
-
-#include
-#include
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-AQHOME_API AQH_HTTP_CONTENT *AQH_HttpContentFiles_new(const char *headerFilename, const char *footerFilename);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-
-#endif
diff --git a/aqhome/http/content_files_p.h b/aqhome/http/content_files_p.h
deleted file mode 100644
index ccd5cb6..0000000
--- a/aqhome/http/content_files_p.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/****************************************************************************
- * 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 AQHOME_CONTENT_FILES_P_H
-#define AQHOME_CONTENT_FILES_P_H
-
-
-#include "aqhome/http/content_files.h"
-
-
-
-typedef struct AQH_HTTP_CONTENT_FILES AQH_HTTP_CONTENT_FILES;
-struct AQH_HTTP_CONTENT_FILES {
- char *headerFilename;
- char *footerFilename;
-
- char *headerData;
- char *footerData;
-};
-
-
-
-#endif
diff --git a/aqhome/http/content_p.h b/aqhome/http/content_p.h
deleted file mode 100644
index 2023098..0000000
--- a/aqhome/http/content_p.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/****************************************************************************
- * 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 AQHOME_CONTENT_P_H
-#define AQHOME_CONTENT_P_H
-
-
-#include "aqhome/http/content.h"
-
-
-struct AQH_HTTP_CONTENT {
- GWEN_INHERIT_ELEMENT(AQH_HTTP_CONTENT);
- GWEN_TREE2_ELEMENT(AQH_HTTP_CONTENT);
-
- AQH_HTTP_CONTENT_ADD_OPENING_CONTENT_FN addOpeningContentFn;
- AQH_HTTP_CONTENT_ADD_CLOSING_CONTENT_FN addClosingContentFn;
-};
-
-
-
-
-#endif
diff --git a/aqhome/http/urlhandler.c b/aqhome/http/urlhandler.c
deleted file mode 100644
index 52a0871..0000000
--- a/aqhome/http/urlhandler.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
- * 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.
- ****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include
-#endif
-
-
-#include "./urlhandler_p.h"
-
-#include
-#include
-#include
-
-
-
-
-GWEN_INHERIT_FUNCTIONS(AQH_URLHANDLER)
-GWEN_LIST_FUNCTIONS(AQH_URLHANDLER, AQH_UrlHandler)
-
-
-
-
-
-AQH_URLHANDLER *AQH_UrlHandler_new(void)
-{
- AQH_URLHANDLER *uh;
-
- GWEN_NEW_OBJECT(AQH_URLHANDLER, uh);
- GWEN_INHERIT_INIT(AQH_URLHANDLER, uh);
- uh->urlPatternList=GWEN_StringList_new();
-
- return uh;
-}
-
-
-
-void AQH_UrlHandler_free(AQH_URLHANDLER *uh)
-{
- if (uh) {
- GWEN_INHERIT_FINI(AQH_URLHANDLER, uh);
- GWEN_StringList_free(uh->urlPatternList);
- GWEN_FREE_OBJECT(uh);
- }
-}
-
-
-
-AQH_HTTP_CONTENT *AQH_UrlHandler_GetContentProvider(const AQH_URLHANDLER *uh)
-{
- return uh?uh->httpContentProvider:NULL;
-}
-
-
-
-void AQH_UrlHandler_SetContentProvider(AQH_URLHANDLER *uh, AQH_HTTP_CONTENT *cp)
-{
- if (uh)
- uh->httpContentProvider=cp;
-}
-
-
-
-void AQH_UrlHandler_AddUrlPattern(AQH_URLHANDLER *uh, const char *s)
-{
- if (uh && s && *s)
- GWEN_StringList_AppendString(uh->urlPatternList, s, 0, 1);
-}
-
-
-
-int AQH_UrlHandler_UrlMatches(const AQH_URLHANDLER *uh, const char *s)
-{
- if (uh && s && *s) {
- GWEN_STRINGLISTENTRY *se;
-
- se=GWEN_StringList_FirstEntry(uh->urlPatternList);
- while(se) {
- const char *pattern;
-
- pattern=GWEN_StringListEntry_Data(se);
- if (GWEN_Text_ComparePattern(s, pattern, 0)!=-1)
- return 1;
- se=GWEN_StringListEntry_Next(se);
- }
- }
- return 0;
-}
-
-
-
-GWEN_MSG *AQH_UrlHandler_HandleMessage(AQH_URLHANDLER *uh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msgReceived)
-{
- if (uh && uh->handleFn)
- return uh->handleFn(uh, ep, msgReceived);
- return NULL;
-}
-
-
-
-
-
-
-
-
-
diff --git a/aqhome/http/urlhandler.h b/aqhome/http/urlhandler.h
deleted file mode 100644
index 06658c6..0000000
--- a/aqhome/http/urlhandler.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
- * 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 AQHOME_URLHANDLER_H
-#define AQHOME_URLHANDLER_H
-
-#include
-
-#include "aqhome/http/content.h"
-
-#include
-#include
-#include
-#include
-
-
-
-typedef struct AQH_URLHANDLER AQH_URLHANDLER;
-GWEN_INHERIT_FUNCTION_LIB_DEFS(AQH_URLHANDLER, AQHOME_API)
-GWEN_LIST_FUNCTION_LIB_DEFS(AQH_URLHANDLER, AQH_UrlHandler, AQHOME_API)
-
-
-
-typedef GWEN_MSG*(*AQH_URLHANDLER_HANDLE_FN)(AQH_URLHANDLER *uh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msgReceived);
-
-
-AQHOME_API AQH_URLHANDLER *AQH_UrlHandler_new(void);
-AQHOME_API void AQH_UrlHandler_free(AQH_URLHANDLER *uh);
-
-AQHOME_API AQH_HTTP_CONTENT *AQH_UrlHandler_GetContentProvider(const AQH_URLHANDLER *uh);
-AQHOME_API void AQH_UrlHandler_SetContentProvider(AQH_URLHANDLER *uh, AQH_HTTP_CONTENT *cp);
-
-AQHOME_API void AQH_UrlHandler_AddUrlPattern(AQH_URLHANDLER *uh, const char *s);
-AQHOME_API int AQH_UrlHandler_UrlMatches(const AQH_URLHANDLER *uh, const char *s);
-
-AQHOME_API GWEN_MSG *AQH_UrlHandler_HandleMessage(AQH_URLHANDLER *uh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msgReceived);
-
-
-
-
-
-
-#endif
diff --git a/aqhome/http/urlhandler_p.h b/aqhome/http/urlhandler_p.h
deleted file mode 100644
index 8cd05a6..0000000
--- a/aqhome/http/urlhandler_p.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/****************************************************************************
- * 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 AQHOME_URLHANDLER_P_H
-#define AQHOME_URLHANDLER_P_H
-
-
-#include "aqhome/http/urlhandler.h"
-
-
-struct AQH_URLHANDLER {
- GWEN_INHERIT_ELEMENT(AQH_URLHANDLER);
- GWEN_LIST_ELEMENT(AQH_URLHANDLER);
-
- GWEN_STRINGLIST *urlPatternList;
- AQH_URLHANDLER_HANDLE_FN handleFn;
-
- AQH_HTTP_CONTENT *httpContentProvider;
-};
-
-
-
-
-#endif