hnbgw: Add SUA client socket towards localhost
This socket doesn't do much yet except to connect to localhost:14001 The host/port needs to be made configurable, and the RUA<->SUA interfacing needs to be implemented. Also, we'll need two SUA sockets, one for MSC and one for SGSN.
This commit is contained in:
parent
38a4f32d58
commit
75a4e65f52
|
@ -18,6 +18,7 @@ AC_PROG_RANLIB
|
|||
PKG_CHECK_MODULES(OSMOCORE, libosmocore)
|
||||
PKG_CHECK_MODULES(OSMOGSM, libosmogsm)
|
||||
PKG_CHECK_MODULES(OSMOVTY, libosmovty)
|
||||
PKG_CHECK_MODULES(OSMOSIGTRAN, libosmo-sigtran)
|
||||
PKG_CHECK_MODULES(ASN1C, libasn1c)
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
|
|
@ -3,13 +3,13 @@ SUBDIRS = hnbap rua ranap tests
|
|||
ASN1_ROOT = $(top_builddir)/asn1/
|
||||
ASN1TOSTRUCT = $(ASN1_ROOT)/utils/asn1tostruct.py
|
||||
|
||||
AM_CFLAGS = $(OSMOCORE_CFLAGS) $(OSMOVTY_CFLAGS) $(OSMOGSM_CFLAGS) $(ASN1C_CFLAGS) -Ihnbap/
|
||||
AM_CFLAGS = $(OSMOCORE_CFLAGS) $(OSMOVTY_CFLAGS) $(OSMOGSM_CFLAGS) $(ASN1C_CFLAGS) $(OSMOSIGTRAN_CFLAGS) -Ihnbap/
|
||||
COMMON_LDADD = -lsctp
|
||||
|
||||
bin_PROGRAMS = hnbgw
|
||||
|
||||
hnbgw_SOURCES = hnbap_encoder.c hnbap_decoder.c rua_encoder.c rua_decoder.c ranap_common.c rua_common.c hnbap_common.c iu_helpers.c asn1helpers.c hnbgw.c hnbgw_hnbap.c hnbgw_rua.c hnbgw_ranap.c ranap_decoder.c ranap_encoder.c ranap_msg_factory.c
|
||||
hnbgw_LDADD = $(OSMOCORE_LIBS) $(OSMOVTY_LIBS) $(OSMOGSM_LIBS) $(ASN1C_LIBS) $(COMMON_LDADD) hnbap/libosmo-asn1-hnbap.a rua/libosmo-asn1-rua.a ranap/libosmo-asn1-ranap.a
|
||||
hnbgw_LDADD = $(OSMOCORE_LIBS) $(OSMOVTY_LIBS) $(OSMOGSM_LIBS) $(ASN1C_LIBS) $(OSMOSIGTRAN_LIBS) $(COMMON_LDADD) hnbap/libosmo-asn1-hnbap.a rua/libosmo-asn1-rua.a ranap/libosmo-asn1-ranap.a
|
||||
|
||||
BUILT_SOURCES = hnbap_decoder.c hnbap_encoder.c rua_decoder.c rua_encoder.c ranap_decoder.c ranap_encoder.c
|
||||
|
||||
|
|
44
src/hnbgw.c
44
src/hnbgw.c
|
@ -44,12 +44,17 @@
|
|||
#include <osmocom/vty/logging.h>
|
||||
#include <osmocom/vty/command.h>
|
||||
|
||||
#include <osmocom/sigtran/sua.h>
|
||||
#include <osmocom/sigtran/protocol/sua.h>
|
||||
#include <osmocom/sigtran/sccp_sap.h>
|
||||
|
||||
#include "hnbgw.h"
|
||||
#include "hnbgw_hnbap.h"
|
||||
#include "hnbgw_rua.h"
|
||||
|
||||
static void *tall_hnb_ctx;
|
||||
static void *tall_ue_ctx;
|
||||
static void *tall_sua_ctx;
|
||||
void *talloc_asn1_ctx;
|
||||
|
||||
struct hnb_gw g_hnb_gw = {
|
||||
|
@ -237,6 +242,20 @@ static int listen_fd_cb(struct osmo_fd *fd, unsigned int what)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Entry point for primitives coming up from SCCP User SAP */
|
||||
static int sccp_sap_up(struct osmo_prim_hdr *oph, void *link)
|
||||
{
|
||||
struct osmo_scu_prim *prim = (struct osmo_scu_prim *) oph;
|
||||
|
||||
LOGP(DMAIN, LOGL_DEBUG, "sccp_sap_up(%s)\n", osmo_scu_prim_name(oph));
|
||||
|
||||
/* FIXME: Do something */
|
||||
|
||||
msgb_free(oph->msg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct log_info_cat log_cat[] = {
|
||||
[DMAIN] = {
|
||||
.name = "DMAIN", .loglevel = LOGL_INFO, .enabled = 1,
|
||||
|
@ -248,6 +267,11 @@ static const struct log_info_cat log_cat[] = {
|
|||
.color = "",
|
||||
.description = "Home Node B Application Part",
|
||||
},
|
||||
[DSUA] = {
|
||||
.name = "DSUA", .loglevel = LOGL_DEBUG, .enabled = 1,
|
||||
.color = "",
|
||||
.description = "SCCP User Adaptation",
|
||||
},
|
||||
};
|
||||
|
||||
static const struct log_info hnbgw_log_info = {
|
||||
|
@ -328,10 +352,13 @@ static void hnbgw_vty_init(void)
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct osmo_sua_user *sua_user;
|
||||
struct osmo_sua_link *sua_link;
|
||||
int rc;
|
||||
|
||||
tall_hnb_ctx = talloc_named_const(NULL, 0, "hnb_context");
|
||||
tall_ue_ctx = talloc_named_const(NULL, 0, "ue_context");
|
||||
tall_sua_ctx = talloc_named_const(NULL, 0, "sua");
|
||||
talloc_asn1_ctx = talloc_named_const(NULL, 0, "asn1_context");
|
||||
|
||||
g_hnb_gw.listen_fd.cb = listen_fd_cb;
|
||||
|
@ -354,6 +381,23 @@ int main(int argc, char **argv)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
osmo_sua_set_log_area(DSUA);
|
||||
sua_user = osmo_sua_user_create(tall_sua_ctx, sccp_sap_up);
|
||||
if (!sua_user) {
|
||||
perror("Failed to init SUA");
|
||||
exit(1);
|
||||
}
|
||||
rc = osmo_sua_client_connect(sua_user, "127.0.0.1", SUA_PORT);
|
||||
if (rc < 0) {
|
||||
perror("Failed to connect SUA");
|
||||
exit(1);
|
||||
}
|
||||
sua_link = osmo_sua_client_get_link(sua_user);
|
||||
if (!sua_link) {
|
||||
perror("Failed to get SUA link");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
rc = osmo_sock_init_ofd(&g_hnb_gw.listen_fd, AF_INET, SOCK_STREAM,
|
||||
IPPROTO_SCTP, NULL,
|
||||
g_hnb_gw.config.iuh_listen_port, OSMO_SOCK_F_BIND);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
enum {
|
||||
DMAIN,
|
||||
DHNBAP,
|
||||
DSUA,
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue