aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-06-16 17:45:59 +0800
committerHarald Welte <laforge@gnumonks.org>2012-06-16 17:53:38 +0800
commit68d85d5610858e1c7d0427a82bae1fb645f5590a (patch)
tree1011076b6b2092c17f5ff5d30331ce3e9dbd2474 /openbsc
parentfdd8b3b40dd4499a15558afc10f8d7cfd0041157 (diff)
libgb: Remove dependency to openbsc/debug.h
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/debug.h2
-rw-r--r--openbsc/include/osmocom/gprs/gprs_bssgp.h1
-rw-r--r--openbsc/include/osmocom/gprs/gprs_msgb.h4
-rw-r--r--openbsc/include/osmocom/gprs/gprs_ns.h2
-rw-r--r--openbsc/src/gprs/gb_proxy_main.c2
-rw-r--r--openbsc/src/gprs/sgsn_main.c3
-rw-r--r--openbsc/src/libcommon/debug.c5
-rw-r--r--openbsc/src/libgb/common_vty.c2
-rw-r--r--openbsc/src/libgb/common_vty.h3
-rw-r--r--openbsc/src/libgb/gprs_bssgp.c11
-rw-r--r--openbsc/src/libgb/gprs_bssgp_bss.c2
-rw-r--r--openbsc/src/libgb/gprs_bssgp_util.c2
-rw-r--r--openbsc/src/libgb/gprs_bssgp_vty.c2
-rw-r--r--openbsc/src/libgb/gprs_ns.c37
-rw-r--r--openbsc/src/libgb/gprs_ns_frgre.c2
-rw-r--r--openbsc/src/libgb/gprs_ns_vty.c2
-rw-r--r--openbsc/src/libgb/libosmo-gb.map56
17 files changed, 108 insertions, 30 deletions
diff --git a/openbsc/include/openbsc/debug.h b/openbsc/include/openbsc/debug.h
index 43f0ff808..0023b8cd2 100644
--- a/openbsc/include/openbsc/debug.h
+++ b/openbsc/include/openbsc/debug.h
@@ -40,8 +40,6 @@ enum {
#define BSC_CTX_SUBSCR 1
#define BSC_CTX_BTS 2
#define BSC_CTX_SCCP 3
-#define BSC_CTX_NSVC 4
-#define BSC_CTX_BVC 5
/* target */
diff --git a/openbsc/include/osmocom/gprs/gprs_bssgp.h b/openbsc/include/osmocom/gprs/gprs_bssgp.h
index 9970a513d..25c902c17 100644
--- a/openbsc/include/osmocom/gprs/gprs_bssgp.h
+++ b/openbsc/include/osmocom/gprs/gprs_bssgp.h
@@ -249,5 +249,6 @@ int gprs_bssgp_tx_paging(uint16_t nsei, uint16_t ns_bvci,
/* gprs_bssgp_vty.c */
int gprs_bssgp_vty_init(void);
+void gprs_bssgp_set_log_ss(int ss);
#endif /* _GPRS_BSSGP_H */
diff --git a/openbsc/include/osmocom/gprs/gprs_msgb.h b/openbsc/include/osmocom/gprs/gprs_msgb.h
index eddd888f5..3567bb7f3 100644
--- a/openbsc/include/osmocom/gprs/gprs_msgb.h
+++ b/openbsc/include/osmocom/gprs/gprs_msgb.h
@@ -27,4 +27,8 @@ struct libgb_msgb_cb {
#define msgb_bcid(__x) LIBGB_MSGB_CB(__x)->bssgp_cell_id
#define msgb_llch(__x) LIBGB_MSGB_CB(__x)->llch
+/* logging contexts */
+#define GPRS_CTX_NSVC 0
+#define GPRS_CTX_BVC 1
+
#endif
diff --git a/openbsc/include/osmocom/gprs/gprs_ns.h b/openbsc/include/osmocom/gprs/gprs_ns.h
index ab4bd4e67..a77515d25 100644
--- a/openbsc/include/osmocom/gprs/gprs_ns.h
+++ b/openbsc/include/osmocom/gprs/gprs_ns.h
@@ -258,6 +258,8 @@ struct ns_signal_data {
uint8_t cause;
};
+void gprs_ns_set_log_ss(int ss);
+
/*! }@ */
#endif
diff --git a/openbsc/src/gprs/gb_proxy_main.c b/openbsc/src/gprs/gb_proxy_main.c
index 5f67a7129..e9f337fd5 100644
--- a/openbsc/src/gprs/gb_proxy_main.c
+++ b/openbsc/src/gprs/gb_proxy_main.c
@@ -236,6 +236,8 @@ int main(int argc, char **argv)
}
gbcfg.nsi = bssgp_nsi;
gprs_ns_vty_init(bssgp_nsi);
+ gprs_ns_set_log_ss(DNS);
+ gprs_bssgp_set_log_ss(DBSSGP);
osmo_signal_register_handler(SS_L_NS, &gbprox_signal, NULL);
rc = gbproxy_parse_config(config_file, &gbcfg);
diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c
index 98cc600d7..a579e7e83 100644
--- a/openbsc/src/gprs/sgsn_main.c
+++ b/openbsc/src/gprs/sgsn_main.c
@@ -226,6 +226,9 @@ int main(int argc, char **argv)
if (rc < 0)
exit(1);
+ gprs_ns_set_log_ss(DNS);
+ gprs_bssgp_set_log_ss(DBSSGP);
+
sgsn_nsi = gprs_ns_instantiate(&sgsn_ns_cb, tall_bsc_ctx);
if (!sgsn_nsi) {
LOGP(DGPRS, LOGL_ERROR, "Unable to instantiate NS\n");
diff --git a/openbsc/src/libcommon/debug.c b/openbsc/src/libcommon/debug.c
index e15342ba6..68756d0e2 100644
--- a/openbsc/src/libcommon/debug.c
+++ b/openbsc/src/libcommon/debug.c
@@ -30,6 +30,7 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/logging.h>
+#include <osmocom/gprs/gprs_msgb.h>
#include <openbsc/gsm_data.h>
#include <openbsc/gsm_subscriber.h>
#include <openbsc/debug.h>
@@ -173,8 +174,8 @@ static int filter_fn(const struct log_context *ctx,
struct log_target *tar)
{
struct gsm_subscriber *subscr = ctx->ctx[BSC_CTX_SUBSCR];
- const struct gprs_nsvc *nsvc = ctx->ctx[BSC_CTX_NSVC];
- const struct gprs_nsvc *bvc = ctx->ctx[BSC_CTX_BVC];
+ const struct gprs_nsvc *nsvc = ctx->ctx[GPRS_CTX_NSVC];
+ const struct gprs_nsvc *bvc = ctx->ctx[GPRS_CTX_BVC];
if ((tar->filter_map & (1 << FLT_IMSI)) != 0
&& subscr && strcmp(subscr->imsi, tar->filter_data[FLT_IMSI]) == 0)
diff --git a/openbsc/src/libgb/common_vty.c b/openbsc/src/libgb/common_vty.c
index 269df8cd4..a16e9957c 100644
--- a/openbsc/src/libgb/common_vty.c
+++ b/openbsc/src/libgb/common_vty.c
@@ -61,3 +61,5 @@ gDEFUN(libgb_end,
}
return CMD_SUCCESS;
}
+
+int DNS, DBSSGP;
diff --git a/openbsc/src/libgb/common_vty.h b/openbsc/src/libgb/common_vty.h
index a2782663d..8c6b9ab16 100644
--- a/openbsc/src/libgb/common_vty.h
+++ b/openbsc/src/libgb/common_vty.h
@@ -1,4 +1,7 @@
#include <osmocom/vty/command.h>
+#include <osmocom/core/logging.h>
+
+extern int DNS, DBSSGP;
extern struct cmd_element libgb_exit_cmd;
extern struct cmd_element libgb_end_cmd;
diff --git a/openbsc/src/libgb/gprs_bssgp.c b/openbsc/src/libgb/gprs_bssgp.c
index 33cca3dfc..a64973645 100644
--- a/openbsc/src/libgb/gprs_bssgp.c
+++ b/openbsc/src/libgb/gprs_bssgp.c
@@ -32,13 +32,13 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/rate_ctr.h>
-#include <openbsc/debug.h>
-
#include <osmocom/gprs/gprs_bssgp.h>
#include <osmocom/gprs/gprs_ns.h>
#include <openbsc/gprs_gmm.h>
+#include "common_vty.h"
+
void *bssgp_tall_ctx = NULL;
static const struct rate_ctr_desc bssgp_ctr_description[] = {
@@ -683,7 +683,7 @@ int gprs_bssgp_rcvmsg(struct msgb *msg)
}
if (bctx) {
- log_set_context(BSC_CTX_BVC, bctx);
+ log_set_context(GPRS_CTX_BVC, bctx);
rate_ctr_inc(&bctx->ctrg->ctr[BSSGP_CTR_PKTS_IN]);
rate_ctr_add(&bctx->ctrg->ctr[BSSGP_CTR_BYTES_IN],
msgb_bssgp_len(msg));
@@ -853,3 +853,8 @@ int gprs_bssgp_tx_paging(uint16_t nsei, uint16_t ns_bvci,
return gprs_ns_sendmsg(bssgp_nsi, msg);
}
+
+void gprs_bssgp_set_log_ss(int ss)
+{
+ DBSSGP = ss;
+}
diff --git a/openbsc/src/libgb/gprs_bssgp_bss.c b/openbsc/src/libgb/gprs_bssgp_bss.c
index a681b9dab..4ca11ffd7 100644
--- a/openbsc/src/libgb/gprs_bssgp_bss.c
+++ b/openbsc/src/libgb/gprs_bssgp_bss.c
@@ -31,7 +31,7 @@
#include <osmocom/gprs/gprs_bssgp.h>
#include <osmocom/gprs/gprs_ns.h>
-#include <openbsc/debug.h>
+#include "common_vty.h"
uint8_t *bssgp_msgb_tlli_put(struct msgb *msg, uint32_t tlli)
{
diff --git a/openbsc/src/libgb/gprs_bssgp_util.c b/openbsc/src/libgb/gprs_bssgp_util.c
index 6ab97a79c..ae4647ef2 100644
--- a/openbsc/src/libgb/gprs_bssgp_util.c
+++ b/openbsc/src/libgb/gprs_bssgp_util.c
@@ -30,7 +30,7 @@
#include <osmocom/gprs/gprs_bssgp.h>
#include <osmocom/gprs/gprs_ns.h>
-#include <openbsc/debug.h>
+#include "common_vty.h"
struct gprs_ns_inst *bssgp_nsi;
diff --git a/openbsc/src/libgb/gprs_bssgp_vty.c b/openbsc/src/libgb/gprs_bssgp_vty.c
index 37919e669..ff1b8f5c8 100644
--- a/openbsc/src/libgb/gprs_bssgp_vty.c
+++ b/openbsc/src/libgb/gprs_bssgp_vty.c
@@ -40,8 +40,6 @@
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/misc.h>
-#include <openbsc/debug.h>
-
#include "common_vty.h"
/* FIXME: this should go to some common file as it is copied
diff --git a/openbsc/src/libgb/gprs_ns.c b/openbsc/src/libgb/gprs_ns.c
index 617c50d69..04a7f1067 100644
--- a/openbsc/src/libgb/gprs_ns.c
+++ b/openbsc/src/libgb/gprs_ns.c
@@ -79,7 +79,7 @@
#include <osmocom/gprs/gprs_bssgp.h>
#include <osmocom/gprs/gprs_ns_frgre.h>
-#include <openbsc/debug.h>
+#include "common_vty.h"
static const struct tlv_definition ns_att_tlvdef = {
.def = {
@@ -233,7 +233,7 @@ static int gprs_ns_tx(struct gprs_nsvc *nsvc, struct msgb *msg)
{
int ret;
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
/* Increment number of Uplink bytes */
rate_ctr_inc(&nsvc->ctrg->ctr[NS_CTR_PKTS_OUT]);
@@ -260,7 +260,7 @@ static int gprs_ns_tx_simple(struct gprs_nsvc *nsvc, uint8_t pdu_type)
struct msgb *msg = gprs_ns_msgb_alloc();
struct gprs_ns_hdr *nsh;
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
if (!msg)
return -ENOMEM;
@@ -284,7 +284,7 @@ int gprs_ns_tx_reset(struct gprs_nsvc *nsvc, uint8_t cause)
uint16_t nsvci = htons(nsvc->nsvci);
uint16_t nsei = htons(nsvc->nsei);
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
if (!msg)
return -ENOMEM;
@@ -316,7 +316,7 @@ int gprs_ns_tx_status(struct gprs_nsvc *nsvc, uint8_t cause,
struct gprs_ns_hdr *nsh;
uint16_t nsvci = htons(nsvc->nsvci);
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
bvci = htons(bvci);
@@ -369,7 +369,7 @@ int gprs_ns_tx_block(struct gprs_nsvc *nsvc, uint8_t cause)
struct gprs_ns_hdr *nsh;
uint16_t nsvci = htons(nsvc->nsvci);
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
if (!msg)
return -ENOMEM;
@@ -397,7 +397,7 @@ int gprs_ns_tx_block(struct gprs_nsvc *nsvc, uint8_t cause)
*/
int gprs_ns_tx_unblock(struct gprs_nsvc *nsvc)
{
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
LOGP(DNS, LOGL_INFO, "NSEI=%u Tx NS UNBLOCK (NSVCI=%u)\n",
nsvc->nsei, nsvc->nsvci);
@@ -410,7 +410,7 @@ int gprs_ns_tx_unblock(struct gprs_nsvc *nsvc)
*/
int gprs_ns_tx_alive(struct gprs_nsvc *nsvc)
{
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
LOGP(DNS, LOGL_DEBUG, "NSEI=%u Tx NS ALIVE (NSVCI=%u)\n",
nsvc->nsei, nsvc->nsvci);
@@ -423,7 +423,7 @@ int gprs_ns_tx_alive(struct gprs_nsvc *nsvc)
*/
int gprs_ns_tx_alive_ack(struct gprs_nsvc *nsvc)
{
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
LOGP(DNS, LOGL_DEBUG, "NSEI=%u Tx NS ALIVE_ACK (NSVCI=%u)\n",
nsvc->nsei, nsvc->nsvci);
@@ -448,7 +448,7 @@ static void nsvc_start_timer(struct gprs_nsvc *nsvc, enum nsvc_timer_mode mode)
enum ns_timeout tout = timer_mode_tout[mode];
unsigned int seconds = nsvc->nsi->timeout[tout];
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
DEBUGP(DNS, "NSEI=%u Starting timer in mode %s (%u seconds)\n",
nsvc->nsei, get_value_string(timer_mode_strs, mode),
seconds);
@@ -466,7 +466,7 @@ static void gprs_ns_timer_cb(void *data)
enum ns_timeout tout = timer_mode_tout[nsvc->timer_mode];
unsigned int seconds = nsvc->nsi->timeout[tout];
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
DEBUGP(DNS, "NSEI=%u Timer expired in mode %s (%u seconds)\n",
nsvc->nsei, get_value_string(timer_mode_strs, nsvc->timer_mode),
seconds);
@@ -520,7 +520,7 @@ static int gprs_ns_tx_reset_ack(struct gprs_nsvc *nsvc)
struct gprs_ns_hdr *nsh;
uint16_t nsvci, nsei;
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
if (!msg)
return -ENOMEM;
@@ -564,7 +564,7 @@ int gprs_ns_sendmsg(struct gprs_ns_inst *nsi, struct msgb *msg)
msgb_free(msg);
return -EINVAL;
}
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
if (!(nsvc->state & NSE_S_ALIVE)) {
LOGP(DNS, LOGL_ERROR, "NSEI=%u is not alive, cannot send\n",
@@ -760,7 +760,7 @@ int gprs_ns_rcvmsg(struct gprs_ns_inst *nsi, struct msgb *msg,
if (nsh->pdu_type != NS_PDUT_RESET) {
/* Since we have no NSVC, we have to use a fake */
nsvc = nsi->unknown_nsvc;
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
LOGP(DNS, LOGL_INFO, "Rejecting NS PDU type 0x%0x "
"from %s:%u for non-existing NS-VC\n",
nsh->pdu_type, inet_ntoa(saddr->sin_addr),
@@ -799,7 +799,7 @@ int gprs_ns_rcvmsg(struct gprs_ns_inst *nsi, struct msgb *msg,
if (!nsvc) {
nsvc = nsvc_create(nsi, 0xffff);
nsvc->ll = ll;
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
LOGP(DNS, LOGL_INFO, "Creating NS-VC for BSS at %s:%u\n",
inet_ntoa(saddr->sin_addr), ntohs(saddr->sin_port));
}
@@ -808,7 +808,7 @@ int gprs_ns_rcvmsg(struct gprs_ns_inst *nsi, struct msgb *msg,
} else
msgb_nsei(msg) = nsvc->nsei;
- log_set_context(BSC_CTX_NSVC, nsvc);
+ log_set_context(GPRS_CTX_NSVC, nsvc);
/* Increment number of Incoming bytes */
rate_ctr_inc(&nsvc->ctrg->ctr[NS_CTR_PKTS_IN]);
@@ -1095,4 +1095,9 @@ struct gprs_nsvc *nsip_connect(struct gprs_ns_inst *nsi,
return nsvc;
}
+void gprs_ns_set_log_ss(int ss)
+{
+ DNS = ss;
+}
+
/*! }@ */
diff --git a/openbsc/src/libgb/gprs_ns_frgre.c b/openbsc/src/libgb/gprs_ns_frgre.c
index 9be9f2a8f..be5f0f6c7 100644
--- a/openbsc/src/libgb/gprs_ns_frgre.c
+++ b/openbsc/src/libgb/gprs_ns_frgre.c
@@ -37,7 +37,7 @@
#include <osmocom/core/socket.h>
#include <osmocom/gprs/gprs_ns.h>
-#include <openbsc/debug.h>
+#include "common_vty.h"
#define GRE_PTYPE_FR 0x6559
#define GRE_PTYPE_IPv4 0x0800
diff --git a/openbsc/src/libgb/gprs_ns_vty.c b/openbsc/src/libgb/gprs_ns_vty.c
index 0ae314197..2f0b70ad4 100644
--- a/openbsc/src/libgb/gprs_ns_vty.c
+++ b/openbsc/src/libgb/gprs_ns_vty.c
@@ -40,8 +40,6 @@
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/misc.h>
-#include <openbsc/debug.h>
-
#include "common_vty.h"
static struct gprs_ns_inst *vty_nsi = NULL;
diff --git a/openbsc/src/libgb/libosmo-gb.map b/openbsc/src/libgb/libosmo-gb.map
new file mode 100644
index 000000000..ab3c4eaf1
--- /dev/null
+++ b/openbsc/src/libgb/libosmo-gb.map
@@ -0,0 +1,56 @@
+LIBOSMOGB_1.0 {
+global:
+bssgp_cause_str;
+bssgp_create_cell_id;
+bssgp_msgb_alloc;
+bssgp_msgb_tlli_put;
+bssgp_parse_cell_id;
+bssgp_tx_bvc_block;
+bssgp_tx_bvc_reset;
+bssgp_tx_bvc_unblock;
+bssgp_tx_flush_ll_ack;
+bssgp_tx_llc_discarded;
+bssgp_tx_ra_capa_upd;
+bssgp_tx_radio_status_imsi;
+bssgp_tx_radio_status_tlli;
+bssgp_tx_radio_status_tmsi;
+bssgp_tx_resume;
+bssgp_tx_resume_ack;
+bssgp_tx_resume_nack;
+bssgp_tx_simple_bvci;
+bssgp_tx_status;
+bssgp_tx_suspend;
+bssgp_tx_suspend_ack;
+bssgp_tx_suspend_nack;
+bssgp_tx_ul_ud;
+
+gprs_bssgp_rcvmsg
+gprs_bssgp_rx_paging
+gprs_bssgp_set_log_ss
+gprs_bssgp_tx_dl_ud
+gprs_bssgp_tx_paging
+gprs_bssgp_vty_init
+
+gprs_ns_cause_str;
+gprs_ns_destroy;
+gprs_ns_frgre_listen;
+gprs_ns_frgre_sendmsg;
+gprs_ns_instantiate;
+gprs_ns_nsip_listen;
+gprs_ns_rcvmsg;
+gprs_ns_sendmsg;
+gprs_ns_set_log_ss;
+gprs_ns_tx_alive;
+gprs_ns_tx_alive_ack;
+gprs_ns_tx_block;
+gprs_ns_tx_reset;
+gprs_ns_tx_status;
+gprs_ns_tx_unblock;
+gprs_ns_vty_init;
+
+gprs_nsvc_reset;
+
+nsip_connect;
+
+local: *;
+};