blob: fcfd23beb1d2f9a6ab28c2147bc1f8a6bab6b504 [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
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>
Harald Welted5db12c2010-08-03 15:11:51 +020027#include <osmocom/sccp/sccp_types.h>
Holger Hans Peter Freytherc2b31ed2010-07-31 05:17:17 +080028
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 */
36struct 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 */
67struct 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
Holger Hans Peter Freytherf4b34392010-08-28 16:08:39 +080082 /*
83 * audio handling. Remember if we have ever send a CRCX,
84 * remember the endpoint used by the MSC and BSC.
85 */
Holger Hans Peter Freytherc2b31ed2010-07-31 05:17:17 +080086 int crcx;
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