Introduce logging category smscb

The smscb_message_fsm is totally independent of CBSP.

Change-Id: I6e686747ddde9540ff3f765ef461bfca812615ba
This commit is contained in:
Pau Espin 2022-07-27 20:40:56 +02:00
parent e6e878a2fc
commit cb99991127
4 changed files with 13 additions and 4 deletions

View File

@ -1,5 +1,6 @@
log stderr log stderr
logging level main notice logging level main notice
logging level smscb notice
logging level cbsp notice logging level cbsp notice
logging level sbcap notice logging level sbcap notice
logging level asn1c notice logging level asn1c notice

View File

@ -2,6 +2,7 @@
enum { enum {
DMAIN, DMAIN,
DSMSCB,
DCBSP, DCBSP,
DSBcAP, DSBcAP,
DASN1C, DASN1C,

View File

@ -62,6 +62,13 @@ static const struct log_info_cat log_info_cat[] = {
.enabled = 1, .enabled = 1,
.loglevel = LOGL_NOTICE, .loglevel = LOGL_NOTICE,
}, },
[DSMSCB] = {
.name = "DSMSCB",
.description = "SMS Cell Broadcast handling",
.color = "\033[1;35m",
.enabled = 1,
.loglevel = LOGL_NOTICE,
},
[DCBSP] = { [DCBSP] = {
.name = "DCBSP", .name = "DCBSP",
.description = "Cell Broadcast Service Protocol (CBC-BSC)", .description = "Cell Broadcast Service Protocol (CBC-BSC)",

View File

@ -335,7 +335,7 @@ static struct osmo_fsm smscb_fsm = {
.allstate_event_mask = S(SMSCB_E_CHILD_DIED), .allstate_event_mask = S(SMSCB_E_CHILD_DIED),
.allstate_action = smscb_fsm_allstate, .allstate_action = smscb_fsm_allstate,
.timer_cb = smscb_fsm_timer_cb, .timer_cb = smscb_fsm_timer_cb,
.log_subsys = DCBSP, .log_subsys = DSMSCB,
.event_names = smscb_fsm_event_names, .event_names = smscb_fsm_event_names,
.cleanup= smscb_fsm_cleanup, .cleanup= smscb_fsm_cleanup,
}; };
@ -349,7 +349,7 @@ struct cbc_message *cbc_message_alloc(void *ctx, const struct cbc_message *orig_
char idbuf[32]; char idbuf[32];
if (cbc_message_by_id(orig_msg->msg.message_id)) { if (cbc_message_by_id(orig_msg->msg.message_id)) {
LOGP(DCBSP, LOGL_ERROR, "Cannot create message_id %u (already exists)\n", LOGP(DSMSCB, LOGL_ERROR, "Cannot create message_id %u (already exists)\n",
orig_msg->msg.message_id); orig_msg->msg.message_id);
return NULL; return NULL;
} }
@ -357,13 +357,13 @@ struct cbc_message *cbc_message_alloc(void *ctx, const struct cbc_message *orig_
snprintf(idbuf, sizeof(idbuf), "%s-%u", orig_msg->cbe_name, orig_msg->msg.message_id); snprintf(idbuf, sizeof(idbuf), "%s-%u", orig_msg->cbe_name, orig_msg->msg.message_id);
fi = osmo_fsm_inst_alloc(&smscb_fsm, ctx, NULL, LOGL_INFO, idbuf); fi = osmo_fsm_inst_alloc(&smscb_fsm, ctx, NULL, LOGL_INFO, idbuf);
if (!fi) { if (!fi) {
LOGP(DCBSP, LOGL_ERROR, "Cannot allocate cbc_message fsm\n"); LOGP(DSMSCB, LOGL_ERROR, "Cannot allocate cbc_message fsm\n");
return NULL; return NULL;
} }
smscb = talloc(fi, struct cbc_message); smscb = talloc(fi, struct cbc_message);
if (!smscb) { if (!smscb) {
LOGP(DCBSP, LOGL_ERROR, "Cannot allocate cbc_message\n"); LOGP(DSMSCB, LOGL_ERROR, "Cannot allocate cbc_message\n");
osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL); osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL);
return NULL; return NULL;
} }