Harald Welte (local) | b8afe81 | 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> |
| 29 | |
| 30 | /* RRLP MS based position request */ |
| 31 | static const u_int8_t ms_based_pos_req[] = { 0x40, 0x01, 0x78, 0xa8 }; |
| 32 | |
| 33 | static int subscr_sig_cb(unsigned int subsys, unsigned int signal, |
| 34 | void *handler_data, void *signal_data) |
| 35 | { |
| 36 | struct gsm_subscriber *subscr; |
| 37 | struct gsm_lchan *lchan; |
| 38 | |
| 39 | switch (signal) { |
| 40 | case S_SUBSCR_ATTACHED: |
| 41 | /* A subscriber has attached. */ |
| 42 | subscr = signal_data; |
| 43 | lchan = lchan_for_subscr(subscr); |
| 44 | if (!lchan) |
| 45 | break; |
| 46 | gsm48_send_rr_app_info(lchan, 0x00, sizeof(ms_based_pos_req), |
| 47 | ms_based_pos_req); |
| 48 | break; |
| 49 | } |
| 50 | return 0; |
| 51 | } |
| 52 | |
| 53 | static int paging_sig_cb(unsigned int subsys, unsigned int signal, |
| 54 | void *handler_data, void *signal_data) |
| 55 | { |
| 56 | struct paging_signal_data *psig_data = signal_data; |
| 57 | |
| 58 | switch (signal) { |
| 59 | case S_PAGING_COMPLETED: |
| 60 | /* A subscriber has attached. */ |
| 61 | gsm48_send_rr_app_info(psig_data->lchan, 0x00, |
| 62 | sizeof(ms_based_pos_req), |
| 63 | ms_based_pos_req); |
| 64 | break; |
| 65 | } |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | void on_dso_load_rrlp(void) |
| 70 | { |
| 71 | register_signal_handler(SS_SUBSCR, subscr_sig_cb, NULL); |
| 72 | register_signal_handler(SS_PAGING, paging_sig_cb, NULL); |
| 73 | } |