mncc: Use helper function to check if an MNCC frame is data (speech/traffic)

Rename method mncc_rcv_tchf() to mncc_rcv_data(), because the check applies
to all types of data frames, not only TCH/F data.
This commit is contained in:
Andreas Eversberg 2013-03-11 08:12:43 +01:00 committed by Holger Hans Peter Freyther
parent f78fc4e76e
commit 9acbe4cefe
3 changed files with 17 additions and 16 deletions

View File

@ -191,4 +191,12 @@ int mncc_sock_from_cc(struct gsm_network *net, struct msgb *msg);
int mncc_sock_init(struct gsm_network *gsmnet);
#define mncc_is_data_frame(msg_type) \
(msg_type == GSM_TCHF_FRAME \
|| msg_type == GSM_TCHF_FRAME_EFR \
|| msg_type == GSM_TCHH_FRAME \
|| msg_type == GSM_TCH_FRAME_AMR \
|| msg_type == GSM_BAD_FRAME)
#endif

View File

@ -273,8 +273,8 @@ static int mncc_rel_cnf(struct gsm_call *call, int msg_type, struct gsm_mncc *re
return 0;
}
/* receiving a TCH/F frame from the BSC code */
static int mncc_rcv_tchf(struct gsm_call *call, int msg_type,
/* receiving a (speech) traffic frame from the BSC code */
static int mncc_rcv_data(struct gsm_call *call, int msg_type,
struct gsm_data_frame *dfr)
{
struct gsm_trans *remote_trans;
@ -339,16 +339,14 @@ int int_mncc_recv(struct gsm_network *net, struct msgb *msg)
DEBUGP(DMNCC, "(call %x) Call created.\n", call->callref);
}
switch (msg_type) {
case GSM_TCHF_FRAME:
case GSM_TCHF_FRAME_EFR:
break;
default:
DEBUGP(DMNCC, "(call %x) Received message %s\n", call->callref,
get_mncc_name(msg_type));
break;
if (mncc_is_data_frame(msg_type)) {
rc = mncc_rcv_data(call, msg_type, arg);
goto out_free;
}
DEBUGP(DMNCC, "(call %x) Received message %s\n", call->callref,
get_mncc_name(msg_type));
switch(msg_type) {
case MNCC_SETUP_IND:
rc = mncc_setup_ind(call, msg_type, arg);
@ -408,10 +406,6 @@ int int_mncc_recv(struct gsm_network *net, struct msgb *msg)
call->callref, data->cause.value);
rc = mncc_tx_to_cc(net, MNCC_RETRIEVE_REJ, data);
break;
case GSM_TCHF_FRAME:
case GSM_TCHF_FRAME_EFR:
rc = mncc_rcv_tchf(call, msg_type, arg);
break;
default:
LOGP(DMNCC, LOGL_NOTICE, "(call %x) Message unhandled\n", callref);
break;

View File

@ -54,8 +54,7 @@ int mncc_sock_from_cc(struct gsm_network *net, struct msgb *msg)
if (net->mncc_state->conn_bfd.fd < 0) {
LOGP(DMNCC, LOGL_ERROR, "mncc_sock receives %s for external CC app "
"but socket is gone\n", get_mncc_name(msg_type));
if (msg_type != GSM_TCHF_FRAME &&
msg_type != GSM_TCHF_FRAME_EFR) {
if (!mncc_is_data_frame(msg_type)) {
/* release the request */
struct gsm_mncc mncc_out;
memset(&mncc_out, 0, sizeof(mncc_out));