mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc.git
synced 2025-11-06 07:03:55 +00:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61f2f7123c | ||
|
|
aeea8b1145 | ||
|
|
5b25874c2b | ||
|
|
b3ee9ca764 | ||
|
|
6c7d06a50a | ||
|
|
9514e3e4ba | ||
|
|
fb6f123daf | ||
|
|
2029fbaf6a | ||
|
|
8b12076f97 | ||
|
|
4db977919c | ||
|
|
a7a5270814 | ||
|
|
f492acf37f | ||
|
|
6e3f0abd89 | ||
|
|
cfb35a8c5b | ||
|
|
78f4cc85a4 | ||
|
|
cf3c47d6bc | ||
|
|
35b230f2bf | ||
|
|
88b5f3bb04 | ||
|
|
3ae1a77bbc | ||
|
|
1c3cfd2ccc | ||
|
|
13385443a3 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -20,6 +20,7 @@ depcomp
|
|||||||
install-sh
|
install-sh
|
||||||
missing
|
missing
|
||||||
stamp-h1
|
stamp-h1
|
||||||
|
configure~
|
||||||
|
|
||||||
# libtool
|
# libtool
|
||||||
ltmain.sh
|
ltmain.sh
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ GIT Repository
|
|||||||
|
|
||||||
You can clone from the official osmo-cbc.git repository using
|
You can clone from the official osmo-cbc.git repository using
|
||||||
|
|
||||||
git clone https://git.osmocom.org/osmo-cbc.git
|
git clone https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc
|
||||||
|
|
||||||
There is a cgit interface at https://git.osmocom.org/osmo-cbc/
|
There is a web interface at <https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc>
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
"num_of_bcast": { "$ref": "#/definitions/number_of_broadcasts" },
|
"num_of_bcast": { "$ref": "#/definitions/number_of_broadcasts" },
|
||||||
"scope": { "$ref": "#/definitions/scope" },
|
"scope": { "$ref": "#/definitions/scope" },
|
||||||
"warning_period_sec": { "$ref": "#/definitions/warning_period_sec" },
|
"warning_period_sec": { "$ref": "#/definitions/warning_period_sec" },
|
||||||
"smscb": { "$ref": "smscb.schema.json#definitions/smscb_message" }
|
"smscb_message": { "$ref": "smscb.schema.json#definitions/smscb_message" }
|
||||||
},
|
},
|
||||||
"required": [ "scope", "smscb" }
|
"required": [ "scope", "smscb" }
|
||||||
}
|
}
|
||||||
|
|||||||
10
configure.ac
10
configure.ac
@@ -31,10 +31,10 @@ if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
|
|||||||
fi
|
fi
|
||||||
PKG_PROG_PKG_CONFIG([0.20])
|
PKG_PROG_PKG_CONFIG([0.20])
|
||||||
|
|
||||||
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.0.0)
|
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.7.0)
|
||||||
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.0.0)
|
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.7.0)
|
||||||
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.0.0)
|
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.7.0)
|
||||||
PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.4.0)
|
PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.2.0)
|
||||||
PKG_CHECK_MODULES(ULFIUS, libulfius)
|
PKG_CHECK_MODULES(ULFIUS, libulfius)
|
||||||
PKG_CHECK_MODULES(JANSSON, jansson)
|
PKG_CHECK_MODULES(JANSSON, jansson)
|
||||||
PKG_CHECK_MODULES(ORCANIA, liborcania)
|
PKG_CHECK_MODULES(ORCANIA, liborcania)
|
||||||
@@ -157,7 +157,7 @@ if test "x$enable_ext_tests" = "xyes" ; then
|
|||||||
AM_PATH_PYTHON
|
AM_PATH_PYTHON
|
||||||
AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmo_verify_transcript_vty.py,yes)
|
AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmo_verify_transcript_vty.py,yes)
|
||||||
if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
|
if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
|
||||||
AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.])
|
AC_MSG_ERROR([Please install https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests to run the VTY/CTRL tests.])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
|
AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
|
||||||
|
|||||||
@@ -30,16 +30,10 @@ BuildRequires: pkgconfig >= 0.20
|
|||||||
%if 0%{?suse_version}
|
%if 0%{?suse_version}
|
||||||
BuildRequires: systemd-rpm-macros
|
BuildRequires: systemd-rpm-macros
|
||||||
%endif
|
%endif
|
||||||
BuildRequires: pkgconfig(libcrypto) >= 0.9.5
|
BuildRequires: pkgconfig(libosmocore) >= 1.7.0
|
||||||
BuildRequires: pkgconfig(libosmo-netif) >= 0.6.0
|
BuildRequires: pkgconfig(libosmogsm) >= 1.7.0
|
||||||
BuildRequires: pkgconfig(libosmo-sccp) >= 0.10.0
|
BuildRequires: pkgconfig(libosmovty) >= 1.7.0
|
||||||
BuildRequires: pkgconfig(libosmo-sigtran) >= 0.10.0
|
BuildRequires: pkgconfig(libosmo-netif) >= 1.2.0
|
||||||
BuildRequires: pkgconfig(libosmoabis) >= 0.6.0
|
|
||||||
BuildRequires: pkgconfig(libosmocore) >= 1.2.0
|
|
||||||
BuildRequires: pkgconfig(libosmoctrl) >= 1.2.0
|
|
||||||
BuildRequires: pkgconfig(libosmogb)
|
|
||||||
BuildRequires: pkgconfig(libosmogsm) >= 1.2.0
|
|
||||||
BuildRequires: pkgconfig(libosmovty) >= 1.2.0
|
|
||||||
BuildRequires: pkgconfig(talloc)
|
BuildRequires: pkgconfig(talloc)
|
||||||
BuildRequires: pkgconfig(libulfius)
|
BuildRequires: pkgconfig(libulfius)
|
||||||
%{?systemd_requires}
|
%{?systemd_requires}
|
||||||
|
|||||||
39
debian/changelog
vendored
39
debian/changelog
vendored
@@ -1,3 +1,42 @@
|
|||||||
|
osmo-cbc (0.3.0) unstable; urgency=medium
|
||||||
|
|
||||||
|
[ Vadim Yanitskiy ]
|
||||||
|
* doc/examples: make osmo-cbc.cfg file more informative
|
||||||
|
* VTY: cosmetic: use VTY_IPV46_CMD in the command string
|
||||||
|
* VTY: fix incomplete 'remote-ip' command description
|
||||||
|
|
||||||
|
[ Harald Welte ]
|
||||||
|
* CBSP: Set Channel Indication IE in KILL for CBS
|
||||||
|
* CBSP: Append/store results in KILL COMPLETE + KILL FAIL
|
||||||
|
* cbc: Don't crash if peer->remote_host is NULL
|
||||||
|
* update git URLs (git -> https; gitea)
|
||||||
|
|
||||||
|
[ Pau Espin Pedrol ]
|
||||||
|
* vty. Fix several typos and missing param descriptions
|
||||||
|
* src/Makefile: Reformat files one per line
|
||||||
|
* cbsp_server.h: Move function to the proper section
|
||||||
|
* Rework cbsp_cbc_create() params
|
||||||
|
* cbsp_server: Reorder logged message
|
||||||
|
* .gitignore: add configure~
|
||||||
|
|
||||||
|
-- Pau Espin Pedrol <pespin@sysmocom.de> Wed, 29 Jun 2022 12:00:03 +0200
|
||||||
|
|
||||||
|
osmo-cbc (0.2.3) unstable; urgency=medium
|
||||||
|
|
||||||
|
[ Harald Welte ]
|
||||||
|
* varaible for atoi() result shouild be signed integer
|
||||||
|
|
||||||
|
-- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 16 Nov 2021 18:05:21 +0100
|
||||||
|
|
||||||
|
osmo-cbc (0.2.2) unstable; urgency=medium
|
||||||
|
|
||||||
|
* rest_api.c: Add missing \n in log line after error message
|
||||||
|
* bring JSON schema in sync with reality
|
||||||
|
* fix encoding of CBSP cell identifiers
|
||||||
|
* Update dependencies to current libosmocore & co
|
||||||
|
|
||||||
|
-- Harald Welte <laforge@osmocom.org> Tue, 23 Feb 2021 20:40:44 +0100
|
||||||
|
|
||||||
osmo-cbc (0.2.1) unstable; urgency=medium
|
osmo-cbc (0.2.1) unstable; urgency=medium
|
||||||
|
|
||||||
[ Harald Welte ]
|
[ Harald Welte ]
|
||||||
|
|||||||
8
debian/control
vendored
8
debian/control
vendored
@@ -11,14 +11,14 @@ Build-Depends: debhelper (>=9),
|
|||||||
pkg-config,
|
pkg-config,
|
||||||
python3-minimal,
|
python3-minimal,
|
||||||
libtalloc-dev,
|
libtalloc-dev,
|
||||||
libosmocore-dev,
|
libosmocore-dev (>= 1.7.0),
|
||||||
libosmo-netif-dev,
|
libosmo-netif-dev (>= 1.2.0),
|
||||||
libulfius-dev,
|
libulfius-dev,
|
||||||
libjansson-dev,
|
libjansson-dev,
|
||||||
osmo-gsm-manuals-dev
|
osmo-gsm-manuals-dev
|
||||||
Standards-Version: 3.9.8
|
Standards-Version: 3.9.8
|
||||||
Vcs-Git: git://git.osmocom.org/osmo-cbc.git
|
Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc
|
||||||
Vcs-Browser: https://git.osmocom.org/osmo-cbc/
|
Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc
|
||||||
Homepage: https://projects.osmocom.org/projects/osmo-cbc
|
Homepage: https://projects.osmocom.org/projects/osmo-cbc
|
||||||
|
|
||||||
Package: osmo-cbc
|
Package: osmo-cbc
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
|
||||||
log stderr
|
log stderr
|
||||||
logging level cbsp debug
|
logging level cbsp debug
|
||||||
|
cbc
|
||||||
|
unknown-peers reject
|
||||||
|
cbsp
|
||||||
|
local-ip 127.0.0.1
|
||||||
|
local-port 48049
|
||||||
|
ecbe
|
||||||
|
local-ip 127.0.0.1
|
||||||
|
local-port 12345
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
"dcs_class": { "$ref": "#/definitions/dcs_class" },
|
"dcs_class": { "$ref": "#/definitions/dcs_class" },
|
||||||
"data_utf8": { "type": "string" }
|
"data_utf8": { "type": "string" }
|
||||||
},
|
},
|
||||||
"required": [ "data" ]
|
"required": [ "data_utf8" ]
|
||||||
},
|
},
|
||||||
"page": {
|
"page": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|||||||
@@ -5,14 +5,30 @@ AM_CFLAGS=-Wall -g $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAG
|
|||||||
$(COVERAGE_CFLAGS)
|
$(COVERAGE_CFLAGS)
|
||||||
AM_LDFLAGS=$(COVERAGE_LDFLAGS)
|
AM_LDFLAGS=$(COVERAGE_LDFLAGS)
|
||||||
|
|
||||||
EXTRA_DIST = cbc_data.h cbsp_server.h charset.h internal.h rest_it_op.h
|
EXTRA_DIST = \
|
||||||
|
cbc_data.h \
|
||||||
|
cbsp_server.h \
|
||||||
|
charset.h \
|
||||||
|
internal.h \
|
||||||
|
rest_it_op.h \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
bin_PROGRAMS = osmo-cbc
|
bin_PROGRAMS = osmo-cbc
|
||||||
|
|
||||||
osmo_cbc_SOURCES = cbc_main.c cbc_data.c cbc_vty.c cbsp_server.c cbsp_server_fsm.c \
|
osmo_cbc_SOURCES = \
|
||||||
rest_api.c charset.c message_handling.c rest_it_op.c \
|
cbc_main.c \
|
||||||
smscb_peer_fsm.c smscb_message_fsm.c
|
cbc_data.c \
|
||||||
|
cbc_vty.c \
|
||||||
|
cbsp_server.c \
|
||||||
|
cbsp_server_fsm.c \
|
||||||
|
rest_api.c \
|
||||||
|
charset.c \
|
||||||
|
message_handling.c \
|
||||||
|
rest_it_op.c \
|
||||||
|
smscb_peer_fsm.c \
|
||||||
|
smscb_message_fsm.c \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
osmo_cbc_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) \
|
osmo_cbc_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) \
|
||||||
$(LIBOSMONETIF_LIBS) \
|
$(LIBOSMONETIF_LIBS) \
|
||||||
$(ULFIUS_LIBS) $(JANSSON_LIBS) $(ORCANIA_LIBS)
|
$(ULFIUS_LIBS) $(JANSSON_LIBS) $(ORCANIA_LIBS)
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ struct cbc_peer *cbc_peer_by_addr_proto(const char *remote_host, uint16_t remote
|
|||||||
struct cbc_peer *peer;
|
struct cbc_peer *peer;
|
||||||
|
|
||||||
llist_for_each_entry(peer, &g_cbc->peers, list) {
|
llist_for_each_entry(peer, &g_cbc->peers, list) {
|
||||||
|
if (!peer->remote_host)
|
||||||
|
continue;
|
||||||
if (!strcasecmp(remote_host, peer->remote_host)) {
|
if (!strcasecmp(remote_host, peer->remote_host)) {
|
||||||
if (peer->remote_port == -1)
|
if (peer->remote_port == -1)
|
||||||
return peer;
|
return peer;
|
||||||
|
|||||||
@@ -244,8 +244,7 @@ int main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cbsp_cbc_create(tall_cbc_ctx, g_cbc->config.cbsp.local_host, g_cbc->config.cbsp.local_port,
|
if (cbsp_cbc_create(tall_cbc_ctx) == NULL) {
|
||||||
&cbc_client_rx_cb) == NULL) {
|
|
||||||
perror("Error binidng CBSP port\n");
|
perror("Error binidng CBSP port\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ static void dump_one_cbc_peer(struct vty *vty, const struct cbc_peer *peer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vty_out(vty, "|%-20s| %-15s| %-5d| %-6s| %-20s|%s",
|
vty_out(vty, "|%-20s| %-15s| %-5d| %-6s| %-20s|%s",
|
||||||
peer->name ? peer->name : "<unnamed>", peer->remote_host, peer->remote_port,
|
peer->name ? peer->name : "<unnamed>",
|
||||||
|
peer->remote_host ? peer->remote_host : "<unset>", peer->remote_port,
|
||||||
get_value_string(cbc_peer_proto_name, peer->proto), state, VTY_NEWLINE);
|
get_value_string(cbc_peer_proto_name, peer->proto), state, VTY_NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,7 +348,7 @@ static int config_write_cbsp(struct vty *vty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEFUN(cfg_cbsp_local_ip, cfg_cbsp_local_ip_cmd,
|
DEFUN(cfg_cbsp_local_ip, cfg_cbsp_local_ip_cmd,
|
||||||
"local-ip (A.B.C.D|X:X::X:X)",
|
"local-ip " VTY_IPV46_CMD,
|
||||||
"Local IP address for CBSP\n"
|
"Local IP address for CBSP\n"
|
||||||
"Local IPv4 address for CBSP\n" "Local IPv6 address for CBSP\n")
|
"Local IPv4 address for CBSP\n" "Local IPv6 address for CBSP\n")
|
||||||
{
|
{
|
||||||
@@ -383,7 +384,7 @@ static int config_write_ecbe(struct vty *vty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEFUN(cfg_ecbe_local_ip, cfg_ecbe_local_ip_cmd,
|
DEFUN(cfg_ecbe_local_ip, cfg_ecbe_local_ip_cmd,
|
||||||
"local-ip (A.B.C.D|X:X::X:X)",
|
"local-ip " VTY_IPV46_CMD,
|
||||||
"Local IP address for CBSP\n"
|
"Local IP address for CBSP\n"
|
||||||
"Local IPv4 address for ECBE REST Interface\n"
|
"Local IPv4 address for ECBE REST Interface\n"
|
||||||
"Local IPv6 address for ECBE REST Interface\n")
|
"Local IPv6 address for ECBE REST Interface\n")
|
||||||
@@ -394,8 +395,8 @@ DEFUN(cfg_ecbe_local_ip, cfg_ecbe_local_ip_cmd,
|
|||||||
|
|
||||||
DEFUN(cfg_ecbe_local_port, cfg_ecbe_local_port_cmd,
|
DEFUN(cfg_ecbe_local_port, cfg_ecbe_local_port_cmd,
|
||||||
"local-port <0-65535>",
|
"local-port <0-65535>",
|
||||||
"Local TCP port for ECBE RESET Interface\n"
|
"Local TCP port for ECBE REST Interface\n"
|
||||||
"Local TCP port for ECBE RESET Interface\n")
|
"Local TCP port for ECBE REST Interface\n")
|
||||||
{
|
{
|
||||||
g_cbc->config.ecbe.local_port = atoi(argv[0]);
|
g_cbc->config.ecbe.local_port = atoi(argv[0]);
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
@@ -406,7 +407,8 @@ DEFUN(cfg_ecbe_local_port, cfg_ecbe_local_port_cmd,
|
|||||||
|
|
||||||
DEFUN(cfg_cbc_peer, cfg_cbc_peer_cmd,
|
DEFUN(cfg_cbc_peer, cfg_cbc_peer_cmd,
|
||||||
"peer NAME",
|
"peer NAME",
|
||||||
"Remote Peer\n")
|
"Remote Peer\n"
|
||||||
|
"Name identifying the peer\n")
|
||||||
{
|
{
|
||||||
struct cbc_peer *peer;
|
struct cbc_peer *peer;
|
||||||
|
|
||||||
@@ -423,7 +425,8 @@ DEFUN(cfg_cbc_peer, cfg_cbc_peer_cmd,
|
|||||||
|
|
||||||
DEFUN(cfg_cbc_no_peer, cfg_cbc_no_peer_cmd,
|
DEFUN(cfg_cbc_no_peer, cfg_cbc_no_peer_cmd,
|
||||||
"no peer NAME",
|
"no peer NAME",
|
||||||
NO_STR "Remote Peer\n")
|
NO_STR "Remote Peer\n"
|
||||||
|
"Name identifying the peer\n")
|
||||||
{
|
{
|
||||||
struct cbc_peer *peer;
|
struct cbc_peer *peer;
|
||||||
|
|
||||||
@@ -469,9 +472,9 @@ DEFUN(cfg_peer_no_remote_port, cfg_peer_no_remote_port_cmd,
|
|||||||
|
|
||||||
|
|
||||||
DEFUN(cfg_peer_remote_ip, cfg_peer_remote_ip_cmd,
|
DEFUN(cfg_peer_remote_ip, cfg_peer_remote_ip_cmd,
|
||||||
"remote-ip (A.B.C.D|X:X::X:X)",
|
"remote-ip " VTY_IPV46_CMD,
|
||||||
"Configure remote IP of peer\n"
|
"Configure remote IP of peer\n"
|
||||||
"Remote IP address of peer\n")
|
"IPv4 address of peer\n" "IPv6 address of peer\n")
|
||||||
{
|
{
|
||||||
struct cbc_peer *peer = (struct cbc_peer *) vty->index;
|
struct cbc_peer *peer = (struct cbc_peer *) vty->index;
|
||||||
osmo_talloc_replace_string(peer, &peer->remote_host, argv[0]);
|
osmo_talloc_replace_string(peer, &peer->remote_host, argv[0]);
|
||||||
@@ -488,7 +491,8 @@ static void write_one_peer(struct vty *vty, struct cbc_peer *peer)
|
|||||||
vty_out(vty, " no remote-port%s", VTY_NEWLINE);
|
vty_out(vty, " no remote-port%s", VTY_NEWLINE);
|
||||||
else
|
else
|
||||||
vty_out(vty, " remote-port %d%s", peer->remote_port, VTY_NEWLINE);
|
vty_out(vty, " remote-port %d%s", peer->remote_port, VTY_NEWLINE);
|
||||||
vty_out(vty, " remote-ip %s%s", peer->remote_host, VTY_NEWLINE);
|
if (peer->remote_host)
|
||||||
|
vty_out(vty, " remote-ip %s%s", peer->remote_host, VTY_NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_write_peer(struct vty *vty)
|
static int config_write_peer(struct vty *vty)
|
||||||
|
|||||||
@@ -126,6 +126,8 @@ static int cbsp_cbc_accept_cb(struct osmo_stream_srv_link *link, int fd)
|
|||||||
osmo_sock_get_ip_and_port(fd, remote_ip, sizeof(remote_ip), portbuf, sizeof(portbuf), false);
|
osmo_sock_get_ip_and_port(fd, remote_ip, sizeof(remote_ip), portbuf, sizeof(portbuf), false);
|
||||||
remote_port = atoi(portbuf);
|
remote_port = atoi(portbuf);
|
||||||
|
|
||||||
|
LOGP(DCBSP, LOGL_NOTICE, "New CBSP client connection from %s:%u\n", remote_ip, remote_port);
|
||||||
|
|
||||||
client->conn = osmo_stream_srv_create(link, link, fd, cbsp_cbc_read_cb, cbsp_cbc_closed_cb, client);
|
client->conn = osmo_stream_srv_create(link, link, fd, cbsp_cbc_read_cb, cbsp_cbc_closed_cb, client);
|
||||||
if (!client->conn) {
|
if (!client->conn) {
|
||||||
LOGP(DCBSP, LOGL_ERROR, "Unable to create stream server for %s:%d\n",
|
LOGP(DCBSP, LOGL_ERROR, "Unable to create stream server for %s:%d\n",
|
||||||
@@ -167,9 +169,7 @@ static int cbsp_cbc_accept_cb(struct osmo_stream_srv_link *link, int fd)
|
|||||||
client->peer->client.cbsp = client;
|
client->peer->client.cbsp = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGPCC(client, LOGL_NOTICE, "New CBSP client connection from %s:%u\n", remote_ip, remote_port);
|
|
||||||
osmo_fsm_inst_dispatch(client->fi, CBSP_SRV_E_CMD_RESET, NULL);
|
osmo_fsm_inst_dispatch(client->fi, CBSP_SRV_E_CMD_RESET, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,18 +206,18 @@ void cbsp_cbc_client_close(struct osmo_cbsp_cbc_client *client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* initialize the CBC-side CBSP server */
|
/* initialize the CBC-side CBSP server */
|
||||||
struct osmo_cbsp_cbc *cbsp_cbc_create(void *ctx, const char *bind_ip, int bind_port,
|
struct osmo_cbsp_cbc *cbsp_cbc_create(void *ctx)
|
||||||
int (*rx_cb)(struct osmo_cbsp_cbc_client *client,
|
|
||||||
struct osmo_cbsp_decoded *dec))
|
|
||||||
{
|
{
|
||||||
struct osmo_cbsp_cbc *cbc = talloc_zero(ctx, struct osmo_cbsp_cbc);
|
struct osmo_cbsp_cbc *cbc = talloc_zero(ctx, struct osmo_cbsp_cbc);
|
||||||
int rc;
|
int rc;
|
||||||
|
char *bind_ip = g_cbc->config.cbsp.local_host;
|
||||||
|
int bind_port = g_cbc->config.cbsp.local_port;
|
||||||
|
|
||||||
if (bind_port == -1)
|
if (bind_port == -1)
|
||||||
bind_port = CBSP_TCP_PORT;
|
bind_port = CBSP_TCP_PORT;
|
||||||
|
|
||||||
OSMO_ASSERT(cbc);
|
OSMO_ASSERT(cbc);
|
||||||
cbc->rx_cb = rx_cb;
|
cbc->rx_cb = cbsp_cbc_client_rx_cb;
|
||||||
INIT_LLIST_HEAD(&cbc->clients);
|
INIT_LLIST_HEAD(&cbc->clients);
|
||||||
cbc->link = osmo_stream_srv_link_create(cbc);
|
cbc->link = osmo_stream_srv_link_create(cbc);
|
||||||
osmo_stream_srv_link_set_data(cbc->link, cbc);
|
osmo_stream_srv_link_set_data(cbc->link, cbc);
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ struct osmo_cbsp_cbc {
|
|||||||
int (*rx_cb)(struct osmo_cbsp_cbc_client *client, struct osmo_cbsp_decoded *dec);
|
int (*rx_cb)(struct osmo_cbsp_cbc_client *client, struct osmo_cbsp_decoded *dec);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct osmo_cbsp_cbc *cbsp_cbc_create(void *ctx);
|
||||||
|
|
||||||
/* a single (remote) client connected to the (local) CBC server */
|
/* a single (remote) client connected to the (local) CBC server */
|
||||||
struct osmo_cbsp_cbc_client {
|
struct osmo_cbsp_cbc_client {
|
||||||
/* entry in osmo_cbsp_cbc.clients */
|
/* entry in osmo_cbsp_cbc.clients */
|
||||||
@@ -40,6 +42,4 @@ struct osmo_cbsp_cbc_client {
|
|||||||
const char *cbsp_cbc_client_name(const struct osmo_cbsp_cbc_client *client);
|
const char *cbsp_cbc_client_name(const struct osmo_cbsp_cbc_client *client);
|
||||||
void cbsp_cbc_client_tx(struct osmo_cbsp_cbc_client *client, struct osmo_cbsp_decoded *cbsp);
|
void cbsp_cbc_client_tx(struct osmo_cbsp_cbc_client *client, struct osmo_cbsp_decoded *cbsp);
|
||||||
void cbsp_cbc_client_close(struct osmo_cbsp_cbc_client *client);
|
void cbsp_cbc_client_close(struct osmo_cbsp_cbc_client *client);
|
||||||
struct osmo_cbsp_cbc *cbsp_cbc_create(void *ctx, const char *bind_ip, int bind_port,
|
int cbsp_cbc_client_rx_cb(struct osmo_cbsp_cbc_client *client, struct osmo_cbsp_decoded *dec);
|
||||||
int (*rx_cb)(struct osmo_cbsp_cbc_client *client,
|
|
||||||
struct osmo_cbsp_decoded *dec));
|
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ static int get_msg_id(const struct osmo_cbsp_decoded *dec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* message was received from remote CBSP peer (BSC) */
|
/* message was received from remote CBSP peer (BSC) */
|
||||||
int cbc_client_rx_cb(struct osmo_cbsp_cbc_client *client, struct osmo_cbsp_decoded *dec)
|
int cbsp_cbc_client_rx_cb(struct osmo_cbsp_cbc_client *client, struct osmo_cbsp_decoded *dec)
|
||||||
{
|
{
|
||||||
struct cbc_message *smscb;
|
struct cbc_message *smscb;
|
||||||
struct cbc_message_peer *mp;
|
struct cbc_message_peer *mp;
|
||||||
|
|||||||
@@ -589,7 +589,7 @@ static int api_cb_message_post(const struct _u_request *req, struct _u_response
|
|||||||
return U_CALLBACK_COMPLETE;
|
return U_CALLBACK_COMPLETE;
|
||||||
err:
|
err:
|
||||||
jsonstr = json_dumps(json_req, 0);
|
jsonstr = json_dumps(json_req, 0);
|
||||||
LOGP(DREST, LOGL_ERROR, "ERROR: %s (%s)", errstr, jsonstr);
|
LOGP(DREST, LOGL_ERROR, "ERROR: %s (%s)\n", errstr, jsonstr);
|
||||||
free(jsonstr);
|
free(jsonstr);
|
||||||
json_decref(json_req);
|
json_decref(json_req);
|
||||||
talloc_free(riop);
|
talloc_free(riop);
|
||||||
@@ -602,7 +602,7 @@ static int api_cb_message_del(const struct _u_request *req, struct _u_response *
|
|||||||
{
|
{
|
||||||
const char *message_id_str = u_map_get(req->map_url, "message_id");
|
const char *message_id_str = u_map_get(req->map_url, "message_id");
|
||||||
struct rest_it_op *riop = talloc_zero(g_cbc, struct rest_it_op);
|
struct rest_it_op *riop = talloc_zero(g_cbc, struct rest_it_op);
|
||||||
uint16_t message_id;
|
int message_id;
|
||||||
int status = 404;
|
int status = 404;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
|||||||
@@ -149,25 +149,28 @@ static void cci_from_cbsp(struct cbc_cell_id *cci, enum CELL_IDENT id_discr,
|
|||||||
static void cbsp_from_cci(union gsm0808_cell_id_u *u, const struct cbc_cell_id *cci)
|
static void cbsp_from_cci(union gsm0808_cell_id_u *u, const struct cbc_cell_id *cci)
|
||||||
{
|
{
|
||||||
switch (cci->id_discr) {
|
switch (cci->id_discr) {
|
||||||
case CELL_IDENT_NO_CELL:
|
case CBC_CELL_ID_NONE:
|
||||||
break;
|
break;
|
||||||
case CELL_IDENT_WHOLE_GLOBAL:
|
case CBC_CELL_ID_CGI:
|
||||||
u->global = cci->u.cgi;
|
u->global = cci->u.cgi;
|
||||||
|
printf("u->gobal: %s\n", osmo_hexdump((uint8_t *) &u->global, sizeof(u->global)));
|
||||||
break;
|
break;
|
||||||
case CELL_IDENT_LAC_AND_CI:
|
case CBC_CELL_ID_LAC_CI:
|
||||||
u->lac_and_ci = cci->u.lac_and_ci;
|
u->lac_and_ci = cci->u.lac_and_ci;
|
||||||
break;
|
break;
|
||||||
case CELL_IDENT_CI:
|
case CBC_CELL_ID_CI:
|
||||||
u->ci = cci->u.ci;
|
u->ci = cci->u.ci;
|
||||||
break;
|
break;
|
||||||
case CELL_IDENT_LAI:
|
case CBC_CELL_ID_LAI:
|
||||||
u->lai_and_lac = cci->u.lai;
|
u->lai_and_lac = cci->u.lai;
|
||||||
break;
|
break;
|
||||||
case CELL_IDENT_LAC:
|
case CBC_CELL_ID_LAC:
|
||||||
u->lac = cci->u.lac;
|
u->lac = cci->u.lac;
|
||||||
break;
|
break;
|
||||||
case CELL_IDENT_BSS:
|
case CBC_CELL_ID_BSS:
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
OSMO_ASSERT(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,16 +411,24 @@ static void smscb_p_fsm_wait_replace_ack(struct osmo_fsm_inst *fi, uint32_t even
|
|||||||
static void smscb_p_fsm_wait_delete_ack(struct osmo_fsm_inst *fi, uint32_t event, void *data)
|
static void smscb_p_fsm_wait_delete_ack(struct osmo_fsm_inst *fi, uint32_t event, void *data)
|
||||||
{
|
{
|
||||||
struct cbc_message_peer *mp = (struct cbc_message_peer *) fi->priv;
|
struct cbc_message_peer *mp = (struct cbc_message_peer *) fi->priv;
|
||||||
|
struct osmo_cbsp_decoded *dec = NULL;
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case SMSCB_E_CBSP_DELETE_ACK:
|
case SMSCB_E_CBSP_DELETE_ACK:
|
||||||
/* TODO: append results */
|
dec = data;
|
||||||
|
/* append results */
|
||||||
|
msg_peer_append_cbsp_compl(mp, &dec->u.kill_compl.num_compl_list);
|
||||||
|
msg_peer_append_cbsp_cell(mp, &dec->u.kill_compl.cell_list);
|
||||||
/* Signal parent fsm about completion */
|
/* Signal parent fsm about completion */
|
||||||
osmo_fsm_inst_dispatch(fi->proc.parent, SMSCB_E_CBSP_DELETE_ACK, mp);
|
osmo_fsm_inst_dispatch(fi->proc.parent, SMSCB_E_CBSP_DELETE_ACK, mp);
|
||||||
osmo_fsm_inst_state_chg(fi, SMSCB_S_DELETED, 0, 0);
|
osmo_fsm_inst_state_chg(fi, SMSCB_S_DELETED, 0, 0);
|
||||||
break;
|
break;
|
||||||
case SMSCB_E_CBSP_DELETE_NACK:
|
case SMSCB_E_CBSP_DELETE_NACK:
|
||||||
/* TODO: append results */
|
dec = data;
|
||||||
|
/* append results */
|
||||||
|
msg_peer_append_cbsp_compl(mp, &dec->u.kill_fail.num_compl_list);
|
||||||
|
msg_peer_append_cbsp_cell(mp, &dec->u.kill_fail.cell_list);
|
||||||
|
msg_peer_append_cbsp_fail(mp, &dec->u.kill_fail.fail_list);
|
||||||
/* Signal parent fsm about completion */
|
/* Signal parent fsm about completion */
|
||||||
osmo_fsm_inst_dispatch(fi->proc.parent, SMSCB_E_CBSP_DELETE_NACK, mp);
|
osmo_fsm_inst_dispatch(fi->proc.parent, SMSCB_E_CBSP_DELETE_NACK, mp);
|
||||||
osmo_fsm_inst_state_chg(fi, SMSCB_S_DELETED, 0, 0);
|
osmo_fsm_inst_state_chg(fi, SMSCB_S_DELETED, 0, 0);
|
||||||
@@ -476,6 +487,12 @@ static void smscb_p_fsm_allstate(struct osmo_fsm_inst *fi, uint32_t event, void
|
|||||||
cbsp->u.kill.old_serial_nr = mp->cbcmsg->msg.serial_nr;
|
cbsp->u.kill.old_serial_nr = mp->cbcmsg->msg.serial_nr;
|
||||||
/* TODO: we assume that the delete will always affect all original cells */
|
/* TODO: we assume that the delete will always affect all original cells */
|
||||||
cbsp_append_cell_list(&cbsp->u.kill.cell_list, cbsp, mp);
|
cbsp_append_cell_list(&cbsp->u.kill.cell_list, cbsp, mp);
|
||||||
|
if (!mp->cbcmsg->msg.is_etws) {
|
||||||
|
/* Channel Indication IE is only present in CBS, not in ETWS! */
|
||||||
|
cbsp->u.kill.channel_ind = talloc_zero(cbsp, enum cbsp_channel_ind);
|
||||||
|
OSMO_ASSERT(cbsp->u.kill.channel_ind);
|
||||||
|
*(cbsp->u.kill.channel_ind) = CBSP_CHAN_IND_BASIC;
|
||||||
|
}
|
||||||
cbsp_cbc_client_tx(mp->peer->client.cbsp, cbsp);
|
cbsp_cbc_client_tx(mp->peer->client.cbsp, cbsp);
|
||||||
osmo_fsm_inst_state_chg(fi, SMSCB_S_WAIT_DELETE_ACK, 10, T_WAIT_DELETE_ACK);
|
osmo_fsm_inst_state_chg(fi, SMSCB_S_WAIT_DELETE_ACK, 10, T_WAIT_DELETE_ACK);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user