diff options
Diffstat (limited to 'openbsc/src/libmsc')
-rw-r--r-- | openbsc/src/libmsc/Makefile.am | 4 | ||||
-rw-r--r-- | openbsc/src/libmsc/gsm_04_08.c | 4 | ||||
-rw-r--r-- | openbsc/src/libmsc/gsm_04_08_gprs.c | 141 | ||||
-rw-r--r-- | openbsc/src/libmsc/gsm_04_11.c | 9 | ||||
-rw-r--r-- | openbsc/src/libmsc/gsm_sup.c | 135 | ||||
-rw-r--r-- | openbsc/src/libmsc/gsm_ussd_map.c | 16 | ||||
-rw-r--r-- | openbsc/src/libmsc/gsm_ussd_map_proto.c | 17 | ||||
-rw-r--r-- | openbsc/src/libmsc/ussd.c | 2 | ||||
-rw-r--r-- | openbsc/src/libmsc/vty_interface_layer3.c | 10 |
9 files changed, 102 insertions, 236 deletions
diff --git a/openbsc/src/libmsc/Makefile.am b/openbsc/src/libmsc/Makefile.am index c06b2960d..605f37773 100644 --- a/openbsc/src/libmsc/Makefile.am +++ b/openbsc/src/libmsc/Makefile.am @@ -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 \ diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index a6baf4eea..38a050dea 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.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 ? */ diff --git a/openbsc/src/libmsc/gsm_04_08_gprs.c b/openbsc/src/libmsc/gsm_04_08_gprs.c deleted file mode 100644 index 3ae50e26c..000000000 --- a/openbsc/src/libmsc/gsm_04_08_gprs.c +++ /dev/null @@ -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_; - diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c index c924b426d..25be3b456 100644 --- a/openbsc/src/libmsc/gsm_04_11.c +++ b/openbsc/src/libmsc/gsm_04_11.c @@ -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); } diff --git a/openbsc/src/libmsc/gsm_sup.c b/openbsc/src/libmsc/gsm_sup.c index 5eddd2e5a..1c33b447a 100644 --- a/openbsc/src/libmsc/gsm_sup.c +++ b/openbsc/src/libmsc/gsm_sup.c @@ -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; diff --git a/openbsc/src/libmsc/gsm_ussd_map.c b/openbsc/src/libmsc/gsm_ussd_map.c index 7ca84b133..041d91fbc 100644 --- a/openbsc/src/libmsc/gsm_ussd_map.c +++ b/openbsc/src/libmsc/gsm_ussd_map.c @@ -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; diff --git a/openbsc/src/libmsc/gsm_ussd_map_proto.c b/openbsc/src/libmsc/gsm_ussd_map_proto.c index 1d48efbd5..706ba1d00 100644 --- a/openbsc/src/libmsc/gsm_ussd_map_proto.c +++ b/openbsc/src/libmsc/gsm_ussd_map_proto.c @@ -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++); diff --git a/openbsc/src/libmsc/ussd.c b/openbsc/src/libmsc/ussd.c index dd9503e1a..23adfeef1 100644 --- a/openbsc/src/libmsc/ussd.c +++ b/openbsc/src/libmsc/ussd.c @@ -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); diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c index 7f929eb02..4cab1a50c 100644 --- a/openbsc/src/libmsc/vty_interface_layer3.c +++ b/openbsc/src/libmsc/vty_interface_layer3.c @@ -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); |