Compare commits

...

30 Commits

Author SHA1 Message Date
Oliver Smith 16b42f3d8c contrib: remove rpm spec file
Related: https://osmocom.org/news/255
Related: OS#6446
Change-Id: Ia10ffce57cf0c067d370f0f381435cdd439e3dd9
2024-05-08 15:06:59 +02:00
Vadim Yanitskiy 4b6d3f084f build: include git-version-gen into the release tarball
Change-Id: I3d1c8c905f1acca6256eba51f6ee78214419e97a
2024-01-26 23:29:36 +07:00
Vadim Yanitskiy e9ffa494f0 fix warnings about implicit declaration of strtol()
This commit fixes several warnings like this one:

In file included from ../../../src/libsmpp34/test_apps/smpp.c:40:
test_apps/smpp.c: In function ‘do_smpp_send_message2’:
test_apps/esme.h:32:16: warning: implicit declaration of function ‘strtol’;
                                 did you mean ‘strtok’? [-Wimplicit-function-declaration]
   32 |          dst = strtol((char*)clave, NULL, 10);\
      |                ^~~~~~
test_apps/smpp.c:223:5: note: in expansion of macro ‘GET_PROP_INT’
  223 |     GET_PROP_INT( req.source_addr_ton, p, "source_addr_ton" );
      |     ^~~~~~~~~~~~

Change-Id: I16d9e0171d4c26f721c300e22c78b77f6db4895c
2024-01-08 20:46:47 +07:00
Pau Espin 5bf55100c6 Bump version: 1.14.2.2-86ff → 1.14.3
Change-Id: I2b029ca9d00a7c576312e6287f12a66d0d7e8ca1
2023-09-12 12:40:44 +02:00
Oliver Smith 86ff275bb1 debian: set compat level to 10
Related: OS#5958
Change-Id: I6ee4aace6bf7c246338408c41f790189d75d5488
2023-04-25 16:48:19 +02:00
Vadim Yanitskiy 1abf0b43fc binaries/Makefile.am: libraries shall not be in AM_LDFLAGS
Change-Id: I7258743969f5d3ac85dfb887ee1729cff8a910b6
2023-03-09 16:35:15 +07:00
Pau Espin 357d5af97a Bump version: 1.14.1.8-c3e7 → 1.14.2
Change-Id: Iaec5a62d172d37d16a09843c4beb2e3dc9f73412
2023-02-07 14:28:28 +01:00
Harald Welte c3e797b87c Add -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition
... if --enable-werror is used

Change-Id: I42f0ef1c9eea62a2512a15543ff45d776155fdc5
2022-11-03 12:24:15 +01:00
Harald Welte a53391d885 test_apps: Fix compilation of example smsc code
Change-Id: I12f4daefaa07a1c1b42dc295724e3ec0bdcddfd7
2022-10-27 13:44:38 +02:00
Max 6613063fba Add #define for default SMPP port 2775
Change-Id: I2fcc15ac60b7b6501c9cb1afd0fe6d66d4b76f5f
2022-10-17 14:07:17 +03:00
Max 90acf4bd77 cosmetic: make linter happy
* drop trailing space
* remove FSF postal address from license header

Change-Id: I772e6d7db38d830dfbee651bcd6e8ed24f07ca0b
2022-10-17 14:07:17 +03:00
Vadim Yanitskiy d08cc74519 contrib/jenkins.sh: actually build with $PARALLEL_MAKE
Parallel build has been fixed [1] and re-enabled [2] back in 2018.

Executing $MAKE without $PARALLEL_MAKE builds the project with -j1.
Executing $MAKE with $PARALLEL_MAKE after that makes no sense,
because everything is already compiled and there is nothing to do.

Change-Id: Iff7e7acfac0b827ce3b1086cea376a438b5af334
Related: [1] I5a9d7dbd7b992d322ed0d852ebf8ca2252b51a12
Related: [2] Id41fbcb5a96093eb6c3dc00bcacbd379111ada70
2022-08-29 22:36:12 +07:00
Vadim Yanitskiy 70aa4abefb Makefile.am, configure.ac: fix autoreconf related warnings
* aclocal: warning: couldn't open directory 'm4': No such file or directory
* libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac
* libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am
* configure.ac:9: warning: 'AM_CONFIG_HEADER': this macro is obsolete
  configure.ac:9: You should use the 'AC_CONFIG_HEADERS' macro instead
* configure.ac:22: warning: The macro `AC_PROG_LIBTOOL' is obsolete
* configure.ac:86: warning: AC_OUTPUT should be used without arguments

Change-Id: I3199e7de0a04b4df89d01277cdb305d33902fcc2
2022-08-14 13:06:52 +07:00
Vadim Yanitskiy 2fb61d0f2a update git URLs (git -> https; gitea)
Change-Id: Ic7adcdb289dff952f9897813ea1243cd1945c1ca
2022-08-14 12:34:35 +07:00
Vadim Yanitskiy c59bdf71d9 README.md: fix copy-paste: s/libosmocore/libsmpp34/
Change-Id: Ic0b804f5b3e4ddfc7b6e71195f3acf4dae2c4297
2022-08-14 12:31:50 +07:00
Pau Espin 09726c1cb1 Bump version: 1.14.0.6-1e60 → 1.14.1
Change-Id: Ifdb8f2b5a528f4c70a51322fc2ee66c99d0a68d2
2021-02-23 18:00:48 +01:00
Pau Espin 1e608c02e0 .gitignore: Ignore new autofoo tmp files
Change-Id: Ibdc5bd9ec0e4d95aa9e358502035806ade5a9521
2021-02-04 12:45:57 +01:00
Vadim Yanitskiy bb625e7d19 debian/control: change maintainer to the Osmocom team / mailing list
Change-Id: I382b5cc2becb38948dfdb783a8859157f622872b
2020-08-13 16:09:02 +07:00
Oliver Smith cecae664ff Makefile.am: EXTRA_DIST: debian, contrib/*.spec.in
Change-Id: Ic57665f98ba65e9876157c2238077fcb54256f16
2020-05-22 13:32:04 +02:00
Oliver Smith 4da2ed46b1 contrib: integrate RPM spec
Remove OpenSUSE bug report link, set version to @VERSION@, make it build with
CentOS 8 etc.

Related: OS#4550
Change-Id: If771c1298c84868a9ab0b0aba8d26325c3d810e8
2020-05-19 15:20:26 +02:00
Oliver Smith 552ea2a31e contrib: import RPM spec
Copy the RPM spec file from:
https://build.opensuse.org/project/show/home:mnhauke:osmocom:nightly

Related: OS#4550
Change-Id: Iacfa1f9a445abf7d6dc867c14c6237d9fc8750f7
2020-05-14 11:35:37 +02:00
Eric Wild 7dbf4bbe05 configure.ac: fix libtool issue with clang and sanitizer
As pointed out at https://github.com/libexpat/libexpat/issues/312
libtool does not play nice with clang sanitizer builds at all.
For those builds LD shoud be set to clang too (and LDFLAGS needs the
sanitizer flags as well), because the clang compiler driver knows how
linking to the sanitizer libs works, but then at a later stage libtool
fails to actually produce the shared libraries and the build fails. This
is fixed by this patch.

Addtionally LD_LIBRARY_PATH has no effect on conftest runs during
configure time, so the rpath needs to be set to the asan library path to
ensure the configure run does not fail due to a missing asan library,
i.e.:

SANS='-fsanitize=memory -fsanitize-recover=all -shared-libsan'
export CC=clang-10
ASANPATH=$(dirname `$CC -print-file-name=libclang_rt.asan-x86_64.so`)
export LDFLAGS="-Wl,-rpath,$ASANPATH $SANS $LDFLAGS"

Change-Id: Iae420759fbf3846221f94af4403f6273536ea00b
2020-04-11 01:17:00 +02:00
Pau Espin d2704da4cb Bump version: 1.13.0.7-ffff → 1.14.0
Change-Id: Id7ef68f50fb951dfb0687977924115204f8482a6
2019-08-07 14:48:07 +02:00
Harald Welte ffff2f6572 bind_receiver_test: Fix "unused value" of writing addr_ton twice
The constant 0x34 clearly hints that this should be written to
interface_version...

Closes: CID#135235
Change-Id: I89e16746da5c9f77b721294149a1bce5be5a1eae
2019-07-21 11:33:24 +02:00
Oliver Smith 1a6bf442ea contrib/jenkins.sh: run "make maintainer-clean"
Related: OS#3047
Change-Id: I78fc465169b9ed95a2f9aaef93f28e1ce47b551a
2019-07-10 12:09:11 +02:00
Harald Welte 6b369a4cfd Allow application to override default heap allocator
Let's introduce a mechanism by which libsmpp34-using applications can
override the memory allocator functions.  This allows us e.g. in the
Osmocom context to use talloc which aids us in debugging memory leaks.

Closes: OS#3913
Change-Id: I3656117115e89638c093bfbcbc4369ce302f7a94
2019-04-11 06:12:40 +00:00
Vadim Yanitskiy a0e85ce237 configure.ac: enable kernel style compile messages
Change-Id: I96a5d808e2a199c33a1c9eef77da3a040e305689
2019-04-10 17:50:02 +07:00
Stefan Sperling 3cf5229fa0 fix use of partly initialized struct in tcp test
Properly initialize sockaddr 'name' used by tcp test, and remove
a redundant re-declaration of this variable in a nested scope.

Change-Id: Id6e488308a72be96cca6aa661f088d2c3c67a6a3
Related: CID#188848
2018-11-21 13:23:35 +01:00
Neels Hofmeyr cf9e5f8c33 esme.c: mark switch statement fall-thru for coverity
Change-Id: I2d8f16242b8ddca855fa387ad93f52adf8bcdeec
2018-10-29 18:33:24 +01:00
Pau Espin 16ea74c638 debian/rules: Don't overwrite .tarball-version
The .tarball-version file should contain the *source version* uniquely
identifying the git commit, and not the Debian package name.

With https://gerrit.osmocom.org/#/c/osmo-ci/+/10343/ there is a correct
.tarball-version file in the .tar.xz of the nightly source packages.

Related: OS#3449
Change-Id: I30714578bc7fb3cfe333eebec89dc06eb1bbc9fe
2018-09-17 10:29:14 +02:00
24 changed files with 268 additions and 80 deletions

4
.gitignore vendored
View File

@ -3,6 +3,7 @@ Makefile.in
autom4te.cache
aux_config
.*.swp
*~
configure
INSTALL
Makefile
@ -19,3 +20,6 @@ debian/autoreconf*
debian/tmp
debian/*.log
debian/*.substvars
m4/*.m4
contrib/libsmpp34.spec

View File

@ -1,3 +1,5 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = binaries def_frame def_list
if HAVE_LIBXML2
@ -18,7 +20,10 @@ EXTRA_DIST = src/Makefile.am\
test_apps/sendwp.xml\
test_apps/recv_and_unpack.inc \
README.md \
.version
.version \
debian \
git-version-gen \
$(NULL)
@RELMAKE@

View File

@ -24,9 +24,9 @@ GIT Repository
You can clone from the Osmocom libsmpp34.git repository using
git clone git://git.osmocom.org/libsmpp34.git
git clone https://gitea.osmocom.org/cellular-infrastructure/libsmpp34
There is a cgit interface at <http://git.osmocom.org/libsmpp34/>
There is a web interface at <https://gitea.osmocom.org/cellular-infrastructure/libsmpp34>
Documentation
-------------
@ -58,5 +58,5 @@ contributions. Please see
<https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit> for
more details
The current patch queue for libosmocore can be seen at
The current patch queue for libsmpp34 can be seen at
<https://gerrit.osmocom.org/#/q/project:libsmpp34+status:open>

View File

@ -9,9 +9,8 @@ include $(top_srcdir)/test_pdu/Makefile.am
include $(top_srcdir)/test_apps/Makefile.am
include $(top_srcdir)/src/Makefile.am
LDADD = libsmpp34.la
LDADD = libsmpp34.la -lrt -lpthread
AM_CPPFLAGS = -D_REENTRANT -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS
AM_CFLAGS = @CFLAGS@ -Wall -fPIC # -static
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)
AM_LDFLAGS = -lrt -lpthread
OBJ_EXTRA_DIST = $(esme_EXTRA_DIST)

View File

@ -6,7 +6,11 @@ AC_INIT(libsmpp34, m4_esyscmd([./git-version-gen .tarball-version]), ultraismo@y
AC_CONFIG_AUX_DIR(aux_config)
AM_INIT_AUTOMAKE([foreign])
AM_CONFIG_HEADER([aux_config/config.h])
AC_CONFIG_HEADERS([aux_config/config.h])
AC_CONFIG_MACRO_DIRS([m4])
dnl kernel style compile messages
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
dnl include release helper
RELMAKE='-include osmo-release.mk'
@ -15,8 +19,13 @@ AC_SUBST([RELMAKE])
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
AC_PROG_INSTALL
LT_INIT
dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
AS_CASE(["$LD"],[*clang*],
[AS_CASE(["${host_os}"],
[*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])])
# check for pkg-config (explained in detail in libosmocore/configure.ac)
AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
@ -65,6 +74,7 @@ AC_ARG_ENABLE(werror,
if test x"$werror" = x"yes"
then
WERROR_FLAGS="-Werror"
WERROR_FLAGS+=" -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition"
WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
CFLAGS="$CFLAGS $WERROR_FLAGS"
@ -74,9 +84,10 @@ fi
AC_MSG_RESULT([CFLAGS="$CFLAGS"])
AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
AC_OUTPUT([Makefile
def_frame/Makefile
def_list/Makefile
binaries/Makefile
test_apps/Makefile
libsmpp34.pc])
AC_CONFIG_FILES([Makefile
def_frame/Makefile
def_list/Makefile
binaries/Makefile
test_apps/Makefile
libsmpp34.pc])
AC_OUTPUT

View File

@ -7,8 +7,8 @@ osmo-clean-workspace.sh
autoreconf --install --force
./configure --enable-sanitize --enable-werror
$MAKE
$MAKE $PARALLEL_MAKE
$MAKE distcheck || cat-testlogs.sh
$MAKE maintainer-clean
osmo-clean-workspace.sh

69
debian/changelog vendored
View File

@ -1,3 +1,72 @@
libsmpp34 (1.14.3) unstable; urgency=medium
[ Vadim Yanitskiy ]
* binaries/Makefile.am: libraries shall not be in AM_LDFLAGS
[ Oliver Smith ]
* debian: set compat level to 10
-- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 12 Sep 2023 12:40:43 +0200
libsmpp34 (1.14.2) unstable; urgency=medium
[ Vadim Yanitskiy ]
* README.md: fix copy-paste: s/libosmocore/libsmpp34/
* update git URLs (git -> https; gitea)
* Makefile.am, configure.ac: fix autoreconf related warnings
* contrib/jenkins.sh: actually build with $PARALLEL_MAKE
[ Max ]
* cosmetic: make linter happy
* Add #define for default SMPP port 2775
[ Harald Welte ]
* test_apps: Fix compilation of example smsc code
* Add -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition
-- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 07 Feb 2023 14:28:28 +0100
libsmpp34 (1.14.1) unstable; urgency=medium
[ Eric ]
* configure.ac: fix libtool issue with clang and sanitizer
[ Oliver Smith ]
* contrib: import RPM spec
* contrib: integrate RPM spec
* Makefile.am: EXTRA_DIST: debian, contrib/*.spec.in
[ Vadim Yanitskiy ]
* debian/control: change maintainer to the Osmocom team / mailing list
[ Pau Espin Pedrol ]
* .gitignore: Ignore new autofoo tmp files
-- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 23 Feb 2021 18:00:48 +0100
libsmpp34 (1.14.0) unstable; urgency=medium
[ Pau Espin Pedrol ]
* debian/rules: Don't overwrite .tarball-version
[ Neels Hofmeyr ]
* esme.c: mark switch statement fall-thru for coverity
[ Stefan Sperling ]
* fix use of partly initialized struct in tcp test
[ Vadim Yanitskiy ]
* configure.ac: enable kernel style compile messages
[ Harald Welte ]
* Allow application to override default heap allocator
* bind_receiver_test: Fix "unused value" of writing addr_ton twice
[ Oliver Smith ]
* contrib/jenkins.sh: run "make maintainer-clean"
-- Pau Espin Pedrol <pespin@sysmocom.de> Wed, 07 Aug 2019 14:48:06 +0200
libsmpp34 (1.13.0) unstable; urgency=medium
[ Holger Hans Peter Freyther ]

2
debian/compat vendored
View File

@ -1 +1 @@
9
10

8
debian/control vendored
View File

@ -1,8 +1,8 @@
Source: libsmpp34
Maintainer: Holger Freyther <holger@moiji-mobile.com>
Maintainer: Osmocom team <openbsc@lists.osmocom.org>
Section: libs
Priority: optional
Build-Depends: debhelper (>= 9),
Build-Depends: debhelper (>= 10),
autotools-dev,
autoconf,
automake,
@ -13,8 +13,8 @@ Build-Depends: debhelper (>= 9),
pkg-config,
libxml2-dev
Standards-Version: 3.9.6
Vcs-Browser: http://git.osmocom.org/libsmpp34/
Vcs-Git: git://git.osmocom.org/libsmpp34.git
Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/libsmpp34
Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/libsmpp34
Homepage: https://projects.osmocom.org/projects/libsmpp34
Package: libsmpp1

4
debian/rules vendored
View File

@ -14,10 +14,6 @@ VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')
override_dh_strip:
dh_strip --dbg-package=libsmpp34-dbg
override_dh_autoreconf:
echo $(VERSION) > .tarball-version
dh_autoreconf
# Print test results in case of a failure
override_dh_auto_test:
dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false)

0
m4/.gitkeep Normal file
View File

View File

@ -1,6 +1,6 @@
# This is _NOT_ the library release version, it's an API version.
# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification
LIBVERSION=1:0:0
LIBVERSION=3:0:2
# src/Makefile.am #
lib_LTLIBRARIES = libsmpp34.la
@ -10,6 +10,7 @@ libsmpp34_la_SOURCES = \
$(LIBRARY_SOURCE_DIR)/smpp34.h \
$(LIBRARY_SOURCE_DIR)/smpp34_dumpBuf.c \
$(LIBRARY_SOURCE_DIR)/smpp34_dumpPdu.c \
$(LIBRARY_SOURCE_DIR)/smpp34_heap.c \
$(LIBRARY_SOURCE_DIR)/smpp34_pack.c \
$(LIBRARY_SOURCE_DIR)/smpp34_unpack.c \
$(LIBRARY_SOURCE_DIR)/smpp34_structs.c \
@ -19,6 +20,7 @@ libsmpp34_la_SOURCES = \
include_HEADERS = \
$(LIBRARY_SOURCE_DIR)/smpp34.h \
$(LIBRARY_SOURCE_DIR)/smpp34_heap.h \
$(LIBRARY_SOURCE_DIR)/smpp34_structs.h \
$(LIBRARY_SOURCE_DIR)/smpp34_params.h

View File

@ -1,23 +1,22 @@
/*
/*
* Copyright (C) 2006 Raul Tremsal
* File : smpp34.h
* Author: Raul Tremsal <ultraismo@yahoo.com>
*
* This file is part of libsmpp34 (c-open-smpp3.4 library).
*
* The libsmpp34 library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* The libsmpp34 library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef _SMPP_H_
@ -25,42 +24,43 @@
/* SMPP Version ***************************************************************/
#define SMPP_VERSION 0x34
#define SMPP_PORT 2775
/* Command Id *****************************************************************/
#define GENERIC_NACK 0x80000000
#define BIND_RECEIVER 0x00000001
#define BIND_RECEIVER_RESP 0x80000001
#define BIND_TRANSMITTER 0x00000002
#define BIND_TRANSMITTER_RESP 0x80000002
#define QUERY_SM 0x00000003
#define QUERY_SM_RESP 0x80000003
#define SUBMIT_SM 0x00000004
#define SUBMIT_SM_RESP 0x80000004
#define DELIVER_SM 0x00000005
#define DELIVER_SM_RESP 0x80000005
#define UNBIND 0x00000006
#define UNBIND_RESP 0x80000006
#define REPLACE_SM 0x00000007
#define REPLACE_SM_RESP 0x80000007
#define CANCEL_SM 0x00000008
#define CANCEL_SM_RESP 0x80000008
#define BIND_TRANSCEIVER 0x00000009
#define BIND_TRANSCEIVER_RESP 0x80000009
#define GENERIC_NACK 0x80000000
#define BIND_RECEIVER 0x00000001
#define BIND_RECEIVER_RESP 0x80000001
#define BIND_TRANSMITTER 0x00000002
#define BIND_TRANSMITTER_RESP 0x80000002
#define QUERY_SM 0x00000003
#define QUERY_SM_RESP 0x80000003
#define SUBMIT_SM 0x00000004
#define SUBMIT_SM_RESP 0x80000004
#define DELIVER_SM 0x00000005
#define DELIVER_SM_RESP 0x80000005
#define UNBIND 0x00000006
#define UNBIND_RESP 0x80000006
#define REPLACE_SM 0x00000007
#define REPLACE_SM_RESP 0x80000007
#define CANCEL_SM 0x00000008
#define CANCEL_SM_RESP 0x80000008
#define BIND_TRANSCEIVER 0x00000009
#define BIND_TRANSCEIVER_RESP 0x80000009
/* Reserved 0x0000000A 0x8000000A */
#define OUTBIND 0x0000000B
#define OUTBIND 0x0000000B
/* Reserved 0x0000000C - 0x00000014 0x8000000B - 0x80000014 */
#define ENQUIRE_LINK 0x00000015
#define ENQUIRE_LINK_RESP 0x80000015
#define ENQUIRE_LINK 0x00000015
#define ENQUIRE_LINK_RESP 0x80000015
/* Reserved 0x00000016 - 0x00000020 0x80000016 - 0x80000020*/
#define SUBMIT_MULTI 0x00000021
#define SUBMIT_MULTI_RESP 0x80000021
#define SUBMIT_MULTI 0x00000021
#define SUBMIT_MULTI_RESP 0x80000021
/* Reserved 0x00000022 - 0x000000FF 0x80000022 - 0x800000FF */
/* Reserved 0x00000100 */
#define Reserved 0x80000100
#define Reserved 0x80000100
/* Reserved 0x00000101 0x80000101 */
#define ALERT_NOTIFICATION 0x00000102
#define ALERT_NOTIFICATION 0x00000102
/* Reserved 0x80000102 */
#define DATA_SM 0x00000103
#define DATA_SM_RESP 0x80000103
#define DATA_SM 0x00000103
#define DATA_SM_RESP 0x80000103
/* Reserved for SMPP extension 0x00000104 - 0x0000FFFF 0x80000104 - 0x8000FFFF */
/* Reserved 0x00010000 - 0x000101FF 0x80010000 - 0x800101FF */
/* Reserved for SMSC Vendor 0x00010200 - 0x000102FF 0x80010200 - 0x800102FF */

77
src/smpp34_heap.c Normal file
View File

@ -0,0 +1,77 @@
/*
* Copyright (C) 2019 Harald Welte
* File : smpp34_heap.c
* Author: Harald Welte <laforge@gnumonks.org>
*
* This file is part of libsmpp34 (c-open-smpp3.4 library).
*
* The libsmpp34 library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "smpp34_heap.h"
static void *smpp34_libc_malloc(size_t sz)
{
return malloc(sz);
}
static void *smpp34_libc_realloc(void *ptr, size_t sz)
{
return realloc(ptr, sz);
}
static void smpp34_libc_free(void *ptr)
{
return free(ptr);
}
static bool allocator_used = false;
static struct smpp34_memory_functions smpp34_allocator = {
.malloc_fun = smpp34_libc_malloc,
.realloc_fun = smpp34_libc_realloc,
.free_fun = smpp34_libc_free,
};
void smpp34_set_memory_functions(const struct smpp34_memory_functions *mf)
{
if (allocator_used) {
fprintf(stderr, "%s must be called before first use of smpp34_malloc\n", __func__);
return;
}
smpp34_allocator = *mf;
}
void *smpp34_malloc(size_t sz)
{
allocator_used = true;
return smpp34_allocator.malloc_fun(sz);
}
void *smpp34_realloc(void *ptr, size_t sz)
{
allocator_used = true;
return smpp34_allocator.realloc_fun(ptr, sz);
}
void smpp34_free(void *ptr)
{
smpp34_allocator.free_fun(ptr);
}

15
src/smpp34_heap.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include <stddef.h>
/* override the allocator with these methods; to be called BEFORE allocating anything */
struct smpp34_memory_functions {
void * (*malloc_fun)(size_t sz);
void * (*realloc_fun)(void *ptr, size_t sz);
void (*free_fun)(void *ptr);
};
void smpp34_set_memory_functions(const struct smpp34_memory_functions *mf);
void *smpp34_malloc(size_t sz);
void *smpp34_realloc(void *ptr, size_t sz);
void smpp34_free(void *ptr);

View File

@ -27,15 +27,16 @@
#include "smpp34.h"
#include "smpp34_structs.h"
#include "smpp34_heap.h"
int
build_udad( udad_t **dest, udad_t *source )
{
/* Build new DAD-Chain ************************************************/
udad_t *dummy = (udad_t*)malloc(sizeof( udad_t ));
udad_t *dummy = (udad_t*)smpp34_malloc(sizeof( udad_t ));
if( dummy == NULL ){
printf("Error in malloc()\n" );
printf("Error in smpp34_malloc()\n" );
return( -1 );
};
memcpy(dummy, source, sizeof( udad_t ));
@ -54,7 +55,7 @@ destroy_udad( udad_t *sourceList )
/* Destroy DAD-Chain **************************************************/
while( sourceList != NULL ){
i = sourceList->next;
free((void*)sourceList);
smpp34_free((void*)sourceList);
sourceList = i;
};
@ -68,9 +69,9 @@ build_dad( dad_t **dest, dad_t *source )
{
/* Build new DAD-Chain ************************************************/
dad_t *dummy = (dad_t*)malloc(sizeof( dad_t ));
dad_t *dummy = (dad_t*)smpp34_malloc(sizeof( dad_t ));
if( dummy == NULL ){
printf("Error in malloc()\n" );
printf("Error in smpp34_malloc()\n" );
return( -1 );
};
memcpy(dummy, source, sizeof( dad_t ));
@ -89,7 +90,7 @@ destroy_dad( dad_t *sourceList )
/* Destroy DAD-Chain **************************************************/
while( sourceList != NULL ){
i = sourceList->next;
free((void*)sourceList);
smpp34_free((void*)sourceList);
sourceList = i;
};
@ -102,9 +103,9 @@ build_tlv( tlv_t **dest, tlv_t *source )
{
/* Build new TLV-Chain ************************************************/
tlv_t *dummy = (tlv_t*)malloc(sizeof( tlv_t ));
tlv_t *dummy = (tlv_t*)smpp34_malloc(sizeof( tlv_t ));
if( dummy == NULL ){
printf("Error in malloc()\n" );
printf("Error in smpp34_malloc()\n" );
return( -1 );
};
memcpy(dummy, source, sizeof( tlv_t ));
@ -123,7 +124,7 @@ destroy_tlv( tlv_t *sourceList )
/* Destroy TLV-Chain **************************************************/
while( sourceList != NULL ){
i = sourceList->next;
free((void*)sourceList);
smpp34_free((void*)sourceList);
sourceList = i;
};

View File

@ -31,6 +31,7 @@
#include "smpp34.h"
#include "smpp34_structs.h"
#include "smpp34_params.h"
#include "smpp34_heap.h"
/* GLOBALS ********************************************************************/
/* EXTERN *********************************************************************/
@ -179,7 +180,7 @@ smpp34_unpack(uint32_t type, void* tt, const uint8_t *ptrBuf, int ptrLen)
#define TLV( inst, tlv3, do_tlv ){\
tlv_t *aux_tlv = NULL;\
while( (aux - ini) < t1->command_length ){\
aux_tlv = (tlv_t *) malloc(sizeof( tlv_t ));\
aux_tlv = (tlv_t *) smpp34_malloc(sizeof( tlv_t ));\
memset(aux_tlv, 0, sizeof(tlv_t));\
do_tlv( aux_tlv );\
aux_tlv->next = inst tlv3;\
@ -191,7 +192,7 @@ smpp34_unpack(uint32_t type, void* tt, const uint8_t *ptrBuf, int ptrLen)
udad_t *aux_udad = NULL;\
int c = 0;\
while( c < t1->no_unsuccess ){\
aux_udad = (udad_t *) malloc(sizeof( udad_t ));\
aux_udad = (udad_t *) smpp34_malloc(sizeof( udad_t ));\
memset(aux_udad, 0, sizeof(udad_t));\
do_udad( aux_udad );\
aux_udad->next = inst udad3;\
@ -204,7 +205,7 @@ smpp34_unpack(uint32_t type, void* tt, const uint8_t *ptrBuf, int ptrLen)
dad_t *aux_dad = NULL;\
int c = 0;\
while( c < t1->number_of_dests ){\
aux_dad = (dad_t *) malloc(sizeof( dad_t ));\
aux_dad = (dad_t *) smpp34_malloc(sizeof( dad_t ));\
memset(aux_dad, 0, sizeof(dad_t));\
do_dad( aux_dad );\
aux_dad->next = inst dad3;\

View File

@ -23,6 +23,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <libxml/xmlmemory.h>
@ -56,6 +57,7 @@ int main( int argc, char **argv )
break;
default:
printf("Error: unrecognized option\n");
/* fall thru */
case 'h':
printf("usage: %s %s\n", argv[0], HELP_FORMAT);
return( -1 );

View File

@ -23,6 +23,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <libxml/xmlmemory.h>

View File

@ -23,6 +23,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>

View File

@ -498,7 +498,7 @@ dead_socket:
}
/* call-back of write queue once it wishes to write a message to the socket */
static void esme_link_write_cb(struct osmo_fd *ofd, struct msgb *msg)
static int esme_link_write_cb(struct osmo_fd *ofd, struct msgb *msg)
{
struct osmo_esme *esme = ofd->data;
int rc;
@ -511,8 +511,10 @@ static void esme_link_write_cb(struct osmo_fd *ofd, struct msgb *msg)
smpp_esme_put(esme);
} else if (rc < msgb_length(msg)) {
LOGP(DSMPP, LOGL_ERROR, "%s: Short write\n", esme->system_id);
return;
return -1;
}
return 0;
}
/* callback for already-accepted new TCP socket */

View File

@ -34,7 +34,7 @@ int main(int argc, char **argv)
struct smsc *smsc = talloc_zero(NULL, struct smsc);
int rc;
osmo_init_logging(&log_info);
osmo_init_logging2(smsc, &log_info);
strcpy(smsc->system_id, "OpenBSC");
rc = smpp_smsc_init(smsc, 6080);

View File

@ -28,6 +28,7 @@
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <libxml/xmlmemory.h>
@ -69,7 +70,7 @@ int do_tcp_connect( xmlNodePtr p, int *s )
/* bind to a local addr */
if (strlen(local_src) != 0) {
struct sockaddr_in name;
memset(&name, 0, sizeof(name));
name.sin_family = AF_INET;
name.sin_port = htons(local_port);
name.sin_addr.s_addr = inet_addr(local_src);
@ -91,6 +92,7 @@ int do_tcp_connect( xmlNodePtr p, int *s )
};
memcpy(&addr.s_addr, _host.h_addr_list[0], sizeof(struct in_addr));
memset(&name, 0, sizeof(name));
name.sin_family = AF_INET;
name.sin_port = htons( port );
name.sin_addr = addr;

View File

@ -53,7 +53,7 @@ main( int argc, char *argv[] )
snprintf((char*)b.system_id, sizeof(b.system_id), "%s", "system_id");
snprintf((char*)b.password, sizeof(b.password), "%s", "pass");
snprintf((char*)b.system_type, sizeof(b.system_type), "%s", "syste");
b.addr_ton = 0x34;
b.interface_version = 0x34;
b.addr_ton = 2;
b.addr_npi = 1;
snprintf((char*)b.address_range, sizeof(b.address_range), "%s", "address_range");