Holger Hans Peter Freyther | 456fccf | 2013-02-26 10:54:19 +0100 | [diff] [blame] | 1 | |
| 2 | IPA SCCP message flow in the BSC |
| 3 | |
| 4 | February, 2013 Holger Hans Peter Freyther |
| 5 | |
| 6 | CONTENTS |
| 7 | |
| 8 | 1. SCCP inside the IPA header |
| 9 | 2. Supported SCCP message types |
| 10 | 3. Receiving SCCP messages |
| 11 | 4. Sending SCCP messages |
| 12 | |
| 13 | |
| 14 | 1. SCCP inside the IPA header |
| 15 | |
| 16 | Many Soft-MSCs implement something that is called SCCP/lite. This means |
| 17 | that SCCP messages are transported inside a small multiplexing protocol |
| 18 | over TCP/IP. This is an alternative to a full SIGTRAN implementation. |
| 19 | |
| 20 | The multiplexing protocol is the same as used with the sysmoBTS and the |
| 21 | ip.access nanoBTS. It is a three byte header with two bytes for the length |
| 22 | in network byte order and one byte for the type. The type to be used for |
| 23 | SCCP is 0xFD. |
| 24 | |
| 25 | struct ipa_header { |
| 26 | uint16_t length_in_network_order; |
| 27 | uint8_t type; |
| 28 | } __attribute__((packed)); |
| 29 | |
| 30 | |
| 31 | |
| 32 | 2. Supported SCCP message types |
| 33 | |
| 34 | To implement GSM 08.08 only a subset of SCCP messages need to be implemented. |
| 35 | For transporting paging and reset messages SCCP UDT messages are used. For |
| 36 | the connections with a Mobile Station (MS) a SCCP connection is opened. This |
| 37 | means that the SCCP CR, SCCP CC, SCCP CREF, SCCP RLC, SCCP RLSD, SCCP DT1 |
| 38 | and SCCP IT messages are supported. |
| 39 | |
| 40 | |
| 41 | 3. Receiving SCCP UDT messages |
| 42 | |
| 43 | This is an illustration of the flow of messages. The IPA multiplexing protocol |
| 44 | is used for various protocols. This means there is a central place where the |
| 45 | multiplexing stream terminates. The stream is terminated in the osmo_bsc_msc.c |
| 46 | file and the ipaccess_a_fd_cb method. For SCCP messages the SCCP dispatching |
| 47 | sccp_system_incoming method is called. This function is implemented in the |
| 48 | libosmo-sccp library. |
| 49 | |
| 50 | To receive UDT messages osmo_bsc_sccp.c:osmo_bsc_sccp_init is using the |
| 51 | sccp_set_read function to register a callback for UDT messages. The callback |
| 52 | is msc_sccp_read and it is calling bsc_handle_udt that is implemented in the |
| 53 | osmo_bsc_bssap.c. This function will handle the GSM 08.08 BSSAP messages. |
| 54 | Currently only the reset acknowledge and the paging messages are handled. |
| 55 | |
| 56 | The BSC currently does not accept incoming SCCP messages and is only opening |
| 57 | SCCP connections to the MSC. When opening a connection the callbacks for state |
| 58 | changes (connection confirmed, released, release complete) are set and a routine |
| 59 | for handling incoming data. This registration is done in the osmo_bsc_sccp.c |
| 60 | file and the bsc_create_new_connection method. The name of the callback is |
| 61 | msc_outgoing_sccp_data and this will call bsc_handle_dt1 that is implemented |
| 62 | in the osmo_bsc_bssap.c file. This will forward the messages to the right |
| 63 | Mobile Station (MS). |
| 64 | |
| 65 | |
| 66 | 4. Sending SCCP messages |
| 67 | |
| 68 | There are three parts to sending that will be explained below. The first part |
| 69 | is to send an entire SCCP frame (which includes the GSM 08.08 data) to the |
| 70 | MSC. This is done by first registering the low level sending. sccp_system_init |
| 71 | is called with the function that is responsible for sending a message. The |
| 72 | msc_sccp_write_ipa will call the msc_queue_write function with the data and |
| 73 | the right MSC connection. Below the msc_queue_write the IPA header will be |
| 74 | prepended to the msg and then send to the MSC. |
| 75 | |
| 76 | The BSC supports multiple different A-link connections, the decision to pick |
| 77 | the right MSC is done in this method. It is either done via the SCCP connection |
| 78 | or the ctx pointer. |
| 79 | |
| 80 | When the BSC is starting a BSS RESET message will be sent to the MSC. The reset |
| 81 | is created in osmo_bsc_msc.c:initialize_if_needed and sccp_write is called with |
| 82 | the GSM 08.08 data and the connection to use. The libosmo-sccp library will |
| 83 | embed it into a SCCP UDT message and call the msc_sccp_write_ipa method. |
| 84 | |
| 85 | When a new SCCP connection is to be created the bsc_create_new_connection |
| 86 | in the osmo_bsc_sccp.c file. The sccp_connection_socket method will create |
| 87 | the context for a SCCP connection. The state and data callback will be used |
| 88 | to be notified about data and changes. Once the connection is configured the |
| 89 | bsc_open_connection will be called that will ask the libosmo-sccp library to |
| 90 | create a SCCP CR message using the sccp_connection_connect method. For active |
| 91 | connections the sccp_connection_write method will be called. |
| 92 | |
| 93 | |
| 94 | |