Stefan Schmidt | 4d4661d | 2008-12-27 22:59:48 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) 2008 by Holger Hans Peter Freyther <zecke@selfish.org> |
| 3 | * (C) 2008 by Stefan Schmidt <stefan@datenfreihafen.org> |
| 4 | * All Rights Reserved |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along |
| 17 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #ifndef _CALL_HANDLING_H |
| 23 | #define _CALL_HANDLING_H |
| 24 | |
| 25 | #include "linuxlist.h" |
| 26 | #include "gsm_subscriber.h" |
| 27 | #include "timer.h" |
| 28 | |
| 29 | /* |
| 30 | * State transitions to be seen from the outside |
| 31 | */ |
| 32 | #define CALL_STATE_NULL 0 |
| 33 | #define CALL_STATE_SETUP 1 |
| 34 | #define CALL_STATE_PROCEED 2 |
| 35 | #define CALL_STATE_ALERT 3 |
| 36 | #define CALL_STATE_CONNECT 4 |
| 37 | #define CALL_STATE_ACTIVE 5 |
| 38 | #define CALL_STATE_RELEASE 6 |
| 39 | |
| 40 | struct call_data { |
| 41 | struct llist_head entry; |
| 42 | void (*state_change_cb)(int oldstate, int newstate, int event, void *data); |
| 43 | void *data; |
| 44 | char *destination_number; |
| 45 | |
| 46 | /* Internal */ |
| 47 | int state; |
| 48 | char tmsi[GSM_TMSI_LENGTH]; |
| 49 | struct timer_list t30x; /* to be added for... */ |
| 50 | }; |
| 51 | |
| 52 | |
| 53 | int call_initiate(struct call_data *call, char *tmsi); |
| 54 | void call_abort(struct call_data *call); |
| 55 | |
| 56 | /** |
| 57 | * Get notified about new incoming calls. The call_data is owned |
| 58 | * and managed by the internal call handling. |
| 59 | */ |
| 60 | void call_set_callback(void (*cb)(struct call_data *call, void *data), void* data); |
| 61 | void call_proceed(struct call_data *call_data); |
| 62 | void call_connect(struct call_data *call_data); |
| 63 | |
| 64 | #endif /* _CALL_HANDLING_H */ |