diff --git a/LICENSE b/LICENSE index 7f64a97..3a7a624 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,3 @@ The TLSRPT tools are released under the GNU General Public License (GPL) version 3 or later (see doc/COPYING for the license terms). -The TLSRPT C library in the "clibrary" subdirectory is released under the GNU Lesser General Public License (LGPL) version 3 or later (see clibrary/library/doc/COPYING.LESSER for the license terms). +The TLSRPT C library in the "libtlsrpt" subdirectory is released under the GNU Lesser General Public License (LGPL) version 3 or later (see libtlsrpt/COPYING.LESSER for the license terms). diff --git a/clibrary/LICENSE b/clibrary/LICENSE deleted file mode 100644 index e8fbd38..0000000 --- a/clibrary/LICENSE +++ /dev/null @@ -1 +0,0 @@ -The TLSRPT C library is released under the GNU Lesser General Public License (LGPL) version 3 or later (see doc/COPYING.LESSER for the license terms). \ No newline at end of file diff --git a/clibrary/library/doc/TLSRPT-c-library-API-Documentation.adoc b/doc/TLSRPT-c-library-API-Documentation.adoc similarity index 97% rename from clibrary/library/doc/TLSRPT-c-library-API-Documentation.adoc rename to doc/TLSRPT-c-library-API-Documentation.adoc index 4b02621..543ade4 100644 --- a/clibrary/library/doc/TLSRPT-c-library-API-Documentation.adoc +++ b/doc/TLSRPT-c-library-API-Documentation.adoc @@ -5,8 +5,8 @@ :title-page: = TLSRPT for MTAs - API documentation of the C library -Version 0.04 -2024-09-05 +Version 0.5.0-pre20240929 +2024-09-29 == Error handling @@ -204,6 +204,13 @@ The default is non-blocking. ==== `tlsrpt_set_nonblocking` The `tlsrpt_set_nonblocking` function restores the `sendto` call within `tlsrpt_finish_delivery_request` to its default non-blocking behaviour. +==== `tlsrpt_get_socket` +Parameters::: + truct tlsrpt_connection_t* con:: A pointer to the `tlsrpt_connection_t` struct. + +The `tlsrpt_get_socket` function returns the socket file descriptor used within a `tlsrpt_connection_t`. +This can be useful to set socket options. + === Error code inspection ==== `tlsrpt_errno_from_error_code` diff --git a/clibrary/library/doc/COPYING b/libtlsrpt/COPYING similarity index 100% rename from clibrary/library/doc/COPYING rename to libtlsrpt/COPYING diff --git a/clibrary/library/doc/COPYING.LESSER b/libtlsrpt/COPYING.LESSER similarity index 100% rename from clibrary/library/doc/COPYING.LESSER rename to libtlsrpt/COPYING.LESSER diff --git a/clibrary/INSTALL b/libtlsrpt/INSTALL similarity index 62% rename from clibrary/INSTALL rename to libtlsrpt/INSTALL index 38889d6..a2192ec 100644 --- a/clibrary/INSTALL +++ b/libtlsrpt/INSTALL @@ -2,9 +2,11 @@ libtlsrpt - Installation To install the libtlsrpt in /usr/local/lib and the header files to /usr/local/include: -1. Change directory to the library´s source directory +1. Build library + + make + 2. Call "make install" with PREFIX set to "/usr/local" -cd library/src -make install PREFIX=/usr/local + make install PREFIX=/usr/local diff --git a/libtlsrpt/LICENSE b/libtlsrpt/LICENSE new file mode 100644 index 0000000..cb1cdce --- /dev/null +++ b/libtlsrpt/LICENSE @@ -0,0 +1 @@ +The TLSRPT C library is released under the GNU Lesser General Public License (LGPL) version 3 or later (see COPYING.LESSER for the license terms). \ No newline at end of file diff --git a/clibrary/library/src/Makefile b/libtlsrpt/Makefile similarity index 89% rename from clibrary/library/src/Makefile rename to libtlsrpt/Makefile index 7e6a5a7..355d18b 100644 --- a/clibrary/library/src/Makefile +++ b/libtlsrpt/Makefile @@ -19,7 +19,7 @@ CC=gcc INSTALL=install DEBUG=-g -CFLAGS += -Wall -I ../include -fPIC -O2 ${DEBUG} +CFLAGS += -Wall -I . -fPIC -O2 ${DEBUG} LDFLAGS += -Wall -L. ${DEBUG} LDLIBS += libtlsrpt.a @@ -42,8 +42,8 @@ libtlsrpt.so : libtlsrpt.o json-escape-initializer-list.o demo : demo.o libtlsrpt.a -demo.o : ../include/tlsrpt.h -libtlsrpt.o : ../include/tlsrpt.h +demo.o : tlsrpt.h +libtlsrpt.o : tlsrpt.h json-escape-initializer-list.c : create-json-escape-initializer-list @@ -54,4 +54,4 @@ create-json-escape-initializer-list : LDLIBS = install: ${TARGETLIBS} ${INSTALL} -D -t ${DESTDIR}${PREFIX}/lib ${TARGETLIBS} - ${INSTALL} -D -t ${DESTDIR}${PREFIX}/include ../include/tlsrpt.h + ${INSTALL} -D -t ${DESTDIR}${PREFIX}/include tlsrpt.h diff --git a/clibrary/library/src/create-json-escape-initializer-list.c b/libtlsrpt/create-json-escape-initializer-list.c similarity index 100% rename from clibrary/library/src/create-json-escape-initializer-list.c rename to libtlsrpt/create-json-escape-initializer-list.c diff --git a/clibrary/library/src/demo.c b/libtlsrpt/demo.c similarity index 91% rename from clibrary/library/src/demo.c rename to libtlsrpt/demo.c index f2e788c..9c60813 100644 --- a/clibrary/library/src/demo.c +++ b/libtlsrpt/demo.c @@ -19,6 +19,7 @@ #include #include +#include #include #include "tlsrpt.h" @@ -56,6 +57,13 @@ void testrun() { res = tlsrpt_finish_delivery_request(&dr); printf("Result code is %d\n", res); + if(tlsrpt_error_code_is_internal(res)) { + printf("Internal library error : %s\n", tlsrpt_strerror(res)); + } else { + int e = tlsrpt_errno_from_error_code(res); + printf("%s : errno=%d : %s\n", tlsrpt_strerror(res), e, strerror(e)); + } + tlsrpt_close(&con); diff --git a/clibrary/library/src/libtlsrpt.c b/libtlsrpt/libtlsrpt.c similarity index 100% rename from clibrary/library/src/libtlsrpt.c rename to libtlsrpt/libtlsrpt.c diff --git a/clibrary/library/include/tlsrpt.h b/libtlsrpt/tlsrpt.h similarity index 100% rename from clibrary/library/include/tlsrpt.h rename to libtlsrpt/tlsrpt.h diff --git a/doc/COPYING b/pytlsrpt/COPYING similarity index 100% rename from doc/COPYING rename to pytlsrpt/COPYING diff --git a/sys4_tlsrpt/__init__.py b/pytlsrpt/__init__.py similarity index 100% rename from sys4_tlsrpt/__init__.py rename to pytlsrpt/__init__.py diff --git a/sys4_tlsrpt/config.py b/pytlsrpt/config.py similarity index 100% rename from sys4_tlsrpt/config.py rename to pytlsrpt/config.py diff --git a/sys4_tlsrpt/example.cfg b/pytlsrpt/example.cfg similarity index 100% rename from sys4_tlsrpt/example.cfg rename to pytlsrpt/example.cfg diff --git a/sys4_tlsrpt/tlsrpt.py b/pytlsrpt/tlsrpt.py similarity index 100% rename from sys4_tlsrpt/tlsrpt.py rename to pytlsrpt/tlsrpt.py diff --git a/sys4_tlsrpt/tlsrpt_fetcher.py b/pytlsrpt/tlsrpt_fetcher.py similarity index 100% rename from sys4_tlsrpt/tlsrpt_fetcher.py rename to pytlsrpt/tlsrpt_fetcher.py diff --git a/sys4_tlsrpt/tlsrpt_receiver.py b/pytlsrpt/tlsrpt_receiver.py similarity index 100% rename from sys4_tlsrpt/tlsrpt_receiver.py rename to pytlsrpt/tlsrpt_receiver.py diff --git a/sys4_tlsrpt/tlsrpt_reporter.py b/pytlsrpt/tlsrpt_reporter.py similarity index 100% rename from sys4_tlsrpt/tlsrpt_reporter.py rename to pytlsrpt/tlsrpt_reporter.py diff --git a/sys4_tlsrpt/utility.py b/pytlsrpt/utility.py similarity index 100% rename from sys4_tlsrpt/utility.py rename to pytlsrpt/utility.py diff --git a/clibrary/benchmark/Makefile b/tools/benchmark/Makefile similarity index 100% rename from clibrary/benchmark/Makefile rename to tools/benchmark/Makefile diff --git a/clibrary/benchmark/bench1.cc b/tools/benchmark/bench1.cc similarity index 100% rename from clibrary/benchmark/bench1.cc rename to tools/benchmark/bench1.cc diff --git a/clibrary/benchmark/duration.h b/tools/benchmark/duration.h similarity index 100% rename from clibrary/benchmark/duration.h rename to tools/benchmark/duration.h