diff --git a/debian/changelog b/debian/changelog index bda1f0e..a3bc9aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +libsml (0.1-5~wip) unstable; urgency=low + + * Adapted sml_transport_ for vzlogger + + -- Steffen Vogel Fri, 09 Sep 2011 14:52:56 +0200 + +libsml (0.1-4~wip) unstable; urgency=low + + * Fixed bug in sml_message_body_free (#1) + * Fixed bug in sml_list_entry_parse (#2) + + -- Steffen Vogel Thu, 01 Sep 2011 23:22:33 +0200 + libsml (0.1-3~wip) unstable; urgency=low * fixed invalid destination for libs diff --git a/debian/control b/debian/control index a305d31..cacdfbb 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: libsml Priority: extra Maintainer: Steffen Vogel Build-Depends: debhelper (>= 7.0.50~), uuid-dev (>= 2.16) -Standards-Version: 3.9.1 +Standards-Version: 3.9.2 Section: libs Homepage: http://github.com/dailab/libsml Vcs-Git: git://github.com/dailab/libsml.git diff --git a/debian/copyright b/debian/copyright index fc1e271..7fd28d6 100644 --- a/debian/copyright +++ b/debian/copyright @@ -6,7 +6,7 @@ It was downloaded from: https://github.com/dailab/libsml -Upstream Author(s): +Upstream Authors: Juri Glass, Mathias Runge, diff --git a/debian/patches/debian-changes-0.1-4~wip b/debian/patches/debian-changes-0.1-4~wip new file mode 100644 index 0000000..0e1f0c4 --- /dev/null +++ b/debian/patches/debian-changes-0.1-4~wip @@ -0,0 +1,54 @@ +Description: Upstream changes introduced in version 0.1-4~wip + This patch has been created by dpkg-source during the package build. + Here's the last changelog entry, hopefully it gives details on why + those changes were made: + . + libsml (0.1-4~wip) unstable; urgency=low + . + * Fixed bug in sml_message_body_free + . + The person named in the Author field signed this changelog entry. +Author: Steffen Vogel + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- libsml-0.1.orig/sml/src/sml_message.c ++++ libsml-0.1/sml/src/sml_message.c +@@ -166,7 +166,7 @@ sml_message_body *sml_message_body_init( + + void sml_message_body_write(sml_message_body *message_body, sml_buffer *buf) { + sml_buf_set_type_and_length(buf, SML_TYPE_LIST, 2); +- sml_u16_write(message_body->tag, buf); ++ sml_u16_write(message_body->tag, buf); + + switch (*(message_body->tag)) { + case SML_MESSAGE_OPEN_REQUEST: +@@ -195,8 +195,6 @@ void sml_message_body_write(sml_message_ + + void sml_message_body_free(sml_message_body *message_body) { + if (message_body) { +- sml_number_free(message_body->tag); +- + switch (*(message_body->tag)) { + case SML_MESSAGE_OPEN_REQUEST: + sml_open_request_free((sml_open_request *) message_body->data); +@@ -224,6 +222,8 @@ void sml_message_body_free(sml_message_b + break; + } + ++ sml_number_free(message_body->tag); ++ + free(message_body); + } + } diff --git a/debian/patches/debian-changes-0.1-5~wip b/debian/patches/debian-changes-0.1-5~wip new file mode 100644 index 0000000..6987b4a --- /dev/null +++ b/debian/patches/debian-changes-0.1-5~wip @@ -0,0 +1,133 @@ +Description: Upstream changes introduced in version 0.1-5~wip + This patch has been created by dpkg-source during the package build. + Here's the last changelog entry, hopefully it gives details on why + those changes were made: + . + libsml (0.1-5~wip) unstable; urgency=low + . + * Adapted sml_transport_ for vzlogger + . + The person named in the Author field signed this changelog entry. +Author: Steffen Vogel + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- libsml-0.1.orig/sml/include/sml/sml_shared.h ++++ libsml-0.1/sml/include/sml/sml_shared.h +@@ -106,8 +106,8 @@ void sml_buf_update_bytes_read(sml_buffe + + // Checks if the next field is a skipped optional field, updates the buffer accordingly + int sml_buf_optional_is_skipped(sml_buffer *buf); +-#define SML_SKIP_OPTIONAL (sml_buf_optional_is_skipped(buf)) ? 0 : + ++// Prints arbitrarily byte string to stdout with printf + void hexdump(unsigned char *buffer, size_t buffer_len); + + #ifdef __cplusplus +--- libsml-0.1.orig/sml/include/sml/sml_transport.h ++++ libsml-0.1/sml/include/sml/sml_transport.h +@@ -26,12 +26,14 @@ + extern "C" { + #endif + +-// sml_transport_listen reads continously bytes from fd and scans ++// sml_transport_read reads continously bytes from fd and scans + // for the SML transport protocol escape sequences. If a SML file +-// is detected, the sml_transporter_receiver is called with the +-// complete bytes, including the escape sequences. +-// The buffer is free'd after the sml_transport_receiver comes +-// back. ++// is detected it will be copied into the buffer. The total amount of bytes read ++// will be returned. If the SML file exceeds the len of the buffer, -1 will be returned ++size_t sml_transport_read(int fd, unsigned char *buffer, size_t max_len); ++ ++// sml_transport_listen is an endless loop which reads continously ++// via sml_transport_read and calls the sml_transporter_receiver + void sml_transport_listen(int fd, void (*sml_transport_receiver)(unsigned char *buffer, size_t buffer_len)); + + // sml_transport_writes adds the SML transport protocol escape +--- libsml-0.1.orig/sml/src/sml_list.c ++++ libsml-0.1/sml/src/sml_list.c +@@ -60,7 +60,7 @@ sml_list *sml_list_entry_parse(sml_buffe + l->status = sml_status_parse(buf); + if (sml_buf_has_errors(buf)) goto error; + +- l->val_time = SML_SKIP_OPTIONAL sml_time_parse(buf); ++ l->val_time = sml_time_parse(buf); + if (sml_buf_has_errors(buf)) goto error; + + l->unit = sml_u8_parse(buf); +--- libsml-0.1.orig/sml/src/sml_transport.c ++++ libsml-0.1/sml/src/sml_transport.c +@@ -29,17 +29,17 @@ + + #define MC_SML_BUFFER_LEN 8096 + +-void sml_transport_listen(int fd, void (*sml_transport_receiver)(unsigned char *buffer, size_t buffer_len)) { ++size_t sml_transport_read(int fd, unsigned char *buffer, size_t max_len) { + + fd_set readfds; + FD_ZERO(&readfds); + FD_SET(fd, &readfds); + + unsigned char byte; +- unsigned char buf[MC_SML_BUFFER_LEN]; +- int esc = 0, start = 0, i, end = 0, r; ++ unsigned char buf[max_len]; ++ int esc = 0, start = 0, i = 0, end = 0, r; + +- for (i = 0; i < MC_SML_BUFFER_LEN;) { ++ while (i < max_len) { + select(fd + 1, &readfds, 0, 0, 0); + if (FD_ISSET(fd, &readfds)) { + +@@ -79,13 +79,8 @@ void sml_transport_listen(int fd, void ( + if (end) { + end++; + if (end == 5) { +- char *sml_file = (char *) malloc(i); +- memcpy(sml_file, &(buf[0]), i); +- sml_transport_receiver((unsigned char *)(sml_file), i); +- free(sml_file); +- i = -1; +- esc = 0; +- end = 0; ++ memcpy(buffer, &(buf[0]), i); ++ return i; + } + } + else { +@@ -111,7 +106,21 @@ void sml_transport_listen(int fd, void ( + } + } + } +- printf("error: no end sequence found, buffer full."); ++ ++ return -1; ++} ++ ++void sml_transport_listen(int fd, void (*sml_transport_receiver)(unsigned char *buffer, size_t buffer_len)) { ++ unsigned char buffer[MC_SML_BUFFER_LEN]; ++ size_t bytes; ++ ++ while (1) { ++ bytes = sml_transport_read(fd, buffer, MC_SML_BUFFER_LEN); ++ ++ if (bytes > 0) { ++ sml_transport_receiver(buffer, bytes); ++ } ++ } + } + + int sml_transport_write(int fd, sml_file *file) { diff --git a/debian/patches/series b/debian/patches/series index 03bdee5..2ba0978 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,4 @@ debian-changes-0.1-2~wip debian-changes-0.1-3~wip +debian-changes-0.1-4~wip +debian-changes-0.1-5~wip diff --git a/debian/substvars b/debian/substvars new file mode 100644 index 0000000..1e279bf --- /dev/null +++ b/debian/substvars @@ -0,0 +1 @@ +shlibs:Depends=libuuid1 (>= 2.16)