66 lines
2.1 KiB
C
66 lines
2.1 KiB
C
/*
|
|
* Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com>
|
|
*
|
|
* This file is part of Open5GS.
|
|
*
|
|
* 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 General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "sbi-path.h"
|
|
#include "nnrf-handler.h"
|
|
|
|
void scp_nnrf_handle_nf_discover(
|
|
ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg)
|
|
{
|
|
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
|
ogs_sbi_object_t *sbi_object = NULL;
|
|
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
|
|
ogs_sbi_discovery_option_t *discovery_option = NULL;
|
|
|
|
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
|
|
OpenAPI_search_result_t *SearchResult = NULL;
|
|
|
|
ogs_assert(recvmsg);
|
|
ogs_assert(xact);
|
|
sbi_object = xact->sbi_object;
|
|
ogs_assert(sbi_object);
|
|
service_type = xact->service_type;
|
|
ogs_assert(service_type);
|
|
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
|
|
ogs_assert(target_nf_type);
|
|
|
|
discovery_option = xact->discovery_option;
|
|
|
|
SearchResult = recvmsg->SearchResult;
|
|
if (!SearchResult) {
|
|
ogs_error("No SearchResult");
|
|
return;
|
|
}
|
|
|
|
ogs_nnrf_handle_nf_discover_search_result(SearchResult);
|
|
|
|
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
|
|
target_nf_type, discovery_option);
|
|
if (!nf_instance) {
|
|
ogs_error("(NF discover) No [%s]",
|
|
ogs_sbi_service_type_to_name(service_type));
|
|
return;
|
|
}
|
|
|
|
OGS_SBI_SETUP_NF_INSTANCE(
|
|
sbi_object->service_type_array[service_type], nf_instance);
|
|
|
|
ogs_expect(true == scp_sbi_send_request(nf_instance, xact));
|
|
}
|