gsup: Update code after rebase to updated gsup implementation
This commit is contained in:
parent
362a757f56
commit
5788904242
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include <openbsc/rest_octets.h>
|
||||
#include <openbsc/common_cs.h>
|
||||
#include <openbsc/gprs_gsup_client.h>
|
||||
#include <openbsc/gsup_client.h>
|
||||
|
||||
/** annotations for msgb ownership */
|
||||
#define __uses
|
||||
|
@ -324,9 +324,9 @@ struct gsm_network {
|
|||
struct llist_head upqueue;
|
||||
struct llist_head trans_list;
|
||||
struct bsc_api *bsc_api;
|
||||
struct gprs_gsup_client *hlr_sup_client;
|
||||
struct gprs_gsup_client *ussd_sup_client;
|
||||
struct gprs_gsup_client *sms_client;
|
||||
struct gsup_client *hlr_sup_client;
|
||||
struct gsup_client *ussd_sup_client;
|
||||
struct gsup_client *sms_client;
|
||||
|
||||
unsigned int num_bts;
|
||||
struct llist_head bts_list;
|
||||
|
|
|
@ -12,9 +12,11 @@
|
|||
## args)
|
||||
|
||||
/* Callback for both HLR/auth and USSD SUP sockets */
|
||||
int sup_read_cb(struct gprs_gsup_client *sup_client, struct msgb *msg);
|
||||
int sup_read_cb(struct gsup_client *sup_client, struct msgb *msg);
|
||||
|
||||
/*
|
||||
int subscr_query_auth_info(struct gsm_subscriber *subscr);
|
||||
*/
|
||||
int subscr_location_update(struct gsm_subscriber *subscr);
|
||||
int subscr_purge_ms(struct gsm_subscriber *subscr);
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef _GSM_USSD_MAP_H
|
||||
#define _GSM_USSD_MAP_H
|
||||
|
||||
#include <openbsc/gprs_gsup_client.h>
|
||||
#include <openbsc/gsup_client.h>
|
||||
#include <openbsc/gsm_subscriber.h>
|
||||
#include <openbsc/gsm_ussd_map_proto.h>
|
||||
|
||||
int ussd_map_read_cb(struct gprs_gsup_client *sup_client,
|
||||
int ussd_map_read_cb(struct gsup_client *sup_client,
|
||||
struct msgb *msg);
|
||||
|
||||
int ussd_map_tx_message(struct gsm_network *net, struct ss_header *req,
|
||||
|
|
|
@ -28,10 +28,6 @@ libmsc_a_SOURCES = \
|
|||
gsm_04_08.c \
|
||||
gsm_04_11.c \
|
||||
gsm_04_80.c \
|
||||
../gprs/gsm_04_08_gprs.c \
|
||||
../gprs/gprs_utils.c \
|
||||
../gprs/gprs_gsup_messages.c \
|
||||
../gprs/gprs_gsup_client.c \
|
||||
gsm_sup.c \
|
||||
gsm_subscriber.c \
|
||||
mncc.c \
|
||||
|
|
|
@ -214,6 +214,7 @@ int gsm48_secure_channel(struct gsm_subscriber_connection *conn, int key_seq,
|
|||
/* If not done yet, try to get info for this user */
|
||||
if (status < 0) {
|
||||
rc = auth_get_tuple_for_subscr(net->auth_policy, &atuple, subscr, key_seq);
|
||||
/*
|
||||
if ((rc == 0) && (net->auth_policy == GSM_AUTH_POLICY_REMOTE ||
|
||||
net->auth_policy == GSM_AUTH_POLICY_REMOTE_CLOSED)) {
|
||||
allocate_security_operation(conn);
|
||||
|
@ -223,6 +224,9 @@ int gsm48_secure_channel(struct gsm_subscriber_connection *conn, int key_seq,
|
|||
} else if (rc <= 0) {
|
||||
status = GSM_SECURITY_NOAVAIL;
|
||||
}
|
||||
*/
|
||||
if (rc <= 0)
|
||||
status = GSM_SECURITY_NOAVAIL;
|
||||
}
|
||||
|
||||
/* Are we done yet ? */
|
||||
|
|
|
@ -1,141 +0,0 @@
|
|||
/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
|
||||
* (C) 2010 by On-Waves
|
||||
* (C) 2014-2015 by Sysmocom s.f.m.c. GmbH
|
||||
*
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation; either version 3 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <openbsc/gsm_04_08_gprs.h>
|
||||
|
||||
#include <osmocom/core/utils.h>
|
||||
|
||||
/* Protocol related stuff, should go into libosmocore */
|
||||
|
||||
/* 10.5.5.14 GPRS MM Cause / Table 10.5.147 */
|
||||
const struct value_string gsm48_gmm_cause_names_[] = {
|
||||
{ GMM_CAUSE_IMSI_UNKNOWN, "IMSI unknown in HLR" },
|
||||
{ GMM_CAUSE_ILLEGAL_MS, "Illegal MS" },
|
||||
{ GMM_CAUSE_ILLEGAL_ME, "Illegal ME" },
|
||||
{ GMM_CAUSE_GPRS_NOTALLOWED, "GPRS services not allowed" },
|
||||
{ GMM_CAUSE_GPRS_OTHER_NOTALLOWED,
|
||||
"GPRS services and non-GPRS services not allowed" },
|
||||
{ GMM_CAUSE_MS_ID_NOT_DERIVED,
|
||||
"MS identity cannot be derived by the network" },
|
||||
{ GMM_CAUSE_IMPL_DETACHED, "Implicitly detached" },
|
||||
{ GMM_CAUSE_PLMN_NOTALLOWED, "PLMN not allowed" },
|
||||
{ GMM_CAUSE_LA_NOTALLOWED, "Location Area not allowed" },
|
||||
{ GMM_CAUSE_ROAMING_NOTALLOWED,
|
||||
"Roaming not allowed in this location area" },
|
||||
{ GMM_CAUSE_NO_GPRS_PLMN,
|
||||
"GPRS services not allowed in this PLMN" },
|
||||
{ GMM_CAUSE_MSC_TEMP_NOTREACH, "MSC temporarily not reachable" },
|
||||
{ GMM_CAUSE_NET_FAIL, "Network failure" },
|
||||
{ GMM_CAUSE_CONGESTION, "Congestion" },
|
||||
{ GMM_CAUSE_SEM_INCORR_MSG, "Semantically incorrect message" },
|
||||
{ GMM_CAUSE_INV_MAND_INFO, "Invalid mandatory information" },
|
||||
{ GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL,
|
||||
"Message type non-existant or not implemented" },
|
||||
{ GMM_CAUSE_MSGT_INCOMP_P_STATE,
|
||||
"Message type not compatible with protocol state" },
|
||||
{ GMM_CAUSE_IE_NOTEXIST_NOTIMPL,
|
||||
"Information element non-existent or not implemented" },
|
||||
{ GMM_CAUSE_COND_IE_ERR, "Conditional IE error" },
|
||||
{ GMM_CAUSE_MSG_INCOMP_P_STATE,
|
||||
"Message not compatible with protocol state " },
|
||||
{ GMM_CAUSE_PROTO_ERR_UNSPEC, "Protocol error, unspecified" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
const struct value_string *gsm48_gmm_cause_names = gsm48_gmm_cause_names_;
|
||||
|
||||
/* 10.5.6.6 SM Cause / Table 10.5.157 */
|
||||
const struct value_string gsm48_gsm_cause_names_[] = {
|
||||
{ GSM_CAUSE_INSUFF_RSRC, "Insufficient resources" },
|
||||
{ GSM_CAUSE_MISSING_APN, "Missing or unknown APN" },
|
||||
{ GSM_CAUSE_UNKNOWN_PDP, "Unknown PDP address or PDP type" },
|
||||
{ GSM_CAUSE_AUTH_FAILED, "User Authentication failed" },
|
||||
{ GSM_CAUSE_ACT_REJ_GGSN, "Activation rejected by GGSN" },
|
||||
{ GSM_CAUSE_ACT_REJ_UNSPEC, "Activation rejected, unspecified" },
|
||||
{ GSM_CAUSE_SERV_OPT_NOTSUPP, "Service option not supported" },
|
||||
{ GSM_CAUSE_REQ_SERV_OPT_NOTSUB,
|
||||
"Requested service option not subscribed" },
|
||||
{ GSM_CAUSE_SERV_OPT_TEMP_OOO,
|
||||
"Service option temporarily out of order" },
|
||||
{ GSM_CAUSE_NSAPI_IN_USE, "NSAPI already used" },
|
||||
{ GSM_CAUSE_DEACT_REGULAR, "Regular deactivation" },
|
||||
{ GSM_CAUSE_QOS_NOT_ACCEPTED, "QoS not accepted" },
|
||||
{ GSM_CAUSE_NET_FAIL, "Network Failure" },
|
||||
{ GSM_CAUSE_REACT_RQD, "Reactivation required" },
|
||||
{ GSM_CAUSE_FEATURE_NOTSUPP, "Feature not supported " },
|
||||
{ GSM_CAUSE_INVALID_TRANS_ID, "Invalid transaction identifier" },
|
||||
{ GSM_CAUSE_SEM_INCORR_MSG, "Semantically incorrect message" },
|
||||
{ GSM_CAUSE_INV_MAND_INFO, "Invalid mandatory information" },
|
||||
{ GSM_CAUSE_MSGT_NOTEXIST_NOTIMPL,
|
||||
"Message type non-existant or not implemented" },
|
||||
{ GSM_CAUSE_MSGT_INCOMP_P_STATE,
|
||||
"Message type not compatible with protocol state" },
|
||||
{ GSM_CAUSE_IE_NOTEXIST_NOTIMPL,
|
||||
"Information element non-existent or not implemented" },
|
||||
{ GSM_CAUSE_COND_IE_ERR, "Conditional IE error" },
|
||||
{ GSM_CAUSE_MSG_INCOMP_P_STATE,
|
||||
"Message not compatible with protocol state " },
|
||||
{ GSM_CAUSE_PROTO_ERR_UNSPEC, "Protocol error, unspecified" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
const struct value_string *gsm48_gsm_cause_names = gsm48_gsm_cause_names_;
|
||||
|
||||
/* 10.5.5.2 */
|
||||
const struct value_string gprs_att_t_strs_[] = {
|
||||
{ GPRS_ATT_T_ATTACH, "GPRS attach" },
|
||||
{ GPRS_ATT_T_ATT_WHILE_IMSI, "GPRS attach while IMSI attached" },
|
||||
{ GPRS_ATT_T_COMBINED, "Combined GPRS/IMSI attach" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
const struct value_string *gprs_att_t_strs = gprs_att_t_strs_;
|
||||
|
||||
const struct value_string gprs_upd_t_strs_[] = {
|
||||
{ GPRS_UPD_T_RA, "RA updating" },
|
||||
{ GPRS_UPD_T_RA_LA, "combined RA/LA updating" },
|
||||
{ GPRS_UPD_T_RA_LA_IMSI_ATT, "combined RA/LA updating + IMSI attach" },
|
||||
{ GPRS_UPD_T_PERIODIC, "periodic updating" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
const struct value_string *gprs_upd_t_strs = gprs_upd_t_strs_;
|
||||
|
||||
/* 10.5.5.5 */
|
||||
const struct value_string gprs_det_t_mo_strs_[] = {
|
||||
{ GPRS_DET_T_MO_GPRS, "GPRS detach" },
|
||||
{ GPRS_DET_T_MO_IMSI, "IMSI detach" },
|
||||
{ GPRS_DET_T_MO_COMBINED, "Combined GPRS/IMSI detach" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
const struct value_string *gprs_det_t_mo_strs = gprs_det_t_mo_strs_;
|
||||
|
||||
const struct value_string gprs_det_t_mt_strs_[] = {
|
||||
{ GPRS_DET_T_MT_REATT_REQ, "re-attach required" },
|
||||
{ GPRS_DET_T_MT_REATT_NOTREQ, "re-attach not required" },
|
||||
{ GPRS_DET_T_MT_IMSI, "IMSI detach (after VLR failure)" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
const struct value_string *gprs_det_t_mt_strs = gprs_det_t_mt_strs_;
|
||||
|
|
@ -56,6 +56,7 @@
|
|||
#include <openbsc/bsc_rll.h>
|
||||
#include <openbsc/chan_alloc.h>
|
||||
#include <openbsc/bsc_api.h>
|
||||
#include <openbsc/gsm_sup.h>
|
||||
|
||||
#ifdef BUILD_SMPP
|
||||
#include "smpp_smsc.h"
|
||||
|
@ -596,7 +597,7 @@ static int gsm411_rx_rp_ud(struct msgb *msg, struct gsm_trans *trans,
|
|||
}
|
||||
|
||||
if ((trans->net->sms_client) && (trans->sms_local == 0)) {
|
||||
osmo_counter_inc(trans->conn->bts->network->stats.sms.submitted);
|
||||
rate_ctr_inc(&trans->conn->bts->network->msc_ctrs->ctr[MSC_CTR_SMS_SUBMITTED]);
|
||||
trans->msg_ref = rph->msg_ref;
|
||||
return subscr_tx_sms_message(trans->subscr, rph);
|
||||
}
|
||||
|
@ -685,9 +686,9 @@ static int gsm411_rx_rp_error(struct msgb *msg, struct gsm_trans *trans,
|
|||
|
||||
if ((trans->net->sms_client) && (trans->sms_local == 0)) {
|
||||
if (cause == GSM411_RP_CAUSE_MT_MEM_EXCEEDED) {
|
||||
osmo_counter_inc(net->stats.sms.rp_err_mem);
|
||||
rate_ctr_inc(&net->msc_ctrs->ctr[MSC_CTR_SMS_RP_ERR_MEM]);
|
||||
} else {
|
||||
osmo_counter_inc(net->stats.sms.rp_err_other);
|
||||
rate_ctr_inc(&net->msc_ctrs->ctr[MSC_CTR_SMS_RP_ERR_OTHER]);
|
||||
}
|
||||
return subscr_tx_sms_message(trans->subscr, rph);
|
||||
}
|
||||
|
@ -1160,7 +1161,7 @@ static int gsm411_send_rp_data(struct gsm_subscriber_connection *conn,
|
|||
trans->msg_ref = rp->msg_ref;
|
||||
trans->conn = conn;
|
||||
|
||||
osmo_counter_inc(conn->bts->network->stats.sms.delivered);
|
||||
rate_ctr_inc(&conn->bts->network->msc_ctrs->ctr[MSC_CTR_SMS_DELIVERED]);
|
||||
return gsm411_smr_send(&trans->sms.smr_inst, GSM411_SM_RL_DATA_REQ, msg);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,15 @@
|
|||
*/
|
||||
|
||||
#include <openbsc/gsm_sup.h>
|
||||
#include <osmocom/gsm/tlv.h>
|
||||
#include <openbsc/gsm_subscriber.h>
|
||||
#include <openbsc/gsm_04_08.h>
|
||||
#include <openbsc/debug.h>
|
||||
#include <openbsc/db.h>
|
||||
#include <openbsc/chan_alloc.h>
|
||||
#include <openbsc/gsm_04_08_gprs.h>
|
||||
#include <openbsc/gprs_gsup_messages.h>
|
||||
#include <openbsc/gprs_gsup_client.h>
|
||||
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
||||
#include <osmocom/gsm/gsup.h>
|
||||
#include <openbsc/gsup_client.h>
|
||||
#include <openbsc/osmo_msc.h>
|
||||
#include <openbsc/gprs_utils.h>
|
||||
#include <openbsc/ussd.h>
|
||||
|
@ -49,8 +50,8 @@ static int subscr_uss_message(struct msgb *msg,
|
|||
|
||||
gsup_indicator = msgb_put(msg, 4);
|
||||
|
||||
/* First byte should always be GPRS_GSUP_MSGT_MAP */
|
||||
gsup_indicator[0] = GPRS_GSUP_MSGT_MAP;
|
||||
/* First byte should always be OSMO_GSUP_MSGT_MAP */
|
||||
gsup_indicator[0] = OSMO_GSUP_MSGT_MAP;
|
||||
gsup_indicator[1] = req->message_type;
|
||||
/* TODO ADD tid */
|
||||
gsup_indicator[2] = req->component_type;
|
||||
|
@ -78,7 +79,7 @@ static int subscr_uss_message(struct msgb *msg,
|
|||
/* wrap with GSM0480_CTYPE_INVOKE */
|
||||
// gsm0480_wrap_invoke(msg, req->opcode, invoke_id);
|
||||
// gsup_indicator = msgb_push(msgb, 1);
|
||||
// gsup_indicator[0] = GPRS_GSUP_MSGT_MAP;
|
||||
// gsup_indicator[0] = OSMO_GSUP_MSGT_MAP;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -86,14 +87,14 @@ static int subscr_uss_message(struct msgb *msg,
|
|||
int subscr_tx_uss_message(struct ss_request *req,
|
||||
struct gsm_subscriber *subscr)
|
||||
{
|
||||
struct msgb *msg = gprs_gsup_msgb_alloc();
|
||||
struct msgb *msg = gsup_client_msgb_alloc();
|
||||
if (!msg)
|
||||
return -ENOMEM;
|
||||
|
||||
//GSM0480_OP_CODE_PROCESS_USS_REQ
|
||||
subscr_uss_message(msg, req, subscr->extension);
|
||||
|
||||
return gprs_gsup_client_send(subscr->group->net->ussd_sup_client, msg);
|
||||
return gsup_client_send(subscr->group->net->ussd_sup_client, msg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,7 +109,7 @@ static int rx_uss_message_parse(struct ss_request *ss,
|
|||
if (len < 1 + 2 + 3 + 3)
|
||||
return -1;
|
||||
|
||||
/* skip GPRS_GSUP_MSGT_MAP */
|
||||
/* skip OSMO_GSUP_MSGT_MAP */
|
||||
ss->message_type = *(++const_data);
|
||||
ss->component_type = *(++const_data);
|
||||
const_data += 2;
|
||||
|
@ -181,11 +182,11 @@ int subscr_tx_sms_message(struct gsm_subscriber *subscr,
|
|||
struct gsm411_rp_hdr *rph)
|
||||
{
|
||||
uint8_t *data;
|
||||
struct msgb *msg = gprs_gsup_msgb_alloc();
|
||||
struct msgb *msg = gsup_client_msgb_alloc();
|
||||
if (!msg)
|
||||
return -ENOMEM;
|
||||
|
||||
msgb_put_u8(msg, GPRS_GSUP_MSGT_SMS);
|
||||
msgb_put_u8(msg, OSMO_GSUP_MSGT_SMS);
|
||||
|
||||
if (subscr->extension) {
|
||||
uint8_t bcd_buf[32];
|
||||
|
@ -199,10 +200,10 @@ int subscr_tx_sms_message(struct gsm_subscriber *subscr,
|
|||
data = msgb_put(msg, rph->len - 2);
|
||||
memcpy(data, rph->data, rph->len - 2);
|
||||
|
||||
return gprs_gsup_client_send(subscr->group->net->sms_client, msg);
|
||||
return gsup_client_send(subscr->group->net->sms_client, msg);
|
||||
}
|
||||
|
||||
static int rx_sms_message(struct gprs_gsup_client *sup_client,
|
||||
static int rx_sms_message(struct gsup_client *sup_client,
|
||||
const uint8_t* data, size_t data_len)
|
||||
{
|
||||
|
||||
|
@ -214,7 +215,7 @@ static int rx_sms_message(struct gprs_gsup_client *sup_client,
|
|||
uint8_t *rp_hdr = (uint8_t*)data + offset;
|
||||
data_len -= 1;
|
||||
|
||||
rc = gprs_match_tlv(&rp_hdr, &data_len, 0x82, &value, &value_len);
|
||||
rc = osmo_match_shift_tlv(&rp_hdr, &data_len, 0x82, &value, &value_len);
|
||||
|
||||
if (rc <= 0)
|
||||
return -GMM_CAUSE_INV_MAND_INFO;
|
||||
|
@ -246,16 +247,16 @@ static int rx_sms_message(struct gprs_gsup_client *sup_client,
|
|||
return gsm411_send_rp_msg_subscr(subscr, msg);
|
||||
}
|
||||
|
||||
static int subscr_tx_sup_message(struct gprs_gsup_client *sup_client,
|
||||
static int subscr_tx_sup_message(struct gsup_client *sup_client,
|
||||
struct gsm_subscriber *subscr,
|
||||
struct gprs_gsup_message *gsup_msg)
|
||||
struct osmo_gsup_message *gsup_msg)
|
||||
{
|
||||
struct msgb *msg = gprs_gsup_msgb_alloc();
|
||||
struct msgb *msg = gsup_client_msgb_alloc();
|
||||
|
||||
if (strlen(gsup_msg->imsi) == 0 && subscr)
|
||||
strncpy(gsup_msg->imsi, subscr->imsi, sizeof(gsup_msg->imsi) - 1);
|
||||
|
||||
gprs_gsup_encode(msg, gsup_msg);
|
||||
osmo_gsup_encode(msg, gsup_msg);
|
||||
|
||||
LOGGSUBSCRP(LOGL_INFO, subscr,
|
||||
"Sending SUP, will send: %s\n", msgb_hexdump(msg));
|
||||
|
@ -265,77 +266,80 @@ static int subscr_tx_sup_message(struct gprs_gsup_client *sup_client,
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
return gprs_gsup_client_send(sup_client, msg);
|
||||
return gsup_client_send(sup_client, msg);
|
||||
}
|
||||
|
||||
/*
|
||||
int subscr_query_auth_info(struct gsm_subscriber *subscr)
|
||||
{
|
||||
struct gprs_gsup_message gsup_msg = {0};
|
||||
struct osmo_gsup_message gsup_msg = {0};
|
||||
|
||||
LOGGSUBSCRP(LOGL_INFO, subscr,
|
||||
"subscriber auth info is not available\n");
|
||||
|
||||
gsup_msg.message_type = GPRS_GSUP_MSGT_SEND_AUTH_INFO_REQUEST;
|
||||
gsup_msg.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST;
|
||||
return subscr_tx_sup_message(subscr->group->net->hlr_sup_client, subscr, &gsup_msg);
|
||||
}
|
||||
|
||||
*/
|
||||
int subscr_location_update(struct gsm_subscriber *subscr)
|
||||
{
|
||||
struct gprs_gsup_message gsup_msg = {0};
|
||||
struct osmo_gsup_message gsup_msg = {0};
|
||||
|
||||
LOGGSUBSCRP(LOGL_INFO, subscr,
|
||||
"subscriber data is not available\n");
|
||||
|
||||
gsup_msg.message_type = GPRS_GSUP_MSGT_UPDATE_LOCATION_REQUEST;
|
||||
gsup_msg.message_type = OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST;
|
||||
return subscr_tx_sup_message(subscr->group->net->hlr_sup_client, subscr, &gsup_msg);
|
||||
}
|
||||
|
||||
int subscr_purge_ms(struct gsm_subscriber *subscr)
|
||||
{
|
||||
struct gprs_gsup_message gsup_msg = {0};
|
||||
gsup_msg.message_type = GPRS_GSUP_MSGT_PURGE_MS_REQUEST;
|
||||
struct osmo_gsup_message gsup_msg = {0};
|
||||
gsup_msg.message_type = OSMO_GSUP_MSGT_PURGE_MS_REQUEST;
|
||||
return subscr_tx_sup_message(subscr->group->net->hlr_sup_client, subscr, &gsup_msg);
|
||||
}
|
||||
|
||||
static int subscr_tx_sup_error_reply(struct gprs_gsup_client *sup_client,
|
||||
static int subscr_tx_sup_error_reply(struct gsup_client *sup_client,
|
||||
struct gsm_subscriber *subscr,
|
||||
struct gprs_gsup_message *gsup_orig,
|
||||
struct osmo_gsup_message *gsup_orig,
|
||||
enum gsm48_gmm_cause cause)
|
||||
{
|
||||
struct gprs_gsup_message gsup_reply = {0};
|
||||
struct osmo_gsup_message gsup_reply = {0};
|
||||
|
||||
strncpy(gsup_reply.imsi, gsup_orig->imsi, sizeof(gsup_reply.imsi) - 1);
|
||||
gsup_reply.cause = cause;
|
||||
gsup_reply.message_type =
|
||||
GPRS_GSUP_TO_MSGT_ERROR(gsup_orig->message_type);
|
||||
OSMO_GSUP_TO_MSGT_ERROR(gsup_orig->message_type);
|
||||
|
||||
return subscr_tx_sup_message(sup_client, subscr, &gsup_reply);
|
||||
}
|
||||
|
||||
static int subscr_handle_sup_auth_res(struct gprs_gsup_client *sup_client,
|
||||
/*
|
||||
static int subscr_handle_sup_auth_res(struct gsup_client *sup_client,
|
||||
struct gsm_subscriber *subscr,
|
||||
struct gprs_gsup_message *gsup_msg)
|
||||
struct osmo_gsup_message *gsup_msg)
|
||||
{
|
||||
struct gsm_subscriber_connection *conn = connection_for_subscr(subscr);
|
||||
struct gsm_security_operation *op;
|
||||
|
||||
|
||||
LOGGSUBSCRP(LOGL_INFO, subscr,
|
||||
"Got SendAuthenticationInfoResult, num_auth_tuples = %zu\n",
|
||||
gsup_msg->num_auth_tuples);
|
||||
"Got SendAuthenticationInfoResult, num_auth_vectors = %zu\n",
|
||||
gsup_msg->num_auth_vectors);
|
||||
|
||||
if (gsup_msg->num_auth_tuples > 0) {
|
||||
if (gsup_msg->num_auth_vectors > 0) {
|
||||
op = conn->sec_operation;
|
||||
memcpy(&op->atuple, gsup_msg->auth_tuples, sizeof(struct gsm_auth_tuple));
|
||||
memcpy(&op->atuple, gsup_msg->auth_vectors, sizeof(struct gsm_auth_vectors));
|
||||
db_sync_lastauthtuple_for_subscr(&op->atuple, subscr);
|
||||
gsm48_tx_mm_auth_req(conn, op->atuple.rand, op->atuple.key_seq);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
static int subscr_handle_sup_upd_loc_res(struct gsm_subscriber *subscr,
|
||||
struct gprs_gsup_message *gsup_msg)
|
||||
struct osmo_gsup_message *gsup_msg)
|
||||
{
|
||||
uint8_t msisdn_lv[10];
|
||||
|
||||
|
@ -372,7 +376,7 @@ static int subscr_handle_sup_upd_loc_res(struct gsm_subscriber *subscr,
|
|||
}
|
||||
|
||||
static int subscr_handle_sup_purge_ms_res(struct gsm_subscriber *subscr,
|
||||
struct gprs_gsup_message *gsup_msg)
|
||||
struct osmo_gsup_message *gsup_msg)
|
||||
{
|
||||
LOGP(DSUP, LOGL_INFO, "SUP PURGE MS result OK for IMSI:%s\n", subscr->imsi);
|
||||
return 0;
|
||||
|
@ -395,7 +399,7 @@ static int check_cause(int cause)
|
|||
}
|
||||
|
||||
static int subscr_handle_sup_upd_loc_err(struct gsm_subscriber *subscr,
|
||||
struct gprs_gsup_message *gsup_msg)
|
||||
struct osmo_gsup_message *gsup_msg)
|
||||
{
|
||||
int cause_err;
|
||||
struct gsm_subscriber_connection *conn = connection_for_subscr(subscr);
|
||||
|
@ -439,8 +443,9 @@ static int subscr_handle_sup_upd_loc_err(struct gsm_subscriber *subscr,
|
|||
return -gsup_msg->cause;
|
||||
}
|
||||
|
||||
/*
|
||||
static int subscr_handle_sup_auth_err(struct gsm_subscriber *subscr,
|
||||
struct gprs_gsup_message *gsup_msg)
|
||||
struct osmo_gsup_message *gsup_msg)
|
||||
{
|
||||
int cause_err;
|
||||
struct gsm_subscriber_connection *conn = connection_for_subscr(subscr);
|
||||
|
@ -489,18 +494,18 @@ static int subscr_handle_sup_auth_err(struct gsm_subscriber *subscr,
|
|||
|
||||
return -gsup_msg->cause;
|
||||
}
|
||||
|
||||
static int subscr_handle_unknown_imsi(struct gprs_gsup_client *sup_client,
|
||||
struct gprs_gsup_message *gsup_msg)
|
||||
*/
|
||||
static int subscr_handle_unknown_imsi(struct gsup_client *sup_client,
|
||||
struct osmo_gsup_message *gsup_msg)
|
||||
{
|
||||
if (GPRS_GSUP_IS_MSGT_REQUEST(gsup_msg->message_type)) {
|
||||
if (OSMO_GSUP_IS_MSGT_REQUEST(gsup_msg->message_type)) {
|
||||
subscr_tx_sup_error_reply(sup_client, NULL, gsup_msg,
|
||||
GMM_CAUSE_IMSI_UNKNOWN);
|
||||
LOGP(DSUP, LOGL_NOTICE,
|
||||
"Unknown IMSI %s, discarding SUP request "
|
||||
"of type 0x%02x\n",
|
||||
gsup_msg->imsi, gsup_msg->message_type);
|
||||
} else if (GPRS_GSUP_IS_MSGT_ERROR(gsup_msg->message_type)) {
|
||||
} else if (OSMO_GSUP_IS_MSGT_ERROR(gsup_msg->message_type)) {
|
||||
LOGP(DSUP, LOGL_NOTICE,
|
||||
"Unknown IMSI %s, discarding SUP error "
|
||||
"of type 0x%02x, cause '%s' (%d)\n",
|
||||
|
@ -517,19 +522,19 @@ static int subscr_handle_unknown_imsi(struct gprs_gsup_client *sup_client,
|
|||
return -GMM_CAUSE_IMSI_UNKNOWN;
|
||||
}
|
||||
|
||||
static int subscr_rx_sup_message(struct gprs_gsup_client *sup_client, struct msgb *msg)
|
||||
static int subscr_rx_sup_message(struct gsup_client *sup_client, struct msgb *msg)
|
||||
{
|
||||
uint8_t *data = msgb_l2(msg);
|
||||
size_t data_len = msgb_l2len(msg);
|
||||
int rc = 0;
|
||||
|
||||
struct gprs_gsup_message gsup_msg = {0};
|
||||
struct osmo_gsup_message gsup_msg = {0};
|
||||
struct gsm_subscriber *subscr;
|
||||
|
||||
if (*data == GPRS_GSUP_MSGT_SMS) {
|
||||
if (*data == OSMO_GSUP_MSGT_SMS) {
|
||||
return rx_sms_message(sup_client, data, data_len);
|
||||
}
|
||||
rc = gprs_gsup_decode(data, data_len, &gsup_msg);
|
||||
rc = osmo_gsup_decode(data, data_len, &gsup_msg);
|
||||
if (rc < 0) {
|
||||
LOGP(DSUP, LOGL_ERROR,
|
||||
"decoding SUP message fails with error '%s' (%d)\n",
|
||||
|
@ -540,13 +545,13 @@ static int subscr_rx_sup_message(struct gprs_gsup_client *sup_client, struct msg
|
|||
if (!gsup_msg.imsi[0]) {
|
||||
LOGP(DSUP, LOGL_ERROR, "Missing IMSI in SUP message\n");
|
||||
|
||||
if (GPRS_GSUP_IS_MSGT_REQUEST(gsup_msg.message_type))
|
||||
if (OSMO_GSUP_IS_MSGT_REQUEST(gsup_msg.message_type))
|
||||
subscr_tx_sup_error_reply(sup_client, NULL, &gsup_msg,
|
||||
GMM_CAUSE_INV_MAND_INFO);
|
||||
return -GMM_CAUSE_INV_MAND_INFO;
|
||||
}
|
||||
|
||||
if (!gsup_msg.cause && GPRS_GSUP_IS_MSGT_ERROR(gsup_msg.message_type))
|
||||
if (!gsup_msg.cause && OSMO_GSUP_IS_MSGT_ERROR(gsup_msg.message_type))
|
||||
gsup_msg.cause = GMM_CAUSE_NET_FAIL;
|
||||
|
||||
subscr = subscr_get_by_imsi(NULL, gsup_msg.imsi);
|
||||
|
@ -559,31 +564,33 @@ static int subscr_rx_sup_message(struct gprs_gsup_client *sup_client, struct msg
|
|||
"Received SUP message of type 0x%02x\n", gsup_msg.message_type);
|
||||
|
||||
switch (gsup_msg.message_type) {
|
||||
|
||||
case GPRS_GSUP_MSGT_SEND_AUTH_INFO_RESULT:
|
||||
/*
|
||||
case OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT:
|
||||
rc = subscr_handle_sup_auth_res(sup_client, subscr, &gsup_msg);
|
||||
break;
|
||||
|
||||
case GPRS_GSUP_MSGT_SEND_AUTH_INFO_ERROR:
|
||||
case OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR:
|
||||
rc = subscr_handle_sup_auth_err(subscr, &gsup_msg);
|
||||
break;
|
||||
|
||||
case GPRS_GSUP_MSGT_UPDATE_LOCATION_RESULT:
|
||||
*/
|
||||
case OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT:
|
||||
rc = subscr_handle_sup_upd_loc_res(subscr, &gsup_msg);
|
||||
break;
|
||||
|
||||
case GPRS_GSUP_MSGT_UPDATE_LOCATION_ERROR:
|
||||
case OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR:
|
||||
rc = subscr_handle_sup_upd_loc_err(subscr, &gsup_msg);
|
||||
break;
|
||||
|
||||
case GPRS_GSUP_MSGT_LOCATION_CANCEL_REQUEST:
|
||||
case GPRS_GSUP_MSGT_PURGE_MS_ERROR:
|
||||
case GPRS_GSUP_MSGT_PURGE_MS_RESULT:
|
||||
case OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST:
|
||||
case OSMO_GSUP_MSGT_PURGE_MS_ERROR:
|
||||
case OSMO_GSUP_MSGT_PURGE_MS_RESULT:
|
||||
rc = subscr_handle_sup_purge_ms_res(subscr, &gsup_msg);
|
||||
break;
|
||||
|
||||
case GPRS_GSUP_MSGT_INSERT_DATA_REQUEST:
|
||||
case GPRS_GSUP_MSGT_DELETE_DATA_REQUEST:
|
||||
case OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT:
|
||||
case OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR:
|
||||
case OSMO_GSUP_MSGT_INSERT_DATA_REQUEST:
|
||||
case OSMO_GSUP_MSGT_DELETE_DATA_REQUEST:
|
||||
LOGGSUBSCRP(LOGL_ERROR, subscr,
|
||||
"Rx SUP message type %d not yet implemented\n",
|
||||
gsup_msg.message_type);
|
||||
|
@ -596,7 +603,7 @@ static int subscr_rx_sup_message(struct gprs_gsup_client *sup_client, struct msg
|
|||
LOGGSUBSCRP(LOGL_ERROR, subscr,
|
||||
"Rx SUP message type %d not valid at SGSN\n",
|
||||
gsup_msg.message_type);
|
||||
if (GPRS_GSUP_IS_MSGT_REQUEST(gsup_msg.message_type))
|
||||
if (OSMO_GSUP_IS_MSGT_REQUEST(gsup_msg.message_type))
|
||||
subscr_tx_sup_error_reply(sup_client, subscr, &gsup_msg,
|
||||
GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL);
|
||||
rc = -GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL;
|
||||
|
@ -608,7 +615,7 @@ static int subscr_rx_sup_message(struct gprs_gsup_client *sup_client, struct msg
|
|||
return rc;
|
||||
}
|
||||
|
||||
int sup_read_cb(struct gprs_gsup_client *sup_client, struct msgb *msg)
|
||||
int sup_read_cb(struct gsup_client *sup_client, struct msgb *msg)
|
||||
{
|
||||
int rc;
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
#include <openbsc/debug.h>
|
||||
#include <openbsc/db.h>
|
||||
#include <openbsc/chan_alloc.h>
|
||||
#include <openbsc/gsm_04_08_gprs.h>
|
||||
#include <openbsc/gprs_gsup_messages.h>
|
||||
#include <openbsc/gprs_gsup_client.h>
|
||||
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
||||
#include <osmocom/gsm/gsup.h>
|
||||
#include <openbsc/gsup_client.h>
|
||||
#include <openbsc/osmo_msc.h>
|
||||
#include <openbsc/gprs_utils.h>
|
||||
#include <openbsc/ussd.h>
|
||||
|
@ -39,13 +39,13 @@ int ussd_map_tx_message(struct gsm_network* net,
|
|||
uint32_t ref,
|
||||
const uint8_t* component_data)
|
||||
{
|
||||
struct msgb *msg = gprs_gsup_msgb_alloc();
|
||||
struct msgb *msg = gsup_client_msgb_alloc();
|
||||
if (!msg)
|
||||
return -ENOMEM;
|
||||
|
||||
subscr_uss_message(msg, req, extension, ref, component_data);
|
||||
|
||||
return gprs_gsup_client_send(net->ussd_sup_client, msg);
|
||||
return gsup_client_send(net->ussd_sup_client, msg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,20 +67,20 @@ static int ussd_map_rx_message_int(struct gsm_network *net, const uint8_t* data,
|
|||
return on_ussd_response(net, ref, &ss, data + ss.component_offset, extension);
|
||||
}
|
||||
|
||||
static int ussd_map_rx_message(struct gprs_gsup_client *sup_client, struct msgb *msg)
|
||||
static int ussd_map_rx_message(struct gsup_client *sup_client, struct msgb *msg)
|
||||
{
|
||||
uint8_t *data = msgb_l2(msg);
|
||||
size_t data_len = msgb_l2len(msg);
|
||||
struct gsm_network *gsmnet = (struct gsm_network *)sup_client->data;
|
||||
|
||||
if (*data != GPRS_GSUP_MSGT_USSD_MAP) {
|
||||
if (*data != OSMO_GSUP_MSGT_USSD_MAP) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ussd_map_rx_message_int(gsmnet, data, data_len);
|
||||
}
|
||||
|
||||
int ussd_map_read_cb(struct gprs_gsup_client *sup_client, struct msgb *msg)
|
||||
int ussd_map_read_cb(struct gsup_client *sup_client, struct msgb *msg)
|
||||
{
|
||||
int rc;
|
||||
|
||||
|
|
|
@ -26,15 +26,14 @@
|
|||
#include <openbsc/debug.h>
|
||||
#include <openbsc/db.h>
|
||||
#include <openbsc/chan_alloc.h>
|
||||
#include <openbsc/gsm_04_08_gprs.h>
|
||||
#include <openbsc/gprs_gsup_messages.h>
|
||||
#include <openbsc/gprs_gsup_client.h>
|
||||
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
||||
#include <osmocom/gsm/gsup.h>
|
||||
#include <openbsc/osmo_msc.h>
|
||||
#include <openbsc/gprs_utils.h>
|
||||
#include <openbsc/ussd.h>
|
||||
|
||||
/*
|
||||
* 0 - GPRS_GSUP_MSGT_USSD_MAP constant
|
||||
* 0 - OSMO_GSUP_MSGT_USSD_MAP constant
|
||||
* 1 - LEN
|
||||
* 2 - message_type [ REGISTER / FACILITY / RELEASE COMPLETE ]
|
||||
* 3,4,5,6 - tid ID associated with the session
|
||||
|
@ -56,8 +55,8 @@ int subscr_uss_message(struct msgb *msg,
|
|||
|
||||
gsup_indicator = msgb_put(msg, 7);
|
||||
|
||||
/* First byte should always be GPRS_GSUP_MSGT_USSD_MAP */
|
||||
gsup_indicator[offset++] = GPRS_GSUP_MSGT_USSD_MAP;
|
||||
/* First byte should always be OSMO_GSUP_MSGT_USSD_MAP */
|
||||
gsup_indicator[offset++] = OSMO_GSUP_MSGT_USSD_MAP;
|
||||
gsup_indicator[offset++] = 0; // Total length
|
||||
gsup_indicator[offset++] = req->message_type;
|
||||
|
||||
|
@ -80,7 +79,7 @@ int subscr_uss_message(struct msgb *msg,
|
|||
memcpy(gsup_indicator + offset, component_data, req->component_length);
|
||||
}
|
||||
|
||||
gsup_indicator[1] = offset + req->component_length - 2; //except GPRS_GSUP_MSGT_USSD_MAP and length field
|
||||
gsup_indicator[1] = offset + req->component_length - 2; //except OSMO_GSUP_MSGT_USSD_MAP and length field
|
||||
return 0;
|
||||
#if 0
|
||||
gsup_indicator[6] = req->component_type;
|
||||
|
@ -108,7 +107,7 @@ int subscr_uss_message(struct msgb *msg,
|
|||
/* wrap with GSM0480_CTYPE_INVOKE */
|
||||
// gsm0480_wrap_invoke(msg, req->opcode, invoke_id);
|
||||
// gsup_indicator = msgb_push(msgb, 1);
|
||||
// gsup_indicator[0] = GPRS_GSUP_MSGT_MAP;
|
||||
// gsup_indicator[0] = OSMO_GSUP_MSGT_MAP;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
@ -130,7 +129,7 @@ int rx_uss_message_parse(const uint8_t* data,
|
|||
if (len < 7)
|
||||
return -1;
|
||||
|
||||
/* skip GPRS_GSUP_MSGT_MAP */
|
||||
/* skip OSMO_GSUP_MSGT_MAP */
|
||||
total_len = *(const_data++);
|
||||
ss->message_type = *(const_data++);
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ int on_ussd_response(struct gsm_network *net,
|
|||
rc = gsm0480_send_ussd_reject(trans->conn, req);
|
||||
}
|
||||
#endif
|
||||
msg = gsm48_msgb_alloc();
|
||||
msg = gsm48_msgb_alloc_name("");
|
||||
ptr8 = msgb_put(msg, 0);
|
||||
|
||||
memcpy(ptr8, component, reqhdr->component_length);
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include <openbsc/sms_queue.h>
|
||||
#include <openbsc/mncc_int.h>
|
||||
#include <openbsc/handover.h>
|
||||
#include <openbsc/gprs_gsup_client.h>
|
||||
#include <openbsc/gsup_client.h>
|
||||
#include <openbsc/gsm_ussd_map.h>
|
||||
|
||||
#include <osmocom/vty/logging.h>
|
||||
|
@ -1042,8 +1042,8 @@ DEFUN(sup_ussd_destination, sup_ussd_destination_cmd,
|
|||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
gsmnet->ussd_sup_client = gprs_gsup_client_create(
|
||||
argv[0], atoi(argv[1]), &ussd_map_read_cb);
|
||||
gsmnet->ussd_sup_client = gsup_client_create(
|
||||
argv[0], atoi(argv[1]), &ussd_map_read_cb, NULL);
|
||||
if (!gsmnet->ussd_sup_client) {
|
||||
LOGP(DSS, LOGL_FATAL, "Cannot set up USSD SUP socket\n");
|
||||
vty_out(vty, "%%Cannot set up USSD SUP socket%s", VTY_NEWLINE);
|
||||
|
@ -1066,8 +1066,8 @@ DEFUN(sms_destination, sms_destination_cmd,
|
|||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
gsmnet->sms_client = gprs_gsup_client_create(
|
||||
argv[0], atoi(argv[1]), &sup_read_cb);
|
||||
gsmnet->sms_client = gsup_client_create(
|
||||
argv[0], atoi(argv[1]), &sup_read_cb, NULL);
|
||||
if (!gsmnet->sms_client) {
|
||||
LOGP(DSUP, LOGL_FATAL, "Cannot set up SMS socket\n");
|
||||
vty_out(vty, "%%Cannot set up SMS socket%s", VTY_NEWLINE);
|
||||
|
|
|
@ -371,9 +371,9 @@ int main(int argc, char **argv)
|
|||
/* Prepare HLR SUP socket if auth policy is "remote" or "remote-closed"*/
|
||||
if (bsc_gsmnet->auth_policy == GSM_AUTH_POLICY_REMOTE ||
|
||||
bsc_gsmnet->auth_policy == GSM_AUTH_POLICY_REMOTE_CLOSED) {
|
||||
bsc_gsmnet->hlr_sup_client = gprs_gsup_client_create(
|
||||
bsc_gsmnet->hlr_sup_client = gsup_client_create(
|
||||
"127.0.0.1", 8183,
|
||||
&sup_read_cb);
|
||||
&sup_read_cb, NULL);
|
||||
if (!bsc_gsmnet->hlr_sup_client) {
|
||||
LOGP(DSUP, LOGL_FATAL, "Cannot set up subscriber management\n");
|
||||
exit(2);
|
||||
|
|
|
@ -7,9 +7,7 @@ AM_LDFLAGS = $(COVERAGE_LDFLAGS)
|
|||
bin_PROGRAMS = reg-proxy
|
||||
|
||||
reg_proxy_SOURCES = \
|
||||
../gprs/gsm_04_08_gprs.c \
|
||||
../gprs/gprs_utils.c \
|
||||
../gprs/gprs_gsup_messages.c ../gprs/gprs_gsup_client.c \
|
||||
tcp_client.c sup_server.c sup.c sip.c sip_client.c reg_proxy.c
|
||||
|
||||
reg_proxy_LDADD = \
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
|
||||
//extern void *tall_reg_ctx;
|
||||
|
||||
//static void start_test_procedure(struct gprs_gsup_client *gsupc);
|
||||
//static void start_test_procedure(struct gsup_client *gsupc);
|
||||
|
||||
/*
|
||||
static void gsup_client_send_ping(struct gprs_gsup_client *gsupc)
|
||||
static void gsup_client_send_ping(struct gsup_client *gsupc)
|
||||
{
|
||||
struct msgb *msg = gprs_gsup_msgb_alloc();
|
||||
struct msgb *msg = gsup_client_msgb_alloc();
|
||||
|
||||
msg->l2h = msgb_put(msg, 1);
|
||||
msg->l2h[0] = IPAC_MSGT_PING;
|
||||
|
@ -123,7 +123,7 @@ static int sip_client_read_cb(struct tcp_client_conn *link, struct msgb *msg)
|
|||
/*
|
||||
static void ping_timer_cb(void *gsupc_)
|
||||
{
|
||||
struct gprs_gsup_client *gsupc = gsupc_;
|
||||
struct gsup_client *gsupc = gsupc_;
|
||||
|
||||
LOGP(DGPRS, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n",
|
||||
gsupc->is_connected ? "connected" : "not connected",
|
||||
|
@ -142,13 +142,13 @@ static void ping_timer_cb(void *gsupc_)
|
|||
}
|
||||
*/
|
||||
/*
|
||||
static void start_test_procedure(struct gprs_gsup_client *gsupc)
|
||||
static void start_test_procedure(struct gsup_client *gsupc)
|
||||
{
|
||||
gsupc->ping_timer.data = gsupc;
|
||||
gsupc->ping_timer.cb = &ping_timer_cb;
|
||||
|
||||
gsupc->got_ipa_pong = 0;
|
||||
osmo_timer_schedule(&gsupc->ping_timer, GPRS_GSUP_PING_INTERVAL, 0);
|
||||
osmo_timer_schedule(&gsupc->ping_timer, OSMO_GSUP_PING_INTERVAL, 0);
|
||||
LOGP(DGPRS, LOGL_DEBUG, "GSUP sending PING\n");
|
||||
gsup_client_send_ping(gsupc);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <openbsc/sup_server.h>
|
||||
#include <openbsc/reg_proxy.h>
|
||||
#include <openbsc/debug.h>
|
||||
#include <openbsc/gprs_gsup_messages.h>
|
||||
#include <osmocom/gsm/gsup.h>
|
||||
#include <openbsc/sip.h>
|
||||
#include <openbsc/sup.h>
|
||||
#include <openbsc/gsm_04_08.h>
|
||||
|
@ -9,7 +9,7 @@
|
|||
#include <openbsc/ussd.h>
|
||||
|
||||
static int handle_sup_upd_loc_req(struct gsm_sup_server *sup_server,
|
||||
struct gprs_gsup_message *sup_msg)
|
||||
struct osmo_gsup_message *sup_msg)
|
||||
{
|
||||
int rc = 0;
|
||||
struct reg_proxy *reg = sup_server->app;
|
||||
|
@ -24,7 +24,7 @@ static int handle_sup_upd_loc_req(struct gsm_sup_server *sup_server,
|
|||
}
|
||||
|
||||
static int handle_sup_purge_ms_req(struct gsm_sup_server *sup_server,
|
||||
struct gprs_gsup_message *sup_msg)
|
||||
struct osmo_gsup_message *sup_msg)
|
||||
{
|
||||
int rc = 0;
|
||||
struct reg_proxy *reg = sup_server->app;
|
||||
|
@ -70,7 +70,7 @@ static int rx_uss_message_parse(struct ss_request *ss,
|
|||
if (len < 1 + 2 + 3 + 3)
|
||||
return -1;
|
||||
|
||||
/* skip GPRS_GSUP_MSGT_MAP */
|
||||
/* skip OSMO_GSUP_MSGT_MAP */
|
||||
ss->message_type = *(++const_data);
|
||||
ss->component_type = *(++const_data);
|
||||
const_data += 2;
|
||||
|
@ -129,8 +129,8 @@ static int subscr_uss_message(struct msgb *msg,
|
|||
|
||||
gsup_indicator = msgb_put(msg, 4);
|
||||
|
||||
/* First byte should always be GPRS_GSUP_MSGT_MAP */
|
||||
gsup_indicator[0] = GPRS_GSUP_MSGT_MAP;
|
||||
/* First byte should always be OSMO_GSUP_MSGT_MAP */
|
||||
gsup_indicator[0] = OSMO_GSUP_MSGT_MAP;
|
||||
gsup_indicator[1] = req->message_type;
|
||||
/* TODO ADD tid */
|
||||
gsup_indicator[2] = req->component_type;
|
||||
|
@ -159,7 +159,7 @@ static int subscr_uss_message(struct msgb *msg,
|
|||
/* wrap with GSM0480_CTYPE_INVOKE */
|
||||
// gsm0480_wrap_invoke(msg, req->opcode, invoke_id);
|
||||
// gsup_indicator = msgb_push(msgb, 1);
|
||||
// gsup_indicator[0] = GPRS_GSUP_MSGT_MAP;
|
||||
// gsup_indicator[0] = OSMO_GSUP_MSGT_MAP;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ static int rx_sup_uss_message(struct gsm_sup_server *sup_server, const uint8_t*
|
|||
if (ss.ussd_text_len > sizeof(ss.ussd_text))
|
||||
ss.ussd_text_len = sizeof(ss.ussd_text);
|
||||
|
||||
struct msgb *msg = gprs_gsup_msgb_alloc();
|
||||
struct msgb *msg = gsup_client_msgb_alloc();
|
||||
subscr_uss_message(msg,
|
||||
&ss,
|
||||
(extention[0] == 0) ? NULL : extention);
|
||||
|
@ -246,17 +246,17 @@ int rx_sup_message(struct gsm_sup_server *sup_server, struct msgb *msg)
|
|||
size_t data_len = msgb_l2len(msg);
|
||||
int rc = 0;
|
||||
|
||||
struct gprs_gsup_message sup_msg = {0};
|
||||
struct osmo_gsup_message sup_msg = {0};
|
||||
//struct gsm_subscriber *subscr;
|
||||
#if 0
|
||||
if (*data == GPRS_GSUP_MSGT_MAP) {
|
||||
if (*data == OSMO_GSUP_MSGT_MAP) {
|
||||
LOGP(DSUP, LOGL_INFO,
|
||||
"Receive USS: %s\n", msgb_hexdump(msg));
|
||||
|
||||
return rx_sup_uss_message(sup_server, data, data_len);
|
||||
}
|
||||
#endif
|
||||
rc = gprs_gsup_decode(data, data_len, &sup_msg);
|
||||
rc = osmo_gsup_decode(data, data_len, &sup_msg);
|
||||
if (rc < 0) {
|
||||
LOGP(DSUP, LOGL_ERROR,
|
||||
"decoding SUP message fails with error '%s' (%d)\n",
|
||||
|
@ -267,13 +267,13 @@ int rx_sup_message(struct gsm_sup_server *sup_server, struct msgb *msg)
|
|||
if (!sup_msg.imsi[0]) {
|
||||
LOGP(DSUP, LOGL_ERROR, "Missing IMSI in SUP message\n");
|
||||
|
||||
// if (GPRS_GSUP_IS_MSGT_REQUEST(gsup_msg.message_type))
|
||||
// if (OSMO_GSUP_IS_MSGT_REQUEST(gsup_msg.message_type))
|
||||
// subscr_tx_sup_error_reply(sup_client, NULL, &gsup_msg,
|
||||
// GMM_CAUSE_INV_MAND_INFO);
|
||||
return -GMM_CAUSE_INV_MAND_INFO;
|
||||
}
|
||||
|
||||
// if (!gsup_msg.cause && GPRS_GSUP_IS_MSGT_ERROR(gsup_msg.message_type))
|
||||
// if (!gsup_msg.cause && OSMO_GSUP_IS_MSGT_ERROR(gsup_msg.message_type))
|
||||
// gsup_msg.cause = GMM_CAUSE_NET_FAIL;
|
||||
|
||||
// subscr = subscr_get_by_imsi(NULL, gsup_msg.imsi);
|
||||
|
@ -286,24 +286,24 @@ int rx_sup_message(struct gsm_sup_server *sup_server, struct msgb *msg)
|
|||
"Received SUP message of type 0x%02x\n", sup_msg.message_type);
|
||||
|
||||
switch (sup_msg.message_type) {
|
||||
case GPRS_GSUP_MSGT_UPDATE_LOCATION_REQUEST:
|
||||
case OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST:
|
||||
rc = handle_sup_upd_loc_req(sup_server, &sup_msg);
|
||||
break;
|
||||
|
||||
case GPRS_GSUP_MSGT_SEND_AUTH_INFO_REQUEST:
|
||||
case OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST:
|
||||
//FIXME!!!!
|
||||
//rc = subscr_handle_sup_auth_req(sup_server, &sup_msg);
|
||||
rc = handle_sup_upd_loc_req(sup_server, &sup_msg);
|
||||
break;
|
||||
|
||||
case GPRS_GSUP_MSGT_LOCATION_CANCEL_ERROR:
|
||||
case GPRS_GSUP_MSGT_LOCATION_CANCEL_RESULT:
|
||||
case GPRS_GSUP_MSGT_PURGE_MS_REQUEST:
|
||||
case OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR:
|
||||
case OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT:
|
||||
case OSMO_GSUP_MSGT_PURGE_MS_REQUEST:
|
||||
rc = handle_sup_purge_ms_req(sup_server, &sup_msg);
|
||||
break;
|
||||
|
||||
case GPRS_GSUP_MSGT_INSERT_DATA_ERROR:
|
||||
case GPRS_GSUP_MSGT_INSERT_DATA_RESULT:
|
||||
case OSMO_GSUP_MSGT_INSERT_DATA_ERROR:
|
||||
case OSMO_GSUP_MSGT_INSERT_DATA_RESULT:
|
||||
LOGGSUPP(LOGL_ERROR, &sup_msg,
|
||||
"Rx SUP message type %d not yet implemented\n",
|
||||
sup_msg.message_type);
|
||||
|
@ -326,12 +326,12 @@ int rx_sup_message(struct gsm_sup_server *sup_server, struct msgb *msg)
|
|||
}
|
||||
|
||||
static int tx_sup_message(struct gsm_sup_server *sup_server,
|
||||
struct gprs_gsup_message *sup_msg)
|
||||
struct osmo_gsup_message *sup_msg)
|
||||
{
|
||||
struct msgb *msg = gprs_gsup_msgb_alloc();
|
||||
struct msgb *msg = gsup_client_msgb_alloc();
|
||||
printf("tx_sup_message \n");
|
||||
|
||||
gprs_gsup_encode(msg, sup_msg);
|
||||
osmo_gsup_encode(msg, sup_msg);
|
||||
|
||||
printf("tx_sup_message encoded\n");
|
||||
|
||||
|
@ -350,10 +350,10 @@ static int tx_sup_message(struct gsm_sup_server *sup_server,
|
|||
int handle_location_update_result(struct gsm_sup_server *sup_server,
|
||||
char *imsi, char *msisdn)
|
||||
{
|
||||
struct gprs_gsup_message gsup_msg = {0};
|
||||
struct osmo_gsup_message gsup_msg = {0};
|
||||
u_int8_t msisdn_enc[9];
|
||||
|
||||
gsup_msg.message_type = GPRS_GSUP_MSGT_UPDATE_LOCATION_RESULT;
|
||||
gsup_msg.message_type = OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT;
|
||||
printf("handle_location_update_result 1\n");
|
||||
|
||||
memcpy(gsup_msg.imsi, imsi, 17);
|
||||
|
@ -361,7 +361,7 @@ int handle_location_update_result(struct gsm_sup_server *sup_server,
|
|||
|
||||
if (strcmp(imsi, msisdn) != 0) {
|
||||
gsm48_encode_bcd_number(msisdn_enc, 9, 0, msisdn);
|
||||
gsup_msg.msisdn_enc = msisdn_enc + 1;
|
||||
(&gsup_msg)->msisdn_enc = msisdn_enc + 1;
|
||||
gsup_msg.msisdn_enc_len = msisdn_enc[0];
|
||||
printf("handle_location_update_result %d %d\n", gsup_msg.msisdn_enc_len, gsup_msg.msisdn_enc);
|
||||
}
|
||||
|
@ -372,8 +372,8 @@ int handle_location_update_result(struct gsm_sup_server *sup_server,
|
|||
int handle_purge_ms_result(struct gsm_sup_server *sup_server,
|
||||
char *imsi)
|
||||
{
|
||||
struct gprs_gsup_message gsup_msg = {0};
|
||||
gsup_msg.message_type = GPRS_GSUP_MSGT_PURGE_MS_RESULT;
|
||||
struct osmo_gsup_message gsup_msg = {0};
|
||||
gsup_msg.message_type = OSMO_GSUP_MSGT_PURGE_MS_RESULT;
|
||||
memcpy(gsup_msg.imsi, imsi, 17);
|
||||
return tx_sup_message(sup_server, &gsup_msg);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef struct operation operation_t;
|
|||
#include <osmocom/gsm/gsm0480.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
|
||||
#include <openbsc/gprs_gsup_messages.h>
|
||||
#include <osmocom/gsm/gsup.h>
|
||||
#include <openbsc/gsm_ussd_map_proto.h>
|
||||
#include <openbsc/gsm_04_80.h>
|
||||
|
||||
|
@ -1239,7 +1239,7 @@ static int isup_handle_connection(context_t *cli, su_wait_t *w, void *p)
|
|||
goto err;
|
||||
case IPAC_PROTO_OSMO:
|
||||
// TODO callback
|
||||
if (msg->l2h[1] == GPRS_GSUP_MSGT_USSD_MAP) {
|
||||
if (msg->l2h[1] == OSMO_GSUP_MSGT_USSD_MAP) {
|
||||
LOGP(DLCTRL, LOGL_ERROR,
|
||||
"Receive USS: %s\n", msgb_hexdump(msg));
|
||||
|
||||
|
@ -1256,7 +1256,7 @@ static int isup_handle_connection(context_t *cli, su_wait_t *w, void *p)
|
|||
|
||||
/* TODO: handle gprs_gsup_decode() for other types */
|
||||
|
||||
LOGP(DLCTRL, LOGL_ERROR, "Unknown IPAC_PROTO_OSMO GPRS_GSUP_MSGT_* 0x%x\n", msg->l2h[1]);
|
||||
LOGP(DLCTRL, LOGL_ERROR, "Unknown IPAC_PROTO_OSMO OSMO_GSUP_MSGT_* 0x%x\n", msg->l2h[1]);
|
||||
msgb_free(msg);
|
||||
conn->pending_msg = NULL;
|
||||
goto err;
|
||||
|
|
|
@ -114,7 +114,7 @@ int auth_get_tuple_for_subscr_verbose(struct gsm_auth_tuple *atuple,
|
|||
int key_seq)
|
||||
{
|
||||
int auth_action;
|
||||
auth_action = auth_get_tuple_for_subscr(atuple, subscr, key_seq);
|
||||
auth_action = auth_get_tuple_for_subscr(GSM_AUTH_POLICY_ACCEPT_ALL, atuple, subscr, key_seq);
|
||||
printf("auth_get_tuple_for_subscr(key_seq=%d) --> auth_action == %s\n",
|
||||
key_seq, auth_action_str(auth_action));
|
||||
return auth_action;
|
||||
|
|
Loading…
Reference in New Issue