[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-anastasis] branch master updated: adapting to new GN
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-anastasis] branch master updated: adapting to new GNUNET_PQ API, removing dead, useless code |
Date: |
Fri, 11 Oct 2019 23:49:00 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new b628002 adapting to new GNUNET_PQ API, removing dead, useless code
b628002 is described below
commit b6280020afef3bdff9c66a899d2caf550c4c585b
Author: Christian Grothoff <address@hidden>
AuthorDate: Fri Oct 11 23:48:58 2019 +0200
adapting to new GNUNET_PQ API, removing dead, useless code
---
configure.ac | 1 -
doc/Makefile.am | 71 +-
doc/Makefile.in | 547 +------
src/backup-db/plugin_anastasis_postgres.c | 2506 ++---------------------------
src/backup/Makefile.am | 4 +-
src/backup/Makefile.in | 172 +-
src/include/Makefile.in | 54 +-
src/include/anastasis_database_plugin.h | 98 +-
src/include/platform.h | 4 +-
9 files changed, 291 insertions(+), 3166 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6580692..b261464 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,7 +278,6 @@ AM_CONDITIONAL([HAVE_GNUNETPQ], [false])
AM_CONDITIONAL([HAVE_POSTGRESQL], [false])
AM_CONDITIONAL([HAVE_LIBCURL], [false])
AM_CONDITIONAL([HAVE_LIBGNURL], [false])
-AM_CONDITIONAL([HAVE_TSC], [false])
AM_CONDITIONAL([USE_COVERAGE], [false])
AM_CONDITIONAL([ENABLE_DOC], [true])
AM_CONDITIONAL([HAVE_TWISTER], [true])
diff --git a/doc/Makefile.am b/doc/Makefile.am
index f135953..0ea14b6 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,71 +1,2 @@
-all: manual.pdf manual.html
-
-manual.pdf: arch.pdf manual.texi
-manual.html: arch.png manual.texi
-
-%.png: %.dot
- dot -Tpng $< > $@
-%.pdf: %.dot
- dot -Tpdf $< > $@
-
-clean-local:
- -rm -f arch.png arch.pdf arch-api.png arch-api.pdf
-
-merchant-api-curl.pdf: merchant-api.content.texi arch-api.pdf
-merchant-api-python.pdf: merchant-api.content.texi arch-api.pdf
-merchant-api-curl.html: merchant-api.content.texi arch-api.png
-merchant-api-python.html: merchant-api.content.texi arch-api.png
-
-# NOTE: While GNU makeinfo 6.5 supports --css-ref=URL,
-# makeinfo 4.8 (in NetBSD 8.0, macOS, and maybe other
-# base) does only support --css-include=FILE.
-# The only difference is a shorter html output and
-# in 6.5 the ability to use refs instead of include.
-# We prefer not to break builds in this case, so
-# we use the include version which is backwards compatible
-# and upwards compatible, while the ref variant is neither.
-
-AM_MAKEINFOHTMLFLAGS = --no-split --css-include=docstyle.css
--css-include=brown-paper.css
-
man_MANS = \
- taler-merchant-benchmark.1 \
- taler-merchant-httpd.1
-
-info_TEXINFOS = \
- manual.texi \
- merchant-api-python.texi \
- merchant-api-curl.texi \
- merchant-api-php.texi
-
-manual_TEXINFOS = \
- version-manual.texi \
- merchant-api.content.texi
-
-merchant_api_python_TEXINFOS = \
- version-merchant-api-python.texi \
- merchant-api.content.texi
-
-merchant_api_curl_TEXINFOS = \
- version-merchant-api-curl.texi \
- merchant-api.content.texi
-
-merchant_api_php_TEXINFOS = \
- version-merchant-api-php.texi \
- merchant-api.content.texi
-
-extra_TEXINFOS = \
- fdl-1.3.texi \
- agpl.texi \
- syntax.texi \
- merchant-api.content.texi
-
-EXTRA_DIST = \
- arch.dot \
- $(extra_TEXINFOS) \
- docstyle.css \
- brown-paper.css \
- $(man_MANS)
-
-DISTCLEANFILES = \
- manual.cps \
- manual.dvi
+ anastasis-httpd.1
diff --git a/doc/Makefile.in b/doc/Makefile.in
index a66aca2..9e540c5 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -97,13 +97,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_postgresql.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/version-manual.texi \
- $(srcdir)/stamp-vti $(srcdir)/version-merchant-api-python.texi \
- $(srcdir)/stamp-1 $(srcdir)/version-merchant-api-curl.texi \
- $(srcdir)/stamp-2 $(srcdir)/version-merchant-api-php.texi \
- $(srcdir)/stamp-3 $(am__DIST_COMMON)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/taler_merchant_config.h
+CONFIG_HEADER = $(top_builddir)/anastasis_config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
@@ -120,58 +116,11 @@ am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
-AM_V_DVIPS = $(am__v_DVIPS_@AM_V@)
-am__v_DVIPS_ = $(am__v_DVIPS_@AM_DEFAULT_V@)
-am__v_DVIPS_0 = @echo " DVIPS " $@;
-am__v_DVIPS_1 =
-AM_V_MAKEINFO = $(am__v_MAKEINFO_@AM_V@)
-am__v_MAKEINFO_ = $(am__v_MAKEINFO_@AM_DEFAULT_V@)
-am__v_MAKEINFO_0 = @echo " MAKEINFO" $@;
-am__v_MAKEINFO_1 =
-AM_V_INFOHTML = $(am__v_INFOHTML_@AM_V@)
-am__v_INFOHTML_ = $(am__v_INFOHTML_@AM_DEFAULT_V@)
-am__v_INFOHTML_0 = @echo " INFOHTML" $@;
-am__v_INFOHTML_1 =
-AM_V_TEXI2DVI = $(am__v_TEXI2DVI_@AM_V@)
-am__v_TEXI2DVI_ = $(am__v_TEXI2DVI_@AM_DEFAULT_V@)
-am__v_TEXI2DVI_0 = @echo " TEXI2DVI" $@;
-am__v_TEXI2DVI_1 =
-AM_V_TEXI2PDF = $(am__v_TEXI2PDF_@AM_V@)
-am__v_TEXI2PDF_ = $(am__v_TEXI2PDF_@AM_DEFAULT_V@)
-am__v_TEXI2PDF_0 = @echo " TEXI2PDF" $@;
-am__v_TEXI2PDF_1 =
-AM_V_texinfo = $(am__v_texinfo_@AM_V@)
-am__v_texinfo_ = $(am__v_texinfo_@AM_DEFAULT_V@)
-am__v_texinfo_0 = -q
-am__v_texinfo_1 =
-AM_V_texidevnull = $(am__v_texidevnull_@AM_V@)
-am__v_texidevnull_ = $(am__v_texidevnull_@AM_DEFAULT_V@)
-am__v_texidevnull_0 = > /dev/null
-am__v_texidevnull_1 =
-INFO_DEPS = $(srcdir)/manual.info $(srcdir)/merchant-api-python.info \
- $(srcdir)/merchant-api-curl.info \
- $(srcdir)/merchant-api-php.info
-am__TEXINFO_TEX_DIR = $(srcdir)
-DVIS = manual.dvi merchant-api-python.dvi merchant-api-curl.dvi \
- merchant-api-php.dvi
-PDFS = manual.pdf merchant-api-python.pdf merchant-api-curl.pdf \
- merchant-api-php.pdf
-PSS = manual.ps merchant-api-python.ps merchant-api-curl.ps \
- merchant-api-php.ps
-HTMLS = manual.html merchant-api-python.html merchant-api-curl.html \
- merchant-api-php.html
-TEXINFOS = manual.texi merchant-api-python.texi merchant-api-curl.texi \
- merchant-api-php.texi
-TEXI2DVI = texi2dvi
-TEXI2PDF = $(TEXI2DVI) --pdf --batch
-MAKEINFOHTML = $(MAKEINFO) --html
-DVIPS = dvips
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
-am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)"
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -200,12 +149,11 @@ am__uninstall_files_from_dir = { \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
man1dir = $(mandir)/man1
+am__installdirs = "$(DESTDIR)$(man1dir)"
NROFF = nroff
MANS = $(man_MANS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-am__DIST_COMMON = $(manual_TEXINFOS) $(merchant_api_curl_TEXINFOS) \
- $(merchant_api_php_TEXINFOS) $(merchant_api_python_TEXINFOS) \
- $(srcdir)/Makefile.in mdate-sh texinfo.tex
+am__DIST_COMMON = $(srcdir)/Makefile.in mdate-sh texinfo.tex
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -372,64 +320,12 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-tsc = @tsc@
-
-# NOTE: While GNU makeinfo 6.5 supports --css-ref=URL,
-# makeinfo 4.8 (in NetBSD 8.0, macOS, and maybe other
-# base) does only support --css-include=FILE.
-# The only difference is a shorter html output and
-# in 6.5 the ability to use refs instead of include.
-# We prefer not to break builds in this case, so
-# we use the include version which is backwards compatible
-# and upwards compatible, while the ref variant is neither.
-AM_MAKEINFOHTMLFLAGS = --no-split --css-include=docstyle.css
--css-include=brown-paper.css
man_MANS = \
- taler-merchant-benchmark.1 \
- taler-merchant-httpd.1
-
-info_TEXINFOS = \
- manual.texi \
- merchant-api-python.texi \
- merchant-api-curl.texi \
- merchant-api-php.texi
-
-manual_TEXINFOS = \
- version-manual.texi \
- merchant-api.content.texi
-
-merchant_api_python_TEXINFOS = \
- version-merchant-api-python.texi \
- merchant-api.content.texi
-
-merchant_api_curl_TEXINFOS = \
- version-merchant-api-curl.texi \
- merchant-api.content.texi
-
-merchant_api_php_TEXINFOS = \
- version-merchant-api-php.texi \
- merchant-api.content.texi
-
-extra_TEXINFOS = \
- fdl-1.3.texi \
- agpl.texi \
- syntax.texi \
- merchant-api.content.texi
-
-EXTRA_DIST = \
- arch.dot \
- $(extra_TEXINFOS) \
- docstyle.css \
- brown-paper.css \
- $(man_MANS)
-
-DISTCLEANFILES = \
- manual.cps \
- manual.dvi
+ anastasis-httpd.1
all: all-am
.SUFFIXES:
-.SUFFIXES: .dvi .html .info .pdf .ps .texi
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
@@ -465,248 +361,6 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-
-.texi.info:
- $(AM_V_MAKEINFO)restore=: && backupdir="$(am__leading_dot)am$$$$" && \
- am__cwd=`pwd` && $(am__cd) $(srcdir) && \
- rm -rf $$backupdir && mkdir $$backupdir && \
- if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
- for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9]
$(@:.info=).i[0-9][0-9]; do \
- if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
- done; \
- else :; fi && \
- cd "$$am__cwd"; \
- if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
- -o $@ $<; \
- then \
- rc=0; \
- $(am__cd) $(srcdir); \
- else \
- rc=$$?; \
- $(am__cd) $(srcdir) && \
- $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
- fi; \
- rm -rf $$backupdir; exit $$rc
-
-.texi.dvi:
-
$(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
- MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I
$(srcdir)' \
- $(TEXI2DVI) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@
$(AM_V_texidevnull) \
- $<
-
-.texi.pdf:
-
$(AM_V_TEXI2PDF)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
- MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I
$(srcdir)' \
- $(TEXI2PDF) $(AM_V_texinfo) --build-dir=$(@:.pdf=.t2p) -o $@
$(AM_V_texidevnull) \
- $<
-
-.texi.html:
- $(AM_V_MAKEINFO)rm -rf $(@:.html=.htp)
- $(AM_V_at)if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS)
-I $(srcdir) \
- -o $(@:.html=.htp) $<; \
- then \
- rm -rf $@ && mv $(@:.html=.htp) $@; \
- else \
- rm -rf $(@:.html=.htp); exit 1; \
- fi
-$(srcdir)/manual.info: manual.texi $(srcdir)/version-manual.texi
$(manual_TEXINFOS)
-manual.dvi: manual.texi $(srcdir)/version-manual.texi $(manual_TEXINFOS)
-$(srcdir)/version-manual.texi: $(srcdir)/stamp-vti
-$(srcdir)/stamp-vti: manual.texi $(top_srcdir)/configure
- @(dir=.; test -f ./manual.texi || dir=$(srcdir); \
- set `$(SHELL) $(srcdir)/mdate-sh $$dir/manual.texi`; \
- echo "@set UPDATED $$1 $$2 $$3"; \
- echo "@set UPDATED-MONTH $$2 $$3"; \
- echo "@set EDITION $(VERSION)"; \
- echo "@set VERSION $(VERSION)") > vti.tmp$$$$ && \
- (cmp -s vti.tmp$$$$ $(srcdir)/version-manual.texi \
- || (echo "Updating $(srcdir)/version-manual.texi" && \
- cp vti.tmp$$$$ $(srcdir)/version-manual.texi.tmp$$$$ && \
- mv $(srcdir)/version-manual.texi.tmp$$$$
$(srcdir)/version-manual.texi)) && \
- rm -f vti.tmp$$$$ $(srcdir)/version-manual.texi.$$$$
- @cp $(srcdir)/version-manual.texi $@
-
-mostlyclean-vti:
- -rm -f vti.tmp* $(srcdir)/version-manual.texi.tmp*
-
-maintainer-clean-vti:
- -rm -f $(srcdir)/stamp-vti $(srcdir)/version-manual.texi
-$(srcdir)/merchant-api-python.info: merchant-api-python.texi
$(srcdir)/version-merchant-api-python.texi $(merchant_api_python_TEXINFOS)
-merchant-api-python.dvi: merchant-api-python.texi
$(srcdir)/version-merchant-api-python.texi $(merchant_api_python_TEXINFOS)
-$(srcdir)/version-merchant-api-python.texi: $(srcdir)/stamp-1
-$(srcdir)/stamp-1: merchant-api-python.texi $(top_srcdir)/configure
- @(dir=.; test -f ./merchant-api-python.texi || dir=$(srcdir); \
- set `$(SHELL) $(srcdir)/mdate-sh $$dir/merchant-api-python.texi`; \
- echo "@set UPDATED $$1 $$2 $$3"; \
- echo "@set UPDATED-MONTH $$2 $$3"; \
- echo "@set EDITION $(VERSION)"; \
- echo "@set VERSION $(VERSION)") > 1.tmp$$$$ && \
- (cmp -s 1.tmp$$$$ $(srcdir)/version-merchant-api-python.texi \
- || (echo "Updating $(srcdir)/version-merchant-api-python.texi" && \
- cp 1.tmp$$$$ $(srcdir)/version-merchant-api-python.texi.tmp$$$$
&& \
- mv $(srcdir)/version-merchant-api-python.texi.tmp$$$$
$(srcdir)/version-merchant-api-python.texi)) && \
- rm -f 1.tmp$$$$ $(srcdir)/version-merchant-api-python.texi.$$$$
- @cp $(srcdir)/version-merchant-api-python.texi $@
-
-mostlyclean-1:
- -rm -f 1.tmp* $(srcdir)/version-merchant-api-python.texi.tmp*
-
-maintainer-clean-1:
- -rm -f $(srcdir)/stamp-1 $(srcdir)/version-merchant-api-python.texi
-$(srcdir)/merchant-api-curl.info: merchant-api-curl.texi
$(srcdir)/version-merchant-api-curl.texi $(merchant_api_curl_TEXINFOS)
-merchant-api-curl.dvi: merchant-api-curl.texi
$(srcdir)/version-merchant-api-curl.texi $(merchant_api_curl_TEXINFOS)
-$(srcdir)/version-merchant-api-curl.texi: $(srcdir)/stamp-2
-$(srcdir)/stamp-2: merchant-api-curl.texi $(top_srcdir)/configure
- @(dir=.; test -f ./merchant-api-curl.texi || dir=$(srcdir); \
- set `$(SHELL) $(srcdir)/mdate-sh $$dir/merchant-api-curl.texi`; \
- echo "@set UPDATED $$1 $$2 $$3"; \
- echo "@set UPDATED-MONTH $$2 $$3"; \
- echo "@set EDITION $(VERSION)"; \
- echo "@set VERSION $(VERSION)") > 2.tmp$$$$ && \
- (cmp -s 2.tmp$$$$ $(srcdir)/version-merchant-api-curl.texi \
- || (echo "Updating $(srcdir)/version-merchant-api-curl.texi" && \
- cp 2.tmp$$$$ $(srcdir)/version-merchant-api-curl.texi.tmp$$$$ && \
- mv $(srcdir)/version-merchant-api-curl.texi.tmp$$$$
$(srcdir)/version-merchant-api-curl.texi)) && \
- rm -f 2.tmp$$$$ $(srcdir)/version-merchant-api-curl.texi.$$$$
- @cp $(srcdir)/version-merchant-api-curl.texi $@
-
-mostlyclean-2:
- -rm -f 2.tmp* $(srcdir)/version-merchant-api-curl.texi.tmp*
-
-maintainer-clean-2:
- -rm -f $(srcdir)/stamp-2 $(srcdir)/version-merchant-api-curl.texi
-$(srcdir)/merchant-api-php.info: merchant-api-php.texi
$(srcdir)/version-merchant-api-php.texi $(merchant_api_php_TEXINFOS)
-merchant-api-php.dvi: merchant-api-php.texi
$(srcdir)/version-merchant-api-php.texi $(merchant_api_php_TEXINFOS)
-merchant-api-php.pdf: merchant-api-php.texi
$(srcdir)/version-merchant-api-php.texi $(merchant_api_php_TEXINFOS)
-merchant-api-php.html: merchant-api-php.texi
$(srcdir)/version-merchant-api-php.texi $(merchant_api_php_TEXINFOS)
-$(srcdir)/version-merchant-api-php.texi: $(srcdir)/stamp-3
-$(srcdir)/stamp-3: merchant-api-php.texi $(top_srcdir)/configure
- @(dir=.; test -f ./merchant-api-php.texi || dir=$(srcdir); \
- set `$(SHELL) $(srcdir)/mdate-sh $$dir/merchant-api-php.texi`; \
- echo "@set UPDATED $$1 $$2 $$3"; \
- echo "@set UPDATED-MONTH $$2 $$3"; \
- echo "@set EDITION $(VERSION)"; \
- echo "@set VERSION $(VERSION)") > 3.tmp$$$$ && \
- (cmp -s 3.tmp$$$$ $(srcdir)/version-merchant-api-php.texi \
- || (echo "Updating $(srcdir)/version-merchant-api-php.texi" && \
- cp 3.tmp$$$$ $(srcdir)/version-merchant-api-php.texi.tmp$$$$ && \
- mv $(srcdir)/version-merchant-api-php.texi.tmp$$$$
$(srcdir)/version-merchant-api-php.texi)) && \
- rm -f 3.tmp$$$$ $(srcdir)/version-merchant-api-php.texi.$$$$
- @cp $(srcdir)/version-merchant-api-php.texi $@
-
-mostlyclean-3:
- -rm -f 3.tmp* $(srcdir)/version-merchant-api-php.texi.tmp*
-
-maintainer-clean-3:
- -rm -f $(srcdir)/stamp-3 $(srcdir)/version-merchant-api-php.texi
-.dvi.ps:
-
$(AM_V_DVIPS)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
- $(DVIPS) $(AM_V_texinfo) -o $@ $<
-
-uninstall-dvi-am:
- @$(NORMAL_UNINSTALL)
- @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
- for p in $$list; do \
- $(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \
- rm -f "$(DESTDIR)$(dvidir)/$$f"; \
- done
-
-uninstall-html-am:
- @$(NORMAL_UNINSTALL)
- @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \
- for p in $$list; do \
- $(am__strip_dir) \
- echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \
- rm -rf "$(DESTDIR)$(htmldir)/$$f"; \
- done
-
-uninstall-info-am:
- @$(PRE_UNINSTALL)
- @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \
- list='$(INFO_DEPS)'; \
- for file in $$list; do \
- relfile=`echo "$$file" | sed 's|^.*/||'`; \
- echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove
'$(DESTDIR)$(infodir)/$$relfile'"; \
- if install-info --info-dir="$(DESTDIR)$(infodir)" --remove
"$(DESTDIR)$(infodir)/$$relfile"; \
- then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1;
fi; \
- done; \
- else :; fi
- @$(NORMAL_UNINSTALL)
- @list='$(INFO_DEPS)'; \
- for file in $$list; do \
- relfile=`echo "$$file" | sed 's|^.*/||'`; \
- relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
- (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then
\
- echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile
$$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
- rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9]
$$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
- else :; fi); \
- done
-
-uninstall-pdf-am:
- @$(NORMAL_UNINSTALL)
- @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
- for p in $$list; do \
- $(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \
- rm -f "$(DESTDIR)$(pdfdir)/$$f"; \
- done
-
-uninstall-ps-am:
- @$(NORMAL_UNINSTALL)
- @list='$(PSS)'; test -n "$(psdir)" || list=; \
- for p in $$list; do \
- $(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \
- rm -f "$(DESTDIR)$(psdir)/$$f"; \
- done
-
-dist-info: $(INFO_DEPS)
- @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
- list='$(INFO_DEPS)'; \
- for base in $$list; do \
- case $$base in \
- $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
- esac; \
- if test -f $$base; then d=.; else d=$(srcdir); fi; \
- base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \
- for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9]
$$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \
- if test -f $$file; then \
- relfile=`expr "$$file" : "$$d/\(.*\)"`; \
- test -f "$(distdir)/$$relfile" || \
- cp -p $$file "$(distdir)/$$relfile"; \
- else :; fi; \
- done; \
- done
-
-mostlyclean-aminfo:
- -rm -rf manual.t2d manual.t2p merchant-api-python.t2d \
- merchant-api-python.t2p merchant-api-curl.t2d \
- merchant-api-curl.t2p merchant-api-php.t2d \
- merchant-api-php.t2p
-
-clean-aminfo:
- -test -z "manual.dvi manual.pdf manual.ps manual.html
merchant-api-python.dvi \
- merchant-api-python.pdf merchant-api-python.ps \
- merchant-api-python.html merchant-api-curl.dvi \
- merchant-api-curl.pdf merchant-api-curl.ps \
- merchant-api-curl.html merchant-api-php.dvi \
- merchant-api-php.pdf merchant-api-php.ps \
- merchant-api-php.html" \
- || rm -rf manual.dvi manual.pdf manual.ps manual.html
merchant-api-python.dvi \
- merchant-api-python.pdf merchant-api-python.ps \
- merchant-api-python.html merchant-api-curl.dvi \
- merchant-api-curl.pdf merchant-api-curl.ps \
- merchant-api-curl.html merchant-api-php.dvi \
- merchant-api-php.pdf merchant-api-php.ps \
- merchant-api-php.html
-
-maintainer-clean-aminfo:
- @list='$(INFO_DEPS)'; for i in $$list; do \
- i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
- echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9]
$$i_i[0-9][0-9]"; \
- rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
- done
install-man1: $(man_MANS)
@$(NORMAL_INSTALL)
@list1=''; \
@@ -790,14 +444,11 @@ distdir-am: $(DISTFILES)
|| exit 1; \
fi; \
done
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$(top_distdir)" distdir="$(distdir)" \
- dist-info
check-am: all-am
check: check-am
-all-am: Makefile $(INFO_DEPS) $(MANS)
+all-am: Makefile $(MANS)
installdirs:
- for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)"; do \
+ for dir in "$(DESTDIR)$(man1dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -826,15 +477,13 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f
$(CONFIG_CLEAN_VPATH_FILES)
- -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-aminfo clean-generic clean-libtool clean-local \
- mostlyclean-am
+clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
@@ -842,199 +491,81 @@ distclean-am: clean-am distclean-generic
dvi: dvi-am
-dvi-am: $(DVIS)
+dvi-am:
html: html-am
-html-am: $(HTMLS)
+html-am:
info: info-am
-info-am: $(INFO_DEPS)
+info-am:
-install-data-am: install-info-am install-man
+install-data-am: install-man
install-dvi: install-dvi-am
-install-dvi-am: $(DVIS)
- @$(NORMAL_INSTALL)
- @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \
- done
+install-dvi-am:
+
install-exec-am:
install-html: install-html-am
-install-html-am: $(HTMLS)
- @$(NORMAL_INSTALL)
- @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
- $(am__strip_dir) \
- d2=$$d$$p; \
- if test -d "$$d2"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
- $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
- echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \
- $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
- else \
- list2="$$list2 $$d2"; \
- fi; \
- done; \
- test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \
- done; }
+install-html-am:
+
install-info: install-info-am
-install-info-am: $(INFO_DEPS)
- @$(NORMAL_INSTALL)
- @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
- list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \
- fi; \
- for file in $$list; do \
- case $$file in \
- $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
- esac; \
- if test -f $$file; then d=.; else d=$(srcdir); fi; \
- file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
- for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
- $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
- if test -f $$ifile; then \
- echo "$$ifile"; \
- else : ; fi; \
- done; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done
- @$(POST_INSTALL)
- @if $(am__can_run_installinfo); then \
- list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
- for file in $$list; do \
- relfile=`echo "$$file" | sed 's|^.*/||'`; \
- echo " install-info --info-dir='$(DESTDIR)$(infodir)'
'$(DESTDIR)$(infodir)/$$relfile'";\
- install-info --info-dir="$(DESTDIR)$(infodir)"
"$(DESTDIR)$(infodir)/$$relfile" || :;\
- done; \
- else : ; fi
+install-info-am:
+
install-man: install-man1
install-pdf: install-pdf-am
-install-pdf-am: $(PDFS)
- @$(NORMAL_INSTALL)
- @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done
+install-pdf-am:
+
install-ps: install-ps-am
-install-ps-am: $(PSS)
- @$(NORMAL_INSTALL)
- @list='$(PSS)'; test -n "$(psdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-1 \
- maintainer-clean-2 maintainer-clean-3 maintainer-clean-aminfo \
- maintainer-clean-generic maintainer-clean-vti
+maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-1 mostlyclean-2 mostlyclean-3 \
- mostlyclean-aminfo mostlyclean-generic mostlyclean-libtool \
- mostlyclean-vti
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
-pdf-am: $(PDFS)
+pdf-am:
ps: ps-am
-ps-am: $(PSS)
+ps-am:
-uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
- uninstall-man uninstall-pdf-am uninstall-ps-am
+uninstall-am: uninstall-man
uninstall-man: uninstall-man1
.MAKE: install-am install-strip
-.PHONY: all all-am check check-am clean clean-aminfo clean-generic \
- clean-libtool clean-local cscopelist-am ctags-am dist-info \
- distclean distclean-generic distclean-libtool distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-man1 \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-1 maintainer-clean-2 \
- maintainer-clean-3 maintainer-clean-aminfo \
- maintainer-clean-generic maintainer-clean-vti mostlyclean \
- mostlyclean-1 mostlyclean-2 mostlyclean-3 mostlyclean-aminfo \
- mostlyclean-generic mostlyclean-libtool mostlyclean-vti pdf \
- pdf-am ps ps-am tags-am uninstall uninstall-am \
- uninstall-dvi-am uninstall-html-am uninstall-info-am \
- uninstall-man uninstall-man1 uninstall-pdf-am uninstall-ps-am
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ cscopelist-am ctags-am distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-man1 install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags-am uninstall uninstall-am uninstall-man \
+ uninstall-man1
.PRECIOUS: Makefile
-all: manual.pdf manual.html
-
-manual.pdf: arch.pdf manual.texi
-manual.html: arch.png manual.texi
-
-%.png: %.dot
- dot -Tpng $< > $@
-%.pdf: %.dot
- dot -Tpdf $< > $@
-
-clean-local:
- -rm -f arch.png arch.pdf arch-api.png arch-api.pdf
-
-merchant-api-curl.pdf: merchant-api.content.texi arch-api.pdf
-merchant-api-python.pdf: merchant-api.content.texi arch-api.pdf
-merchant-api-curl.html: merchant-api.content.texi arch-api.png
-merchant-api-python.html: merchant-api.content.texi arch-api.png
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/src/backup-db/plugin_anastasis_postgres.c
b/src/backup-db/plugin_anastasis_postgres.c
index 6d2d585..d53e758 100644
--- a/src/backup-db/plugin_anastasis_postgres.c
+++ b/src/backup-db/plugin_anastasis_postgres.c
@@ -26,7 +26,7 @@
#include <taler/taler_util.h>
#include <taler/taler_pq_lib.h>
#include <taler/taler_json_lib.h>
-#include "taler_merchantdb_plugin.h"
+#include "anastasis_database_plugin.h"
/**
* How often do we re-try if we run into a DB serialization error?
@@ -44,7 +44,7 @@ struct PostgresClosure
/**
* Postgres connection handle.
*/
- PGconn *conn;
+ struct GNUNET_PQ_Context *conn;
/**
* Underlying configuration.
@@ -79,53 +79,6 @@ postgres_drop_tables (void *cls)
}
-/**
- * Initialize merchant tables
- *
- * @param cls closure our `struct Plugin`
- * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
- */
-static int
-postgres_initialize (void *cls)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_ExecuteStatement es[] = {
- /* Orders created by the frontend, not signed or given a nonce yet.
- The contract terms will change (nonce will be added) when moved to the
- contract terms table */
- GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS anastasis_foo ("
- "order_id VARCHAR NOT NULL"
- ",PRIMARY KEY (order_id)"
- ");"),
- GNUNET_PQ_EXECUTE_STATEMENT_END
- };
- struct GNUNET_PQ_PreparedStatement ps[] = {
- GNUNET_PQ_make_prepare ("insert_foo",
- "INSERT INTO anastasis_foo"
- "(order_id) VALUES "
- "($1)",
- 1),
- GNUNET_PQ_PREPARED_STATEMENT_END
- };
-
- if (GNUNET_OK !=
- GNUNET_PQ_exec_statements (pg->conn,
- es))
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- if (GNUNET_OK !=
- GNUNET_PQ_prepare_statements (pg->conn,
- ps))
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- return GNUNET_OK;
-}
-
-
/**
* Check that the database connection is still up.
*
@@ -134,14 +87,7 @@ postgres_initialize (void *cls)
static void
check_connection (struct PostgresClosure *pg)
{
- if (CONNECTION_BAD != PQstatus (pg->conn))
- return;
- PQfinish (pg->conn);
- pg->conn = GNUNET_PQ_connect_with_cfg (pg->cfg,
- "merchantdb-postgres");
- GNUNET_break (NULL != pg->conn);
- GNUNET_break (GNUNET_OK ==
- postgres_initialize (pg));
+ GNUNET_PQ_reconnect_if_down (pg->conn);
}
@@ -156,15 +102,16 @@ static void
postgres_preflight (void *cls)
{
struct PostgresClosure *pg = cls;
- PGresult *result;
- ExecStatusType status;
+ struct GNUNET_PQ_ExecuteStatement es[] = {
+ GNUNET_PQ_make_execute ("COMMIT"),
+ GNUNET_PQ_EXECUTE_STATEMENT_END
+ };
if (NULL == pg->transaction_name)
return; /* all good */
- result = PQexec (pg->conn,
- "COMMIT");
- status = PQresultStatus (result);
- if (PGRES_COMMAND_OK == status)
+ if (GNUNET_OK ==
+ GNUNET_PQ_exec_statements (pg->conn,
+ es))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"BUG: Preflight check committed transaction `%s'!\n",
@@ -177,7 +124,6 @@ postgres_preflight (void *cls)
pg->transaction_name);
}
pg->transaction_name = NULL;
- PQclear (result);
}
@@ -194,26 +140,23 @@ postgres_start (void *cls,
const char *name)
{
struct PostgresClosure *pg = cls;
- PGresult *result;
- ExecStatusType ex;
+ struct GNUNET_PQ_ExecuteStatement es[] = {
+ GNUNET_PQ_make_execute ("START TRANSACTION ISOLATION LEVEL SERIALIZABLE"),
+ GNUNET_PQ_EXECUTE_STATEMENT_END
+ };
check_connection (pg);
postgres_preflight (pg);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting merchant DB transaction\n");
- result = PQexec (pg->conn,
- "START TRANSACTION ISOLATION LEVEL SERIALIZABLE");
- if (PGRES_COMMAND_OK !=
- (ex = PQresultStatus (result)))
+ if (GNUNET_OK !=
+ GNUNET_PQ_exec_statements (pg->conn,
+ es))
{
- TALER_LOG_ERROR ("Failed to start transaction (%s): %s\n",
- PQresStatus (ex),
- PQerrorMessage (pg->conn));
+ TALER_LOG_ERROR ("Failed to start transaction\n");
GNUNET_break (0);
- PQclear (result);
return GNUNET_SYSERR;
}
- PQclear (result);
pg->transaction_name = name;
return GNUNET_OK;
}
@@ -229,15 +172,16 @@ static void
postgres_rollback (void *cls)
{
struct PostgresClosure *pg = cls;
- PGresult *result;
+ struct GNUNET_PQ_ExecuteStatement es[] = {
+ GNUNET_PQ_make_execute ("ROLLBACK"),
+ GNUNET_PQ_EXECUTE_STATEMENT_END
+ };
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Rolling back merchant DB transaction\n");
- result = PQexec (pg->conn,
- "ROLLBACK");
- GNUNET_break (PGRES_COMMAND_OK ==
- PQresultStatus (result));
- PQclear (result);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_PQ_exec_statements (pg->conn,
+ es));
pg->transaction_name = NULL;
}
@@ -277,8 +221,10 @@ postgres_commit (void *cls)
static enum GNUNET_DB_QueryStatus
postgres_find_contract_terms_from_hash (void *cls,
json_t **contract_terms,
- const struct GNUNET_HashCode
*h_contract_terms,
- const struct TALER_MerchantPublicKeyP
*merchant_pub)
+ const struct
+ GNUNET_HashCode *h_contract_terms,
+ const struct
+ TALER_MerchantPublicKeyP *merchant_pub)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -300,127 +246,6 @@ postgres_find_contract_terms_from_hash (void *cls,
}
-/**
- * Retrieve proposal data given its proposal data's hashcode
- *
- * @param cls closure
- * @param contract_terms where to store the retrieved proposal data
- * @param h_contract_terms proposal data's hashcode that will be used to
- * perform the lookup
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_find_paid_contract_terms_from_hash (void *cls,
- json_t **contract_terms,
- const struct GNUNET_HashCode
*h_contract_terms,
- const struct
TALER_MerchantPublicKeyP *merchant_pub)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
- GNUNET_PQ_query_param_auto_from_type (merchant_pub),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_json ("contract_terms",
- contract_terms),
- GNUNET_PQ_result_spec_end
- };
-
- /* no preflight check here, runs in its own transaction from
- caller (in /pay case) */
- check_connection (pg);
- return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-
"find_paid_contract_terms_from_hash",
- params,
- rs);
-}
-
-
-/**
- * Retrieve proposal data given its order id. Ignores if the
- * proposal has been paid or not.
- *
- * @param cls closure
- * @param[out] contract_terms where to store the retrieved contract terms
- * @param[out] last_session_id where to store the result
- * @param order id order id used to perform the lookup
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_find_contract_terms (void *cls,
- json_t **contract_terms,
- char **last_session_id,
- const char *order_id,
- const struct TALER_MerchantPublicKeyP
*merchant_pub)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_string (order_id),
- GNUNET_PQ_query_param_auto_from_type (merchant_pub),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_json ("contract_terms",
- contract_terms),
- GNUNET_PQ_result_spec_string ("last_session_id",
- last_session_id),
- GNUNET_PQ_result_spec_end
- };
-
- *contract_terms = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Finding contract term, order_id: '%s', merchant_pub: '%s'.\n",
- order_id,
- TALER_B2S (merchant_pub));
- check_connection (pg);
- return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "find_contract_terms",
- params,
- rs);
-}
-
-
-/**
- * Retrieve order given its order id and the instance's merchant public key.
- *
- * @param cls closure
- * @param[out] contract_terms where to store the retrieved contract terms
- * @param order id order id used to perform the lookup
- * @param merchant_pub merchant public key that identifies the instance
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_find_order (void *cls,
- json_t **contract_terms,
- const char *order_id,
- const struct TALER_MerchantPublicKeyP *merchant_pub)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_string (order_id),
- GNUNET_PQ_query_param_auto_from_type (merchant_pub),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_json ("contract_terms",
- contract_terms),
- GNUNET_PQ_result_spec_end
- };
-
- *contract_terms = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Finding contract term, order_id: '%s', merchant_pub: '%s'.\n",
- order_id,
- TALER_B2S (merchant_pub));
- check_connection (pg);
- return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "find_order",
- params,
- rs);
-}
-
-
/**
* Insert proposal data and its hashcode into db
*
@@ -433,10 +258,11 @@ postgres_find_order (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_insert_contract_terms (void *cls,
- const char *order_id,
- const struct TALER_MerchantPublicKeyP
*merchant_pub,
- struct GNUNET_TIME_Absolute timestamp,
- const json_t *contract_terms)
+ const char *order_id,
+ const struct
+ TALER_MerchantPublicKeyP *merchant_pub,
+ struct GNUNET_TIME_Absolute timestamp,
+ const json_t *contract_terms)
{
struct PostgresClosure *pg = cls;
struct GNUNET_HashCode h_contract_terms;
@@ -451,7 +277,7 @@ postgres_insert_contract_terms (void *cls,
if (GNUNET_OK !=
TALER_JSON_hash (contract_terms,
- &h_contract_terms))
+ &h_contract_terms))
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -469,333 +295,81 @@ postgres_insert_contract_terms (void *cls,
/**
- * Insert order into the DB.
- *
- * @param cls closure
- * @param order_id identificator of the proposal being stored
- * @param merchant_pub merchant's public key
- * @param timestamp timestamp of this proposal data
- * @param contract_terms proposal data to store
- * @return transaction status
+ * Closure for #find_contracts_cb().
*/
-static enum GNUNET_DB_QueryStatus
-postgres_insert_order (void *cls,
- const char *order_id,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- struct GNUNET_TIME_Absolute timestamp,
- const json_t *contract_terms)
+struct FindContractsContext
{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_string (order_id),
- GNUNET_PQ_query_param_auto_from_type (merchant_pub),
- GNUNET_PQ_query_param_absolute_time (×tamp),
- TALER_PQ_query_param_json (contract_terms),
- GNUNET_PQ_query_param_end
- };
+ /**
+ * Function to call on each result.
+ */
+ TALER_MERCHANTDB_ProposalDataCallback cb;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "inserting order: order_id: %s, merchant_pub: %s.\n",
- order_id,
- TALER_B2S (merchant_pub));
- check_connection (pg);
- return GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "insert_order",
- params);
-}
+ /**
+ * Closure for @e cb.
+ */
+ void *cb_cls;
+
+ /**
+ * Transaction status code to set.
+ */
+ enum GNUNET_DB_QueryStatus qs;
+};
/**
- * Mark contract terms as payed. Needed by /history as only payed
- * contracts must be shown.
- *
- * NOTE: we can't get the list of (payed) contracts from the
- * transactions table because it lacks contract_terms plain JSON. In
- * facts, the protocol doesn't allow to store contract_terms in
- * transactions table, as /pay handler doesn't receive this data (only
- * /proposal does).
+ * Function to be called with the results of a SELECT statement
+ * that has returned @a num_results results.
*
- * @param cls closure
- * @param h_contract_terms hash of the contract that is now paid
- * @param merchant_pub merchant's public key
- * @param last_session_id session id used for the payment, NULL
- * if payment was not session-bound
- * @return transaction status
+ * @param cls of type `struct FindContractsContext *`
+ * @param result the postgres result
+ * @param num_result the number of results in @a result
*/
-static enum GNUNET_DB_QueryStatus
-postgres_mark_proposal_paid (void *cls,
- const struct GNUNET_HashCode *h_contract_terms,
- const struct TALER_MerchantPublicKeyP
*merchant_pub,
- const char *last_session_id)
+static void
+find_contracts_cb (void *cls,
+ PGresult *result,
+ unsigned int num_results)
{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
- GNUNET_PQ_query_param_auto_from_type (merchant_pub),
- GNUNET_PQ_query_param_string ((last_session_id == NULL) ? "" :
last_session_id),
- GNUNET_PQ_query_param_end
- };
+ struct FindContractsContext *fcctx = cls;
- TALER_LOG_DEBUG ("Marking proposal paid, h_contract_terms: '%s',"
- " merchant_pub: '%s'\n",
- GNUNET_h2s (h_contract_terms),
- TALER_B2S (merchant_pub));
- return GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "mark_proposal_paid",
- params);
+ for (unsigned int i = 0; i < num_results; i++)
+ {
+ char *order_id;
+ json_t *contract_terms;
+ uint64_t row_id;
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ GNUNET_PQ_result_spec_string ("order_id",
+ &order_id),
+ TALER_PQ_result_spec_json ("contract_terms",
+ &contract_terms),
+ GNUNET_PQ_result_spec_uint64 ("row_id",
+ &row_id),
+ GNUNET_PQ_result_spec_end
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_PQ_extract_result (result,
+ rs,
+ i))
+ {
+ GNUNET_break (0);
+ fcctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ return;
+ }
+ fcctx->qs = i + 1;
+ fcctx->cb (fcctx->cb_cls,
+ order_id,
+ row_id,
+ contract_terms);
+ GNUNET_PQ_cleanup_result (rs);
+ }
}
/**
- * Insert payment confirmation from the exchange into the database.
- *
- * @param cls closure
- * @param order_id identificator of the proposal associated with this revenue
- * @param merchant_pub merchant's public key
- * @param coin_pub public key of the coin
- * @param amount_with_fee amount the exchange will deposit for this coin
- * @param deposit_fee fee the exchange will charge for this coin
- * @param refund_fee fee the exchange will charge for refunding this coin
- * @param wire_fee wire fee changed by the exchange
- * @param signkey_pub public key used by the exchange for @a exchange_proof
- * @param exchange_proof proof from exchange that coin was accepted
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_store_deposit (void *cls,
- const struct GNUNET_HashCode *h_contract_terms,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const char *exchange_url,
- const struct TALER_Amount *amount_with_fee,
- const struct TALER_Amount *deposit_fee,
- const struct TALER_Amount *refund_fee,
- const struct TALER_Amount *wire_fee,
- const struct TALER_ExchangePublicKeyP *signkey_pub,
- const json_t *exchange_proof)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
- GNUNET_PQ_query_param_auto_from_type (merchant_pub),
- GNUNET_PQ_query_param_auto_from_type (coin_pub),
- GNUNET_PQ_query_param_string (exchange_url),
- TALER_PQ_query_param_amount (amount_with_fee),
- TALER_PQ_query_param_amount (deposit_fee),
- TALER_PQ_query_param_amount (refund_fee),
- TALER_PQ_query_param_amount (wire_fee),
- GNUNET_PQ_query_param_auto_from_type (signkey_pub),
- TALER_PQ_query_param_json (exchange_proof),
- GNUNET_PQ_query_param_end
- };
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Storing payment for h_contract_terms `%s', coin_pub: `%s',
amount_with_fee: %s\n",
- GNUNET_h2s (h_contract_terms),
- TALER_B2S (coin_pub),
- TALER_amount2s (amount_with_fee));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Merchant pub is `%s'\n",
- TALER_B2S (merchant_pub));
- check_connection (pg);
- return GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "insert_deposit",
- params);
-}
-
-
-/**
- * Insert mapping of @a coin_pub and @a h_contract_terms to
- * corresponding @a wtid.
- *
- * @param cls closure
- * @param h_contract_terms hashcode of the proposal data paid by @a coin_pub
- * @param coin_pub public key of the coin
- * @param wtid identifier of the wire transfer in which the exchange
- * send us the money for the coin deposit
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_store_coin_to_transfer (void *cls,
- const struct GNUNET_HashCode
*h_contract_terms,
- const struct TALER_CoinSpendPublicKeyP
*coin_pub,
- const struct TALER_WireTransferIdentifierRawP
*wtid)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
- GNUNET_PQ_query_param_auto_from_type (coin_pub),
- GNUNET_PQ_query_param_auto_from_type (wtid),
- GNUNET_PQ_query_param_end
- };
-
- check_connection (pg);
- return GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "insert_transfer",
- params);
-}
-
-
-/**
- * Insert wire transfer confirmation from the exchange into the database.
- *
- * @param cls closure
- * @param exchange_url URL of the exchange
- * @param wtid identifier of the wire transfer
- * @param execution_time when was @a wtid executed
- * @param signkey_pub public key used by the exchange for @a exchange_proof
- * @param exchange_proof proof from exchange about what the deposit was for
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_store_transfer_to_proof (void *cls,
- const char *exchange_url,
- const struct
TALER_WireTransferIdentifierRawP *wtid,
- struct GNUNET_TIME_Absolute execution_time,
- const struct TALER_ExchangePublicKeyP
*signkey_pub,
- const json_t *exchange_proof)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_string (exchange_url),
- GNUNET_PQ_query_param_auto_from_type (wtid),
- GNUNET_PQ_query_param_absolute_time (&execution_time),
- GNUNET_PQ_query_param_auto_from_type (signkey_pub),
- TALER_PQ_query_param_json (exchange_proof),
- GNUNET_PQ_query_param_end
- };
-
- check_connection (pg);
- return GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "insert_proof",
- params);
-}
-
-
-/**
- * Lookup for a proposal, respecting the signature used by the
- * /history's db methods.
- *
- * @param cls db plugin handle
- * @param order_id order id used to search for the proposal data
- * @param merchant_pub public key of the merchant using this method
- * @param cb the callback
- * @param cb_cls closure to pass to the callback
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_find_contract_terms_history (void *cls,
- const char *order_id,
- const struct TALER_MerchantPublicKeyP
*merchant_pub,
- TALER_MERCHANTDB_ProposalDataCallback cb,
- void *cb_cls)
-{
- struct PostgresClosure *pg = cls;
- json_t *contract_terms;
- enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_string (order_id),
- GNUNET_PQ_query_param_auto_from_type (merchant_pub),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_json ("contract_terms",
- &contract_terms),
- GNUNET_PQ_result_spec_end
- };
-
- qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "find_contract_terms_history",
- params,
- rs);
- if (qs <= 0)
- return qs;
- if (NULL != cb)
- cb (cb_cls,
- order_id,
- 0,
- contract_terms);
- GNUNET_PQ_cleanup_result (rs);
- return qs;
-}
-
-
-/**
- * Closure for #find_contracts_cb().
- */
-struct FindContractsContext
-{
- /**
- * Function to call on each result.
- */
- TALER_MERCHANTDB_ProposalDataCallback cb;
-
- /**
- * Closure for @e cb.
- */
- void *cb_cls;
-
- /**
- * Transaction status code to set.
- */
- enum GNUNET_DB_QueryStatus qs;
-};
-
-
-/**
- * Function to be called with the results of a SELECT statement
- * that has returned @a num_results results.
- *
- * @param cls of type `struct FindContractsContext *`
- * @param result the postgres result
- * @param num_result the number of results in @a result
- */
-static void
-find_contracts_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
-{
- struct FindContractsContext *fcctx = cls;
-
- for (unsigned int i = 0; i < num_results; i++)
- {
- char *order_id;
- json_t *contract_terms;
- uint64_t row_id;
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_string ("order_id",
- &order_id),
- TALER_PQ_result_spec_json ("contract_terms",
- &contract_terms),
- GNUNET_PQ_result_spec_uint64 ("row_id",
- &row_id),
- GNUNET_PQ_result_spec_end
- };
-
- if (GNUNET_OK !=
- GNUNET_PQ_extract_result (result,
- rs,
- i))
- {
- GNUNET_break (0);
- fcctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
- fcctx->qs = i + 1;
- fcctx->cb (fcctx->cb_cls,
- order_id,
- row_id,
- contract_terms);
- GNUNET_PQ_cleanup_result (rs);
- }
-}
-
-
-/**
- * Return proposals whose timestamp are older than `date`.
- * Among those proposals, only those ones being between the
- * start-th and (start-nrows)-th record are returned. The rows
- * are sorted having the youngest first.
+ * Return proposals whose timestamp are older than `date`.
+ * Among those proposals, only those ones being between the
+ * start-th and (start-nrows)-th record are returned. The rows
+ * are sorted having the youngest first.
*
* @param cls our plugin handle.
* @param date only results older than this date are returned.
@@ -819,13 +393,17 @@ find_contracts_cb (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_find_contract_terms_by_date_and_range (void *cls,
- struct GNUNET_TIME_Absolute
date,
- const struct
TALER_MerchantPublicKeyP *merchant_pub,
+ struct GNUNET_TIME_Absolute
+ date,
+ const struct
+ TALER_MerchantPublicKeyP *
+ merchant_pub,
uint64_t start,
uint64_t nrows,
int past,
unsigned int ascending,
-
TALER_MERCHANTDB_ProposalDataCallback cb,
+
TALER_MERCHANTDB_ProposalDataCallback
+ cb,
void *cb_cls)
{
struct PostgresClosure *pg = cls;
@@ -850,10 +428,10 @@ postgres_find_contract_terms_by_date_and_range (void *cls,
(GNUNET_YES == past)
? ( (GNUNET_YES == ascending)
? "find_contract_terms_by_date_and_range_past_asc"
- : "find_contract_terms_by_date_and_range_past" )
+ : "find_contract_terms_by_date_and_range_past")
: ( (GNUNET_YES == ascending)
? "find_contract_terms_by_date_and_range_asc"
- : "find_contract_terms_by_date_and_range" );
+ : "find_contract_terms_by_date_and_range");
check_connection (pg);
qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
stmt,
@@ -867,1858 +445,43 @@ postgres_find_contract_terms_by_date_and_range (void
*cls,
/**
- * Closure for #find_tip_authorizations_cb().
- */
-struct GetAuthorizedTipAmountContext
-{
- /**
- * Total authorized amount.
- */
- struct TALER_Amount authorized_amount;
-
- /**
- * Transaction status code to set.
- */
- enum GNUNET_DB_QueryStatus qs;
-
-};
-
-
-/**
- * Function to be called with the results of a SELECT statement
- * that has returned @a num_results results.
- *
- * @param cls of type `struct GetAuthorizedTipAmountContext *`
- * @param result the postgres result
- * @param num_result the number of results in @a result
- */
-static void
-find_tip_authorizations_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
-{
- struct GetAuthorizedTipAmountContext *ctx = cls;
- unsigned int i;
-
- for (i = 0; i < num_results; i++)
- {
- struct TALER_Amount amount;
- char *just;
- struct GNUNET_HashCode h;
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_string ("justification",
- &just),
- GNUNET_PQ_result_spec_auto_from_type ("tip_id",
- &h),
- TALER_PQ_result_spec_amount ("amount",
- &amount),
- GNUNET_PQ_result_spec_end
- };
-
- if (GNUNET_OK !=
- GNUNET_PQ_extract_result (result,
- rs,
- i))
- {
- GNUNET_break (0);
- ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
-
- if (0 == i)
- {
- ctx->authorized_amount = amount;
- }
- else
- {
- if (GNUNET_OK !=
- TALER_amount_add (&ctx->authorized_amount,
- &ctx->authorized_amount,
- &amount))
- {
- GNUNET_break (0);
- GNUNET_PQ_cleanup_result (rs);
- ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
- }
- GNUNET_PQ_cleanup_result (rs);
- }
-
- if (0 == i)
- {
- ctx->qs = GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
- }
- else
- {
- /* one aggregated result */
- ctx->qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
- }
-}
-
-
-/**
- * Get the total amount of authorized tips for a tipping reserve.
+ * Initialize Postgres database subsystem.
*
- * @param cls closure, typically a connection to the db
- * @param reserve_priv which reserve to check
- * @param[out] authorzed_amount amount we've authorized so far for tips
- * @return transaction status, usually
- * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success
- * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the reserve_priv
- * does not identify a known tipping reserve
+ * @param cls a configuration instance
+ * @return NULL on error, otherwise a `struct TALER_MERCHANTDB_Plugin`
*/
-static enum GNUNET_DB_QueryStatus
-postgres_get_authorized_tip_amount (void *cls,
- const struct TALER_ReservePrivateKeyP
*reserve_priv,
- struct TALER_Amount *authorized_amount)
+void *
+libtaler_plugin_merchantdb_postgres_init (void *cls)
{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (reserve_priv),
- GNUNET_PQ_query_param_end
+ struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+ struct PostgresClosure *pg;
+ struct TALER_MERCHANTDB_Plugin *plugin;
+ const char *ec;
+ struct GNUNET_PQ_ExecuteStatement es[] = {
+ /* Orders created by the frontend, not signed or given a nonce yet.
+ The contract terms will change (nonce will be added) when moved to the
+ contract terms table */
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS anastasis_foo ("
+ "order_id VARCHAR NOT NULL"
+ ",PRIMARY KEY (order_id)"
+ ");"),
+ GNUNET_PQ_EXECUTE_STATEMENT_END
};
- enum GNUNET_DB_QueryStatus qs;
- struct GetAuthorizedTipAmountContext ctx = { 0 };
-
- check_connection (pg);
- qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
- "find_tip_authorizations",
- params,
- &find_tip_authorizations_cb,
- &ctx);
- if (0 >= qs)
- return qs;
- *authorized_amount = ctx.authorized_amount;
- return ctx.qs;
-}
-
-
-/**
- * Return proposals whose timestamp are older than `date`.
- * The rows are sorted having the youngest first.
- *
- * @param cls our plugin handle.
- * @param date only results older than this date are returned.
- * @param merchant_pub instance's public key; only rows related to this
- * instance are returned.
- * @param nrows at most nrows rows are returned.
- * @param cb function to call with transaction data, can be NULL.
- * @param cb_cls closure for @a cb
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_find_contract_terms_by_date (void *cls,
- struct GNUNET_TIME_Absolute date,
- const struct TALER_MerchantPublicKeyP
*merchant_pub,
- uint64_t nrows,
- TALER_MERCHANTDB_ProposalDataCallback cb,
- void *cb_cls)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_absolute_time (&date),
- GNUNET_PQ_query_param_auto_from_type (merchant_pub),
- GNUNET_PQ_query_param_uint64 (&nrows),
- GNUNET_PQ_query_param_end
+ struct GNUNET_PQ_PreparedStatement ps[] = {
+ GNUNET_PQ_make_prepare ("insert_foo",
+ "INSERT INTO anastasis_foo"
+ "(order_id) VALUES "
+ "($1)",
+ 1),
+ GNUNET_PQ_PREPARED_STATEMENT_END
};
- enum GNUNET_DB_QueryStatus qs;
- struct FindContractsContext fcctx = {
- .cb = cb,
- .cb_cls = cb_cls
- };
-
- check_connection (pg);
- qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
- "find_contract_terms_by_date",
- params,
- &find_contracts_cb,
- &fcctx);
- if (0 >= qs)
- return qs;
- return fcctx.qs;
-}
-
-
-/**
- * Closure for #find_payments_cb().
- */
-struct FindPaymentsContext
-{
- /**
- * Function to call with results.
- */
- TALER_MERCHANTDB_CoinDepositCallback cb;
-
- /**
- * Closure for @e cls.
- */
- void *cb_cls;
-
- /**
- * Contract term hash used for the search.
- */
- const struct GNUNET_HashCode *h_contract_terms;
-
- /**
- * Transaction status (set).
- */
- enum GNUNET_DB_QueryStatus qs;
-};
-
-
-/**
- * Function to be called with the results of a SELECT statement
- * that has returned @a num_results results.
- *
- * @param cls of type `struct FindPaymentsContext *`
- * @param result the postgres result
- * @param num_result the number of results in @a result
- */
-static void
-find_payments_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
-{
- struct FindPaymentsContext *fpc = cls;
-
- for (unsigned int i=0;i<num_results;i++)
- {
- struct TALER_CoinSpendPublicKeyP coin_pub;
- struct TALER_Amount amount_with_fee;
- struct TALER_Amount deposit_fee;
- struct TALER_Amount refund_fee;
- struct TALER_Amount wire_fee;
- json_t *exchange_proof;
- char *exchange_url;
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
- &coin_pub),
- GNUNET_PQ_result_spec_string ("exchange_url",
- &exchange_url),
- TALER_PQ_result_spec_amount ("amount_with_fee",
- &amount_with_fee),
- TALER_PQ_result_spec_amount ("deposit_fee",
- &deposit_fee),
- TALER_PQ_result_spec_amount ("refund_fee",
- &refund_fee),
- TALER_PQ_result_spec_amount ("wire_fee",
- &wire_fee),
- TALER_PQ_result_spec_json ("exchange_proof",
- &exchange_proof),
- GNUNET_PQ_result_spec_end
- };
-
- if (GNUNET_OK !=
- GNUNET_PQ_extract_result (result,
- rs,
- i))
- {
- GNUNET_break (0);
- fpc->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
- fpc->qs = i + 1;
- fpc->cb (fpc->cb_cls,
- fpc->h_contract_terms,
- &coin_pub,
- exchange_url,
- &amount_with_fee,
- &deposit_fee,
- &refund_fee,
- &wire_fee,
- exchange_proof);
- GNUNET_PQ_cleanup_result (rs);
- }
-}
-
-
-/**
- * Lookup information about coin payments by proposal data hash
- * (and @a merchant_pub)
- *
- * @param cls closure
- * @param h_contract_terms key for the search
- * @param merchant_pub merchant's public key
- * @param cb function to call with payment data
- * @param cb_cls closure for @a cb
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_find_payments (void *cls,
- const struct GNUNET_HashCode *h_contract_terms,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- TALER_MERCHANTDB_CoinDepositCallback cb,
- void *cb_cls)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
- GNUNET_PQ_query_param_auto_from_type (merchant_pub),
- GNUNET_PQ_query_param_end
- };
- struct FindPaymentsContext fpc = {
- .h_contract_terms = h_contract_terms,
- .cb = cb,
- .cb_cls = cb_cls
- };
- enum GNUNET_DB_QueryStatus qs;
-
- /* no preflight check here, run in its own transaction by the
- caller! */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Finding payment for h_contract_terms '%s'\n",
- GNUNET_h2s (h_contract_terms));
- check_connection (pg);
- qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
- "find_deposits",
- params,
- &find_payments_cb,
- &fpc);
- if (qs <= 0)
- return qs;
- return fpc.qs;
-}
-
-
-/**
- * Closure for #find_payments_by_coin_cb().
- */
-struct FindPaymentsByCoinContext
-{
- /**
- * Function to call with results.
- */
- TALER_MERCHANTDB_CoinDepositCallback cb;
-
- /**
- * Closure for @e cls.
- */
- void *cb_cls;
-
- /**
- * Coin we are looking for.
- */
- const struct TALER_CoinSpendPublicKeyP *coin_pub;
-
- /**
- * Hash of the contract we are looking for.
- */
- const struct GNUNET_HashCode *h_contract_terms;
-
- /**
- * Transaction status (set).
- */
- enum GNUNET_DB_QueryStatus qs;
-};
-
-
-/**
- * Function to be called with the results of a SELECT statement
- * that has returned @a num_results results.
- *
- * @param cls of type `struct FindPaymentsByCoinContext *`
- * @param result the postgres result
- * @param num_result the number of results in @a result
- */
-static void
-find_payments_by_coin_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
-{
- struct FindPaymentsByCoinContext *fpc = cls;
-
- for (unsigned int i=0;i<num_results;i++)
- {
- struct TALER_Amount amount_with_fee;
- struct TALER_Amount deposit_fee;
- struct TALER_Amount refund_fee;
- struct TALER_Amount wire_fee;
- char *exchange_url;
- json_t *exchange_proof;
- struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_amount ("amount_with_fee",
- &amount_with_fee),
- TALER_PQ_result_spec_amount ("deposit_fee",
- &deposit_fee),
- TALER_PQ_result_spec_amount ("refund_fee",
- &refund_fee),
- TALER_PQ_result_spec_amount ("wire_fee",
- &wire_fee),
- GNUNET_PQ_result_spec_string ("exchange_url",
- &exchange_url),
- TALER_PQ_result_spec_json ("exchange_proof",
- &exchange_proof),
- GNUNET_PQ_result_spec_end
- };
-
- if (GNUNET_OK !=
- GNUNET_PQ_extract_result (result,
- rs,
- i))
- {
- GNUNET_break (0);
- fpc->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
- fpc->qs = i + 1;
- fpc->cb (fpc->cb_cls,
- fpc->h_contract_terms,
- fpc->coin_pub,
- exchange_url,
- &amount_with_fee,
- &deposit_fee,
- &refund_fee,
- &wire_fee,
- exchange_proof);
- GNUNET_PQ_cleanup_result (rs);
- }
-}
-
-
-/**
- * Retrieve information about a deposited coin.
- *
- * @param cls closure
- * @param h_contract_terms hashcode of the proposal data paid by @a coin_pub
- * @param merchant_pub merchant's public key.
- * @param coin_pub coin's public key used for the search
- * @param cb function to call with payment data
- * @param cb_cls closure for @a cb
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_find_payments_by_hash_and_coin (void *cls,
- const struct GNUNET_HashCode
*h_contract_terms,
- const struct TALER_MerchantPublicKeyP
*merchant_pub,
- const struct
TALER_CoinSpendPublicKeyP *coin_pub,
- TALER_MERCHANTDB_CoinDepositCallback
cb,
- void *cb_cls)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
- GNUNET_PQ_query_param_auto_from_type (merchant_pub),
- GNUNET_PQ_query_param_auto_from_type (coin_pub),
- GNUNET_PQ_query_param_end
- };
- struct FindPaymentsByCoinContext fpc = {
- .cb = cb,
- .cb_cls = cb_cls,
- .h_contract_terms = h_contract_terms,
- .coin_pub = coin_pub
- };
- enum GNUNET_DB_QueryStatus qs;
-
- check_connection (pg);
- qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
- "find_deposits_by_hash_and_coin",
- params,
- &find_payments_by_coin_cb,
- &fpc);
- if (0 >= qs)
- return qs;
- return fpc.qs;
-}
-
-
-/**
- * Closure for #find_transfers_cb().
- */
-struct FindTransfersContext
-{
- /**
- * Function to call on results.
- */
- TALER_MERCHANTDB_TransferCallback cb;
-
- /**
- * Closure for @e cb.
- */
- void *cb_cls;
-
- /**
- * Hash of the contract we are looking under.
- */
- const struct GNUNET_HashCode *h_contract_terms;
-
- /**
- * Transaction status (set).
- */
- enum GNUNET_DB_QueryStatus qs;
-};
-
-
-/**
- * Function to be called with the results of a SELECT statement
- * that has returned @a num_results results.
- *
- * @param cls of type `struct FindTransfersContext *`
- * @param result the postgres result
- * @param num_result the number of results in @a result
- */
-static void
-find_transfers_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
-{
- struct FindTransfersContext *ftc = cls;
-
- for (unsigned int i=0;i<PQntuples (result);i++)
- {
- struct TALER_CoinSpendPublicKeyP coin_pub;
- struct TALER_WireTransferIdentifierRawP wtid;
- struct GNUNET_TIME_Absolute execution_time;
- json_t *proof;
-
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
- &coin_pub),
- GNUNET_PQ_result_spec_auto_from_type ("wtid",
- &wtid),
- GNUNET_PQ_result_spec_absolute_time ("execution_time",
- &execution_time),
- TALER_PQ_result_spec_json ("proof",
- &proof),
- GNUNET_PQ_result_spec_end
- };
-
- if (GNUNET_OK !=
- GNUNET_PQ_extract_result (result,
- rs,
- i))
- {
- GNUNET_break (0);
- ftc->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
- ftc->qs = i + 1;
- ftc->cb (ftc->cb_cls,
- ftc->h_contract_terms,
- &coin_pub,
- &wtid,
- execution_time,
- proof);
- GNUNET_PQ_cleanup_result (rs);
- }
-}
-
-
-/**
- * Lookup information about a transfer by @a h_contract_terms. Note
- * that in theory there could be multiple wire transfers for a
- * single @a h_contract_terms, as the transaction may have involved
- * multiple coins and the coins may be spread over different wire
- * transfers.
- *
- * @param cls closure
- * @param h_contract_terms key for the search
- * @param cb function to call with transfer data
- * @param cb_cls closure for @a cb
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_find_transfers_by_hash (void *cls,
- const struct GNUNET_HashCode
*h_contract_terms,
- TALER_MERCHANTDB_TransferCallback cb,
- void *cb_cls)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
- GNUNET_PQ_query_param_end
- };
- struct FindTransfersContext ftc = {
- .h_contract_terms = h_contract_terms,
- .cb = cb,
- .cb_cls = cb_cls
- };
- enum GNUNET_DB_QueryStatus qs;
-
- check_connection (pg);
- qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
- "find_transfers_by_hash",
- params,
- &find_transfers_cb,
- &ftc);
- if (0 >= qs)
- return qs;
- return ftc.qs;
-}
-
-
-/**
- * Closure for #find_deposits_cb().
- */
-struct FindDepositsContext
-{
-
- /**
- * Function to call for each result.
- */
- TALER_MERCHANTDB_CoinDepositCallback cb;
-
- /**
- * Closure for @e cb.
- */
- void *cb_cls;
-
- /**
- * Transaction status (set).
- */
- enum GNUNET_DB_QueryStatus qs;
-};
-
-
-/**
- * Function to be called with the results of a SELECT statement
- * that has returned @a num_results results.
- *
- * @param cls of type `struct FindDepositsContext *`
- * @param result the postgres result
- * @param num_result the number of results in @a result
- */
-static void
-find_deposits_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
-{
- struct FindDepositsContext *fdc = cls;
-
- for (unsigned int i=0;i<PQntuples (result);i++)
- {
- struct GNUNET_HashCode h_contract_terms;
- struct TALER_CoinSpendPublicKeyP coin_pub;
- struct TALER_Amount amount_with_fee;
- struct TALER_Amount deposit_fee;
- struct TALER_Amount refund_fee;
- struct TALER_Amount wire_fee;
- char *exchange_url;
- json_t *exchange_proof;
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms",
- &h_contract_terms),
- GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
- &coin_pub),
- TALER_PQ_result_spec_amount ("amount_with_fee",
- &amount_with_fee),
- TALER_PQ_result_spec_amount ("deposit_fee",
- &deposit_fee),
- TALER_PQ_result_spec_amount ("refund_fee",
- &refund_fee),
- TALER_PQ_result_spec_amount ("wire_fee",
- &wire_fee),
- GNUNET_PQ_result_spec_string ("exchange_url",
- &exchange_url),
- TALER_PQ_result_spec_json ("exchange_proof",
- &exchange_proof),
- GNUNET_PQ_result_spec_end
- };
-
- if (GNUNET_OK !=
- GNUNET_PQ_extract_result (result,
- rs,
- i))
- {
- GNUNET_break (0);
- fdc->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
- fdc->qs = i + 1;
- fdc->cb (fdc->cb_cls,
- &h_contract_terms,
- &coin_pub,
- exchange_url,
- &amount_with_fee,
- &deposit_fee,
- &refund_fee,
- &wire_fee,
- exchange_proof);
- GNUNET_PQ_cleanup_result (rs);
- }
-}
-
-
-/**
- * Lookup information about a coin deposits by @a wtid.
- *
- * @param cls closure
- * @param wtid wire transfer identifier to find matching transactions for
- * @param cb function to call with payment data
- * @param cb_cls closure for @a cb
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_find_deposits_by_wtid (void *cls,
- const struct TALER_WireTransferIdentifierRawP
*wtid,
- TALER_MERCHANTDB_CoinDepositCallback cb,
- void *cb_cls)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (wtid),
- GNUNET_PQ_query_param_end
- };
- struct FindDepositsContext fdc = {
- .cb = cb,
- .cb_cls = cb_cls
- };
- enum GNUNET_DB_QueryStatus qs;
-
- check_connection (pg);
- qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
- "find_deposits_by_wtid",
- params,
- &find_deposits_cb,
- &fdc);
- if (0 >= qs)
- return qs;
- return fdc.qs;
-}
-
-
-/**
- * Closure for #get_refunds_cb().
- */
-struct GetRefundsContext
-{
- /**
- * Function to call for each refund.
- */
- TALER_MERCHANTDB_RefundCallback rc;
-
- /**
- * Closure for @e rc.
- */
- void *rc_cls;
-
- /**
- * Transaction result.
- */
- enum GNUNET_DB_QueryStatus qs;
-};
-
-
-/**
- * Function to be called with the results of a SELECT statement
- * that has returned @a num_results results.
- *
- * @param cls of type `struct GetRefundsContext *`
- * @param result the postgres result
- * @param num_result the number of results in @a result
- */
-static void
-get_refunds_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
-{
- struct GetRefundsContext *grc = cls;
-
- for (unsigned int i=0;i<num_results;i++)
- {
- struct TALER_CoinSpendPublicKeyP coin_pub;
- uint64_t rtransaction_id;
- struct TALER_Amount refund_amount;
- struct TALER_Amount refund_fee;
- char *reason;
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
- &coin_pub),
- GNUNET_PQ_result_spec_uint64 ("rtransaction_id",
- &rtransaction_id),
- TALER_PQ_result_spec_amount ("refund_amount",
- &refund_amount),
- TALER_PQ_result_spec_amount ("refund_fee",
- &refund_fee),
- GNUNET_PQ_result_spec_string ("reason",
- &reason),
- GNUNET_PQ_result_spec_end
- };
-
- if (GNUNET_OK !=
- GNUNET_PQ_extract_result (result,
- rs,
- i))
- {
- GNUNET_break (0);
- grc->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
- grc->qs = i + 1;
- grc->rc (grc->rc_cls,
- &coin_pub,
- rtransaction_id,
- reason,
- &refund_amount,
- &refund_fee);
- GNUNET_PQ_cleanup_result (rs);
- }
-}
-
-
-/**
- * Obtain refunds associated with a contract.
- *
- * @param cls closure, typically a connection to the db
- * @param merchant_pub public key of the merchant instance
- * @param h_contract_terms hash code of the contract
- * @param rc function to call for each coin on which there is a refund
- * @param rc_cls closure for @a rc
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_get_refunds_from_contract_terms_hash (void *cls,
- const struct
TALER_MerchantPublicKeyP *merchant_pub,
- const struct GNUNET_HashCode
*h_contract_terms,
- TALER_MERCHANTDB_RefundCallback
rc,
- void *rc_cls)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (merchant_pub),
- GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
- GNUNET_PQ_query_param_end
- };
- struct GetRefundsContext grc = {
- .rc = rc,
- .rc_cls = rc_cls
- };
- enum GNUNET_DB_QueryStatus qs;
-
- /* no preflight check here, run in transaction by caller! */
- TALER_LOG_DEBUG ("Looking for refund %s + %s\n",
- GNUNET_h2s (h_contract_terms),
- TALER_B2S (merchant_pub));
- check_connection (pg);
- qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
-
"find_refunds_from_contract_terms_hash",
- params,
- &get_refunds_cb,
- &grc);
- if (0 >= qs)
- return qs;
- return grc.qs;
-}
-
-
-/**
- * Insert a refund row into merchant_refunds. Not meant to be exported
- * in the db API.
- *
- * @param cls closure, tipically a connection to the db
- * @param merchant_pub merchant instance public key
- * @param h_contract_terms hashcode of the contract related to this refund
- * @param coin_pub public key of the coin giving the (part of) refund
- * @param reason human readable explaination behind the refund
- * @param refund how much this coin is refunding
- * @param refund_fee refund fee for this coin
- */
-static enum GNUNET_DB_QueryStatus
-insert_refund (void *cls,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct GNUNET_HashCode *h_contract_terms,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const char *reason,
- const struct TALER_Amount *refund,
- const struct TALER_Amount *refund_fee)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (merchant_pub),
- GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
- GNUNET_PQ_query_param_auto_from_type (coin_pub),
- GNUNET_PQ_query_param_string (reason),
- TALER_PQ_query_param_amount (refund),
- TALER_PQ_query_param_amount (refund_fee),
- GNUNET_PQ_query_param_end
- };
-
- TALER_LOG_DEBUG ("Inserting refund %s + %s\n",
- GNUNET_h2s (h_contract_terms),
- TALER_B2S (merchant_pub));
-
- check_connection (pg);
- return GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "insert_refund",
- params);
-}
-
-
-/**
- * Store information about wire fees charged by an exchange,
- * including signature (so we have proof).
- *
- * @param cls closure
- * @paramm exchange_pub public key of the exchange
- * @param h_wire_method hash of wire method
- * @param wire_fee wire fee charged
- * @param closing_fee closing fee charged (irrelevant for us,
- * but needed to check signature)
- * @param start_date start of fee being used
- * @param end_date end of fee being used
- * @param exchange_sig signature of exchange over fee structure
- * @return transaction status code
- */
-static enum GNUNET_DB_QueryStatus
-postgres_store_wire_fee_by_exchange (void *cls,
- const struct TALER_MasterPublicKeyP
*exchange_pub,
- const struct GNUNET_HashCode
*h_wire_method,
- const struct TALER_Amount *wire_fee,
- const struct TALER_Amount *closing_fee,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute end_date,
- const struct TALER_MasterSignatureP
*exchange_sig)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (exchange_pub),
- GNUNET_PQ_query_param_auto_from_type (h_wire_method),
- TALER_PQ_query_param_amount (wire_fee),
- TALER_PQ_query_param_amount (closing_fee),
- GNUNET_PQ_query_param_absolute_time (&start_date),
- GNUNET_PQ_query_param_absolute_time (&end_date),
- GNUNET_PQ_query_param_auto_from_type (exchange_sig),
- GNUNET_PQ_query_param_end
- };
-
- /* no preflight check here, run in its own transaction by the caller */
- check_connection (pg);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Storing wire fee for %s starting at %s of %s\n",
- TALER_B2S (exchange_pub),
- GNUNET_STRINGS_absolute_time_to_string (start_date),
- TALER_amount2s (wire_fee));
- return GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "insert_wire_fee",
- params);
-}
-
-
-/**
- * Obtain information about wire fees charged by an exchange,
- * including signature (so we have proof).
- *
- * @param cls closure
- * @param exchange_pub public key of the exchange
- * @param h_wire_method hash of wire method
- * @param contract_date date of the contract to use for the lookup
- * @param[out] wire_fee wire fee charged
- * @param[out] closing_fee closing fee charged (irrelevant for us,
- * but needed to check signature)
- * @param[out] start_date start of fee being used
- * @param[out] end_date end of fee being used
- * @param[out] exchange_sig signature of exchange over fee structure
- * @return transaction status code
- */
-static enum GNUNET_DB_QueryStatus
-postgres_lookup_wire_fee (void *cls,
- const struct TALER_MasterPublicKeyP *exchange_pub,
- const struct GNUNET_HashCode *h_wire_method,
- struct GNUNET_TIME_Absolute contract_date,
- struct TALER_Amount *wire_fee,
- struct TALER_Amount *closing_fee,
- struct GNUNET_TIME_Absolute *start_date,
- struct GNUNET_TIME_Absolute *end_date,
- struct TALER_MasterSignatureP *exchange_sig)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (exchange_pub),
- GNUNET_PQ_query_param_auto_from_type (h_wire_method),
- GNUNET_PQ_query_param_absolute_time (&contract_date),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_amount ("wire_fee",
- wire_fee),
- TALER_PQ_result_spec_amount ("closing_fee",
- closing_fee),
- GNUNET_PQ_result_spec_absolute_time ("start_date",
- start_date),
- GNUNET_PQ_result_spec_absolute_time ("end_date",
- end_date),
- GNUNET_PQ_result_spec_auto_from_type ("exchange_sig",
- exchange_sig),
- GNUNET_PQ_result_spec_end
- };
-
- check_connection (pg);
- return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "lookup_wire_fee",
- params,
- rs);
-}
-
-
-/**
- * Closure for #process_refund_cb.
- */
-struct FindRefundContext
-{
- /**
- * Updated to reflect total amount refunded so far.
- */
- struct TALER_Amount refunded_amount;
-
- /**
- * Set to #GNUNET_SYSERR on hard errors.
- */
- int err;
-};
-
-
-/**
- * Function to be called with the results of a SELECT statement
- * that has returned @a num_results results.
- *
- * @param cls closure, our `struct FindRefundContext`
- * @param result the postgres result
- * @param num_result the number of results in @a result
- */
-static void
-process_refund_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
-{
- struct FindRefundContext *ictx = cls;
-
- for (unsigned int i=0; i<num_results; i++)
- {
- /* Sum up existing refunds */
- struct TALER_Amount acc;
- struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_amount ("refund_amount",
- &acc),
- GNUNET_PQ_result_spec_end
- };
-
- if (GNUNET_OK !=
- GNUNET_PQ_extract_result (result,
- rs,
- i))
- {
- GNUNET_break (0);
- ictx->err = GNUNET_SYSERR;
- return;
- }
- if (GNUNET_SYSERR ==
- TALER_amount_add (&ictx->refunded_amount,
- &ictx->refunded_amount,
- &acc))
- {
- GNUNET_break (0);
- ictx->err = GNUNET_SYSERR;
- return;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Found refund of %s\n",
- TALER_amount2s (&acc));
- }
-}
-
-
-/**
- * Closure for #process_deposits_cb.
- */
-struct InsertRefundContext
-{
- /**
- * Used to provide a connection to the db
- */
- struct PostgresClosure *pg;
-
- /**
- * Amount to which increase the refund for this contract
- */
- const struct TALER_Amount *refund;
-
- /**
- * Merchant instance public key
- */
- const struct TALER_MerchantPublicKeyP *merchant_pub;
-
- /**
- * Hash code representing the contract
- */
- const struct GNUNET_HashCode *h_contract_terms;
-
- /**
- * Human-readable reason behind this refund
- */
- const char *reason;
-
- /**
- * Transaction status code.
- */
- enum GNUNET_DB_QueryStatus qs;
-};
-
-
-/**
- * Function to be called with the results of a SELECT statement
- * that has returned @a num_results results.
- *
- * @param cls closure, our `struct InsertRefundContext`
- * @param result the postgres result
- * @param num_result the number of results in @a result
- */
-static void
-process_deposits_for_refund_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
-{
- struct InsertRefundContext *ctx = cls;
- struct TALER_Amount current_refund;
- struct TALER_Amount deposit_refund[GNUNET_NZL(num_results)];
- struct TALER_CoinSpendPublicKeyP deposit_coin_pubs[GNUNET_NZL(num_results)];
- struct TALER_Amount deposit_amount_with_fee[GNUNET_NZL(num_results)];
- struct TALER_Amount deposit_refund_fee[GNUNET_NZL(num_results)];
-
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (ctx->refund->currency,
- ¤t_refund));
-
- /* Pass 1: Collect amount of existing refunds into current_refund.
- * Also store existing refunded amount for each deposit in deposit_refund. */
- for (unsigned int i=0; i<num_results; i++)
- {
- struct TALER_CoinSpendPublicKeyP coin_pub;
- struct TALER_Amount amount_with_fee;
- struct TALER_Amount refund_fee;
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
- &coin_pub),
- TALER_PQ_result_spec_amount ("amount_with_fee",
- &amount_with_fee),
- TALER_PQ_result_spec_amount ("refund_fee",
- &refund_fee),
- GNUNET_PQ_result_spec_end
- };
- struct FindRefundContext ictx;
- enum GNUNET_DB_QueryStatus ires;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (&coin_pub),
- GNUNET_PQ_query_param_end
- };
-
- if (GNUNET_OK !=
- GNUNET_PQ_extract_result (result,
- rs,
- i))
- {
- GNUNET_break (0);
- ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (ctx->refund->currency,
- &ictx.refunded_amount));
- ictx.err = GNUNET_OK; /* no error so far */
- ires = GNUNET_PQ_eval_prepared_multi_select (ctx->pg->conn,
- "find_refunds",
- params,
- &process_refund_cb,
- &ictx);
- if ( (GNUNET_OK != ictx.err) ||
- (GNUNET_DB_STATUS_HARD_ERROR == ires) )
- {
- GNUNET_break (0);
- ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
- if (GNUNET_DB_STATUS_SOFT_ERROR == ires)
- {
- ctx->qs = GNUNET_DB_STATUS_SOFT_ERROR;
- return;
- }
- deposit_refund[i] = ictx.refunded_amount;
- deposit_amount_with_fee[i] = amount_with_fee;
- deposit_coin_pubs[i] = coin_pub;
- deposit_refund_fee[i] = refund_fee;
- if (GNUNET_SYSERR ==
- TALER_amount_add (¤t_refund,
- ¤t_refund,
- &ictx.refunded_amount))
- {
- GNUNET_break (0);
- ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Existing refund for coin %s is %s\n",
- TALER_B2S (&coin_pub),
- TALER_amount2s (&ictx.refunded_amount));
- }
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Total existing refund is %s\n",
- TALER_amount2s (¤t_refund));
-
- /* stop immediately if we are 'done' === amount already
- * refunded. */
- if (0 >= TALER_amount_cmp (ctx->refund,
- ¤t_refund))
- {
- ctx->qs = GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
- return;
- }
-
- /* Phase 2: Try to increase current refund until it matches desired refund
*/
- for (unsigned int i=0;i<num_results; i++)
- {
- const struct TALER_Amount *increment;
- struct TALER_Amount left;
- struct TALER_Amount remaining_refund;
-
- /* How much of the coin is left after the existing refunds? */
- if (GNUNET_SYSERR ==
- TALER_amount_subtract (&left,
- &deposit_amount_with_fee[i],
- &deposit_refund[i]))
- {
- GNUNET_break (0);
- ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
-
- if ( (0 == left.value) &&
- (0 == left.fraction) )
- {
- /* coin was fully refunded, move to next coin */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Coin %s fully refunded, moving to next coin\n",
- TALER_B2S (&deposit_coin_pubs[i]));
- continue;
- }
-
- /* How much of the refund is still to be paid back? */
- if (GNUNET_SYSERR ==
- TALER_amount_subtract (&remaining_refund,
- ctx->refund,
- ¤t_refund))
- {
- GNUNET_break (0);
- ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
-
- /* By how much will we increase the refund for this coin? */
- if (0 >= TALER_amount_cmp (&remaining_refund,
- &left))
- {
- /* remaining_refund <= left */
- increment = &remaining_refund;
- }
- else
- {
- increment = &left;
- }
-
- if (GNUNET_SYSERR ==
- TALER_amount_add (¤t_refund,
- ¤t_refund,
- increment))
- {
- GNUNET_break (0);
- ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
- return;
- }
-
- /* actually run the refund */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Coin %s deposit amount is %s\n",
- TALER_B2S (&deposit_coin_pubs[i]),
- TALER_amount2s (&deposit_amount_with_fee[i]));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Coin %s refund will be incremented by %s\n",
- TALER_B2S (&deposit_coin_pubs[i]),
- TALER_amount2s (increment));
- {
- enum GNUNET_DB_QueryStatus qs;
-
- if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- (qs = insert_refund (ctx->pg,
- ctx->merchant_pub,
- ctx->h_contract_terms,
- &deposit_coin_pubs[i],
- ctx->reason,
- increment,
- &deposit_refund_fee[i])))
- {
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- ctx->qs = qs;
- return;
- }
- }
-
- /* stop immediately if we are done */
- if (0 == TALER_amount_cmp (ctx->refund,
- ¤t_refund))
- return;
- }
-
- /**
- * We end up here if not all of the refund has been covered.
- * Although this should be checked as the business should never
- * issue a refund bigger than the contract's actual price, we cannot
- * rely upon the frontend being correct.
- */
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "The refund of %s is bigger than the order's value\n",
- TALER_amount2s (ctx->refund));
-
- ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
-}
-
-
-/**
- * Function called when some backoffice staff decides to award or
- * increase the refund on an existing contract. This function
- * MUST be called from within a transaction scope setup by the
- * caller as it executes multiple SQL statements (NT).
- *
- * @param cls closure
- * @param h_contract_terms
- * @param merchant_pub merchant's instance public key
- * @param refund maximum refund to return to the customer for this contract
- * @param reason 0-terminated UTF-8 string giving the reason why the customer
- * got a refund (free form, business-specific)
- * @return transaction status
- * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT if the refund is accepted
- * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the refund cannot be
issued: this can happen for two
- * reasons: the issued refund is not greater of the previous
refund,
- * or the coins don't have enough amount left to pay for this
refund.
- */
-static enum GNUNET_DB_QueryStatus
-postgres_increase_refund_for_contract_NT (void *cls,
- const struct GNUNET_HashCode
*h_contract_terms,
- const struct
TALER_MerchantPublicKeyP *merchant_pub,
- const struct TALER_Amount *refund,
- const char *reason)
-{
- struct PostgresClosure *pg = cls;
- struct InsertRefundContext ctx;
- enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
- GNUNET_PQ_query_param_auto_from_type (merchant_pub),
- GNUNET_PQ_query_param_end
- };
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Asked to refund %s on contract %s\n",
- TALER_amount2s (refund),
- GNUNET_h2s (h_contract_terms));
- ctx.pg = pg;
- ctx.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
- ctx.refund = refund;
- ctx.reason = reason;
- ctx.h_contract_terms = h_contract_terms;
- ctx.merchant_pub = merchant_pub;
- qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
- "find_deposits",
- params,
- &process_deposits_for_refund_cb,
- &ctx);
- switch (qs)
- {
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unknown contract: %s (merchant_pub: %s), no refund
possible\n",
- GNUNET_h2s (h_contract_terms),
- TALER_B2S (merchant_pub));
- return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
- case GNUNET_DB_STATUS_HARD_ERROR:
- return qs;
- default:
- /* Got one or more deposits */
- return ctx.qs;
- }
-}
-
-
-/**
- * Lookup proof information about a wire transfer.
- *
- * @param cls closure
- * @param exchange_url from which exchange are we looking for proof
- * @param wtid wire transfer identifier for the search
- * @param cb function to call with proof data
- * @param cb_cls closure for @a cb
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_find_proof_by_wtid (void *cls,
- const char *exchange_url,
- const struct TALER_WireTransferIdentifierRawP
*wtid,
- TALER_MERCHANTDB_ProofCallback cb,
- void *cb_cls)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (wtid),
- GNUNET_PQ_query_param_string (exchange_url),
- GNUNET_PQ_query_param_end
- };
- json_t *proof;
- struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_json ("proof",
- &proof),
- GNUNET_PQ_result_spec_end
- };
- enum GNUNET_DB_QueryStatus qs;
-
- check_connection (pg);
- qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "find_proof_by_wtid",
- params,
- rs);
- if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
- {
- cb (cb_cls,
- proof);
- GNUNET_PQ_cleanup_result (rs);
- }
- return qs;
-}
-
-
-/**
- * Add @a credit to a reserve to be used for tipping. Note that
- * this function does not actually perform any wire transfers to
- * credit the reserve, it merely tells the merchant backend that
- * a reserve was topped up. This has to happen before tips can be
- * authorized.
- *
- * @param cls closure, typically a connection to the db
- * @param reserve_priv which reserve is topped up or created
- * @param credit_uuid unique identifier for the credit operation
- * @param credit how much money was added to the reserve
- * @param expiration when does the reserve expire?
- * @return transaction status, usually
- * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success
- * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if @a credit_uuid already known
- */
-static enum GNUNET_DB_QueryStatus
-postgres_enable_tip_reserve_TR (void *cls,
- const struct TALER_ReservePrivateKeyP
*reserve_priv,
- const struct GNUNET_HashCode *credit_uuid,
- const struct TALER_Amount *credit,
- struct GNUNET_TIME_Absolute expiration)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute old_expiration;
- struct TALER_Amount old_balance;
- enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute new_expiration;
- struct TALER_Amount new_balance;
- unsigned int retries;
-
- retries = 0;
- check_connection (pg);
- RETRY:
- if (MAX_RETRIES < ++retries)
- return GNUNET_DB_STATUS_SOFT_ERROR;
- if (GNUNET_OK !=
- postgres_start (pg,
- "enable tip reserve"))
- {
- GNUNET_break (0);
- return GNUNET_DB_STATUS_HARD_ERROR;
- }
-
- /* ensure that credit_uuid is new/unique */
- {
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (credit_uuid),
- GNUNET_PQ_query_param_auto_from_type (reserve_priv),
- GNUNET_PQ_query_param_end
- };
-
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_end
- };
- qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "lookup_tip_credit_uuid",
- params,
- rs);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- postgres_rollback (pg);
- if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
- goto RETRY;
- return qs;
- }
- if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != qs)
- {
- /* UUID already exists, we are done! */
- postgres_rollback (pg);
- return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
- }
- }
-
- {
- struct GNUNET_TIME_Absolute now;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (reserve_priv),
- GNUNET_PQ_query_param_auto_from_type (credit_uuid),
- GNUNET_PQ_query_param_absolute_time (&now),
- TALER_PQ_query_param_amount (credit),
- GNUNET_PQ_query_param_end
- };
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
- qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "insert_tip_credit_uuid",
- params);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- postgres_rollback (pg);
- if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
- goto RETRY;
- return qs;
- }
- }
-
- /* Obtain existing reserve balance */
- {
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (reserve_priv),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_absolute_time ("expiration",
- &old_expiration),
- TALER_PQ_result_spec_amount ("balance",
- &old_balance),
- GNUNET_PQ_result_spec_end
- };
-
- qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-
"lookup_tip_reserve_balance",
- params,
- rs);
- }
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- postgres_rollback (pg);
- if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
- goto RETRY;
- return qs;
- }
- if ( (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) &&
- (GNUNET_TIME_absolute_get_remaining (old_expiration).rel_value_us > 0) )
- {
- new_expiration = GNUNET_TIME_absolute_max (old_expiration,
- expiration);
- if (GNUNET_OK !=
- TALER_amount_add (&new_balance,
- credit,
- &old_balance))
- {
- GNUNET_break (0);
- postgres_rollback (pg);
- return GNUNET_DB_STATUS_HARD_ERROR;
- }
- }
- else
- {
- if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Old reserve balance of %s had expired at %s, not carrying
it over!\n",
- TALER_amount2s (&old_balance),
- GNUNET_STRINGS_absolute_time_to_string (old_expiration));
- }
- new_expiration = expiration;
- new_balance = *credit;
- }
-
- {
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (reserve_priv),
- GNUNET_PQ_query_param_absolute_time (&new_expiration),
- TALER_PQ_query_param_amount (&new_balance),
- GNUNET_PQ_query_param_end
- };
- const char *stmt;
-
- stmt = (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
- ? "update_tip_reserve_balance"
- : "insert_tip_reserve_balance";
- qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
- stmt,
- params);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- postgres_rollback (pg);
- if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
- goto RETRY;
- return qs;
- }
- }
- qs = postgres_commit (pg);
- if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
- return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
- goto RETRY;
- return qs;
-}
-
-
-/**
- * Authorize a tip over @a amount from reserve @a reserve_priv. Remember
- * the authorization under @a tip_id for later, together with the
- * @a justification.
- *
- * @param cls closure, typically a connection to the db
- * @param justification why was the tip approved
- * @param amount how high is the tip (with fees)
- * @param reserve_priv which reserve is debited
- * @param exchange_url which exchange manages the tip
- * @param[out] expiration set to when the tip expires
- * @param[out] tip_id set to the unique ID for the tip
- * @return taler error code
- * #TALER_EC_TIP_AUTHORIZE_RESERVE_EXPIRED if the reserve is known but
has expired
- * #TALER_EC_TIP_AUTHORIZE_RESERVE_UNKNOWN if the reserve is not known
- * #TALER_EC_TIP_AUTHORIZE_INSUFFICIENT_FUNDS if the reserve has
insufficient funds left
- * #TALER_EC_TIP_AUTHORIZE_DB_HARD_ERROR on hard DB errors
- * #TALER_EC_TIP_AUTHORIZE_DB_SOFT_ERROR on soft DB errors (client should
retry)
- * #TALER_EC_NONE upon success
- */
-static enum TALER_ErrorCode
-postgres_authorize_tip_TR (void *cls,
- const char *justification,
- const struct TALER_Amount *amount,
- const struct TALER_ReservePrivateKeyP *reserve_priv,
- const char *exchange_url,
- struct GNUNET_TIME_Absolute *expiration,
- struct GNUNET_HashCode *tip_id)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (reserve_priv),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_TIME_Absolute old_expiration;
- struct TALER_Amount old_balance;
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_absolute_time ("expiration",
- &old_expiration),
- TALER_PQ_result_spec_amount ("balance",
- &old_balance),
- GNUNET_PQ_result_spec_end
- };
- enum GNUNET_DB_QueryStatus qs;
- struct TALER_Amount new_balance;
- unsigned int retries;
-
- retries = 0;
- check_connection (pg);
- RETRY:
- if (MAX_RETRIES < ++retries)
- return TALER_EC_TIP_AUTHORIZE_DB_SOFT_ERROR;
- if (GNUNET_OK !=
- postgres_start (pg,
- "authorize tip"))
- {
- GNUNET_break (0);
- return TALER_EC_TIP_AUTHORIZE_DB_HARD_ERROR;
- }
- qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "lookup_tip_reserve_balance",
- params,
- rs);
- if (0 >= qs)
- {
- /* reserve unknown */
- postgres_rollback (pg);
- if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
- goto RETRY;
- if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
- return TALER_EC_TIP_AUTHORIZE_INSUFFICIENT_FUNDS;
- return TALER_EC_TIP_AUTHORIZE_DB_HARD_ERROR;
- }
- if (0 == GNUNET_TIME_absolute_get_remaining (old_expiration).rel_value_us)
- {
- /* reserve expired, can't be used */
- postgres_rollback (pg);
- return TALER_EC_TIP_AUTHORIZE_RESERVE_EXPIRED;
- }
- if (GNUNET_SYSERR ==
- TALER_amount_subtract (&new_balance,
- &old_balance,
- amount))
- {
- /* insufficient funds left in reserve */
- postgres_rollback (pg);
- return TALER_EC_TIP_AUTHORIZE_INSUFFICIENT_FUNDS;
- }
- /* Update reserve balance */
- {
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (reserve_priv),
- GNUNET_PQ_query_param_absolute_time (&old_expiration),
- TALER_PQ_query_param_amount (&new_balance),
- GNUNET_PQ_query_param_end
- };
-
- qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "update_tip_reserve_balance",
- params);
- if (0 > qs)
- {
- postgres_rollback (pg);
- if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
- goto RETRY;
- return TALER_EC_TIP_AUTHORIZE_DB_HARD_ERROR;
- }
- }
- /* Generate and store tip ID */
- *expiration = old_expiration;
- GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_STRONG,
- tip_id);
- {
- struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (reserve_priv),
- GNUNET_PQ_query_param_auto_from_type (tip_id),
- GNUNET_PQ_query_param_string (exchange_url),
- GNUNET_PQ_query_param_string (justification),
- GNUNET_PQ_query_param_absolute_time (&now),
- TALER_PQ_query_param_amount (amount), /* overall amount */
- TALER_PQ_query_param_amount (amount), /* amount left */
- GNUNET_PQ_query_param_end
- };
-
- (void) GNUNET_TIME_round_abs (&now);
- qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "insert_tip_justification",
- params);
- if (0 > qs)
- {
- postgres_rollback (pg);
- if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
- goto RETRY;
- return TALER_EC_TIP_AUTHORIZE_DB_HARD_ERROR;
- }
- }
- qs = postgres_commit (pg);
- if (0 <= qs)
- return TALER_EC_NONE; /* success! */
- if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
- goto RETRY;
- return TALER_EC_TIP_AUTHORIZE_DB_HARD_ERROR;
-}
-
-
-/**
- * Find out tip authorization details associated with @a tip_id
- *
- * @param cls closure, typically a connection to the d
- * @param tip_id the unique ID for the tip
- * @param[out] exchange_url set to the URL of the exchange (unless NULL)
- * @param[out] amount set to the authorized amount (unless NULL)
- * @param[out] timestamp set to the timestamp of the tip authorization (unless
NULL)
- * @return transaction status, usually
- * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success
- * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if @a credit_uuid already known
- */
-static enum GNUNET_DB_QueryStatus
-postgres_lookup_tip_by_id (void *cls,
- const struct GNUNET_HashCode *tip_id,
- char **exchange_url,
- struct TALER_Amount *amount,
- struct GNUNET_TIME_Absolute *timestamp)
-{
- char *res_exchange_url;
- struct TALER_Amount res_amount;
- struct GNUNET_TIME_Absolute res_timestamp;
-
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (tip_id),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_string ("exchange_url",
- &res_exchange_url),
- GNUNET_PQ_result_spec_absolute_time ("timestamp",
- &res_timestamp),
- TALER_PQ_result_spec_amount ("amount",
- &res_amount),
- GNUNET_PQ_result_spec_end
- };
- enum GNUNET_DB_QueryStatus qs;
-
- qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "find_tip_by_id",
- params,
- rs);
- if (0 >= qs)
- {
- if (NULL != exchange_url)
- *exchange_url = NULL;
- return qs;
- }
- if (NULL != exchange_url)
- *exchange_url = strdup (res_exchange_url);
- if (NULL != amount)
- *amount = res_amount;
- if (NULL != timestamp)
- *timestamp = res_timestamp;
- GNUNET_PQ_cleanup_result (rs);
- return qs;
-}
-
-
-
-/**
- * Initialize Postgres database subsystem.
- *
- * @param cls a configuration instance
- * @return NULL on error, otherwise a `struct TALER_MERCHANTDB_Plugin`
- */
-void *
-libtaler_plugin_merchantdb_postgres_init (void *cls)
-{
- struct GNUNET_CONFIGURATION_Handle *cfg = cls;
- struct PostgresClosure *pg;
- struct TALER_MERCHANTDB_Plugin *plugin;
- const char *ec;
pg = GNUNET_new (struct PostgresClosure);
- ec = getenv ("TALER_MERCHANTDB_POSTGRES_CONFIG");
- if (NULL != ec)
- {
- GNUNET_CONFIGURATION_set_value_string (cfg,
- "merchantdb-postgres",
- "CONFIG",
- ec);
- }
- else
- {
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_have_value (cfg,
- "merchantdb-postgres",
- "CONFIG"))
- {
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "merchantdb-postgres",
- "CONFIG");
- return NULL;
- }
- }
pg->cfg = cfg;
pg->conn = GNUNET_PQ_connect_with_cfg (cfg,
- "merchantdb-postgres");
+ "anastasis",
+ es,
+ ps);
if (NULL == pg->conn)
{
GNUNET_free (pg);
@@ -2727,7 +490,6 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
plugin = GNUNET_new (struct TALER_MERCHANTDB_Plugin);
plugin->cls = pg;
plugin->drop_tables = &postgres_drop_tables;
- plugin->initialize = &postgres_initialize;
plugin->start = postgres_start;
plugin->commit = postgres_commit;
plugin->preflight = postgres_preflight;
@@ -2749,7 +511,7 @@ libtaler_plugin_merchantdb_postgres_done (void *cls)
struct TALER_MERCHANTDB_Plugin *plugin = cls;
struct PostgresClosure *pg = plugin->cls;
- PQfinish (pg->conn);
+ GNUNE_PQ_disconnect (pg->conn);
GNUNET_free (pg);
GNUNET_free (plugin);
return NULL;
diff --git a/src/backup/Makefile.am b/src/backup/Makefile.am
index 77716a4..88e56b5 100644
--- a/src/backup/Makefile.am
+++ b/src/backup/Makefile.am
@@ -16,9 +16,9 @@ anastasis_httpd_SOURCES = \
anastasis-httpd.c taler-merchant-httpd.h \
anastasis-httpd_parsing.c anastasis-httpd_parsing.h \
anastasis-httpd_responses.c anastasis-httpd_responses.h \
- anastasis-httpd_mhd.c anastasis-httpd_mhd.h \
+ anastasis-httpd_mhd.c anastasis-httpd_mhd.h
-taler_merchant_httpd_LDADD = \
+anastasis_httpd_LDADD = \
-lmicrohttpd \
-ljansson \
-lgnunetcurl \
diff --git a/src/backup/Makefile.in b/src/backup/Makefile.in
index f7b710f..a420db1 100644
--- a/src/backup/Makefile.in
+++ b/src/backup/Makefile.in
@@ -89,8 +89,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-bin_PROGRAMS = taler-merchant-httpd$(EXEEXT)
-subdir = src/backend
+bin_PROGRAMS = anastasis-httpd$(EXEEXT)
+subdir = src/backup
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_postgresql.m4 \
$(top_srcdir)/m4/ax_prog_doxygen.m4 \
@@ -102,32 +102,17 @@ am__configure_deps = $(am__aclocal_m4_deps)
$(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/taler_merchant_config.h
+CONFIG_HEADER = $(top_builddir)/anastasis_config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgcfgdir)"
PROGRAMS = $(bin_PROGRAMS)
-am_taler_merchant_httpd_OBJECTS = taler-merchant-httpd.$(OBJEXT) \
- taler-merchant-httpd_parsing.$(OBJEXT) \
- taler-merchant-httpd_responses.$(OBJEXT) \
- taler-merchant-httpd_mhd.$(OBJEXT) \
- taler-merchant-httpd_auditors.$(OBJEXT) \
- taler-merchant-httpd_exchanges.$(OBJEXT) \
- taler-merchant-httpd_proposal.$(OBJEXT) \
- taler-merchant-httpd_pay.$(OBJEXT) \
- taler-merchant-httpd_history.$(OBJEXT) \
- taler-merchant-httpd_tip-authorize.$(OBJEXT) \
- taler-merchant-httpd_tip-pickup.$(OBJEXT) \
- taler-merchant-httpd_tip-query.$(OBJEXT) \
- taler-merchant-httpd_tip-reserve-helper.$(OBJEXT) \
- taler-merchant-httpd_track-transaction.$(OBJEXT) \
- taler-merchant-httpd_track-transfer.$(OBJEXT) \
- taler-merchant-httpd_refund.$(OBJEXT) \
- taler-merchant-httpd_check-payment.$(OBJEXT) \
- taler-merchant-httpd_trigger-pay.$(OBJEXT)
-taler_merchant_httpd_OBJECTS = $(am_taler_merchant_httpd_OBJECTS)
-taler_merchant_httpd_DEPENDENCIES = \
- $(top_builddir)/src/backenddb/libtalermerchantdb.la
+am_anastasis_httpd_OBJECTS = anastasis-httpd.$(OBJEXT) \
+ anastasis-httpd_parsing.$(OBJEXT) \
+ anastasis-httpd_responses.$(OBJEXT) \
+ anastasis-httpd_mhd.$(OBJEXT)
+anastasis_httpd_OBJECTS = $(am_anastasis_httpd_OBJECTS)
+anastasis_httpd_DEPENDENCIES =
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
@@ -147,24 +132,10 @@ am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__maybe_remake_depfiles = depfiles
-am__depfiles_remade = ./$(DEPDIR)/taler-merchant-httpd.Po \
- ./$(DEPDIR)/taler-merchant-httpd_auditors.Po \
- ./$(DEPDIR)/taler-merchant-httpd_check-payment.Po \
- ./$(DEPDIR)/taler-merchant-httpd_exchanges.Po \
- ./$(DEPDIR)/taler-merchant-httpd_history.Po \
- ./$(DEPDIR)/taler-merchant-httpd_mhd.Po \
- ./$(DEPDIR)/taler-merchant-httpd_parsing.Po \
- ./$(DEPDIR)/taler-merchant-httpd_pay.Po \
- ./$(DEPDIR)/taler-merchant-httpd_proposal.Po \
- ./$(DEPDIR)/taler-merchant-httpd_refund.Po \
- ./$(DEPDIR)/taler-merchant-httpd_responses.Po \
- ./$(DEPDIR)/taler-merchant-httpd_tip-authorize.Po \
- ./$(DEPDIR)/taler-merchant-httpd_tip-pickup.Po \
- ./$(DEPDIR)/taler-merchant-httpd_tip-query.Po \
- ./$(DEPDIR)/taler-merchant-httpd_tip-reserve-helper.Po \
- ./$(DEPDIR)/taler-merchant-httpd_track-transaction.Po \
- ./$(DEPDIR)/taler-merchant-httpd_track-transfer.Po \
- ./$(DEPDIR)/taler-merchant-httpd_trigger-pay.Po
+am__depfiles_remade = ./$(DEPDIR)/anastasis-httpd.Po \
+ ./$(DEPDIR)/anastasis-httpd_mhd.Po \
+ ./$(DEPDIR)/anastasis-httpd_parsing.Po \
+ ./$(DEPDIR)/anastasis-httpd_responses.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -184,8 +155,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
-SOURCES = $(taler_merchant_httpd_SOURCES)
-DIST_SOURCES = $(taler_merchant_httpd_SOURCES)
+SOURCES = $(anastasis_httpd_SOURCES)
+DIST_SOURCES = $(anastasis_httpd_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -405,44 +376,23 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-tsc = @tsc@
# This Makefile.am is in the public domain
AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_srcdir)/src/backend-lib/
pkgcfgdir = $(prefix)/share/taler/config.d/
pkgcfg_DATA = \
- merchant.conf
+ anastasis.conf
EXTRA_DIST = \
$(pkgcfg_DATA)
-taler_merchant_httpd_SOURCES = \
- taler-merchant-httpd.c taler-merchant-httpd.h \
- taler-merchant-httpd_parsing.c taler-merchant-httpd_parsing.h \
- taler-merchant-httpd_responses.c taler-merchant-httpd_responses.h \
- taler-merchant-httpd_mhd.c taler-merchant-httpd_mhd.h \
- taler-merchant-httpd_auditors.c taler-merchant-httpd_auditors.h \
- taler-merchant-httpd_exchanges.c taler-merchant-httpd_exchanges.h \
- taler-merchant-httpd_proposal.c taler-merchant-httpd_proposal.h \
- taler-merchant-httpd_pay.c taler-merchant-httpd_pay.h \
- taler-merchant-httpd_history.c taler-merchant-httpd_history.h \
- taler-merchant-httpd_tip-authorize.c taler-merchant-httpd_tip-authorize.h \
- taler-merchant-httpd_tip-pickup.c taler-merchant-httpd_tip-pickup.h \
- taler-merchant-httpd_tip-query.c taler-merchant-httpd_tip-query.h \
- taler-merchant-httpd_tip-reserve-helper.c
taler-merchant-httpd_tip-reserve-helper.h \
- taler-merchant-httpd_track-transaction.c
taler-merchant-httpd_track-transaction.h \
- taler-merchant-httpd_track-transfer.c taler-merchant-httpd_track-transfer.h \
- taler-merchant-httpd_refund.c taler-merchant-httpd_refund.h \
- taler-merchant-httpd_check-payment.c taler-merchant-httpd_check-payment.h \
- taler-merchant-httpd_trigger-pay.c taler-merchant-httpd_trigger-pay.h
-
-taler_merchant_httpd_LDADD = \
- $(top_builddir)/src/backenddb/libtalermerchantdb.la \
- -ltalerexchange \
- -ltalerwire \
- -ltalerjson \
- -ltalerutil \
- -ltalerpq \
+anastasis_httpd_SOURCES = \
+ anastasis-httpd.c taler-merchant-httpd.h \
+ anastasis-httpd_parsing.c anastasis-httpd_parsing.h \
+ anastasis-httpd_responses.c anastasis-httpd_responses.h \
+ anastasis-httpd_mhd.c anastasis-httpd_mhd.h
+
+anastasis_httpd_LDADD = \
-lmicrohttpd \
-ljansson \
-lgnunetcurl \
@@ -462,9 +412,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am
$(am__configure_deps)
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/backend/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/backup/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu src/backend/Makefile
+ $(AUTOMAKE) --gnu src/backup/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@@ -532,9 +482,9 @@ clean-binPROGRAMS:
echo " rm -f" $$list; \
rm -f $$list
-taler-merchant-httpd$(EXEEXT): $(taler_merchant_httpd_OBJECTS)
$(taler_merchant_httpd_DEPENDENCIES) $(EXTRA_taler_merchant_httpd_DEPENDENCIES)
- @rm -f taler-merchant-httpd$(EXEEXT)
- $(AM_V_CCLD)$(LINK) $(taler_merchant_httpd_OBJECTS)
$(taler_merchant_httpd_LDADD) $(LIBS)
+anastasis-httpd$(EXEEXT): $(anastasis_httpd_OBJECTS)
$(anastasis_httpd_DEPENDENCIES) $(EXTRA_anastasis_httpd_DEPENDENCIES)
+ @rm -f anastasis-httpd$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(anastasis_httpd_OBJECTS) $(anastasis_httpd_LDADD)
$(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -542,24 +492,10 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd.Po@am__quote@ # am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_auditors.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_check-payment.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_exchanges.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_history.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_mhd.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_parsing.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_pay.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_proposal.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_refund.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_responses.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_tip-authorize.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_tip-pickup.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_tip-query.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_tip-reserve-helper.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_track-transaction.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_track-transfer.Po@am__quote@ #
am--include-marker
-@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/taler-merchant-httpd_trigger-pay.Po@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/anastasis-httpd.Po@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/anastasis-httpd_mhd.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/anastasis-httpd_parsing.Po@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/anastasis-httpd_responses.Po@am__quote@ #
am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@@ -745,24 +681,10 @@ clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
- -rm -f ./$(DEPDIR)/taler-merchant-httpd.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_auditors.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_check-payment.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_exchanges.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_history.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_mhd.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_parsing.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_pay.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_proposal.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_refund.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_responses.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_tip-authorize.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_tip-pickup.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_tip-query.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_tip-reserve-helper.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_track-transaction.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_track-transfer.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_trigger-pay.Po
+ -rm -f ./$(DEPDIR)/anastasis-httpd.Po
+ -rm -f ./$(DEPDIR)/anastasis-httpd_mhd.Po
+ -rm -f ./$(DEPDIR)/anastasis-httpd_parsing.Po
+ -rm -f ./$(DEPDIR)/anastasis-httpd_responses.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
@@ -808,24 +730,10 @@ install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
- -rm -f ./$(DEPDIR)/taler-merchant-httpd.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_auditors.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_check-payment.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_exchanges.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_history.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_mhd.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_parsing.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_pay.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_proposal.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_refund.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_responses.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_tip-authorize.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_tip-pickup.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_tip-query.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_tip-reserve-helper.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_track-transaction.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_track-transfer.Po
- -rm -f ./$(DEPDIR)/taler-merchant-httpd_trigger-pay.Po
+ -rm -f ./$(DEPDIR)/anastasis-httpd.Po
+ -rm -f ./$(DEPDIR)/anastasis-httpd_mhd.Po
+ -rm -f ./$(DEPDIR)/anastasis-httpd_parsing.Po
+ -rm -f ./$(DEPDIR)/anastasis-httpd_responses.Po
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
diff --git a/src/include/Makefile.in b/src/include/Makefile.in
index 8430d0a..bf074d2 100644
--- a/src/include/Makefile.in
+++ b/src/include/Makefile.in
@@ -98,10 +98,10 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_postgresql.m4
\
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-DIST_COMMON = $(srcdir)/Makefile.am $(talerinclude_HEADERS) \
+DIST_COMMON = $(srcdir)/Makefile.am $(anastasisinclude_HEADERS) \
$(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/taler_merchant_config.h
+CONFIG_HEADER = $(top_builddir)/anastasis_config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
@@ -150,8 +150,8 @@ am__uninstall_files_from_dir = { \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
-am__installdirs = "$(DESTDIR)$(talerincludedir)"
-HEADERS = $(talerinclude_HEADERS)
+am__installdirs = "$(DESTDIR)$(anastasisincludedir)"
+HEADERS = $(anastasisinclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
@@ -338,17 +338,15 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-tsc = @tsc@
# This Makefile.am is in the public domain
EXTRA_DIST = \
platform.h
-talerincludedir = $(includedir)/taler
-talerinclude_HEADERS = \
- taler_merchantdb_lib.h \
- taler_merchantdb_plugin.h \
- taler_merchant_service.h
+anastasisincludedir = $(includedir)/anastasis
+anastasisinclude_HEADERS = \
+ anastasis_database_plugin.h \
+ anastasis_service.h
all: all-am
@@ -388,27 +386,27 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-install-talerincludeHEADERS: $(talerinclude_HEADERS)
+install-anastasisincludeHEADERS: $(anastasisinclude_HEADERS)
@$(NORMAL_INSTALL)
- @list='$(talerinclude_HEADERS)'; test -n "$(talerincludedir)" || list=;
\
+ @list='$(anastasisinclude_HEADERS)'; test -n "$(anastasisincludedir)"
|| list=; \
if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(talerincludedir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(talerincludedir)" || exit 1; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(anastasisincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(anastasisincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
- echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(talerincludedir)'"; \
- $(INSTALL_HEADER) $$files "$(DESTDIR)$(talerincludedir)" || exit $$?;
\
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(anastasisincludedir)'";
\
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(anastasisincludedir)" || exit
$$?; \
done
-uninstall-talerincludeHEADERS:
+uninstall-anastasisincludeHEADERS:
@$(NORMAL_UNINSTALL)
- @list='$(talerinclude_HEADERS)'; test -n "$(talerincludedir)" || list=;
\
+ @list='$(anastasisinclude_HEADERS)'; test -n "$(anastasisincludedir)"
|| list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(talerincludedir)'; $(am__uninstall_files_from_dir)
+ dir='$(DESTDIR)$(anastasisincludedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -499,7 +497,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
installdirs:
- for dir in "$(DESTDIR)$(talerincludedir)"; do \
+ for dir in "$(DESTDIR)$(anastasisincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -552,7 +550,7 @@ info: info-am
info-am:
-install-data-am: install-talerincludeHEADERS
+install-data-am: install-anastasisincludeHEADERS
install-dvi: install-dvi-am
@@ -596,7 +594,7 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-talerincludeHEADERS
+uninstall-am: uninstall-anastasisincludeHEADERS
.MAKE: install-am install-strip
@@ -604,15 +602,15 @@ uninstall-am: uninstall-talerincludeHEADERS
clean-libtool cscopelist-am ctags ctags-am distclean \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- install-talerincludeHEADERS installcheck installcheck-am \
+ install-anastasisincludeHEADERS install-data install-data-am \
+ install-dvi install-dvi-am install-exec install-exec-am \
+ install-html install-html-am install-info install-info-am \
+ install-man install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags tags-am uninstall uninstall-am \
- uninstall-talerincludeHEADERS
+ uninstall-anastasisincludeHEADERS
.PRECIOUS: Makefile
diff --git a/src/include/anastasis_database_plugin.h
b/src/include/anastasis_database_plugin.h
index 8f2da87..bd82af5 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -30,22 +30,25 @@
/**
* An EdDSA public key that is used to identify a user's account.
*/
-struct ANASTASIS_AccountPubP {
+struct ANASTASIS_AccountPubP
+{
struct GNUNET_EddsaPublicKey pub;
};
/**
* Random identifier used to later charge a payment.
*/
-struct ANASTASIS_PaymentSecretP {
+struct ANASTASIS_PaymentSecretP
+{
uint32_t id[8];
};
/**
* UUID Identifier for a Truth document
*/
-struct ANASTASIS_uuid {
- char uuid[36];
+struct ANASTASIS_uuid
+{
+ char uuid[36];
};
@@ -87,15 +90,6 @@ struct AnastasisDatabasePlugin
int
(*drop_tables) (void *cls);
- /**
- * Initialize anastasis tables
- *
- * @param cls closure
- * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
- */
- int
- (*initialize) (void *cls);
-
/**
* Function called to perform "garbage collection" on the
* database, expiring records we no longer require. Deletes
@@ -104,14 +98,14 @@ struct AnastasisDatabasePlugin
* truth and financial records older than @a fin_expire.
*
* @param cls closure
- * @param fin_expire financial records older than the given
+ * @param fin_expire financial records older than the given
* time stamp should be garbage collected (usual
* values might be something like 6-10 years in the past)
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*gc) (void *cls,
- struct GNUNET_TIME_Absolute fin_expire);
+ (*gc)(void *cls,
+ struct GNUNET_TIME_Absolute fin_expire);
/**
* Record user payment.
@@ -125,12 +119,12 @@ struct AnastasisDatabasePlugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*record_payment) (void *cls,
- const struct TALER_Amount *amount,
- const struct ANASTASIS_AccountPubP *account_pub,
- unsigned int num_uploads,
- struct GNUNET_TIME_Relative lifetime_inc,
- const struct ANASTASIS_PaymentSecretP *payment_secret);
+ (*record_payment)(void *cls,
+ const struct TALER_Amount *amount,
+ const struct ANASTASIS_AccountPubP *account_pub,
+ unsigned int num_uploads,
+ struct GNUNET_TIME_Relative lifetime_inc,
+ const struct ANASTASIS_PaymentSecretP *payment_secret);
/**
* Upload encrypted recovery document.
@@ -146,12 +140,13 @@ struct AnastasisDatabasePlugin
* did not have enough upload left; HARD error if @a payment_secret
is unknown, ...
*/
enum GNUNET_DB_QueryStatus
- (*store_recovery_document) (void *cls,
- const struct ANASTASIS_AccountPubP *account_pub,
- const void *data,
- size_t data_size,
- const struct ANASTASIS_PaymentSecretP
*payment_secret,
- uint32_t *version);
+ (*store_recovery_document)(void *cls,
+ const struct ANASTASIS_AccountPubP *account_pub,
+ const void *data,
+ size_t data_size,
+ const struct
+ ANASTASIS_PaymentSecretP *payment_secret,
+ uint32_t *version);
/**
* Fetch recovery document for user.
@@ -164,11 +159,11 @@ struct AnastasisDatabasePlugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*get_recovery_document) (void *cls,
- const struct ANASTASIS_AccountPubP *account_pub,
- uint32_t version,
- size_t *data_size,
- void **data);
+ (*get_recovery_document)(void *cls,
+ const struct ANASTASIS_AccountPubP *account_pub,
+ uint32_t version,
+ size_t *data_size,
+ void **data);
/**
* Fetch latest recovery document for user.
@@ -181,11 +176,12 @@ struct AnastasisDatabasePlugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*get_latest_recovery_document) (void *cls,
- const struct ANASTASIS_AccountPubP *account_pub,
- size_t *data_size,
- void **data,
- uint32_t *version);
+ (*get_latest_recovery_document)(void *cls,
+ const struct
+ ANASTASIS_AccountPubP *account_pub,
+ size_t *data_size,
+ void **data,
+ uint32_t *version);
/**
* Upload Truth, which contains the Truth and the KeyShare.
@@ -203,17 +199,17 @@ struct AnastasisDatabasePlugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*store_truth) (void *cls,
- const struct ANASTASIS_uuid *uuid,
- const void *truth,
- size_t truth_size,
- const void *key_share_data,
- size_t key_share_data_size,
- char *truth_method,
- size_t size_truth_method,
- char *truth_mimetype,
- size_t size_truth_mimetype,
- struct GNUNET_TIME_Relative truth_expiration);
+ (*store_truth)(void *cls,
+ const struct ANASTASIS_uuid *uuid,
+ const void *truth,
+ size_t truth_size,
+ const void *key_share_data,
+ size_t key_share_data_size,
+ char *truth_method,
+ size_t size_truth_method,
+ char *truth_mimetype,
+ size_t size_truth_mimetype,
+ struct GNUNET_TIME_Relative truth_expiration);
/**
@@ -221,8 +217,8 @@ struct AnastasisDatabasePlugin
* @param uuid the identifier for the Truth
*/
enum GNUNET_DB_QueryStatus
- (*get_encrypted_key_share) (void *cls,
- const struct ANASTASIS_uuid *uuid);
+ (*get_encrypted_key_share)(void *cls,
+ const struct ANASTASIS_uuid *uuid);
diff --git a/src/include/platform.h b/src/include/platform.h
index a2ed6f4..04a2dce 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -28,7 +28,7 @@
#ifndef HAVE_USED_CONFIG_H
# define HAVE_USED_CONFIG_H
# ifdef HAVE_CONFIG_H
-# include "taler_merchant_config.h"
+# include "anastasis_config.h"
# endif
#endif
@@ -36,7 +36,7 @@
#if (GNUNET_EXTRA_LOGGING >= 1)
#define VERBOSE(cmd) cmd
#else
-#define VERBOSE(cmd) do { break; }while(0)
+#define VERBOSE(cmd) do { break; } while (0)
#endif
/* Include the features available for GNU source */
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-anastasis] branch master updated: adapting to new GNUNET_PQ API, removing dead, useless code,
gnunet <=