diff --git a/.gitignore b/.gitignore index 140ffb8..8435c81 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,14 @@ build debian/*.log debian/*substvars +debian/libwspcodec debian/libwspcodec-dev +debian/libwspcodec.postinst.debhelper +debian/libwspcodec.postrm.debhelper debian/files debian/tmp +documentation.list +installroot +libwspcodec.ncb +libwspcodec.opt +RPMS diff --git a/Makefile b/Makefile index 675fb53..99846dc 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ all: debug release pkgconfig # Library version # -VERSION_MAJOR = 1 +VERSION_MAJOR = 2 VERSION_MINOR = 0 VERSION_MICRO = 0 VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO) @@ -34,7 +34,7 @@ SRC = wsputil.c # Directories # -SRC_DIR = src +SRC_DIR = wspcodec BUILD_DIR = build DEBUG_BUILD_DIR = $(BUILD_DIR)/debug RELEASE_BUILD_DIR = $(BUILD_DIR)/release diff --git a/debian/changelog b/debian/changelog index 1562ee8..a90587c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,17 @@ +libwspcodec (2.0.0) unstable; urgency=low + + * Made content type field configurable. + This resolves conflict between WSP Content-Type and X-Mms-Report-Allowed + headers (both are equal 0x11) + + -- Slava Monich Thu, 26 Dec 2013 00:27:57 +0200 + +libwspcodec (1.0.1) unstable; urgency=low + + * Repackaged the sources, no API changes. + + -- Slava Monich Thu, 26 Dec 2013 00:27:57 +0200 + libwspcodec (1.0.0) unstable; urgency=low * Initial release diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control index f2d54f5..264a85b 100644 --- a/debian/control +++ b/debian/control @@ -8,11 +8,11 @@ Standards-Version: 3.8.4 Package: libwspcodec Section: libs Architecture: any -Depends: libglib2.0-bin (>= 2.0) +Depends: libglib2.0-bin (>= 2.32), ${shlibs:Depends}, ${misc:Depends} Description: WSP encoder and decoder library Package: libwspcodec-dev Section: libdevel Architecture: any -Depends: libwspcodec (= ${binary:Version}) +Depends: libwspcodec (= ${binary:Version}), libglib2.0-dev (>= 2.32), ${misc:Depends} Description: Development files for libwspcodec diff --git a/debian/libwspcodec-dev.install b/debian/libwspcodec-dev.install index 0fc930f..70b18b8 100644 --- a/debian/libwspcodec-dev.install +++ b/debian/libwspcodec-dev.install @@ -1,3 +1,3 @@ -src/wspcodec.h usr/include/libwspcodec/wspcodec -src/wsputil.h usr/include/libwspcodec/wspcodec +wspcodec/wspcodec.h usr/include/libwspcodec/wspcodec +wspcodec/wsputil.h usr/include/libwspcodec/wspcodec build/libwspcodec.pc usr/lib/pkgconfig diff --git a/debian/libwspcodec.install b/debian/libwspcodec.install new file mode 100644 index 0000000..633b21a --- /dev/null +++ b/debian/libwspcodec.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/libwspcodec.so* usr/lib diff --git a/libwspcodec.dsp b/libwspcodec.dsp new file mode 100644 index 0000000..92a269b --- /dev/null +++ b/libwspcodec.dsp @@ -0,0 +1,104 @@ +# Microsoft Developer Studio Project File - Name="libwspcodec" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libwspcodec - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libwspcodec.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libwspcodec.mak" CFG="libwspcodec - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libwspcodec - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libwspcodec - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libwspcodec - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "build/Release" +# PROP BASE Intermediate_Dir "build/Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "build/Release" +# PROP Intermediate_Dir "build/Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "$(GTK_ROOT)/include/glib-2.0" /I "$(GTK_ROOT)/lib/glib-2.0/include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "libwspcodec - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "build/Debug" +# PROP BASE Intermediate_Dir "build/Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "build/Debug" +# PROP Intermediate_Dir "build/Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MD /W3 /Gm /GX /Zi /Od /I "$(GTK_ROOT)/include/glib-2.0" /I "$(GTK_ROOT)/lib/glib-2.0/include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "libwspcodec - Win32 Release" +# Name "libwspcodec - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\wspcodec\wsputil.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\wspcodec\wspcodec.h +# End Source File +# Begin Source File + +SOURCE=.\wspcodec\wsputil.h +# End Source File +# End Group +# End Target +# End Project diff --git a/rpm/libwspcodec.spec b/rpm/libwspcodec.spec index 8d0ae4f..6da6f78 100644 --- a/rpm/libwspcodec.spec +++ b/rpm/libwspcodec.spec @@ -1,5 +1,5 @@ Name: libwspcodec -Version: 1.0.0 +Version: 2.0.0 Release: 1 Summary: WSP encoder and decoder library Group: Development/Libraries diff --git a/src/wspcodec.h b/wspcodec/wspcodec.h similarity index 100% rename from src/wspcodec.h rename to wspcodec/wspcodec.h diff --git a/src/wsputil.c b/wspcodec/wsputil.c similarity index 98% rename from src/wsputil.c rename to wspcodec/wsputil.c index aa6707b..8aa4c52 100644 --- a/src/wsputil.c +++ b/wspcodec/wsputil.c @@ -528,18 +528,13 @@ gboolean wsp_decode_application_id(struct wsp_header_iter *iter, } static inline gboolean is_content_type_header(const unsigned char *pdu, - unsigned char code_page, - unsigned int flags) + struct wsp_header_iter *iter) { - /* Check for MMS Content-Type header */ - if (flags & WSP_HEADER_ITER_FLAG_DETECT_MMS_MULTIPART) - if (code_page == 1 && *pdu == 0x84) + /* Check for Content-Type header */ + if (iter->flags & WSP_HEADER_ITER_FLAG_DETECT_MULTIPART) + if (iter->code_page == 1 && *pdu == iter->content_type_header) return TRUE; - /* Check for WSP default Content-Type header */ - if (code_page == 1 && *pdu == 0x91) - return TRUE; - return FALSE; } @@ -639,6 +634,12 @@ void wsp_header_iter_init(struct wsp_header_iter *iter, iter->max = len; iter->code_page = 1; iter->flags = flags; + if (flags & WSP_HEADER_ITER_FLAG_DETECT_MMS_MULTIPART) { + iter->flags |= WSP_HEADER_ITER_FLAG_DETECT_MULTIPART; + iter->content_type_header = 0x84; + } else { + iter->content_type_header = 0x91; + } } gboolean wsp_header_iter_next(struct wsp_header_iter *iter) @@ -687,7 +688,7 @@ gboolean wsp_header_iter_next(struct wsp_header_iter *iter) return FALSE; if (*pdu >= 0x80) { - if (is_content_type_header(pdu, iter->code_page, iter->flags)) + if (is_content_type_header(pdu, iter)) return FALSE; header = WSP_HEADER_TYPE_WELL_KNOWN; @@ -742,7 +743,7 @@ gboolean wsp_header_iter_is_multipart(struct wsp_header_iter *iter) { const unsigned char *pdu = iter->pdu + iter->pos; - return is_content_type_header(pdu, iter->code_page, iter->flags); + return is_content_type_header(pdu, iter); } enum wsp_header_type wsp_header_iter_get_hdr_type(struct wsp_header_iter *iter) diff --git a/src/wsputil.h b/wspcodec/wsputil.h similarity index 98% rename from src/wsputil.h rename to wspcodec/wsputil.h index 62e8470..cd59ca2 100644 --- a/src/wsputil.h +++ b/wspcodec/wsputil.h @@ -19,9 +19,13 @@ * */ +#ifndef WSPUTIL_H +#define WSPUTIL_H + enum wsp_header_iter_flag { WSP_HEADER_ITER_FLAG_REJECT_CP = 0x1, WSP_HEADER_ITER_FLAG_DETECT_MMS_MULTIPART = 0x2, + WSP_HEADER_ITER_FLAG_DETECT_MULTIPART = 0x4, }; enum wsp_header_type { @@ -97,6 +101,7 @@ struct wsp_header_iter { unsigned int pos; unsigned int flags; unsigned char code_page; + unsigned char content_type_header; enum wsp_header_type header_type; const void *header; @@ -210,3 +215,5 @@ gboolean wsp_text_header_iter_init(struct wsp_text_header_iter *iter, gboolean wsp_text_header_iter_param_next(struct wsp_text_header_iter *iter); const char *wsp_text_header_iter_get_key(struct wsp_text_header_iter *iter); const char *wsp_text_header_iter_get_value(struct wsp_text_header_iter *iter); + +#endif /* WSPUTIL_H */