From 245f7faade8af73bdfff16cbc3cbe0b8ddc2383a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Sch=C3=B6bel?= <jonathan@xn--schbel-yxa.info> Date: Mon, 20 Jun 2022 18:33:20 +0200 Subject: [PATCH] added data data handels all intern data and serves as a cache between the CMS and the (R)DBMS. --- configure.ac | 1 + src/Makefile.am | 2 ++ src/cms.c | 7 +++++++ src/cms.h | 6 +++++- src/data.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ src/data.h | 39 +++++++++++++++++++++++++++++++++++++ src/sefht.h | 35 +++++++++++++++++++++++++++++++++ 7 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 src/data.c create mode 100644 src/data.h create mode 100644 src/sefht.h diff --git a/configure.ac b/configure.ac index 35d0adc..1cbc448 100644 --- a/configure.ac +++ b/configure.ac @@ -18,6 +18,7 @@ PKG_CHECK_MODULES([CHECK], [check >= 0.9.4]) # Checks for libraries. # Checks for header files. +AC_CHECK_HEADER([limits.h]) AC_CHECK_HEADER([stdio.h]) AC_CHECK_HEADER([stdlib.h]) diff --git a/src/Makefile.am b/src/Makefile.am index d13e2dd..0704e76 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,4 +7,6 @@ bin_PROGRAMS = sefht.fcgi sefht_fcgi_SOURCES = sefht_fcgi_SOURCES += main.c sefht_fcgi_SOURCES += macro.h +sefht_fcgi_SOURCES += sefht.h sefht_fcgi_SOURCES += cms.c cms.h +sefht_fcgi_SOURCES += data.c data.h diff --git a/src/cms.c b/src/cms.c index 805cb12..28f0bce 100644 --- a/src/cms.c +++ b/src/cms.c @@ -26,8 +26,11 @@ #include "macro.h" +#include "data.h" + #include "cms.h" + struct SH_Cms * SH_Cms_new () { @@ -38,12 +41,16 @@ SH_Cms_new () EXIT; } + cms->data = SH_Data_new (); + return cms; } void SH_Cms_free (struct SH_Cms * cms) { + SH_Data_free (cms->data); + free (cms); return; } diff --git a/src/cms.h b/src/cms.h index 6f6e97a..65637d0 100644 --- a/src/cms.h +++ b/src/cms.h @@ -24,9 +24,13 @@ #ifndef _CMS_H #define _CMS_H + +#include "data.h" + + struct SH_Cms { - // + struct SH_Data * data; }; struct SH_Cms * SH_Cms_new (); diff --git a/src/data.c b/src/data.c new file mode 100644 index 0000000..e7deedf --- /dev/null +++ b/src/data.c @@ -0,0 +1,51 @@ +/* + * data.c + * + * Copyright 2022 Jonathan Schöbel <jonathan@Ubermos-2019> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + + +#include <stdlib.h> + +#include "macro.h" + +#include "data.h" + + +struct SH_Data * +SH_Data_new () +{ + struct SH_Data * data; + data = malloc (sizeof (struct SH_Data)); + + if (data == NULL) { + EXIT; + } + + return data; +} + +void +SH_Data_free (struct SH_Data * data) +{ + free (data); + return; +} + diff --git a/src/data.h b/src/data.h new file mode 100644 index 0000000..6f48260 --- /dev/null +++ b/src/data.h @@ -0,0 +1,39 @@ +/* + * data.h + * + * Copyright 2022 Jonathan Schöbel <jonathan@Ubermos-2019> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + + +#ifndef _DATA_H +#define _DATA_H + +#include "sefht.h" + + +struct SH_Data +{ + // +}; + +struct SH_Data * SH_Data_new (); +void SH_Data_free (struct SH_Data * data); + +#endif /* _DATA_H */ diff --git a/src/sefht.h b/src/sefht.h new file mode 100644 index 0000000..d4f7836 --- /dev/null +++ b/src/sefht.h @@ -0,0 +1,35 @@ +/* + * sefht.h + * + * Copyright 2022 Jonathan Schöbel <jonathan@Ubermos-2019> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + + +#ifndef _SEFHT_H +#define _SEFHT_H + +#include <limits.h> + + +typedef unsigned int page_t; +#define PAGE_MIN 0 +#define PAGE_MAX UINT_MAX + +#endif /* _SEFHT_H */ -- GitLab