blob: 0ade668c4d30cd6c63fa1e001cc37798d4289438 [file] [log] [blame]
Holger Hans Peter Freytherc2b31ed2010-07-31 05:17:17 +08001/* 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
Harald Welte9af6ddf2011-01-01 15:25:50 +01008 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
Holger Hans Peter Freytherc2b31ed2010-07-31 05:17:17 +080010 * (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
Harald Welte9af6ddf2011-01-01 15:25:50 +010015 * GNU Affero General Public License for more details.
Holger Hans Peter Freytherc2b31ed2010-07-31 05:17:17 +080016 *
Harald Welte9af6ddf2011-01-01 15:25:50 +010017 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Holger Hans Peter Freytherc2b31ed2010-07-31 05:17:17 +080019 *
20 */
21
22#ifndef BSC_NAT_SCCP_H
23#define BSC_NAT_SCCP_H
24
25#include <sys/types.h>
Harald Welted5db12c2010-08-03 15:11:51 +020026#include <osmocom/sccp/sccp_types.h>
Holger Hans Peter Freytherc2b31ed2010-07-31 05:17:17 +080027
28/*
29 * For the NAT we will need to analyze and later patch
30 * the received message. This would require us to parse
31 * the IPA and SCCP header twice. Instead of doing this
32 * we will have one analyze structure and have the patching
33 * and filter operate on the same structure.
34 */
35struct bsc_nat_parsed {
36 /* ip access prototype */
37 int ipa_proto;
38
39 /* source local reference */
40 struct sccp_source_reference *src_local_ref;
41
42 /* destination local reference */
43 struct sccp_source_reference *dest_local_ref;
44
45 /* called ssn number */
46 int called_ssn;
47
48 /* calling ssn number */
49 int calling_ssn;
50
51 /* sccp message type */
52 int sccp_type;
53
54 /* bssap type, e.g. 0 for BSS Management */
55 int bssap;
56
57 /* the gsm0808 message type */
58 int gsm_type;
59};
60
61/*
62 * Per SCCP source local reference patch table. It needs to
63 * be updated on new SCCP connections, connection confirm and reject,
64 * and on the loss of the BSC connection.
65 */
66struct sccp_connections {
67 struct llist_head list_entry;
68
69 struct bsc_connection *bsc;
70 struct bsc_msc_connection *msc_con;
71
72 struct sccp_source_reference real_ref;
73 struct sccp_source_reference patched_ref;
74 struct sccp_source_reference remote_ref;
75 int has_remote_ref;
76
77 /* status */
78 int con_type;
79 int con_local;
Holger Hans Peter Freyther909e61f2010-09-15 00:41:19 +080080 int imsi_checked;
Holger Hans Peter Freyther8c78b482010-09-29 01:00:46 +080081 char *imsi;
Holger Hans Peter Freytherc2b31ed2010-07-31 05:17:17 +080082
Holger Hans Peter Freytherf4b34392010-08-28 16:08:39 +080083 /*
84 * audio handling. Remember if we have ever send a CRCX,
85 * remember the endpoint used by the MSC and BSC.
86 */
Holger Hans Peter Freytherf4b34392010-08-28 16:08:39 +080087 int msc_endp;
88 int bsc_endp;
Holger Hans Peter Freytherc2b31ed2010-07-31 05:17:17 +080089
90 /* timeout handling */
91 struct timespec creation_time;
92};
93
94
95#endif