Holger Hans Peter Freyther | 9a23af6 | 2009-06-12 07:08:13 +0200 | [diff] [blame] | 1 | /* The concept of a subscriber for the MSC, roughly HLR/VLR functionality */ |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2 | |
| 3 | /* (C) 2008 by Harald Welte <laforge@gnumonks.org> |
| 4 | * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org> |
| 5 | * |
| 6 | * All Rights Reserved |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 9 | * it under the terms of the GNU Affero General Public License as published by |
| 10 | * the Free Software Foundation; either version 3 of the License, or |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 16 | * GNU Affero General Public License for more details. |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 17 | * |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 18 | * You should have received a copy of the GNU Affero General Public License |
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 20 | * |
| 21 | */ |
| 22 | |
| 23 | #include <unistd.h> |
| 24 | #include <stdlib.h> |
| 25 | #include <stdio.h> |
| 26 | #include <string.h> |
Holger Freyther | 8bdf762 | 2009-04-18 13:48:55 +0200 | [diff] [blame] | 27 | #include <assert.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 28 | |
Sylvain Munaut | 3461975 | 2010-12-01 21:07:29 +0100 | [diff] [blame] | 29 | #include <osmocore/talloc.h> |
| 30 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 31 | #include <openbsc/gsm_subscriber.h> |
Sylvain Munaut | 65c51b6 | 2010-12-01 22:38:03 +0100 | [diff] [blame] | 32 | #include <openbsc/gsm_04_08.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 33 | #include <openbsc/debug.h> |
Sylvain Munaut | 3461975 | 2010-12-01 21:07:29 +0100 | [diff] [blame] | 34 | #include <openbsc/paging.h> |
Harald Welte | b779983 | 2009-07-29 23:14:15 +0200 | [diff] [blame] | 35 | #include <openbsc/signal.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 36 | #include <openbsc/db.h> |
| 37 | |
Sylvain Munaut | 3461975 | 2010-12-01 21:07:29 +0100 | [diff] [blame] | 38 | void *tall_sub_req_ctx; |
| 39 | |
Holger Hans Peter Freyther | 9a23af6 | 2009-06-12 07:08:13 +0200 | [diff] [blame] | 40 | extern struct llist_head *subscr_bsc_active_subscriber(void); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 41 | |
Sylvain Munaut | 65c51b6 | 2010-12-01 22:38:03 +0100 | [diff] [blame] | 42 | int gsm48_secure_channel(struct gsm_subscriber_connection *conn, int key_seq, |
| 43 | gsm_cbfn *cb, void *cb_data); |
| 44 | |
Sylvain Munaut | 3461975 | 2010-12-01 21:07:29 +0100 | [diff] [blame] | 45 | |
| 46 | /* |
| 47 | * Struct for pending channel requests. This is managed in the |
| 48 | * llist_head requests of each subscriber. The reference counting |
| 49 | * should work in such a way that a subscriber with a pending request |
| 50 | * remains in memory. |
| 51 | */ |
| 52 | struct subscr_request { |
| 53 | struct llist_head entry; |
| 54 | |
| 55 | /* back reference */ |
| 56 | struct gsm_subscriber *subscr; |
| 57 | |
| 58 | /* the requested channel type */ |
| 59 | int channel_type; |
| 60 | |
| 61 | /* the callback data */ |
| 62 | gsm_cbfn *cbfn; |
| 63 | void *param; |
| 64 | }; |
| 65 | |
| 66 | /* |
| 67 | * We got the channel assigned and can now hand this channel |
| 68 | * over to one of our callbacks. |
| 69 | */ |
Sylvain Munaut | 65c51b6 | 2010-12-01 22:38:03 +0100 | [diff] [blame] | 70 | static int subscr_paging_dispatch(unsigned int hooknum, unsigned int event, |
| 71 | struct msgb *msg, void *data, void *param) |
Sylvain Munaut | 3461975 | 2010-12-01 21:07:29 +0100 | [diff] [blame] | 72 | { |
| 73 | struct subscr_request *request; |
Sylvain Munaut | 7a8f881 | 2010-12-01 23:04:03 +0100 | [diff] [blame] | 74 | struct gsm_subscriber_connection *conn = data; |
Sylvain Munaut | 65c51b6 | 2010-12-01 22:38:03 +0100 | [diff] [blame] | 75 | struct gsm_subscriber *subscr = param; |
Sylvain Munaut | 7a8f881 | 2010-12-01 23:04:03 +0100 | [diff] [blame] | 76 | struct paging_signal_data sig_data; |
Sylvain Munaut | 3461975 | 2010-12-01 21:07:29 +0100 | [diff] [blame] | 77 | |
| 78 | /* There is no request anymore... */ |
| 79 | if (llist_empty(&subscr->requests)) |
| 80 | return -1; |
| 81 | |
Sylvain Munaut | 7a8f881 | 2010-12-01 23:04:03 +0100 | [diff] [blame] | 82 | /* Dispatch signal */ |
| 83 | sig_data.subscr = subscr; |
| 84 | sig_data.bts = conn ? conn->bts : NULL; |
| 85 | sig_data.conn = conn; |
Holger Hans Peter Freyther | ab2a933 | 2010-12-23 18:19:17 +0100 | [diff] [blame] | 86 | sig_data.paging_result = event; |
Sylvain Munaut | 7a8f881 | 2010-12-01 23:04:03 +0100 | [diff] [blame] | 87 | dispatch_signal( |
| 88 | SS_PAGING, |
| 89 | event == GSM_PAGING_SUCCEEDED ? |
| 90 | S_PAGING_SUCCEEDED : S_PAGING_EXPIRED, |
| 91 | &sig_data |
| 92 | ); |
| 93 | |
Sylvain Munaut | 3461975 | 2010-12-01 21:07:29 +0100 | [diff] [blame] | 94 | /* |
| 95 | * FIXME: What to do with paging requests coming during |
| 96 | * this callback? We must be sure to not start paging when |
| 97 | * we have an active connection to a subscriber and to make |
| 98 | * the subscr_put_channel work as required... |
| 99 | */ |
| 100 | request = (struct subscr_request *)subscr->requests.next; |
| 101 | llist_del(&request->entry); |
| 102 | subscr->in_callback = 1; |
| 103 | request->cbfn(hooknum, event, msg, data, request->param); |
| 104 | subscr->in_callback = 0; |
| 105 | |
Holger Hans Peter Freyther | a32e9c1 | 2010-12-28 17:47:43 +0100 | [diff] [blame] | 106 | if (event != GSM_PAGING_SUCCEEDED) { |
| 107 | /* |
| 108 | * This is a workaround for a bigger issue. We have |
| 109 | * issued paging that might involve multiple BTSes |
| 110 | * and one of them have failed now. We will stop the |
| 111 | * other paging requests as well as the next timeout |
| 112 | * would work on the next paging request and the queue |
| 113 | * will do bad things. This should be fixed by counting |
| 114 | * the outstanding results. |
| 115 | */ |
| 116 | paging_request_stop(NULL, subscr, NULL, NULL); |
Holger Hans Peter Freyther | bffd485 | 2010-12-28 17:27:05 +0100 | [diff] [blame] | 117 | subscr_put_channel(subscr); |
Holger Hans Peter Freyther | a32e9c1 | 2010-12-28 17:47:43 +0100 | [diff] [blame] | 118 | } |
Holger Hans Peter Freyther | bffd485 | 2010-12-28 17:27:05 +0100 | [diff] [blame] | 119 | |
Sylvain Munaut | 3461975 | 2010-12-01 21:07:29 +0100 | [diff] [blame] | 120 | subscr_put(subscr); |
| 121 | talloc_free(request); |
| 122 | return 0; |
| 123 | } |
| 124 | |
Sylvain Munaut | 65c51b6 | 2010-12-01 22:38:03 +0100 | [diff] [blame] | 125 | static int subscr_paging_sec_cb(unsigned int hooknum, unsigned int event, |
| 126 | struct msgb *msg, void *data, void *param) |
| 127 | { |
| 128 | int rc; |
| 129 | |
| 130 | switch (event) { |
| 131 | case GSM_SECURITY_AUTH_FAILED: |
| 132 | /* Dispatch as paging failure */ |
| 133 | rc = subscr_paging_dispatch( |
| 134 | GSM_HOOK_RR_PAGING, GSM_PAGING_EXPIRED, |
| 135 | msg, data, param); |
| 136 | break; |
| 137 | |
| 138 | case GSM_SECURITY_NOAVAIL: |
| 139 | case GSM_SECURITY_SUCCEEDED: |
| 140 | /* Dispatch as paging failure */ |
| 141 | rc = subscr_paging_dispatch( |
| 142 | GSM_HOOK_RR_PAGING, GSM_PAGING_SUCCEEDED, |
| 143 | msg, data, param); |
| 144 | break; |
| 145 | |
| 146 | default: |
| 147 | rc = -EINVAL; |
| 148 | } |
| 149 | |
| 150 | return rc; |
| 151 | } |
| 152 | |
| 153 | static int subscr_paging_cb(unsigned int hooknum, unsigned int event, |
| 154 | struct msgb *msg, void *data, void *param) |
| 155 | { |
| 156 | struct gsm_subscriber_connection *conn = data; |
| 157 | struct gsm48_hdr *gh; |
| 158 | struct gsm48_pag_resp *pr; |
| 159 | |
| 160 | /* Other cases mean problem, dispatch direclty */ |
| 161 | if (event != GSM_PAGING_SUCCEEDED) |
| 162 | return subscr_paging_dispatch(hooknum, event, msg, data, param); |
| 163 | |
| 164 | /* Get paging response */ |
| 165 | gh = msgb_l3(msg); |
| 166 | pr = (struct gsm48_pag_resp *)gh->data; |
| 167 | |
| 168 | /* We _really_ have a channel, secure it now ! */ |
| 169 | return gsm48_secure_channel(conn, pr->key_seq, subscr_paging_sec_cb, param); |
| 170 | } |
| 171 | |
| 172 | |
Sylvain Munaut | 3461975 | 2010-12-01 21:07:29 +0100 | [diff] [blame] | 173 | static void subscr_send_paging_request(struct gsm_subscriber *subscr) |
| 174 | { |
| 175 | struct subscr_request *request; |
| 176 | int rc; |
| 177 | |
| 178 | assert(!llist_empty(&subscr->requests)); |
| 179 | |
| 180 | request = (struct subscr_request *)subscr->requests.next; |
| 181 | rc = paging_request(subscr->net, subscr, request->channel_type, |
| 182 | subscr_paging_cb, subscr); |
| 183 | |
| 184 | /* paging failed, quit now */ |
| 185 | if (rc <= 0) { |
Holger Hans Peter Freyther | ab2a933 | 2010-12-23 18:19:17 +0100 | [diff] [blame] | 186 | subscr_paging_cb(GSM_HOOK_RR_PAGING, GSM_PAGING_BUSY, |
Sylvain Munaut | 3461975 | 2010-12-01 21:07:29 +0100 | [diff] [blame] | 187 | NULL, NULL, subscr); |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | void subscr_get_channel(struct gsm_subscriber *subscr, |
| 192 | int type, gsm_cbfn *cbfn, void *param) |
| 193 | { |
| 194 | struct subscr_request *request; |
| 195 | |
| 196 | request = talloc(tall_sub_req_ctx, struct subscr_request); |
| 197 | if (!request) { |
| 198 | if (cbfn) |
| 199 | cbfn(GSM_HOOK_RR_PAGING, GSM_PAGING_OOM, |
| 200 | NULL, NULL, param); |
| 201 | return; |
| 202 | } |
| 203 | |
| 204 | memset(request, 0, sizeof(*request)); |
| 205 | request->subscr = subscr_get(subscr); |
| 206 | request->channel_type = type; |
| 207 | request->cbfn = cbfn; |
| 208 | request->param = param; |
| 209 | |
| 210 | /* |
| 211 | * FIXME: We might be able to assign more than one |
| 212 | * channel, e.g. voice and SMS submit at the same |
| 213 | * time. |
| 214 | */ |
| 215 | if (!subscr->in_callback && llist_empty(&subscr->requests)) { |
| 216 | /* add to the list, send a request */ |
| 217 | llist_add_tail(&request->entry, &subscr->requests); |
| 218 | subscr_send_paging_request(subscr); |
| 219 | } else { |
| 220 | /* this will be picked up later, from subscr_put_channel */ |
| 221 | llist_add_tail(&request->entry, &subscr->requests); |
| 222 | } |
| 223 | } |
| 224 | |
Holger Hans Peter Freyther | 000571f | 2010-12-27 22:43:28 +0100 | [diff] [blame] | 225 | void subscr_put_channel(struct gsm_subscriber *subscr) |
Sylvain Munaut | 3461975 | 2010-12-01 21:07:29 +0100 | [diff] [blame] | 226 | { |
| 227 | /* |
| 228 | * FIXME: Continue with other requests now... by checking |
| 229 | * the gsm_subscriber inside the gsm_lchan. Drop the ref count |
| 230 | * of the lchan after having asked the next requestee to handle |
| 231 | * the channel. |
| 232 | */ |
| 233 | /* |
| 234 | * FIXME: is the lchan is of a different type we could still |
| 235 | * issue an immediate assignment for another channel and then |
| 236 | * close this one. |
| 237 | */ |
| 238 | /* |
| 239 | * Currently we will drop the last ref of the lchan which |
| 240 | * will result in a channel release on RSL and we will start |
| 241 | * the paging. This should work most of the time as the MS |
| 242 | * will listen to the paging requests before we timeout |
| 243 | */ |
| 244 | |
Holger Hans Peter Freyther | 000571f | 2010-12-27 22:43:28 +0100 | [diff] [blame] | 245 | if (subscr && !llist_empty(&subscr->requests)) |
| 246 | subscr_send_paging_request(subscr); |
Sylvain Munaut | 3461975 | 2010-12-01 21:07:29 +0100 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | |
Harald Welte | 7535041 | 2009-07-23 18:46:00 +0200 | [diff] [blame] | 250 | struct gsm_subscriber *subscr_get_by_tmsi(struct gsm_network *net, |
Holger Hans Peter Freyther | cd8bacf | 2009-08-19 12:53:57 +0200 | [diff] [blame] | 251 | u_int32_t tmsi) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 252 | { |
Holger Hans Peter Freyther | cd8bacf | 2009-08-19 12:53:57 +0200 | [diff] [blame] | 253 | char tmsi_string[14]; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 254 | struct gsm_subscriber *subscr; |
| 255 | |
| 256 | /* we might have a record in memory already */ |
Holger Hans Peter Freyther | 9a23af6 | 2009-06-12 07:08:13 +0200 | [diff] [blame] | 257 | llist_for_each_entry(subscr, subscr_bsc_active_subscriber(), entry) { |
Holger Hans Peter Freyther | cd8bacf | 2009-08-19 12:53:57 +0200 | [diff] [blame] | 258 | if (tmsi == subscr->tmsi) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 259 | return subscr_get(subscr); |
| 260 | } |
| 261 | |
Holger Hans Peter Freyther | cd8bacf | 2009-08-19 12:53:57 +0200 | [diff] [blame] | 262 | sprintf(tmsi_string, "%u", tmsi); |
| 263 | return db_get_subscriber(net, GSM_SUBSCRIBER_TMSI, tmsi_string); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 264 | } |
| 265 | |
Harald Welte | 7535041 | 2009-07-23 18:46:00 +0200 | [diff] [blame] | 266 | struct gsm_subscriber *subscr_get_by_imsi(struct gsm_network *net, |
| 267 | const char *imsi) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 268 | { |
| 269 | struct gsm_subscriber *subscr; |
| 270 | |
Holger Hans Peter Freyther | 9a23af6 | 2009-06-12 07:08:13 +0200 | [diff] [blame] | 271 | llist_for_each_entry(subscr, subscr_bsc_active_subscriber(), entry) { |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 272 | if (strcmp(subscr->imsi, imsi) == 0) |
| 273 | return subscr_get(subscr); |
| 274 | } |
| 275 | |
Harald Welte | 7535041 | 2009-07-23 18:46:00 +0200 | [diff] [blame] | 276 | return db_get_subscriber(net, GSM_SUBSCRIBER_IMSI, imsi); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 277 | } |
| 278 | |
Harald Welte | 7535041 | 2009-07-23 18:46:00 +0200 | [diff] [blame] | 279 | struct gsm_subscriber *subscr_get_by_extension(struct gsm_network *net, |
| 280 | const char *ext) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 281 | { |
| 282 | struct gsm_subscriber *subscr; |
| 283 | |
Holger Hans Peter Freyther | 9a23af6 | 2009-06-12 07:08:13 +0200 | [diff] [blame] | 284 | llist_for_each_entry(subscr, subscr_bsc_active_subscriber(), entry) { |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 285 | if (strcmp(subscr->extension, ext) == 0) |
| 286 | return subscr_get(subscr); |
| 287 | } |
| 288 | |
Harald Welte | 7535041 | 2009-07-23 18:46:00 +0200 | [diff] [blame] | 289 | return db_get_subscriber(net, GSM_SUBSCRIBER_EXTENSION, ext); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 290 | } |
| 291 | |
Harald Welte | 68b7df2 | 2009-08-08 16:03:15 +0200 | [diff] [blame] | 292 | struct gsm_subscriber *subscr_get_by_id(struct gsm_network *net, |
| 293 | unsigned long long id) |
| 294 | { |
| 295 | struct gsm_subscriber *subscr; |
| 296 | char buf[32]; |
| 297 | sprintf(buf, "%llu", id); |
| 298 | |
Holger Hans Peter Freyther | 9a23af6 | 2009-06-12 07:08:13 +0200 | [diff] [blame] | 299 | llist_for_each_entry(subscr, subscr_bsc_active_subscriber(), entry) { |
Harald Welte | 68b7df2 | 2009-08-08 16:03:15 +0200 | [diff] [blame] | 300 | if (subscr->id == id) |
| 301 | return subscr_get(subscr); |
| 302 | } |
| 303 | |
| 304 | return db_get_subscriber(net, GSM_SUBSCRIBER_ID, buf); |
| 305 | } |
| 306 | |
| 307 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 308 | int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason) |
| 309 | { |
Holger Hans Peter Freyther | 52a6375 | 2010-12-25 19:40:14 +0100 | [diff] [blame] | 310 | int rc; |
| 311 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 312 | /* FIXME: Migrate pending requests from one BSC to another */ |
| 313 | switch (reason) { |
| 314 | case GSM_SUBSCRIBER_UPDATE_ATTACHED: |
Harald Welte | c2189a6 | 2009-07-23 18:56:43 +0200 | [diff] [blame] | 315 | s->net = bts->network; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 316 | /* Indicate "attached to LAC" */ |
| 317 | s->lac = bts->location_area_code; |
Harald Welte | f00c2ac | 2009-12-24 13:48:14 +0100 | [diff] [blame] | 318 | LOGP(DMM, LOGL_INFO, "Subscriber %s ATTACHED LAC=%u\n", |
Harald Welte | 0747c6a | 2009-12-24 14:50:24 +0100 | [diff] [blame] | 319 | subscr_name(s), s->lac); |
Holger Hans Peter Freyther | 52a6375 | 2010-12-25 19:40:14 +0100 | [diff] [blame] | 320 | rc = db_sync_subscriber(s); |
| 321 | db_subscriber_update(s); |
Harald Welte | b779983 | 2009-07-29 23:14:15 +0200 | [diff] [blame] | 322 | dispatch_signal(SS_SUBSCR, S_SUBSCR_ATTACHED, s); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 323 | break; |
| 324 | case GSM_SUBSCRIBER_UPDATE_DETACHED: |
| 325 | /* Only detach if we are currently in this area */ |
| 326 | if (bts->location_area_code == s->lac) |
Holger Hans Peter Freyther | 6c6ab86 | 2009-10-01 04:07:15 +0200 | [diff] [blame] | 327 | s->lac = GSM_LAC_RESERVED_DETACHED; |
Harald Welte | 0747c6a | 2009-12-24 14:50:24 +0100 | [diff] [blame] | 328 | LOGP(DMM, LOGL_INFO, "Subscriber %s DETACHED\n", subscr_name(s)); |
Holger Hans Peter Freyther | 52a6375 | 2010-12-25 19:40:14 +0100 | [diff] [blame] | 329 | rc = db_sync_subscriber(s); |
| 330 | db_subscriber_update(s); |
Harald Welte | b779983 | 2009-07-29 23:14:15 +0200 | [diff] [blame] | 331 | dispatch_signal(SS_SUBSCR, S_SUBSCR_DETACHED, s); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 332 | break; |
| 333 | default: |
| 334 | fprintf(stderr, "subscr_update with unknown reason: %d\n", |
| 335 | reason); |
Holger Hans Peter Freyther | 52a6375 | 2010-12-25 19:40:14 +0100 | [diff] [blame] | 336 | rc = db_sync_subscriber(s); |
| 337 | db_subscriber_update(s); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 338 | break; |
| 339 | }; |
Holger Hans Peter Freyther | 52a6375 | 2010-12-25 19:40:14 +0100 | [diff] [blame] | 340 | |
| 341 | return rc; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 342 | } |
| 343 | |
Holger Hans Peter Freyther | 0c29e5f | 2010-12-22 18:12:11 +0100 | [diff] [blame] | 344 | void subscr_update_from_db(struct gsm_subscriber *sub) |
| 345 | { |
| 346 | db_subscriber_update(sub); |
| 347 | } |
Holger Hans Peter Freyther | 5b72b30 | 2010-12-28 22:12:30 +0100 | [diff] [blame^] | 348 | |
| 349 | int subscr_pending_requests(struct gsm_subscriber *sub) |
| 350 | { |
| 351 | struct subscr_request *req; |
| 352 | int pending = 0; |
| 353 | |
| 354 | llist_for_each_entry(req, &sub->requests, entry) |
| 355 | pending += 1; |
| 356 | |
| 357 | return pending; |
| 358 | } |