This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Holger Freyther gerrit-no-reply at lists.osmocom.orgHolger Freyther has submitted this change and it was merged. Change subject: mobile: Inform the primitive layer about status and new sms ...................................................................... mobile: Inform the primitive layer about status and new sms Inform the layer about new SMS and inform about the cause of it. In both cases pass the SMS. Change-Id: Ib7ab34b1b85b62ef0e8fff347adccbc5dc414161 --- M src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h M src/host/layer23/include/osmocom/bb/mobile/primitives.h M src/host/layer23/src/mobile/gsm411_sms.c M src/host/layer23/src/mobile/primitives.c 4 files changed, 46 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h b/src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h index a94d1aa..d3074fb 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h +++ b/src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h @@ -4,6 +4,12 @@ #define SMS_HDR_SIZE 128 #define SMS_TEXT_SIZE 256 +#include <stdint.h> +#include <time.h> + +struct osmocom_ms; +struct msgb; + struct gsm_sms { unsigned long validity_minutes; uint8_t reply_path_req; diff --git a/src/host/layer23/include/osmocom/bb/mobile/primitives.h b/src/host/layer23/include/osmocom/bb/mobile/primitives.h index 4d81ba1..6804fc0 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/primitives.h +++ b/src/host/layer23/include/osmocom/bb/mobile/primitives.h @@ -1,5 +1,7 @@ #pragma once +#include <osmocom/bb/mobile/gsm411_sms.h> + #include <osmocom/core/prim.h> struct mobile_prim; @@ -16,6 +18,7 @@ PRIM_MOB_TIMER_CANCEL, PRIM_MOB_STARTED, PRIM_MOB_SHUTDOWN, + PRIM_MOB_SMS, }; struct mobile_prim_intf { @@ -52,14 +55,26 @@ int new_state; }; +/** + * SMS related configs. + */ +struct mobile_sms_param { + struct gsm_sms sms; + + bool cause_valid; + int cause; +}; + struct mobile_prim { struct osmo_prim_hdr hdr; /*!< Primitive base class */ union { struct mobile_timer_param timer; struct mobile_started_param started; struct mobile_shutdown_param shutdown; + struct mobile_sms_param sms; } u; }; + struct mobile_prim_intf *mobile_prim_intf_alloc(struct osmocom_ms *ms); int mobile_prim_intf_req(struct mobile_prim_intf *intf, struct mobile_prim *hdr); @@ -68,4 +83,6 @@ struct mobile_prim *mobile_prim_alloc(unsigned int primitive, enum osmo_prim_operation op); void mobile_prim_ntfy_started(struct osmocom_ms *ms, bool started); -void mobile_prim_ntfy_shutdown(struct osmocom_ms *ms, int old_state, int new_state); \ No newline at end of file +void mobile_prim_ntfy_shutdown(struct osmocom_ms *ms, int old_state, int new_state); +void mobile_prim_ntfy_sms_new(struct osmocom_ms *ms, struct gsm_sms *sms); +void mobile_prim_ntfy_sms_status(struct osmocom_ms *ms, struct gsm_sms *sms, uint8_t cause); diff --git a/src/host/layer23/src/mobile/gsm411_sms.c b/src/host/layer23/src/mobile/gsm411_sms.c index b635bb2..6d9d56e 100644 --- a/src/host/layer23/src/mobile/gsm411_sms.c +++ b/src/host/layer23/src/mobile/gsm411_sms.c @@ -40,6 +40,7 @@ #include <osmocom/gsm/gsm0411_utils.h> #include <osmocom/core/talloc.h> #include <osmocom/bb/mobile/vty.h> +#include <osmocom/bb/mobile/primitives.h> #define UM_SAPI_SMS 3 @@ -129,6 +130,7 @@ vty_notify(ms, "SMS to %s failed: %s\n", sms->address, get_value_string(gsm411_rp_cause_strs, cause)); + mobile_prim_ntfy_sms_status(ms, sms, cause); return 0; } /* @@ -186,6 +188,8 @@ char vty_text[sizeof(gsms->text)], *p; FILE *fp; + mobile_prim_ntfy_sms_new(ms, gsms); + /* remove linefeeds and show at VTY */ strcpy(vty_text, gsms->text); for (p = vty_text; *p; p++) { diff --git a/src/host/layer23/src/mobile/primitives.c b/src/host/layer23/src/mobile/primitives.c index dde34bc..0902139 100644 --- a/src/host/layer23/src/mobile/primitives.c +++ b/src/host/layer23/src/mobile/primitives.c @@ -126,6 +126,24 @@ dispatch(ms, prim); } +void mobile_prim_ntfy_sms_new(struct osmocom_ms *ms, struct gsm_sms *sms) +{ + struct mobile_prim *prim = mobile_prim_alloc(PRIM_MOB_SMS, PRIM_OP_INDICATION); + + prim->u.sms.sms = *sms; + dispatch(ms, prim); +} + +void mobile_prim_ntfy_sms_status(struct osmocom_ms *ms, struct gsm_sms *sms, uint8_t cause) +{ + struct mobile_prim *prim = mobile_prim_alloc(PRIM_MOB_SMS, PRIM_OP_INDICATION); + + prim->u.sms.sms = *sms; + prim->u.sms.cause_valid = true; + prim->u.sms.cause = cause; + dispatch(ms, prim); +} + static int cancel_timer(struct mobile_prim_intf *intf, struct mobile_timer_param *param) { struct timer_closure *closure; -- To view, visit https://gerrit.osmocom.org/4932 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib7ab34b1b85b62ef0e8fff347adccbc5dc414161 Gerrit-PatchSet: 6 Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Owner: Holger Freyther <holger at freyther.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Holger Freyther <holger at freyther.de> Gerrit-Reviewer: Jenkins Builder