Introduce dynamic log category for libosmo-rua/hnbap
Same as already done for libosmo-ranap. This allows applications setting the cateogy dynamically, and will allow untangling library tests using hnbgw log categories in this repo. Change-Id: I5d09b67b115ad8938e5162a23accfcbafab139d4
This commit is contained in:
parent
53052963c1
commit
1562225332
|
@ -124,7 +124,8 @@
|
||||||
|
|
||||||
#include <osmocom/core/logging.h>
|
#include <osmocom/core/logging.h>
|
||||||
|
|
||||||
#define HNBAP_DEBUG(x, args ...) DEBUGP(1, x, ## args)
|
extern int _hnbap_DHNBAP;
|
||||||
|
#define HNBAP_DEBUG(x, args ...) DEBUGP(_hnbap_DHNBAP, x, ## args)
|
||||||
|
|
||||||
extern int asn1_xer_print;
|
extern int asn1_xer_print;
|
||||||
|
|
||||||
|
@ -149,3 +150,5 @@ HNBAP_IE_t *hnbap_new_ie(HNBAP_ProtocolIE_ID_t id, HNBAP_Criticality_t criticali
|
||||||
asn_TYPE_descriptor_t *type, void *sptr);
|
asn_TYPE_descriptor_t *type, void *sptr);
|
||||||
|
|
||||||
char *hnbap_cause_str(HNBAP_Cause_t *cause);
|
char *hnbap_cause_str(HNBAP_Cause_t *cause);
|
||||||
|
|
||||||
|
void hnbap_set_log_area(int log_area);
|
||||||
|
|
|
@ -593,8 +593,8 @@
|
||||||
|
|
||||||
struct gprs_ra_id;
|
struct gprs_ra_id;
|
||||||
|
|
||||||
#define RANAP_DEBUG(x, args ...) DEBUGP(_ranap_DRANAP, x, ## args)
|
|
||||||
extern int _ranap_DRANAP;
|
extern int _ranap_DRANAP;
|
||||||
|
#define RANAP_DEBUG(x, args ...) DEBUGP(_ranap_DRANAP, x, ## args)
|
||||||
|
|
||||||
extern int asn1_xer_print;
|
extern int asn1_xer_print;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,8 @@
|
||||||
|
|
||||||
#include <osmocom/core/logging.h>
|
#include <osmocom/core/logging.h>
|
||||||
|
|
||||||
#define RUA_DEBUG(x, args ...) DEBUGP(0, x, ## args)
|
extern int _rua_DRUA;
|
||||||
|
#define RUA_DEBUG(x, args ...) DEBUGP(_rua_DRUA, x, ## args)
|
||||||
|
|
||||||
extern int asn1_xer_print;
|
extern int asn1_xer_print;
|
||||||
|
|
||||||
|
@ -69,3 +70,5 @@ RUA_IE_t *rua_new_ie(RUA_ProtocolIE_ID_t id, RUA_Criticality_t criticality,
|
||||||
asn_TYPE_descriptor_t *type, void *sptr);
|
asn_TYPE_descriptor_t *type, void *sptr);
|
||||||
|
|
||||||
char *rua_cause_str(RUA_Cause_t *cause);
|
char *rua_cause_str(RUA_Cause_t *cause);
|
||||||
|
|
||||||
|
void rua_set_log_area(int log_area);
|
||||||
|
|
|
@ -24,7 +24,9 @@
|
||||||
#include <osmocom/core/msgb.h>
|
#include <osmocom/core/msgb.h>
|
||||||
|
|
||||||
#include <osmocom/hnbap/hnbap_common.h>
|
#include <osmocom/hnbap/hnbap_common.h>
|
||||||
#include <osmocom/iuh/hnbgw.h>
|
|
||||||
|
int _hnbap_DHNBAP = 0;
|
||||||
|
#define DHNBAP _hnbap_DHNBAP
|
||||||
|
|
||||||
static const struct value_string hnbap_cause_radio_vals[] = {
|
static const struct value_string hnbap_cause_radio_vals[] = {
|
||||||
{ HNBAP_CauseRadioNetwork_overload, "overload" },
|
{ HNBAP_CauseRadioNetwork_overload, "overload" },
|
||||||
|
@ -242,3 +244,8 @@ HNBAP_IE_t *hnbap_new_ie(HNBAP_ProtocolIE_ID_t id,
|
||||||
|
|
||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hnbap_set_log_area(int log_area)
|
||||||
|
{
|
||||||
|
_hnbap_DHNBAP = log_area;
|
||||||
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <osmocom/ranap/ranap_common_cn.h>
|
#include <osmocom/ranap/ranap_common_cn.h>
|
||||||
#include <osmocom/ranap/ranap_ies_defs.h>
|
#include <osmocom/ranap/ranap_ies_defs.h>
|
||||||
|
|
||||||
#include <osmocom/iuh/hnbgw.h>
|
#define DRANAP _ranap_DRANAP
|
||||||
|
|
||||||
static int cn_ranap_rx_initiating_msg_co(void *ctx, RANAP_InitiatingMessage_t *imsg,
|
static int cn_ranap_rx_initiating_msg_co(void *ctx, RANAP_InitiatingMessage_t *imsg,
|
||||||
ranap_message *message)
|
ranap_message *message)
|
||||||
|
|
|
@ -24,10 +24,12 @@
|
||||||
#include <osmocom/core/msgb.h>
|
#include <osmocom/core/msgb.h>
|
||||||
|
|
||||||
#include <osmocom/rua/rua_common.h>
|
#include <osmocom/rua/rua_common.h>
|
||||||
#include <osmocom/iuh/hnbgw.h>
|
|
||||||
|
|
||||||
extern int asn1_xer_print;
|
extern int asn1_xer_print;
|
||||||
|
|
||||||
|
int _rua_DRUA = 0;
|
||||||
|
#define DRUA _rua_DRUA
|
||||||
|
|
||||||
static const struct value_string rua_cause_radio_vals[] = {
|
static const struct value_string rua_cause_radio_vals[] = {
|
||||||
{ RUA_CauseRadioNetwork_normal, "normal" },
|
{ RUA_CauseRadioNetwork_normal, "normal" },
|
||||||
{ RUA_CauseRadioNetwork_connect_failed, "connect failed" },
|
{ RUA_CauseRadioNetwork_connect_failed, "connect failed" },
|
||||||
|
@ -224,3 +226,8 @@ RUA_IE_t *rua_new_ie(RUA_ProtocolIE_ID_t id,
|
||||||
|
|
||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rua_set_log_area(int log_area)
|
||||||
|
{
|
||||||
|
_rua_DRUA = log_area;
|
||||||
|
}
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
#include <osmocom/rua/rua_ies_defs.h>
|
#include <osmocom/rua/rua_ies_defs.h>
|
||||||
#include <osmocom/rua/rua_msg_factory.h>
|
#include <osmocom/rua/rua_msg_factory.h>
|
||||||
#include "asn1helpers.h"
|
#include "asn1helpers.h"
|
||||||
#include <osmocom/iuh/hnbgw.h>
|
|
||||||
|
|
||||||
|
#define DRUA _rua_DRUA
|
||||||
|
|
||||||
|
#define IUH_PPI_RUA 19
|
||||||
|
|
||||||
struct msgb *rua_new_udt(struct msgb *inmsg)
|
struct msgb *rua_new_udt(struct msgb *inmsg)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +33,7 @@ struct msgb *rua_new_udt(struct msgb *inmsg)
|
||||||
|
|
||||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_ConnectionlessTransfer, &out);
|
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_ConnectionlessTransfer, &out);
|
||||||
|
|
||||||
DEBUGP(DMAIN, "transmitting RUA payload of %u bytes\n", msgb_length(msg));
|
DEBUGP(DRUA, "transmitting RUA payload of %u bytes\n", msgb_length(msg));
|
||||||
|
|
||||||
msgb_sctp_ppid(msg) = IUH_PPI_RUA;
|
msgb_sctp_ppid(msg) = IUH_PPI_RUA;
|
||||||
|
|
||||||
|
@ -68,7 +70,7 @@ struct msgb *rua_new_conn(int is_ps, uint32_t context_id, struct msgb *inmsg)
|
||||||
|
|
||||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_Connect, &out);
|
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_Connect, &out);
|
||||||
|
|
||||||
DEBUGP(DMAIN, "transmitting RUA payload of %u bytes\n", msgb_length(msg));
|
DEBUGP(DRUA, "transmitting RUA payload of %u bytes\n", msgb_length(msg));
|
||||||
|
|
||||||
msgb_sctp_ppid(msg) = IUH_PPI_RUA;
|
msgb_sctp_ppid(msg) = IUH_PPI_RUA;
|
||||||
|
|
||||||
|
@ -104,7 +106,7 @@ struct msgb *rua_new_dt(int is_ps, uint32_t context_id, struct msgb *inmsg)
|
||||||
|
|
||||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_DirectTransfer, &out);
|
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_DirectTransfer, &out);
|
||||||
|
|
||||||
DEBUGP(DMAIN, "transmitting RUA payload of %u bytes\n", msgb_length(msg));
|
DEBUGP(DRUA, "transmitting RUA payload of %u bytes\n", msgb_length(msg));
|
||||||
|
|
||||||
msgb_sctp_ppid(msg) = IUH_PPI_RUA;
|
msgb_sctp_ppid(msg) = IUH_PPI_RUA;
|
||||||
|
|
||||||
|
@ -146,7 +148,7 @@ struct msgb *rua_new_disc(int is_ps, uint32_t context_id, struct msgb *inmsg)
|
||||||
|
|
||||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_Disconnect, &out);
|
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_Disconnect, &out);
|
||||||
|
|
||||||
DEBUGP(DMAIN, "transmitting RUA payload of %u bytes\n", msgb_length(msg));
|
DEBUGP(DRUA, "transmitting RUA payload of %u bytes\n", msgb_length(msg));
|
||||||
|
|
||||||
msgb_sctp_ppid(msg) = IUH_PPI_RUA;
|
msgb_sctp_ppid(msg) = IUH_PPI_RUA;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ noinst_HEADERS = test_common.h hnb-test.h hnb-test-layers.h
|
||||||
test_helpers_SOURCES = test-helpers.c test_common.c
|
test_helpers_SOURCES = test-helpers.c test_common.c
|
||||||
test_helpers_LDADD = $(COMMON_LIBS) $(top_builddir)/src/libosmo-ranap.la
|
test_helpers_LDADD = $(COMMON_LIBS) $(top_builddir)/src/libosmo-ranap.la
|
||||||
|
|
||||||
test_hnbap_SOURCES = $(top_srcdir)/src/hnbap_common.c $(top_builddir)/src/hnbap_decoder.c test-hnbap.c test_common.c
|
test_hnbap_SOURCES = test-hnbap.c test_common.c
|
||||||
test_hnbap_LDADD = $(COMMON_LIBS) $(top_builddir)/src/libosmo-hnbap.la $(top_builddir)/src/libosmo-ranap.la
|
test_hnbap_LDADD = $(COMMON_LIBS) $(top_builddir)/src/libosmo-hnbap.la $(top_builddir)/src/libosmo-ranap.la
|
||||||
|
|
||||||
hnb_test_SOURCES = hnb-test.c test_common.c hnb-test-ranap.c hnb-test-rua.c
|
hnb_test_SOURCES = hnb-test.c test_common.c hnb-test-ranap.c hnb-test-rua.c
|
||||||
|
|
|
@ -7,10 +7,7 @@
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
#include <osmocom/core/logging.h>
|
#include <osmocom/core/logging.h>
|
||||||
|
|
||||||
enum {
|
#include "test_common.h"
|
||||||
DMAIN,
|
|
||||||
DHNBAP,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* 25.467 Section 7.1 */
|
/* 25.467 Section 7.1 */
|
||||||
|
|
|
@ -209,6 +209,7 @@ int main(int argc, char **argv)
|
||||||
asn1_xer_print = 0;
|
asn1_xer_print = 0;
|
||||||
|
|
||||||
test_common_init();
|
test_common_init();
|
||||||
|
ranap_set_log_area(DRANAP);
|
||||||
|
|
||||||
test_iu_helpers();
|
test_iu_helpers();
|
||||||
test_asn1_helpers();
|
test_asn1_helpers();
|
||||||
|
|
|
@ -173,6 +173,8 @@ int main(int argc, char **argv)
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
test_common_init();
|
test_common_init();
|
||||||
|
ranap_set_log_area(DRANAP);
|
||||||
|
hnbap_set_log_area(DHNBAP);
|
||||||
log_set_log_level(osmo_stderr_target, LOGL_INFO);
|
log_set_log_level(osmo_stderr_target, LOGL_INFO);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "test_common.h"
|
||||||
|
|
||||||
#include <osmocom/iuh/hnbgw.h>
|
|
||||||
|
|
||||||
extern void *tall_msgb_ctx;
|
extern void *tall_msgb_ctx;
|
||||||
|
|
||||||
static void test_aper_int(uint32_t inp)
|
static void test_aper_int(uint32_t inp)
|
||||||
|
@ -98,6 +96,7 @@ int main(int argc, char **argv)
|
||||||
//asn_debug = 1;
|
//asn_debug = 1;
|
||||||
|
|
||||||
test_common_init();
|
test_common_init();
|
||||||
|
ranap_set_log_area(DRANAP);
|
||||||
|
|
||||||
test_aper_int(1);
|
test_aper_int(1);
|
||||||
test_aper_int(2);
|
test_aper_int(2);
|
||||||
|
|
|
@ -33,14 +33,14 @@
|
||||||
#include <netinet/sctp.h>
|
#include <netinet/sctp.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
#include <asn1c/asn_internal.h>
|
||||||
|
|
||||||
#include <osmocom/core/application.h>
|
#include <osmocom/core/application.h>
|
||||||
#include <osmocom/core/talloc.h>
|
#include <osmocom/core/talloc.h>
|
||||||
#include <osmocom/core/logging.h>
|
#include <osmocom/core/logging.h>
|
||||||
#include <osmocom/core/msgb.h>
|
#include <osmocom/core/msgb.h>
|
||||||
|
|
||||||
#include <osmocom/ranap/ranap_common.h>
|
#include "test_common.h"
|
||||||
|
|
||||||
#include <osmocom/iuh/hnbgw.h>
|
|
||||||
|
|
||||||
static const struct log_info_cat log_cat[] = {
|
static const struct log_info_cat log_cat[] = {
|
||||||
[DMAIN] = {
|
[DMAIN] = {
|
||||||
|
@ -83,8 +83,6 @@ int test_common_init(void)
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
ranap_set_log_area(DRANAP);
|
|
||||||
|
|
||||||
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
|
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
|
||||||
log_set_use_color(osmo_stderr_target, 0);
|
log_set_use_color(osmo_stderr_target, 0);
|
||||||
log_set_print_category(osmo_stderr_target, 0);
|
log_set_print_category(osmo_stderr_target, 0);
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
enum {
|
||||||
|
DMAIN,
|
||||||
|
DHNBAP,
|
||||||
|
DRUA,
|
||||||
|
DRANAP,
|
||||||
|
};
|
||||||
|
|
||||||
int test_common_init(void);
|
int test_common_init(void);
|
||||||
void test_common_cleanup(void);
|
void test_common_cleanup(void);
|
||||||
|
|
Loading…
Reference in New Issue