2010-07-05 08:02:04 +00:00
|
|
|
/* (C) 2009-2010 by Holger Hans Peter Freyther <zecke@selfish.org>
|
|
|
|
* (C) 2009-2010 by On-Waves
|
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <openbsc/osmo_bsc.h>
|
2010-11-03 18:03:35 +00:00
|
|
|
#include <openbsc/debug.h>
|
|
|
|
|
2010-11-04 10:59:41 +00:00
|
|
|
#include <osmocore/gsm0808.h>
|
|
|
|
|
2010-11-03 18:03:35 +00:00
|
|
|
#define return_when_not_connected(conn) \
|
|
|
|
if (!conn->sccp_con) {\
|
|
|
|
LOGP(DMSC, LOGL_ERROR, "MSC Connection not present.\n"); \
|
|
|
|
return; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define return_when_not_connected_val(conn, ret) \
|
|
|
|
if (!conn->sccp_con) {\
|
|
|
|
LOGP(DMSC, LOGL_ERROR, "MSC Connection not present.\n"); \
|
|
|
|
return ret; \
|
|
|
|
}
|
2010-07-05 08:02:04 +00:00
|
|
|
|
2010-09-16 09:26:35 +00:00
|
|
|
static void bsc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci)
|
|
|
|
{
|
2010-11-03 18:03:35 +00:00
|
|
|
return_when_not_connected(conn);
|
2010-09-16 09:26:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void bsc_cipher_mode_compl(struct gsm_subscriber_connection *conn,
|
|
|
|
struct msgb *msg, uint8_t chosen_encr)
|
|
|
|
{
|
2010-11-04 10:59:41 +00:00
|
|
|
struct msgb *resp;
|
2010-11-03 18:03:35 +00:00
|
|
|
return_when_not_connected(conn);
|
2010-11-04 10:59:41 +00:00
|
|
|
|
|
|
|
LOGP(DMSC, LOGL_DEBUG, "CIPHER MODE COMPLETE from MS, forwarding to MSC\n");
|
|
|
|
resp = gsm0808_create_cipher_complete(msg, chosen_encr);
|
|
|
|
if (!resp) {
|
|
|
|
LOGP(DMSC, LOGL_ERROR, "Creating the response failed.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
bsc_queue_for_msc(conn, resp);
|
2010-09-16 09:26:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg,
|
|
|
|
uint16_t chosen_channel)
|
|
|
|
{
|
|
|
|
return BSC_API_CONN_POL_REJECT;
|
|
|
|
}
|
|
|
|
|
2010-11-04 11:18:00 +00:00
|
|
|
static void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg)
|
2010-09-16 09:26:35 +00:00
|
|
|
{
|
2010-11-03 18:03:35 +00:00
|
|
|
return_when_not_connected(conn);
|
2010-09-16 09:26:35 +00:00
|
|
|
}
|
|
|
|
|
2010-11-04 11:06:57 +00:00
|
|
|
static void bsc_assign_compl(struct gsm_subscriber_connection *conn, uint8_t rr_cause,
|
|
|
|
uint8_t chosen_channel, uint8_t encr_alg_id,
|
|
|
|
uint8_t speech_model)
|
2010-09-16 09:26:35 +00:00
|
|
|
{
|
2010-11-03 18:03:35 +00:00
|
|
|
return_when_not_connected(conn);
|
2010-09-16 09:26:35 +00:00
|
|
|
}
|
|
|
|
|
2010-11-05 09:37:17 +00:00
|
|
|
static void bsc_assign_fail(struct gsm_subscriber_connection *conn,
|
|
|
|
uint8_t cause, uint8_t *rr_cause)
|
2010-09-16 09:26:35 +00:00
|
|
|
{
|
2010-11-03 18:03:35 +00:00
|
|
|
return_when_not_connected(conn);
|
2010-09-16 09:26:35 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 18:01:58 +00:00
|
|
|
static int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause)
|
2010-09-16 09:26:35 +00:00
|
|
|
{
|
2010-11-03 18:03:35 +00:00
|
|
|
return_when_not_connected_val(conn, 1);
|
2010-11-03 18:01:58 +00:00
|
|
|
return 0;
|
2010-09-16 09:26:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct bsc_api bsc_handler = {
|
|
|
|
.sapi_n_reject = bsc_sapi_n_reject,
|
|
|
|
.cipher_mode_compl = bsc_cipher_mode_compl,
|
|
|
|
.compl_l3 = bsc_compl_l3,
|
|
|
|
.dtap = bsc_dtap,
|
|
|
|
.assign_compl = bsc_assign_compl,
|
|
|
|
.assign_fail = bsc_assign_fail,
|
|
|
|
.clear_request = bsc_clear_request,
|
|
|
|
};
|
|
|
|
|
2010-07-05 08:02:04 +00:00
|
|
|
struct bsc_api *osmo_bsc_api()
|
|
|
|
{
|
2010-09-16 09:26:35 +00:00
|
|
|
return &bsc_handler;
|
2010-07-05 08:02:04 +00:00
|
|
|
}
|