aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/include/openbsc/signal.h9
-rw-r--r--openbsc/src/gsm_04_11.c37
-rw-r--r--openbsc/src/token_auth.c3
3 files changed, 36 insertions, 13 deletions
diff --git a/openbsc/include/openbsc/signal.h b/openbsc/include/openbsc/signal.h
index 3a98fad81..dfb837d38 100644
--- a/openbsc/include/openbsc/signal.h
+++ b/openbsc/include/openbsc/signal.h
@@ -173,6 +173,15 @@ struct rf_signal_data {
struct gsm_network *net;
};
+struct sms_signal_data {
+ /* The transaction where this occured */
+ struct gsm_trans *trans;
+ /* Can be NULL for SMMA */
+ struct gsm_sms *sms;
+ /* int paging result. Only the ones with > 0 */
+ int paging_result;
+};
+
enum signal_ns {
S_NS_RESET,
S_NS_BLOCK,
diff --git a/openbsc/src/gsm_04_11.c b/openbsc/src/gsm_04_11.c
index faa712c5c..31bdf38c7 100644
--- a/openbsc/src/gsm_04_11.c
+++ b/openbsc/src/gsm_04_11.c
@@ -119,6 +119,18 @@ void sms_free(struct gsm_sms *sms)
talloc_free(sms);
}
+static void send_signal(int sig_no,
+ struct gsm_trans *trans,
+ struct gsm_sms *sms,
+ int paging_result)
+{
+ struct sms_signal_data sig;
+ sig.trans = trans;
+ sig.sms = sms;
+ sig.paging_result = paging_result;
+ dispatch_signal(SS_SMS, sig_no, &sig);
+}
+
/*
* This should be called whenever all SMS to a given subscriber
* on a given connection has been sent. This will inform the higher
@@ -422,7 +434,7 @@ static int gsm340_rx_sms_submit(struct msgb *msg, struct gsm_sms *gsms)
return GSM411_RP_CAUSE_MO_NET_OUT_OF_ORDER;
}
/* dispatch a signal to tell higher level about it */
- dispatch_signal(SS_SMS, S_SMS_SUBMITTED, gsms);
+ send_signal(S_SMS_SUBMITTED, NULL, gsms, 0);
return 0;
}
@@ -614,7 +626,8 @@ static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *m
gsms->validity_minutes = gsm340_validity_period(sms_vpf, sms_vp);
- dispatch_signal(SS_SMS, 0, gsms);
+ /* FIXME: This looks very wrong */
+ send_signal(0, NULL, gsms, 0);
/* determine gsms->receiver based on dialled number */
gsms->receiver = subscr_get_by_extension(conn->bts->network, gsms->dest_addr);
@@ -754,7 +767,7 @@ static int gsm411_rx_rp_ack(struct msgb *msg, struct gsm_trans *trans,
/* mark this SMS as sent in database */
db_sms_mark_sent(sms);
- dispatch_signal(SS_SMS, S_SMS_DELIVERED, sms);
+ send_signal(S_SMS_DELIVERED, trans, sms, 0);
sms_free(sms);
trans->sms.sms = NULL;
@@ -809,10 +822,10 @@ static int gsm411_rx_rp_error(struct msgb *msg, struct gsm_trans *trans,
/* MS has not enough memory to store the message. We need
* to store this in our database and wait for a SMMA message */
/* FIXME */
- dispatch_signal(SS_SMS, S_SMS_MEM_EXCEEDED, sms);
+ send_signal(S_SMS_MEM_EXCEEDED, trans, sms, 0);
counter_inc(net->stats.sms.rp_err_mem);
} else {
- dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, sms);
+ send_signal(S_SMS_UNKNOWN_ERROR, trans, sms, 0);
counter_inc(net->stats.sms.rp_err_other);
}
@@ -834,7 +847,7 @@ static int gsm411_rx_rp_smma(struct msgb *msg, struct gsm_trans *trans,
/* MS tells us that it has memory for more SMS, we need
* to check if we have any pending messages for it and then
* transfer those */
- dispatch_signal(SS_SMS, S_SMS_SMMA, trans->subscr);
+ send_signal(S_SMS_SMMA, trans, NULL, 0);
/* check for more messages for this subscriber */
sms = db_sms_get_unsent_for_subscr(trans->subscr);
@@ -1046,7 +1059,7 @@ static int gsm411_send_sms(struct gsm_subscriber_connection *conn, struct gsm_sm
transaction_id = trans_assign_trans_id(conn->subscr, GSM48_PDISC_SMS, 0);
if (transaction_id == -1) {
LOGP(DSMS, LOGL_ERROR, "No available transaction ids\n");
- dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, sms);
+ send_signal(S_SMS_UNKNOWN_ERROR, NULL, sms, 0);
sms_free(sms);
return -EBUSY;
}
@@ -1058,7 +1071,7 @@ static int gsm411_send_sms(struct gsm_subscriber_connection *conn, struct gsm_sm
transaction_id, new_callref++);
if (!trans) {
LOGP(DSMS, LOGL_ERROR, "No memory for trans\n");
- dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, sms);
+ send_signal(S_SMS_UNKNOWN_ERROR, NULL, sms, 0);
sms_free(sms);
/* FIXME: send some error message */
return -ENOMEM;
@@ -1092,7 +1105,7 @@ static int gsm411_send_sms(struct gsm_subscriber_connection *conn, struct gsm_sm
/* generate the 03.40 TPDU */
rc = gsm340_gen_tpdu(msg, sms);
if (rc < 0) {
- dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, sms);
+ send_signal(S_SMS_UNKNOWN_ERROR, trans, sms, 0);
trans_free(trans);
sms_free(sms);
msgb_free(msg);
@@ -1132,7 +1145,7 @@ static int paging_cb_send_sms(unsigned int hooknum, unsigned int event,
case GSM_PAGING_EXPIRED:
case GSM_PAGING_OOM:
case GSM_PAGING_BUSY:
- dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, sms);
+ send_signal(S_SMS_UNKNOWN_ERROR, NULL, sms, event);
sms_free(sms);
rc = -ETIMEDOUT;
break;
@@ -1191,7 +1204,7 @@ void _gsm411_sms_trans_free(struct gsm_trans *trans)
{
if (trans->sms.sms) {
LOGP(DSMS, LOGL_ERROR, "Transaction contains SMS.\n");
- dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, trans->sms.sms);
+ send_signal(S_SMS_UNKNOWN_ERROR, trans, trans->sms.sms, 0);
sms_free(trans->sms.sms);
trans->sms.sms = NULL;
}
@@ -1211,7 +1224,7 @@ void gsm411_sapi_n_reject(struct gsm_subscriber_connection *conn)
continue;
}
- dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, sms);
+ send_signal(S_SMS_UNKNOWN_ERROR, trans, sms, 0);
sms_free(sms);
trans->sms.sms = NULL;
trans_free(trans);
diff --git a/openbsc/src/token_auth.c b/openbsc/src/token_auth.c
index dc8cce251..9e671521b 100644
--- a/openbsc/src/token_auth.c
+++ b/openbsc/src/token_auth.c
@@ -117,7 +117,8 @@ unauth:
static int token_sms_cb(unsigned int subsys, unsigned int signal,
void *handler_data, void *signal_data)
{
- struct gsm_sms *sms = signal_data;
+ struct sms_signal_data *sig = signal_data;
+ struct gsm_sms *sms = sig->sms;;
struct gsm_subscriber_connection *conn;
u_int8_t auth_rand[16];