api_conversions.hpp 2.96 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
 * the OAI Public License, Version 1.1  (the "License"); you may not use this
 * file except in compliance with the License. You may obtain a copy of the
 * License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */

/*! \file api_conversions.hpp
 \brief
 \author  Tien-Thinh NGUYEN
 \company Eurecom
 \date 2020
 \email: tien-thinh.nguyen@eurecom.fr
 */

#ifndef FILE_API_CONVERSIONS_HPP_SEEN
#define FILE_API_CONVERSIONS_HPP_SEEN

#include "NFProfile.h"
#include "nrf_profile.hpp"
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
35
36
#include "nrf_subscription.hpp"
#include "SubscriptionData.h"
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
37
#include "nrf.h"
38
39
40
41
42
43
44
45

using namespace oai::nrf::model;
using namespace oai::nrf::app;

namespace oai {
namespace nrf {
namespace api_conv {

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
46
47
48
49
50
51
/*
 * Convert a json-type profile to a NF profile
 * @param [const NFProfile &] NFProfile: Json-type profile from OpenAPITool
 * @param [std::shared_ptr<nrf_profile> &] profile: NF profile
 * @return true if successful, otherwise, return false
 */
Raphael Defosseux's avatar
Raphael Defosseux committed
52
53
bool profile_api_to_nrf_profile(
    const NFProfile& api_profile, std::shared_ptr<nrf_profile>& profile);
54

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
55
56
57
58
59
60
61
62
/*
 * Convert a json-type profile to a subscription profile
 * @param [const SubscriptionData &] subData: Json-type subscription data from
 * OpenAPITool
 * @param [std::shared_ptr<nrf_subscription> &] sub: NRF Subscription
 * @return true if successful, otherwise, return false
 */
bool subscription_api_to_nrf_subscription(
Raphael Defosseux's avatar
Raphael Defosseux committed
63
    const SubscriptionData& api_sub, std::shared_ptr<nrf_subscription>& sub);
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
64

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
65
66
67
68
69
/*
 * Convert a string to nf type
 * @param [const std::string &] str: string input
 * @return the corresponding nf_type
 */
Raphael Defosseux's avatar
Raphael Defosseux committed
70
nf_type_t string_to_nf_type(const std::string& str);
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
71

72
73
74
75
76
77
78
/*
 * Convert a string to nf type
 * @param [const std::string &] str: string input
 * @return the corresponding up_interface_type
 */
nf_up_interface_type_t string_to_up_interface_type(const std::string& str);

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
79
80
81
82
83
/*
 * Convert a string to Patch operation
 * @param [const std::string &] str: string input
 * @return the corresponding Patch operation
 */
Raphael Defosseux's avatar
Raphael Defosseux committed
84
patch_op_type_t string_to_patch_operation(const std::string& str);
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
85

Raphael Defosseux's avatar
Raphael Defosseux committed
86
bool validate_uuid(const std::string& str);
87

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
88
}  // namespace api_conv
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
89
90
}  // namespace nrf
}  // namespace oai
91
92

#endif /* FILE_API_CONVERSIONS_HPP_SEEN */