blob: ff18e0fd1e57b253e5da7e78ad62f2c8e5320b90 [file] [log] [blame]
Harald Welte8acc3562013-03-21 15:05:20 +01001
2== mgw_nat ==
3
4== files ==
5
6=== mgw_nat_app.erl ===
7
8This file contains the OTP application wrapper for running mgw_nat as an
9OTP application. It exports the start/2 and stop/1 functions which are
10required for application:{start,stop}(mgw_nat) to work.
11
12There is also mgw_nat_app:reload_config/0, which will re-read the config
13file given to the erl machine as '-config' shell argument.
14
15=== mgw_nat_sup.erl ===
16
17This is the supervisor code, it starts:
18 * one mgw_nat_adm process
19 * one mgw_nat_usr for each signalling link in the config file
20
21=== mgw_nat_adm.erl ===
22
23This is a permanent server running under the supervisor, taking care of
24realoading configuration or dumping some information as well as casting
25messages to all of the mgw_nat_usr children.
26
27=== mgw_nat_usr.erl ===
28
29This is a gen_server OTP behavior which wraps the sctp_helper. Among
30the arguments passed to the sctp_helper are the 'rewrite_act_mod', whcih
31is the name of the Erlang module actually doing the rewriting.
32
33=== sctp_helper.erl ===
34
35Erlang module for wrapping both a listen-type and a connect-type SCTP
36connection, taking care of re-connects, etc. Each actual user payload
37message is handled via handle_rx_data/5, which will in turn call the
38rewrite_actor/5 function of the 'rewrite_act_mod'
39
40=== mgw_nat_act_vfuk_onw ===
41
42This is a rewrite actor module for patching the advertised CAMEL Phase
43during Location update of inbound roaming subsribers.
44
45the rewrite_actor/5 is first called with sctp as the first element, at
46which time mgw_nat:mangle_rx_data/4 is being called. mangle_rx_data
47will parse all higher level protocols (m2ua/mtp3/sccp/tcap/map),
48and each time one protocol layer has been decoded, it will again call
49the rewrite_actor/5 function with the first argument set to the protocol
50in question.
51
52m2ua/mtp3/sccp is handled without modification by the default clause of
53rewrite_actor/5.
54
55Once the map level is reached, the mangle_map_camel_phase/3 function is
56called. If the direction is STP->MSC, then the message is in the
57direction we are not interested in.
58
59In the MSC->STP direction, we decode the called_party_addr, do a global
60title match on it. If there is a match against the int_camel_ph_tbl,
61then the hierarchical record data structure is walked by
62osmo_util:tuple_walk/3 which will call caleph_twalk_cb/3. If there is a
63match on UpdateLocationArg, the supportedCamelPhases is rewritten
64accordingly.
65
66=== mgw_nat_act_bow_onw.erl ===
67
68This is a much more complex rewrite actor doing a lot of different
69rewrites whihc are not described here in detail.
70
71=== imsi_list.erl ===
72
73maintains a list of 1:1 IMSI mappings, internally represented by tw
74gb_tree's.
75 * read_list/1 populates the gb_trees from an Erlang list
76 * read_file/1 populates the gb_trees from a CSV file
77 * match_imsi/3 matches an IMSI either in forward or reverse direction
78
79=== mangle_tt_sri_sm.erl ===
80
81Contains utility code for rewriting the translation type of the global
82title present in SRI-for-SM messages.
83
84=== sccp_masq.erl ===
85
86This code implements SCCP masquerading:
87
88The mgw_nat gateway has a pool of dynamically-allocated SCCP global
89titles. Whenever needed (decided by other code), the original GT is
90replaced with one dynamically allocated from the pool. If ther ever is
91a SCCP mesage directed at one of the dynamic addresses in response, the
92inverse translation back to the original address is performed.