aqhome: added service definitions, started implementing HTTP service.

This commit is contained in:
Martin Preuss
2023-07-24 21:49:17 +02:00
parent db5d6cb980
commit 16ce958964
33 changed files with 2346 additions and 7 deletions

84
aqhome/http/content.c Normal file
View File

@@ -0,0 +1,84 @@
/****************************************************************************
* 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 <config.h>
#endif
#include "aqhome/http/content_p.h"
#include <gwenhywfar/debug.h>
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;
}