Harald Welte (local) | 9571378 | 2009-08-16 13:18:51 +0200 | [diff] [blame] | 1 | |
| 2 | |
| 3 | /* (C) 2009 by Harald Welte <laforge@gnumonks.org> |
| 4 | * |
| 5 | * All Rights Reserved |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | |
| 24 | #include <sys/types.h> |
| 25 | |
| 26 | #include <openbsc/gsm_04_08.h> |
| 27 | #include <openbsc/signal.h> |
| 28 | #include <openbsc/gsm_subscriber.h> |
Holger Hans Peter Freyther | d70da87 | 2009-10-22 15:42:19 +0200 | [diff] [blame] | 29 | #include <openbsc/chan_alloc.h> |
Harald Welte (local) | 9571378 | 2009-08-16 13:18:51 +0200 | [diff] [blame] | 30 | |
| 31 | /* RRLP MS based position request */ |
| 32 | static const u_int8_t ms_based_pos_req[] = { 0x40, 0x01, 0x78, 0xa8 }; |
| 33 | |
| 34 | static int subscr_sig_cb(unsigned int subsys, unsigned int signal, |
| 35 | void *handler_data, void *signal_data) |
| 36 | { |
| 37 | struct gsm_subscriber *subscr; |
| 38 | struct gsm_lchan *lchan; |
| 39 | |
| 40 | switch (signal) { |
| 41 | case S_SUBSCR_ATTACHED: |
| 42 | /* A subscriber has attached. */ |
| 43 | subscr = signal_data; |
| 44 | lchan = lchan_for_subscr(subscr); |
| 45 | if (!lchan) |
| 46 | break; |
| 47 | gsm48_send_rr_app_info(lchan, 0x00, sizeof(ms_based_pos_req), |
| 48 | ms_based_pos_req); |
| 49 | break; |
| 50 | } |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | static int paging_sig_cb(unsigned int subsys, unsigned int signal, |
| 55 | void *handler_data, void *signal_data) |
| 56 | { |
| 57 | struct paging_signal_data *psig_data = signal_data; |
| 58 | |
| 59 | switch (signal) { |
| 60 | case S_PAGING_COMPLETED: |
| 61 | /* A subscriber has attached. */ |
| 62 | gsm48_send_rr_app_info(psig_data->lchan, 0x00, |
| 63 | sizeof(ms_based_pos_req), |
| 64 | ms_based_pos_req); |
| 65 | break; |
| 66 | } |
| 67 | return 0; |
| 68 | } |
| 69 | |
| 70 | void on_dso_load_rrlp(void) |
| 71 | { |
| 72 | register_signal_handler(SS_SUBSCR, subscr_sig_cb, NULL); |
| 73 | register_signal_handler(SS_PAGING, paging_sig_cb, NULL); |
| 74 | } |