Commit 83ee68cd authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'http2_support' into 'develop'

httpv2 support

See merge request oai/cn5g/oai-cn5g-udr!10
parents b2ac5a46 4b976730
......@@ -435,6 +435,8 @@ check_install_udr_deps() {
install_nlohmann_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_nghttp2_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
$SUDO ldconfig
return 0
......
......@@ -40,6 +40,7 @@ RUN git clone https://github.com/vishnubob/wait-for-it.git
# Building UDR
WORKDIR /openair-udr/build/scripts
RUN ./build_udr --install-deps --force
RUN ./build_udr --clean --Verbose --build-type Release --jobs
#---------------------------------------------------------------------
......@@ -75,6 +76,9 @@ COPY --from=oai-udr-builder /openair-udr/scripts/entrypoint.sh .
COPY --from=oai-udr-builder /wait-for-it/wait-for-it.sh .
COPY --from=oai-udr-builder /usr/local/lib/libpistache.so /usr/local/lib/
COPY --from=oai-udr-builder /usr/local/lib/libnghttp2_asio.so.1 /usr/local/lib/
COPY --from=oai-udr-builder /usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 /usr/local/lib/
RUN ldconfig
WORKDIR /openair-udr/etc
......
......@@ -108,6 +108,7 @@ COPY --from=oai-udr-builder /lib64/libboost_date_time.so.1.66.0 .
COPY --from=oai-udr-builder /lib64/libconfig++.so.9 .
COPY --from=oai-udr-builder /lib64/libnghttp2.so.14 .
COPY --from=oai-udr-builder /usr/lib64/mysql/libmysqlclient.so.21 .
COPY --from=oai-udr-builder /usr/local/lib/libnghttp2_asio.so.1 /usr/lib64/
RUN ldconfig
......
......@@ -92,6 +92,9 @@ COPY --from=oai-udr-builder /openair-udr/scripts/entrypoint.sh .
COPY --from=oai-udr-builder /wait-for-it/wait-for-it.sh .
COPY --from=oai-udr-builder /usr/local/lib/libpistache.so /usr/local/lib/
COPY --from=oai-udr-builder /usr/local/lib/libnghttp2_asio.so.1 /usr/local/lib/
COPY --from=oai-udr-builder /usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 /usr/local/lib/
RUN ldconfig
WORKDIR /openair-udr/etc
......
......@@ -4,6 +4,7 @@ set -euo pipefail
CONFIG_DIR="/openair-udr/etc"
UDR_INTERFACE_PORT_FOR_NUDR=${UDR_INTERFACE_PORT_FOR_NUDR:-80}
UDR_INTERFACE_HTTP2_PORT_FOR_NUDR=${UDR_INTERFACE_HTTP2_PORT_FOR_NUDR:-8080}
for c in ${CONFIG_DIR}/*.conf; do
# grep variable names (format: ${VAR}) from template to be rendered
......
......@@ -31,6 +31,7 @@ include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
file(GLOB UDR_API_SERVER_src_files
${UDR_API_SERVER_DIR}/udr-api-server.cpp
${UDR_API_SERVER_DIR}/udr-http2-server.cpp
${UDR_API_SERVER_DIR}/model/*.cpp
${UDR_API_SERVER_DIR}/api/*.cpp
${UDR_API_SERVER_DIR}/impl/*.cpp
......
......@@ -65,9 +65,12 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::create_amf_context3gpp(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
long http_code = 0;
m_udr_app->handle_create_amf_context_3gpp(ueId, amf3GppAccessRegistration,
response_data, code);
response_data, http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......@@ -78,8 +81,11 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::query_amf_context3gpp(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_query_amf_context_3gpp(ueId, response_data, code);
long http_code = 0;
m_udr_app->handle_query_amf_context_3gpp(ueId, response_data, http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......
......@@ -58,8 +58,12 @@ void AccessAndMobilitySubscriptionDataDocumentApiImpl::query_am_data(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_query_am_data(ueId, servingPlmnId, response_data, code);
long http_code = 0;
m_udr_app->handle_query_am_data(ueId, servingPlmnId, response_data,
http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......
......@@ -51,9 +51,12 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
long http_code = 0;
m_udr_app->handle_create_authentication_status(ueId, authEvent, response_data,
code);
http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......@@ -62,8 +65,12 @@ void AuthenticationStatusDocumentApiImpl::delete_authentication_status(
const std::string &ueId, Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_delete_authentication_status(ueId, response_data, code);
long http_code = 0;
m_udr_app->handle_delete_authentication_status(ueId, response_data,
http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......@@ -74,8 +81,11 @@ void AuthenticationStatusDocumentApiImpl::query_authentication_status(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_query_authentication_status(ueId, response_data, code);
long http_code = 0;
m_udr_app->handle_query_authentication_status(ueId, response_data, http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......
......@@ -57,8 +57,11 @@ void AuthenticationSubscriptionDocumentApiImpl::
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_modify_authentication_subscription(ueId, patchItem,
response_data, code);
long http_code = 0;
m_udr_app->handle_modify_authentication_subscription(
ueId, patchItem, response_data, http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
......@@ -71,8 +74,12 @@ void AuthenticationSubscriptionDocumentApiImpl::
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_read_authentication_subscription(ueId, response_data, code);
long http_code = 0;
m_udr_app->handle_read_authentication_subscription(ueId, response_data,
http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......
......@@ -59,8 +59,12 @@ void SDMSubscriptionDocumentApiImpl::querysdm_subscription(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_query_sdm_subscription(ueId, subsId, response_data, code);
long http_code = 0;
m_udr_app->handle_query_sdm_subscription(ueId, subsId, response_data,
http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......@@ -69,8 +73,12 @@ void SDMSubscriptionDocumentApiImpl::removesdm_subscriptions(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_remove_sdm_subscription(ueId, subsId, response_data, code);
long http_code = 0;
m_udr_app->handle_remove_sdm_subscription(ueId, subsId, response_data,
http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......@@ -80,9 +88,12 @@ void SDMSubscriptionDocumentApiImpl::updatesdmsubscriptions(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
long http_code = 0;
m_udr_app->handle_update_sdm_subscription(ueId, subsId, sdmSubscription,
response_data, code);
response_data, http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......
......@@ -50,9 +50,12 @@ void SDMSubscriptionsCollectionApiImpl::create_sdm_subscriptions(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
long http_code = 0;
m_udr_app->handle_create_sdm_subscriptions(ueId, sdmSubscription,
response_data, code);
response_data, http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......@@ -62,8 +65,11 @@ void SDMSubscriptionsCollectionApiImpl::querysdmsubscriptions(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_query_sdm_subscriptions(ueId, response_data, code);
long http_code = 0;
m_udr_app->handle_query_sdm_subscriptions(ueId, response_data, http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......
......@@ -52,9 +52,12 @@ void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
long http_code = 0;
m_udr_app->handle_create_smf_context_non_3gpp(
ueId, pduSessionId, smfRegistration, response_data, code);
ueId, pduSessionId, smfRegistration, response_data, http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......@@ -63,8 +66,12 @@ void SMFRegistrationDocumentApiImpl::delete_smf_context(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_delete_smf_context(ueId, pduSessionId, response_data, code);
long http_code = 0;
m_udr_app->handle_delete_smf_context(ueId, pduSessionId, response_data,
http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......@@ -75,9 +82,12 @@ void SMFRegistrationDocumentApiImpl::query_smf_registration(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
long http_code = 0;
m_udr_app->handle_query_smf_registration(ueId, pduSessionId, response_data,
code);
http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......
......@@ -52,8 +52,11 @@ void SMFRegistrationsCollectionApiImpl::query_smf_reg_list(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_query_smf_reg_list(ueId, response_data, code);
long http_code = 0;
m_udr_app->handle_query_smf_reg_list(ueId, response_data, http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......
......@@ -56,9 +56,12 @@ void SMFSelectionSubscriptionDataDocumentApiImpl::query_smf_select_data(
Pistache::Http::ResponseWriter &response) {
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
long http_code = 0;
m_udr_app->handle_query_smf_select_data(ueId, servingPlmnId, response_data,
code);
http_code);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......
......@@ -69,9 +69,12 @@ void SessionManagementSubscriptionDataApiImpl::query_sm_data(
// TODO: DNN and SNSSAI
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_query_sm_data(ueId, servingPlmnId, response_data, code,
long http_code = 0;
m_udr_app->handle_query_sm_data(ueId, servingPlmnId, response_data, http_code,
snssai, dnn_str);
code = static_cast<Pistache::Http::Code>(http_code);
Logger::udr_server().debug("HTTP Response code %d.\n", code);
response.send(code, response_data.dump().c_str());
}
......
This diff is collapsed.
/*
* 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 udr_http2-server.h
\brief
\author Tien-Thinh NGUYEN
\company Eurecom
\date 2021
\email: tien-thinh.nguyen@eurecom.fr
*/
#ifndef FILE_UDR_HTTP2_SERVER_SEEN
#define FILE_UDR_HTTP2_SERVER_SEEN
#include "Amf3GppAccessRegistration.h"
#include "AuthEvent.h"
#include "PatchItem.h"
#include "SdmSubscription.h"
#include "SmfRegistration.h"
#include "udr_app.hpp"
#include <nghttp2/asio_http2_server.h>
using namespace nghttp2::asio_http2;
using namespace nghttp2::asio_http2::server;
using namespace oai::udr::app;
class udr_http2_server {
public:
udr_http2_server(std::string addr, uint32_t port, udr_app *udr_app_inst)
: m_address(addr), m_port(port), server(), m_udr_app(udr_app_inst) {}
void start();
void init(size_t thr) {}
void query_am_data_handler(const std::string &ue_id,
const std::string &serving_plmn_id,
const response &response);
void create_amf_context_3gpp_handler(
const std::string &ue_id,
Amf3GppAccessRegistration &amf3GppAccessRegistration,
const response &response);
void query_amf_context_3gpp_handler(const std::string &ue_id,
const response &response);
void create_authentication_status_handler(const std::string &ue_id,
const AuthEvent &authEvent,
const response &response);
void delete_authentication_status_handler(const std::string &ue_id,
const response &response);
void query_authentication_status_handler(const std::string &ue_id,
const response &response);
void modify_authentication_subscription_handler(
const std::string &ue_id, const std::vector<PatchItem> &patchItem,
const response &response);
void read_authentication_subscription_handler(const std::string &ue_id,
const response &response);
void query_sdm_subscription_handler(const std::string &ue_id,
const std::string &subs_id,
const response &response);
void remove_sdm_subscription_handler(const std::string &ue_id,
const std::string &subs_id,
const response &response);
void modify_sdm_subscription_handler(const std::string &ue_id,
const std::string &subs_id,
SdmSubscription &sdmSubscription,
const response &response);
void update_sdm_subscription_handler(const std::string &ue_id,
const std::string &subs_id,
SdmSubscription &sdmSubscription,
const response &response);
void create_sdm_subscriptions_handler(const std::string &ue_id,
SdmSubscription &sdmSubscription,
const response &response);
void query_sdm_subscriptions_handler(const std::string &ue_id,
const response &response);
void query_sm_data_handler(const std::string &ue_id,
const std::string &serving_plmn_id,
const response &response,
oai::udr::model::Snssai snssai = {},
std::string dnn = {});
void create_smf_context_non_3gpp_handler(
const std::string &ue_id, const int32_t &pdu_session_id,
const SmfRegistration &smfRegistration, const response &response);
void delete_smf_context_handler(const std::string &ue_id,
const int32_t &pdu_session_id,
const response &response);
void query_smf_registration_handler(const std::string &ue_id,
const int32_t &pdu_session_id,
const response &response);
void query_smf_reg_list_handler(const std::string &ue_id,
const response &response);
void query_smf_select_data_handler(const std::string &ue_id,
const std::string &serving_plmn_id,
const response &response);
void stop();
private:
std::string m_address;
uint32_t m_port;
http2 server;
udr_app *m_udr_app;
};
#endif
/*
* 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
*/
#ifndef FILE_3GPP_29_500_SEEN
#define FILE_3GPP_29_500_SEEN
enum http_status_code_e {
HTTP_STATUS_CODE_100_CONTINUE = 100,
HTTP_STATUS_CODE_200_OK = 200,
HTTP_STATUS_CODE_201_CREATED = 201,
HTTP_STATUS_CODE_202_ACCEPTED = 202,
HTTP_STATUS_CODE_204_NO_CONTENT = 204,
HTTP_STATUS_CODE_300_MULTIPLE_CHOICES = 300,
HTTP_STATUS_CODE_303_SEE_OTHER = 303,
HTTP_STATUS_CODE_307_TEMPORARY_REDIRECT = 307,
HTTP_STATUS_CODE_308_PERMANENT_REDIRECT = 308,
HTTP_STATUS_CODE_400_BAD_REQUEST = 400,
HTTP_STATUS_CODE_401_UNAUTHORIZED = 401,
HTTP_STATUS_CODE_403_FORBIDDEN = 403,
HTTP_STATUS_CODE_404_NOT_FOUND = 404,
HTTP_STATUS_CODE_405_METHOD_NOT_ALLOWED = 405,
HTTP_STATUS_CODE_406_NOT_ACCEPTABLE = 406,
HTTP_STATUS_CODE_408_REQUEST_TIMEOUT = 408,
HTTP_STATUS_CODE_409_CONFLICT = 409,
HTTP_STATUS_CODE_410_GONE = 410,
HTTP_STATUS_CODE_411_LENGTH_REQUIRED = 411,
HTTP_STATUS_CODE_412_PRECONDITION_FAILED = 412,
HTTP_STATUS_CODE_413_PAYLOAD_TOO_LARGE = 413,
HTTP_STATUS_CODE_414_URI_TOO_LONG = 414,
HTTP_STATUS_CODE_415_UNSUPPORTED_MEDIA_TYPE_NA = 415,
HTTP_STATUS_CODE_429_TOO_MANY_REQUESTS = 429,
HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR = 500,
HTTP_STATUS_CODE_501_NOT_IMPLEMENTED = 501,
HTTP_STATUS_CODE_503_SERVICE_UNAVAILABLE = 503,
HTTP_STATUS_CODE_504_GATEWAY_TIMEOUT = 504
};
#endif // FILE_3GPP_29_500_SEEN
......@@ -26,6 +26,7 @@ include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
add_library(3GPP_COMMON_TYPES STATIC
${CMAKE_CURRENT_SOURCE_DIR}/logger.cpp
${CMAKE_CURRENT_SOURCE_DIR}/conversions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pid_file.cpp
${CMAKE_CURRENT_SOURCE_DIR}/if.cpp
${CMAKE_CURRENT_SOURCE_DIR}/string.cpp
......
/*
* 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 conversions.cpp
\brief
\author Sebastien ROUX
\company Eurecom
*/
#include "conversions.hpp"
#include <arpa/inet.h>
#include <ctype.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <iomanip>
#include <iostream>
#include <sstream>
//------------------------------------------------------------------------------
std::string conv::toString(const struct in_addr &inaddr) {
std::string s = {};
char str[INET6_ADDRSTRLEN] = {};
if (inet_ntop(AF_INET, (const void *)&inaddr, str, INET6_ADDRSTRLEN) ==
NULL) {
s.append("Error in_addr");
} else {
s.append(str);
}
return s;
}
//------------------------------------------------------------------------------
std::string conv::toString(const struct in6_addr &in6addr) {
std::string s = {};
char str[INET6_ADDRSTRLEN] = {};
if (inet_ntop(AF_INET6, (const void *)&in6addr, str, INET6_ADDRSTRLEN) ==
nullptr) {
s.append("Error in6_addr");
} else {
s.append(str);
}
return s;
}
/*
* 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 conversions.hpp
\brief
\author Sebastien ROUX, Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_CONVERSIONS_HPP_SEEN
#define FILE_CONVERSIONS_HPP_SEEN
#include <netinet/in.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <string>
/* Used to format an uint32_t containing an ipv4 address */
#define IN_ADDR_FMT "%u.%u.%u.%u"
#define PRI_IN_ADDR(aDDRESS) \
(uint8_t)((aDDRESS.s_addr) & 0x000000ff), \
(uint8_t)(((aDDRESS.s_addr) & 0x0000ff00) >> 8), \
(uint8_t)(((aDDRESS.s_addr) & 0x00ff0000) >> 16), \
(uint8_t)(((aDDRESS.s_addr) & 0xff000000) >> 24)
#define IPV4_ADDR_DISPLAY_8(aDDRESS) \
(aDDRESS)[0], (aDDRESS)[1], (aDDRESS)[2], (aDDRESS)[3]
class conv {
public:
static std::string toString(const struct in_addr &inaddr);
static std::string toString(const struct in6_addr &in6addr);
};
#endif /* FILE_CONVERSIONS_HPP_SEEN */
......@@ -25,6 +25,7 @@
#include <cctype>
#include <functional>
#include <locale>
#include <regex>
#include <stdarg.h>
template <class T> class Buffer {
......@@ -83,3 +84,20 @@ std::string &util::rtrim(std::string &s) {
// trim from both ends
std::string &util::trim(std::string &s) { return util::ltrim(util::rtrim(s)); }
// extract query param from given querystring
std::string query_param_tmp;
//
std::string util::get_query_param(std::string querystring, std::string param) {
std::regex reList("([^=]*)=([^&]*)&?");
query_param_tmp.clear();
std::for_each(
std::sregex_iterator(querystring.begin(), querystring.end(), reList),
std::sregex_iterator(), [param](std::smatch match) {
if (match[1] == param) {
query_param_tmp = match[2].str().c_str();
return;
}
});
return query_param_tmp;
}
\ No newline at end of file
......@@ -40,6 +40,7 @@ std::string &ltrim(std::string &s);
std::string &rtrim(std::string &s);
// trim from both ends
std::string &trim(std::string &s);
// extract query param from given querystring
std::string get_query_param(std::string querystring, std::string param);
} // namespace util
#endif
/*
* 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
*/
#ifndef FILE_UDR_SEEN
#define FILE_UDR_SEEN
#define NUDR_DR_BASE "/nudr-dr/"
#define NUDR_DR_AUTH_STATUS "authentication-status"
#define NUDR_DR_AUTH_SUBS "authentication-subscription"
#define NUDR_DR_AMF_XGPP_ACCESS "amf-3gpp-access"
#define NUDR_DR_AM_DATA "am-data"
#define NUDR_DR_SDM_SUBS "sdm-subscriptions"
#define NUDR_DR_SM_DATA "sm-data"
#define NUDR_DR_SMF_REG "smf-registrations"
#define NUDR_DR_SMF_SELECT "smf-selection-subscription-data"
#endif
......@@ -290,5 +290,5 @@ IF(STATIC_LINKING)
ENDIF(STATIC_LINKING)
target_link_libraries (udr ${ASAN}
-Wl,--start-group UDR 3GPP_COMMON_TYPES UDR_API -lnettle ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES} -lboost_system -lboost_thread -lboost_date_time -lssl -lcrypto -lgmp -lmysqlclient -Wl,--end-group pthread m rt config++ boost_system pistache curl)
-Wl,--start-group UDR 3GPP_COMMON_TYPES UDR_API -lnettle ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES} -lnghttp2_asio -lboost_system -lboost_thread -lboost_date_time -lssl -lcrypto -lgmp -lmysqlclient -Wl,--end-group pthread m rt config++ boost_system pistache curl)
......@@ -22,10 +22,12 @@
#include <iostream>
#include <thread>
#include "conversions.hpp"
#include "logger.hpp"
#include "options.hpp"
#include "pid_file.hpp"
#include "udr-api-server.h"
#include "udr-http2-server.h"
#include "udr_app.hpp"
#include "udr_config.hpp"
......@@ -37,7 +39,7 @@ using namespace oai::udr::config;
udr_config udr_cfg;
udr_app *udr_app_inst = nullptr;
UDRApiServer *api_server = nullptr;
#include "udr_config.hpp"
udr_http2_server *udr_api_server_2 = nullptr;
//------------------------------------------------------------------------------
void my_app_signal_handler(int s) {
......@@ -106,7 +108,15 @@ int main(int argc, char **argv) {
api_server = new UDRApiServer(addr, udr_app_inst);
api_server->init(2);
std::thread udr_manager(&UDRApiServer::start, api_server);
// UDM NGHTTP API server (HTTP2)
udr_api_server_2 =
new udr_http2_server(conv::toString(udr_cfg.nudr.addr4),
udr_cfg.nudr_http2_port, udr_app_inst);
std::thread udr_http2_manager(&udr_http2_server::start, udr_api_server_2);
udr_manager.join();
udr_http2_manager.join();
FILE *fp = NULL;
std::string filename = fmt::format("/tmp/udr_{}.status", getpid());
......
This diff is collapsed.
This diff is collapsed.
......@@ -187,7 +187,7 @@ void udr_config::display() {
Logger::config().info("- Nudr Networking:");
Logger::config().info(" Interface name ......: %s", nudr.if_name.c_str());
Logger::config().info(" IPv4 Addr ...........: %s", inet_ntoa(nudr.addr4));
Logger::config().info(" Port ................: %d", nudr.port);
Logger::config().info(" HTTP1 Port ..........: %d", nudr.port);
Logger::config().info(" HTTP2 port ..........: %d", nudr_http2_port);
Logger::config().info(" API version..........: %s",
nudr.api_version.c_str());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment