summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-03-11 08:12:43 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2013-07-29 12:39:36 +0200
commit72e6e17c941d641c186d5c751efc78d2e7d396ec (patch)
tree5ee9b1c86964e48b82b525c3502e5e7bae01f376
parent695bee1ae74b2cd60c7fee0ed1b44583a7dc54e4 (diff)
Use helper function to check is an MNCC frame is data (speech/traffic)
-rw-r--r--openbsc/include/openbsc/mncc.h8
-rw-r--r--openbsc/src/libmsc/mncc_builtin.c10
-rw-r--r--openbsc/src/libmsc/mncc_sock.c12
3 files changed, 11 insertions, 19 deletions
diff --git a/openbsc/include/openbsc/mncc.h b/openbsc/include/openbsc/mncc.h
index 0a4f2efb7..804766920 100644
--- a/openbsc/include/openbsc/mncc.h
+++ b/openbsc/include/openbsc/mncc.h
@@ -203,4 +203,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
diff --git a/openbsc/src/libmsc/mncc_builtin.c b/openbsc/src/libmsc/mncc_builtin.c
index 665725b8a..69daab32c 100644
--- a/openbsc/src/libmsc/mncc_builtin.c
+++ b/openbsc/src/libmsc/mncc_builtin.c
@@ -339,17 +339,9 @@ 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:
- case GSM_TCHH_FRAME:
- case GSM_TCH_FRAME_AMR:
- break;
- default:
+ if (!mncc_is_data_frame(msg_type))
DEBUGP(DMNCC, "(call %x) Received message %s\n", call->callref,
get_mncc_name(msg_type));
- break;
- }
switch(msg_type) {
case MNCC_SETUP_IND:
diff --git a/openbsc/src/libmsc/mncc_sock.c b/openbsc/src/libmsc/mncc_sock.c
index 5ae9cc402..c898ad330 100644
--- a/openbsc/src/libmsc/mncc_sock.c
+++ b/openbsc/src/libmsc/mncc_sock.c
@@ -54,11 +54,7 @@ int mncc_sock_from_cc(struct gsm_network *net, struct msgb *msg)
/* L4 uses RTP for this transaction, we send our data via RTP,
* otherwise we send it through MNCC interface */
- if (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) {
+ if (mncc_is_data_frame(msg_type)) {
struct gsm_trans *trans = trans_find_by_callref(net, mncc_in->callref);
if (trans && trans->cc.rs) {
@@ -72,11 +68,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
- && msg_type != GSM_TCHH_FRAME
- && msg_type != GSM_TCH_FRAME_AMR
- && msg_type != GSM_BAD_FRAME) {
+ if (mncc_is_data_frame(msg_type)) {
/* release the request */
struct gsm_mncc mncc_out;
memset(&mncc_out, 0, sizeof(mncc_out));