Holger Hans Peter Freyther | 84ec871 | 2011-02-15 20:01:47 +0100 | [diff] [blame] | 1 | /* |
| 2 | * (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org> |
| 3 | * (C) 2010-2011 by On-Waves |
| 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 Affero General Public License as published by |
| 8 | * the Free Software Foundation, either version 3 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 Affero General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Affero General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #ifndef MSC_CONNECTION_H |
| 21 | #define MSC_CONNECTION_H |
| 22 | |
| 23 | #include <osmocore/linuxlist.h> |
| 24 | #include <osmocore/write_queue.h> |
| 25 | #include <osmocore/timer.h> |
| 26 | |
| 27 | #include <osmocom/sccp/sccp.h> |
| 28 | |
| 29 | struct bsc_data; |
| 30 | struct ss7_application; |
| 31 | |
| 32 | struct msc_connection { |
| 33 | /* management */ |
| 34 | struct llist_head entry; |
| 35 | int nr; |
| 36 | char *name; |
| 37 | |
| 38 | /* ip management */ |
| 39 | int dscp; |
| 40 | char *ip; |
| 41 | char *token; |
| 42 | |
| 43 | /* connection management */ |
| 44 | int msc_link_down; |
| 45 | struct write_queue msc_connection; |
| 46 | struct timer_list reconnect_timer; |
| 47 | int first_contact; |
| 48 | |
| 49 | /* time to wait for first message from MSC */ |
| 50 | struct timer_list msc_timeout; |
| 51 | int msc_time; |
| 52 | |
| 53 | /* timeouts for the msc connection */ |
| 54 | int ping_time; |
| 55 | int pong_time; |
| 56 | struct timer_list ping_timeout; |
| 57 | struct timer_list pong_timeout; |
| 58 | struct timer_list reset_timeout; |
| 59 | |
| 60 | /* mgcp messgaes */ |
| 61 | struct write_queue mgcp_agent; |
| 62 | |
| 63 | /* application pointer */ |
| 64 | struct llist_head sccp_connections; |
| 65 | struct mtp_link_set *target_link; |
| 66 | int forward_only; |
| 67 | int reset_count; |
| 68 | }; |
| 69 | |
| 70 | /* msc related functions */ |
| 71 | void msc_send_rlc(struct msc_connection *bsc, struct sccp_source_reference *src, struct sccp_source_reference *dest); |
| 72 | void msc_send_reset(struct msc_connection *bsc); |
| 73 | void msc_send_msg(struct msc_connection *bsc, int rc, struct sccp_parse_result *, struct msgb *msg); |
| 74 | void msc_send_direct(struct msc_connection *bsc, struct msgb *msg); |
| 75 | void msc_close_connection(struct msc_connection *data); |
| 76 | |
| 77 | struct msc_connection *msc_connection_create(struct bsc_data *bsc, int mgcp); |
| 78 | struct msc_connection *msc_connection_num(struct bsc_data *bsc, int num); |
| 79 | int msc_connection_start(struct msc_connection *msc); |
| 80 | |
| 81 | /* MGCP */ |
| 82 | void mgcp_forward(struct msc_connection *msc, const uint8_t *data, unsigned int length); |
| 83 | |
Holger Hans Peter Freyther | 3d4d8c7 | 2011-02-15 21:14:09 +0100 | [diff] [blame^] | 84 | /* Called by the MSC Connection */ |
| 85 | void msc_dispatch_sccp(struct msc_connection *msc, struct msgb *msg); |
| 86 | |
| 87 | |
Holger Hans Peter Freyther | 84ec871 | 2011-02-15 20:01:47 +0100 | [diff] [blame] | 88 | #endif |