Holger Hans Peter Freyther | c2b31ed | 2010-07-31 05:17:17 +0800 | [diff] [blame^] | 1 | /* NAT utilities using SCCP types */ |
| 2 | /* |
| 3 | * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org> |
| 4 | * (C) 2010 by On-Waves |
| 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 | #ifndef BSC_NAT_SCCP_H |
| 24 | #define BSC_NAT_SCCP_H |
| 25 | |
| 26 | #include <sys/types.h> |
| 27 | #include <sccp/sccp_types.h> |
| 28 | |
| 29 | /* |
| 30 | * For the NAT we will need to analyze and later patch |
| 31 | * the received message. This would require us to parse |
| 32 | * the IPA and SCCP header twice. Instead of doing this |
| 33 | * we will have one analyze structure and have the patching |
| 34 | * and filter operate on the same structure. |
| 35 | */ |
| 36 | struct bsc_nat_parsed { |
| 37 | /* ip access prototype */ |
| 38 | int ipa_proto; |
| 39 | |
| 40 | /* source local reference */ |
| 41 | struct sccp_source_reference *src_local_ref; |
| 42 | |
| 43 | /* destination local reference */ |
| 44 | struct sccp_source_reference *dest_local_ref; |
| 45 | |
| 46 | /* called ssn number */ |
| 47 | int called_ssn; |
| 48 | |
| 49 | /* calling ssn number */ |
| 50 | int calling_ssn; |
| 51 | |
| 52 | /* sccp message type */ |
| 53 | int sccp_type; |
| 54 | |
| 55 | /* bssap type, e.g. 0 for BSS Management */ |
| 56 | int bssap; |
| 57 | |
| 58 | /* the gsm0808 message type */ |
| 59 | int gsm_type; |
| 60 | }; |
| 61 | |
| 62 | /* |
| 63 | * Per SCCP source local reference patch table. It needs to |
| 64 | * be updated on new SCCP connections, connection confirm and reject, |
| 65 | * and on the loss of the BSC connection. |
| 66 | */ |
| 67 | struct sccp_connections { |
| 68 | struct llist_head list_entry; |
| 69 | |
| 70 | struct bsc_connection *bsc; |
| 71 | struct bsc_msc_connection *msc_con; |
| 72 | |
| 73 | struct sccp_source_reference real_ref; |
| 74 | struct sccp_source_reference patched_ref; |
| 75 | struct sccp_source_reference remote_ref; |
| 76 | int has_remote_ref; |
| 77 | |
| 78 | /* status */ |
| 79 | int con_type; |
| 80 | int con_local; |
| 81 | |
| 82 | /* GSM audio handling. That is 32 * multiplex + ts */ |
| 83 | int crcx; |
| 84 | int msc_timeslot; |
| 85 | int bsc_timeslot; |
| 86 | |
| 87 | /* timeout handling */ |
| 88 | struct timespec creation_time; |
| 89 | }; |
| 90 | |
| 91 | |
| 92 | #endif |