Compare commits
30 Commits
Author | SHA1 | Date |
---|---|---|
Oliver Smith | 16b42f3d8c | |
Vadim Yanitskiy | 4b6d3f084f | |
Vadim Yanitskiy | e9ffa494f0 | |
Pau Espin | 5bf55100c6 | |
Oliver Smith | 86ff275bb1 | |
Vadim Yanitskiy | 1abf0b43fc | |
Pau Espin | 357d5af97a | |
Harald Welte | c3e797b87c | |
Harald Welte | a53391d885 | |
Max | 6613063fba | |
Max | 90acf4bd77 | |
Vadim Yanitskiy | d08cc74519 | |
Vadim Yanitskiy | 70aa4abefb | |
Vadim Yanitskiy | 2fb61d0f2a | |
Vadim Yanitskiy | c59bdf71d9 | |
Pau Espin | 09726c1cb1 | |
Pau Espin | 1e608c02e0 | |
Vadim Yanitskiy | bb625e7d19 | |
Oliver Smith | cecae664ff | |
Oliver Smith | 4da2ed46b1 | |
Oliver Smith | 552ea2a31e | |
Eric Wild | 7dbf4bbe05 | |
Pau Espin | d2704da4cb | |
Harald Welte | ffff2f6572 | |
Oliver Smith | 1a6bf442ea | |
Harald Welte | 6b369a4cfd | |
Vadim Yanitskiy | a0e85ce237 | |
Stefan Sperling | 3cf5229fa0 | |
Neels Hofmeyr | cf9e5f8c33 | |
Pau Espin | 16ea74c638 |
|
@ -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
|
||||
|
|
|
@ -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@
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
|
|
27
configure.ac
27
configure.ac
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ]
|
||||
|
|
|
@ -1 +1 @@
|
|||
9
|
||||
10
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
76
src/smpp34.h
76
src/smpp34.h
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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;\
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue