Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 1 | /* minimalistic telnet/network interface it might turn into a wire interface */ |
| 2 | /* (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org> |
| 3 | * All Rights Reserved |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #include <sys/socket.h> |
| 22 | #include <netinet/in.h> |
| 23 | #include <malloc.h> |
| 24 | #include <stdio.h> |
| 25 | #include <string.h> |
| 26 | #include <unistd.h> |
| 27 | |
| 28 | #include <openbsc/telnet_interface.h> |
Holger Freyther | ae61cae | 2009-01-04 03:46:01 +0000 | [diff] [blame] | 29 | #include <openbsc/gsm_subscriber.h> |
Holger Freyther | f87573d | 2009-01-04 03:49:41 +0000 | [diff] [blame] | 30 | #include <openbsc/chan_alloc.h> |
Holger Freyther | 3ae8fd2 | 2009-01-04 03:50:40 +0000 | [diff] [blame] | 31 | #include <openbsc/gsm_04_08.h> |
Holger Freyther | 9b17776 | 2009-02-16 19:07:18 +0000 | [diff] [blame] | 32 | #include <openbsc/gsm_04_11.h> |
Holger Freyther | 868b8cd | 2009-01-04 03:57:27 +0000 | [diff] [blame] | 33 | #include <openbsc/msgb.h> |
Holger Freyther | 7448a53 | 2009-01-04 20:18:23 +0000 | [diff] [blame] | 34 | #include <openbsc/abis_rsl.h> |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 35 | #include <openbsc/paging.h> |
Holger Freyther | 7aaf112 | 2009-02-14 22:51:13 +0000 | [diff] [blame] | 36 | #include <openbsc/signal.h> |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 37 | |
| 38 | extern void telnet_parse(struct telnet_connection *connection, char *line); |
| 39 | |
Holger Freyther | ae61cae | 2009-01-04 03:46:01 +0000 | [diff] [blame] | 40 | #define WRITE_CONNECTION(fd, msg...) \ |
| 41 | int ret; \ |
| 42 | char buf[4096]; \ |
| 43 | snprintf(buf, sizeof(buf), msg); \ |
| 44 | ret = write(fd, buf, strlen(buf)); |
| 45 | |
| 46 | |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 47 | /* per connection data */ |
| 48 | LLIST_HEAD(active_connections); |
| 49 | |
| 50 | /* per network data */ |
| 51 | static int telnet_new_connection(struct bsc_fd *fd, unsigned int what); |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 52 | static int telnet_paging_callback(unsigned int subsys, unsigned int signal, |
| 53 | void *handler_data, void *signal_data); |
| 54 | static int telnet_sms_callback(unsigned int subsys, unsigned int signal, |
| 55 | void *handler_data, void *signal_data); |
Holger Freyther | 7aaf112 | 2009-02-14 22:51:13 +0000 | [diff] [blame] | 56 | |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 57 | static struct bsc_fd server_socket = { |
| 58 | .when = BSC_FD_READ, |
| 59 | .cb = telnet_new_connection, |
| 60 | .priv_nr = 0, |
| 61 | }; |
| 62 | |
| 63 | void telnet_init(struct gsm_network *network, int port) { |
| 64 | struct sockaddr_in sock_addr; |
Holger Freyther | f077689 | 2009-02-03 20:49:51 +0000 | [diff] [blame] | 65 | int fd, on = 1; |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 66 | |
| 67 | fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); |
| 68 | |
| 69 | if (fd < 0) { |
| 70 | perror("Telnet interface socket creation failed"); |
| 71 | return; |
| 72 | } |
| 73 | |
Holger Freyther | f077689 | 2009-02-03 20:49:51 +0000 | [diff] [blame] | 74 | setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); |
| 75 | |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 76 | memset(&sock_addr, 0, sizeof(sock_addr)); |
| 77 | sock_addr.sin_family = AF_INET; |
| 78 | sock_addr.sin_port = htons(port); |
| 79 | sock_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); |
| 80 | |
| 81 | if (bind(fd, (struct sockaddr*)&sock_addr, sizeof(sock_addr)) < 0) { |
| 82 | perror("Telnet interface failed to bind"); |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | if (listen(fd, 0) < 0) { |
| 87 | perror("Telnet interface failed to listen"); |
| 88 | return; |
| 89 | } |
| 90 | |
| 91 | server_socket.data = network; |
| 92 | server_socket.fd = fd; |
| 93 | bsc_register_fd(&server_socket); |
Holger Freyther | 7aaf112 | 2009-02-14 22:51:13 +0000 | [diff] [blame] | 94 | |
Holger Freyther | 9b17776 | 2009-02-16 19:07:18 +0000 | [diff] [blame] | 95 | /* register callbacks */ |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 96 | register_signal_handler(SS_PAGING, telnet_paging_callback, network); |
| 97 | register_signal_handler(SS_SMS, telnet_sms_callback, network); |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | void telnet_write_help(int fd) { |
| 101 | int ret; |
| 102 | static char *msg = |
| 103 | "Help for the ad-hoc telnet command line interface\n" |
| 104 | "The generic pattern is CMD LEN DATA\\n or just CMD\n" |
| 105 | "where CMD is one of the following:\n" |
| 106 | "help\n" |
| 107 | "page IMSI (type)\n" |
| 108 | "call IMSI (number)\n" |
| 109 | "get_channel IMSI Add use count on an active channel\n" |
| 110 | "put_channel IMSI Remove use count on an active channel\n" |
Holger Freyther | ae61cae | 2009-01-04 03:46:01 +0000 | [diff] [blame] | 111 | "show This will show the channel allocation\n" |
Holger Freyther | 868b8cd | 2009-01-04 03:57:27 +0000 | [diff] [blame] | 112 | "48 IMSI 0xAB 0xEF...Send GSM 04.08. proto and msg byte then data\n" |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 113 | "11 IMSI 0xAB 0xEF...Send GSM 04.11\n"; |
| 114 | |
| 115 | ret = write(fd, msg, strlen(msg)); |
| 116 | } |
| 117 | |
| 118 | static void print_welcome(int fd) { |
| 119 | int ret; |
| 120 | static char *msg = |
| 121 | "Welcome to the OpenBSC Control interface\n" |
| 122 | "Copyright (C) 2008, 2009 Harald Welte\n" |
| 123 | "Contributions by Daniel Willmann, Jan Lübbe, " |
| 124 | "Stefan Schmidt, Holger Freyther\n\n" |
| 125 | "License GPLv2+: GNU GPL version 2 or later " |
| 126 | "<http://gnu.org/licenses/gpl.html>\n" |
| 127 | "This is free software: you are free to change " |
| 128 | "and redistribute it.\n" |
| 129 | "There is NO WARRANTY, to the extent permitted " |
| 130 | "by law.\nType \"help\" to get a short introduction.\n"; |
| 131 | |
| 132 | ret = write(fd, msg, strlen(msg)); |
| 133 | } |
| 134 | |
| 135 | int telnet_close_client(struct bsc_fd *fd) { |
| 136 | struct telnet_connection *conn = (struct telnet_connection*)fd->data; |
| 137 | |
| 138 | close(fd->fd); |
| 139 | bsc_unregister_fd(fd); |
| 140 | llist_del(&conn->entry); |
| 141 | free(conn); |
| 142 | return 0; |
| 143 | } |
| 144 | |
| 145 | void telnet_error_client(int fd) { |
| 146 | int ret; |
| 147 | static char *msg = "Something went wrong. Please try again.\n"; |
| 148 | |
| 149 | printf("Error\n"); |
| 150 | ret = write(fd, msg, strlen(msg)); |
| 151 | } |
| 152 | |
Holger Freyther | f87573d | 2009-01-04 03:49:41 +0000 | [diff] [blame] | 153 | static struct gsm_lchan* find_channel(struct gsm_bts *bts, const char *imsi, |
| 154 | const char **error, int fd) { |
| 155 | int ret; |
| 156 | struct gsm_lchan *lchan; |
| 157 | struct gsm_subscriber *subscr; |
| 158 | |
| 159 | subscr = subscr_get_by_imsi(imsi); |
| 160 | if (!subscr) { |
| 161 | ret = write(fd, error[0], strlen(error[0])); |
| 162 | return NULL; |
| 163 | } |
| 164 | |
| 165 | lchan = lchan_find(bts, subscr); |
| 166 | if (!lchan) |
| 167 | ret = write(fd, error[1], strlen(error[1])); |
| 168 | |
| 169 | subscr_put(subscr); |
| 170 | return lchan; |
| 171 | } |
| 172 | |
Holger Freyther | 7448a53 | 2009-01-04 20:18:23 +0000 | [diff] [blame] | 173 | void telnet_page(struct telnet_connection *connection, const char *imsi, int type) { |
| 174 | int ret; |
| 175 | static const char* error[] = { |
| 176 | "paging: IMSI not found\n", |
| 177 | "paging: No channel allocated for IMSI -> will allocate\n" }; |
| 178 | struct gsm_bts *bts = &connection->network->bts[connection->bts]; |
| 179 | struct gsm_lchan *lchan = find_channel(bts, imsi, error, connection->fd.fd); |
| 180 | |
| 181 | if (lchan) { |
| 182 | static const char *msg = "paging: A Channel is already allocated.\n"; |
| 183 | ret = write(connection->fd.fd, msg, strlen(msg)); |
| 184 | return; |
| 185 | } |
| 186 | |
| 187 | struct gsm_subscriber *subscr = subscr_get_by_imsi(imsi); |
| 188 | if (!subscr) |
| 189 | return; |
| 190 | |
Harald Welte | 09e38af | 2009-02-16 22:52:23 +0000 | [diff] [blame] | 191 | paging_request(bts, subscr, type, NULL, NULL); |
Holger Freyther | 7448a53 | 2009-01-04 20:18:23 +0000 | [diff] [blame] | 192 | } |
| 193 | |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 194 | void telnet_put_channel(struct telnet_connection *connection, const char *imsi) { |
Holger Freyther | f87573d | 2009-01-04 03:49:41 +0000 | [diff] [blame] | 195 | static const char* error[] = { |
| 196 | "put_channel: IMSI not found\n", |
| 197 | "put_channel: No channel allocated for IMSI\n" }; |
| 198 | struct gsm_bts *bts = &connection->network->bts[connection->bts]; |
| 199 | struct gsm_lchan *lchan = find_channel(bts, imsi, error, connection->fd.fd); |
| 200 | |
| 201 | if (!lchan) |
| 202 | return; |
| 203 | |
| 204 | put_lchan(lchan); |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | void telnet_get_channel(struct telnet_connection *connection, const char *imsi) { |
Holger Freyther | f87573d | 2009-01-04 03:49:41 +0000 | [diff] [blame] | 208 | static const char* error[] = { |
| 209 | "get_channel: IMSI not found\n", |
| 210 | "get_channel: No channel allocated for IMSI\n" }; |
| 211 | struct gsm_bts *bts = &connection->network->bts[connection->bts]; |
| 212 | struct gsm_lchan *lchan = find_channel(bts, imsi, error, connection->fd.fd); |
| 213 | |
| 214 | if (!lchan) |
| 215 | return; |
| 216 | |
| 217 | use_lchan(lchan); |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | void telnet_call(struct telnet_connection *connection, const char* imsi, |
| 221 | const char *origin) { |
Holger Freyther | 3ae8fd2 | 2009-01-04 03:50:40 +0000 | [diff] [blame] | 222 | static const char* error[] = { |
| 223 | "call: IMSI not found\n", |
| 224 | "call: No channel allocated for IMSI\n" }; |
| 225 | struct gsm_bts *bts = &connection->network->bts[connection->bts]; |
| 226 | struct gsm_lchan *lchan = find_channel(bts, imsi, error, connection->fd.fd); |
| 227 | |
| 228 | if (!lchan) |
| 229 | return; |
| 230 | |
| 231 | /* TODO: add the origin */ |
Harald Welte | 49f48b8 | 2009-02-17 15:29:33 +0000 | [diff] [blame] | 232 | gsm48_cc_tx_setup(lchan, NULL); |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | void telnet_send_gsm_48(struct telnet_connection *connection) { |
Holger Freyther | 868b8cd | 2009-01-04 03:57:27 +0000 | [diff] [blame] | 236 | static const char* error[] = { |
| 237 | "48: IMSI not found\n", |
| 238 | "48: No channel allocated for IMSI\n" }; |
Holger Freyther | 5e76ce6 | 2009-01-04 20:15:12 +0000 | [diff] [blame] | 239 | int ret; |
Holger Freyther | 868b8cd | 2009-01-04 03:57:27 +0000 | [diff] [blame] | 240 | struct gsm_bts *bts = &connection->network->bts[connection->bts]; |
| 241 | struct gsm_lchan *lchan = find_channel(bts, connection->imsi, error, connection->fd.fd); |
| 242 | |
| 243 | if (!lchan) |
| 244 | return; |
| 245 | |
Holger Freyther | 5e76ce6 | 2009-01-04 20:15:12 +0000 | [diff] [blame] | 246 | if (connection->read < 2) { |
| 247 | static const char *msg = "48: Need at least two bytes"; |
| 248 | ret = write(connection->fd.fd, msg, strlen(msg)); |
| 249 | return; |
| 250 | } |
| 251 | |
Holger Freyther | 868b8cd | 2009-01-04 03:57:27 +0000 | [diff] [blame] | 252 | struct msgb *msg = gsm48_msgb_alloc(); |
| 253 | struct gsm48_hdr *gh; |
| 254 | int i; |
| 255 | |
| 256 | gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + connection->read-2); |
| 257 | msg->lchan = lchan; |
| 258 | |
| 259 | gh->proto_discr = connection->commands[0]; |
| 260 | gh->msg_type = connection->commands[1]; |
| 261 | for (i = 2; i < connection->read; ++i) |
| 262 | gh->data[i-2] = connection->commands[i]; |
| 263 | |
Holger Freyther | 4c8f114 | 2009-01-04 20:17:07 +0000 | [diff] [blame] | 264 | gsm48_sendmsg(msg); |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 265 | } |
| 266 | |
| 267 | void telnet_send_gsm_11(struct telnet_connection *connection) { |
| 268 | printf("sending gsm04.11 message\n"); |
| 269 | } |
| 270 | |
Holger Freyther | ae61cae | 2009-01-04 03:46:01 +0000 | [diff] [blame] | 271 | static void show_bts(int fd, struct gsm_bts *bts) { |
| 272 | WRITE_CONNECTION(fd, |
| 273 | "BTS #%u on link %u LOC: %u TRX: %d CCCH0: arfcn:%u,#%u\n", |
| 274 | bts->nr, bts->bts_nr, bts->location_area_code, |
| 275 | bts->num_trx, bts->c0->arfcn, bts->c0->nr) |
| 276 | } |
| 277 | |
| 278 | static void show_trx(int fd, struct gsm_bts_trx *trx) { |
| 279 | WRITE_CONNECTION(fd, |
| 280 | " TRX: %u ARFCN: %u\n", |
| 281 | trx->nr, trx->arfcn) |
| 282 | } |
| 283 | |
| 284 | static void show_ts(int fd, struct gsm_bts_trx_ts *ts) { |
| 285 | WRITE_CONNECTION(fd, |
Harald Welte | d4fc1b2 | 2009-01-04 16:11:31 +0000 | [diff] [blame] | 286 | " TS: #%u pchan: %12s flags: %u\n", |
| 287 | ts->nr, gsm_pchan_name(ts->pchan), ts->flags); |
Holger Freyther | ae61cae | 2009-01-04 03:46:01 +0000 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | static void show_lchan(int fd, struct gsm_lchan *lchan) { |
| 291 | struct gsm_subscriber *subscr = lchan->subscr; |
| 292 | WRITE_CONNECTION(fd, |
Harald Welte | 626fe9c | 2009-01-09 21:24:53 +0000 | [diff] [blame] | 293 | " LCHAN: #%u type: %7s count: %d subscriber: %s/%s/%s use: %d loc: %p\n", |
Harald Welte | d4fc1b2 | 2009-01-04 16:11:31 +0000 | [diff] [blame] | 294 | lchan->nr, gsm_lchan_name(lchan->type), |
Harald Welte | 626fe9c | 2009-01-09 21:24:53 +0000 | [diff] [blame] | 295 | lchan->use_count, |
Holger Freyther | ae61cae | 2009-01-04 03:46:01 +0000 | [diff] [blame] | 296 | subscr ? subscr->imsi : "na", |
| 297 | subscr ? subscr->tmsi : "na", |
| 298 | subscr ? subscr->name : "na", |
| 299 | lchan->use_count, lchan->loc_operation); |
| 300 | } |
| 301 | |
| 302 | void telnet_list_channels(struct telnet_connection *connection) { |
| 303 | int bts_no, trx, lchan_no, ts_no; |
| 304 | struct gsm_network *network = connection->network; |
| 305 | |
| 306 | for (bts_no = 0; bts_no < network->num_bts; ++bts_no) { |
| 307 | struct gsm_bts *bts = &network->bts[bts_no]; |
| 308 | show_bts(connection->fd.fd, bts); |
| 309 | |
| 310 | for (trx = 0; trx < bts->num_trx; ++trx) { |
| 311 | show_trx(connection->fd.fd, &bts->trx[trx]); |
| 312 | for (ts_no = 0; ts_no < 8; ++ts_no) { |
| 313 | show_ts(connection->fd.fd, &bts->trx[trx].ts[ts_no]); |
| 314 | for (lchan_no = 0; lchan_no < TS_MAX_LCHAN; ++lchan_no) { |
| 315 | struct gsm_lchan *lchan = |
| 316 | &bts->trx[trx].ts[ts_no].lchan[lchan_no]; |
| 317 | show_lchan(connection->fd.fd, lchan); |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 324 | static int client_data(struct bsc_fd *fd, unsigned int what) { |
| 325 | char buf[4096]; |
| 326 | int ret; |
| 327 | |
| 328 | ret = read(fd->fd, buf, sizeof(buf)-1); |
| 329 | buf[ret] = '\0'; |
| 330 | |
| 331 | /* connection is gone */ |
| 332 | if (ret <= 0) |
| 333 | return telnet_close_client(fd); |
| 334 | |
| 335 | /* time to parse. This code assumes that the input is line based */ |
| 336 | telnet_parse((struct telnet_connection*)fd->data, buf); |
| 337 | |
| 338 | return 0; |
| 339 | } |
| 340 | |
| 341 | static int telnet_new_connection(struct bsc_fd *fd, unsigned int what) { |
| 342 | struct telnet_connection *connection; |
| 343 | struct sockaddr_in sockaddr; |
| 344 | socklen_t len = sizeof(sockaddr); |
| 345 | int new_connection = accept(fd->fd, (struct sockaddr*)&sockaddr, &len); |
| 346 | |
| 347 | if (new_connection < 0) { |
| 348 | perror("telnet accept failed"); |
| 349 | return -1; |
| 350 | } |
| 351 | |
| 352 | |
| 353 | connection = (struct telnet_connection*)malloc(sizeof(*connection)); |
| 354 | memset(connection, 0, sizeof(*connection)); |
| 355 | connection->network = (struct gsm_network*)fd->data; |
| 356 | connection->fd.data = connection; |
| 357 | connection->fd.fd = new_connection; |
| 358 | connection->fd.when = BSC_FD_READ; |
| 359 | connection->fd.cb = client_data; |
Holger Freyther | f87573d | 2009-01-04 03:49:41 +0000 | [diff] [blame] | 360 | connection->bts = 0; |
Holger Freyther | 219518d | 2009-01-02 22:04:43 +0000 | [diff] [blame] | 361 | bsc_register_fd(&connection->fd); |
| 362 | llist_add_tail(&connection->entry, &active_connections); |
| 363 | |
| 364 | print_welcome(new_connection); |
| 365 | |
| 366 | return 0; |
| 367 | } |
Holger Freyther | 7aaf112 | 2009-02-14 22:51:13 +0000 | [diff] [blame] | 368 | |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 369 | static int telnet_paging_callback(unsigned int subsys, unsigned int singal, |
| 370 | void *handler_data, void *signal_data) |
Holger Freyther | 7aaf112 | 2009-02-14 22:51:13 +0000 | [diff] [blame] | 371 | { |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 372 | struct paging_signal_data *paging = signal_data; |
Holger Freyther | 7aaf112 | 2009-02-14 22:51:13 +0000 | [diff] [blame] | 373 | struct telnet_connection *con; |
| 374 | |
| 375 | llist_for_each_entry(con, &active_connections, entry) { |
| 376 | if (paging->lchan) { |
| 377 | WRITE_CONNECTION(con->fd.fd, "Paging succeeded\n"); |
| 378 | show_lchan(con->fd.fd, paging->lchan); |
| 379 | } else { |
| 380 | WRITE_CONNECTION(con->fd.fd, "Paging failed for subscriber: %s/%s/%s\n", |
| 381 | paging->subscr->imsi, |
| 382 | paging->subscr->tmsi, |
| 383 | paging->subscr->name); |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | return 0; |
| 388 | } |
Holger Freyther | 9b17776 | 2009-02-16 19:07:18 +0000 | [diff] [blame] | 389 | |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 390 | static int telnet_sms_callback(unsigned int subsys, unsigned int signal, |
| 391 | void *handler_data, void *signal_data) |
Holger Freyther | 9b17776 | 2009-02-16 19:07:18 +0000 | [diff] [blame] | 392 | { |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 393 | struct sms_submit *sms = signal_data; |
Holger Freyther | 9b17776 | 2009-02-16 19:07:18 +0000 | [diff] [blame] | 394 | struct telnet_connection *con; |
| 395 | |
| 396 | llist_for_each_entry(con, &active_connections, entry) { |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 397 | WRITE_CONNECTION(con->fd.fd, "Incoming SMS: %s\n", sms->user_data); |
Holger Freyther | 9b17776 | 2009-02-16 19:07:18 +0000 | [diff] [blame] | 398 | } |
| 399 | |
| 400 | return 0; |
| 401 | } |