summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/mobile/gsm411_sms.c
AgeCommit message (Collapse)AuthorFilesLines
2019-05-23layer23: fix tons of compiler warnings, mostly OSMO_DEPRECATED relatedHarald Welte1-2/+2
Change-Id: I03918bd864c711b377a795186123c85bb6f4dc4a
2018-08-11layer23: Replace all instances of strncpy() by osmo_strlcpyHarald Welte1-2/+2
This gives us working/safe zero termination without overflowing the destination string size. Change-Id: Ica6098ceba2bd01ce3b216085442cc5eed0ca507
2018-06-04mobile/sms: Make it optional to store the SMS on diskHolger Hans Peter Freyther1-4/+12
Disable storing the SMS on disk. This is useful when scripting mobile. Keep the default of attempting to store it to disk. Change-Id: I6353447343d98ebaa5e12ab63f995750f81c8500
2018-06-02mobile/sms: Simplify the string format routinesHolger Hans Peter Freyther1-4/+1
It seems the original code didn't allocate \0 for the string. Just use talloc_asprintf and get a new string... Change-Id: I8ffb50b04d2d6196caf0231711f3467abc8c5ea5
2018-06-02mobile/sms: Fix memory leak in case the storage can not be openedHolger Hans Peter Freyther1-1/+3
Before jumping to the failure handling code free the sms_file. Change-Id: Ifce2bc130fe3a5bd49ad457ee61002952dd496ba
2017-12-27mobile: Send SMS through the primitive interfaceHolger Hans Peter Freyther1-1/+1
Make this symmetric and send the SMS through the primitive interface. Construct and copy the sms into the prim, store the SCA in the prim as well. In 04.11 we see we can store 2*10 digits in the destination address and a NUL. Change-Id: I91d7537f4f6ce5ba00218c58f3456947ec7bc662
2017-12-03mobile: Inform the primitive layer about status and new smsHolger Hans Peter Freyther1-0/+4
Inform the layer about new SMS and inform about the cause of it. In both cases pass the SMS. Change-Id: Ib7ab34b1b85b62ef0e8fff347adccbc5dc414161
2017-12-03mobile: Fix compiler warning on printing ptrdiff_tHolger Hans Peter Freyther1-1/+1
The "msg->tail - msg->l4h" subtract two unsigned char* pointers and should result in a ptrdiff_t. Fix the compiler warning by using "%ti" in the printf. Fixes: gsm411_sms.c: In function ‘gsm411_rx_rp_ud’: gsm411_sms.c:382:25: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=] LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h, ^ /home/ich/install/openbsc/include/osmocom/core/logging.h:93:54: note: in definition of macro ‘LOGPSRCC’ logp2(ss, level, caller_file, caller_line, cont, fmt, ##args); \ ^~~ /home/ich/install/openbsc/include/osmocom/core/logging.h:47:2: note: in expansion of macro ‘LOGPSRC’ LOGPSRC(ss, level, NULL, 0, fmt, ## args) ^~~~~~~ gsm411_sms.c:382:2: note: in expansion of macro ‘LOGP’ LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h, ^~~~ gsm411_sms.c:382:25: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=] LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h, ^ /home/ich/install/openbsc/include/osmocom/core/logging.h:95:53: note: in definition of macro ‘LOGPSRCC’ logp2(ss, level, __BASE_FILE__, __LINE__, cont, fmt, ##args); \ ^~~ /home/ich/install/openbsc/include/osmocom/core/logging.h:47:2: note: in expansion of macro ‘LOGPSRC’ LOGPSRC(ss, level, NULL, 0, fmt, ## args) ^~~~~~~ gsm411_sms.c:382:2: note: in expansion of macro ‘LOGP’ LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h, Change-Id: Ia574fc7849bd00a94cf6651eb0d26fdc91ef1443
2017-11-30mobile: Re-introduce msg_ref in struct gsm_smsHolger Hans Peter Freyther1-7/+9
In I4bac5f06921b5fd85a98d97770d42d4858ca1c42 I have removed the msg_ref field. But in case we delete a transaction with a pending SMS we need to get the msg_ref from somewhere. This is a partial revert but for RX SMS it makes sure that msg_ref will be set (it wasn't set before). Change-Id: I9b0f90f875de5f072565878861d38b0bb3bfbded
2017-11-30mobile: ms->shutdown was not converted properly to enumHolger Hans Peter Freyther1-1/+1
ms->shutdown is ms->shutdown != 0 which should have been converted to ms->shutdown != MS_SHUTDOWN_NONE. This is fixing sending SMS. This was introduced in Iee1140e4848923c7270495c381bf87b7e3fddee1. Change-Id: Ia74374dd9c0dd0ba9cf5725d66f4d2f2a2cfe9ef
2017-11-27mobile: Avoid msg_ref going out of syncHolger Hans Peter Freyther1-10/+9
It seemed like msg_ref could go out of sync. In some places we are using sms->msg_ref in other cases we pass it as parameter (e.g. when sending the SMS) or we get it out of the gsm411_rp_hdr. Instead of hardcoding 42 for all messages make it configurable and pass the parameter from the caller. Change-Id: I4bac5f06921b5fd85a98d97770d42d4858ca1c42
2017-11-27mobile: Instead of putting semantic in a comment, use an enumHolger Hans Peter Freyther1-1/+1
The enum was created to understand the different states during the shutdown and find places where it is used. The normal transitions are like. Idle -> Imsi Detach -> L1 Reset -> Done Idle -> L1 Reset -> Done The shutdown can get stuck in case: * Out of memory situation while handling IMSI detach (timeout) * Never receiving l1 reset acknnowledgment. The code could benefit from the move to osmo fsm to deal with proper timeouts. Change-Id: Iee1140e4848923c7270495c381bf87b7e3fddee1
2017-11-05mobile: get rid of unused variables / functionsVadim Yanitskiy1-2/+2
Change-Id: Id867ffed9b2b67025320d002e1e009e19c759a23
2017-11-05mobile/gsm411_sms.c: use secure gsm_7bit_(en|de)code_nVadim Yanitskiy1-2/+4
Since some 'gsm_7bit_*' functions were deprecated and replaced by more secure ones with the '_n_' postfix in names, it's better to use the updated functions. Change-Id: I58150e9b74699e5f54b9a83416ad8efcb2eccd8e
2013-05-23host/mobile: Fix trans_assign_trans_id() users error checkingSylvain Munaut1-1/+1
The returned value of trans_assign_trans_id() must be stored into a 'int' rather than uint8_t to allow proper testing of negative return values (errors). Thanks to Bhaskar <niceguy108@gmail.com> for the original patches. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-01-02mobile/gsm411: Fix printf format warningSylvain Munaut1-1/+1
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-01-02mobile/gsm411: Adapt to new libosmocore API for SMC/SMR by adding idSylvain Munaut1-8/+8
Here we just use the transaction ID Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13host/mobile: Mobile will use SMS Service Center Address from SIMAndreas Eversberg1-7/+8
In case the SMS Service Center Address is not set in the config, the Address from the SIM card is used. The mobile checks if either one is defined, otherwise it will refuse sending SMS. Since records of SIM are read, this patch includes fixes to talk correctly with the SIM client. Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13host/mobile/sms: Adding SMS support for osmocomBB/mobileAndreas Eversberg1-0/+940
Both MO and MT SMS are supported. Transmission an reception can be controlled via VTY: en sms 1 <destination> <text> All received SMS are stored in "~/.osmocom/bb/sms.txt". SMS transmission is performed on SAPI 3 datalink, using DCCH or ACCH. Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>