abis_nm: Create a signal data structure for the NACK message

Provide the message type and the msgb of the NACK message.
This commit is contained in:
Holger Hans Peter Freyther 2010-07-14 02:08:35 +08:00
parent 4f448c97eb
commit 6d2b66e89a
3 changed files with 15 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/* Generic signalling/notification infrastructure */
/* (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
/* (C) 2009-2010 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009 by Harald Welte <laforge@gnumonks.org>
* All Rights Reserved
*
@ -139,6 +139,11 @@ struct ipacc_ack_signal_data {
u_int8_t msg_type;
};
struct nm_nack_signal_data {
struct msgb *msg;
uint8_t mt;
};
struct challoc_signal_data {
struct gsm_bts *bts;
struct gsm_lchan *lchan;

View File

@ -966,6 +966,7 @@ static int abis_nm_rcvmsg_fom(struct msgb *mb)
return abis_nm_rcvmsg_sw(mb);
if (is_in_arr(mt, nacks, ARRAY_SIZE(nacks))) {
struct nm_nack_signal_data nack_data;
struct tlv_parsed tp;
debugp_foh(foh);
@ -979,7 +980,9 @@ static int abis_nm_rcvmsg_fom(struct msgb *mb)
else
DEBUGPC(DNM, "\n");
dispatch_signal(SS_NM, S_NM_NACK, (void*) &mt);
nack_data.msg = mb;
nack_data.mt = mt;
dispatch_signal(SS_NM, S_NM_NACK, &nack_data);
return 0;
}
#if 0

View File

@ -563,9 +563,9 @@ static int sw_activ_rep(struct msgb *mb)
}
/* Callback function for NACK on the OML NM */
static int oml_msg_nack(u_int8_t mt)
static int oml_msg_nack(struct nm_nack_signal_data *nack)
{
if (mt == NM_MT_SET_BTS_ATTR_NACK) {
if (nack->mt == NM_MT_SET_BTS_ATTR_NACK) {
LOGP(DNM, LOGL_FATAL, "Failed to set BTS attributes. That is fatal. "
"Was the bts type and frequency properly specified?\n");
exit(-1);
@ -578,14 +578,15 @@ static int oml_msg_nack(u_int8_t mt)
static int nm_sig_cb(unsigned int subsys, unsigned int signal,
void *handler_data, void *signal_data)
{
struct nm_nack_signal_data *nack;
u_int8_t *msg_type;
switch (signal) {
case S_NM_SW_ACTIV_REP:
return sw_activ_rep(signal_data);
case S_NM_NACK:
msg_type = signal_data;
return oml_msg_nack(*msg_type);
nack = signal_data;
return oml_msg_nack(nack);
default:
break;
}