mirror of
				https://github.com/open5gs/open5gs.git
				synced 2025-11-04 05:53:18 +00:00 
			
		
		
		
	Use HTTP/2 instead of HTTP/1.1 in 5G Core SBI
This commit is contained in:
		
							
								
								
									
										1
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							@@ -19,6 +19,7 @@ Build-Depends: debhelper (>= 11),
 | 
				
			|||||||
               libyaml-dev,
 | 
					               libyaml-dev,
 | 
				
			||||||
               libmicrohttpd-dev,
 | 
					               libmicrohttpd-dev,
 | 
				
			||||||
               libcurl4-gnutls-dev,
 | 
					               libcurl4-gnutls-dev,
 | 
				
			||||||
 | 
					               libnghttp2-dev,
 | 
				
			||||||
Standards-Version: 4.3.0
 | 
					Standards-Version: 4.3.0
 | 
				
			||||||
Rules-Requires-Root: no
 | 
					Rules-Requires-Root: no
 | 
				
			||||||
Homepage: https://open5gs.org
 | 
					Homepage: https://open5gs.org
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,4 +26,5 @@ RUN yum -y install \
 | 
				
			|||||||
        mongo-c-driver-devel \
 | 
					        mongo-c-driver-devel \
 | 
				
			||||||
        libmicrohttpd-devel \
 | 
					        libmicrohttpd-devel \
 | 
				
			||||||
        libcurl-devel \
 | 
					        libcurl-devel \
 | 
				
			||||||
 | 
					        libnghttp2-devel \
 | 
				
			||||||
        iproute
 | 
					        iproute
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,6 +31,7 @@ RUN dnf -y install \
 | 
				
			|||||||
        mongo-c-driver-devel \
 | 
					        mongo-c-driver-devel \
 | 
				
			||||||
        libmicrohttpd-devel \
 | 
					        libmicrohttpd-devel \
 | 
				
			||||||
        libcurl-devel \
 | 
					        libcurl-devel \
 | 
				
			||||||
 | 
					        libnghttp2-devel \
 | 
				
			||||||
        iproute
 | 
					        iproute
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN dnf -y install meson
 | 
					RUN dnf -y install meson
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,6 +27,7 @@ RUN apt-get update && \
 | 
				
			|||||||
        libyaml-dev \
 | 
					        libyaml-dev \
 | 
				
			||||||
        libmicrohttpd-dev \
 | 
					        libmicrohttpd-dev \
 | 
				
			||||||
        libcurl4-gnutls-dev \
 | 
					        libcurl4-gnutls-dev \
 | 
				
			||||||
 | 
					        libnghttp2-dev \
 | 
				
			||||||
        iproute2 \
 | 
					        iproute2 \
 | 
				
			||||||
        ca-certificates \
 | 
					        ca-certificates \
 | 
				
			||||||
        netbase \
 | 
					        netbase \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,6 +21,7 @@ RUN dnf -y install \
 | 
				
			|||||||
        mongo-c-driver-devel \
 | 
					        mongo-c-driver-devel \
 | 
				
			||||||
        libmicrohttpd-devel \
 | 
					        libmicrohttpd-devel \
 | 
				
			||||||
        libcurl-devel \
 | 
					        libcurl-devel \
 | 
				
			||||||
 | 
					        libnghttp2-devel \
 | 
				
			||||||
        iproute
 | 
					        iproute
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN dnf -y install meson
 | 
					RUN dnf -y install meson
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,6 +27,7 @@ RUN apt-get update && \
 | 
				
			|||||||
        libyaml-dev \
 | 
					        libyaml-dev \
 | 
				
			||||||
        libmicrohttpd-dev \
 | 
					        libmicrohttpd-dev \
 | 
				
			||||||
        libcurl4-gnutls-dev \
 | 
					        libcurl4-gnutls-dev \
 | 
				
			||||||
 | 
					        libnghttp2-dev \
 | 
				
			||||||
        iproute2 \
 | 
					        iproute2 \
 | 
				
			||||||
        ca-certificates \
 | 
					        ca-certificates \
 | 
				
			||||||
        netbase \
 | 
					        netbase \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,7 +44,7 @@ $ sudo ip link set ogstun up
 | 
				
			|||||||
Install the dependencies for building the source code.
 | 
					Install the dependencies for building the source code.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```bash
 | 
					```bash
 | 
				
			||||||
$ sudo apt install python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libidn11-dev libmongoc-dev libbson-dev libyaml-dev libmicrohttpd-dev libcurl4-gnutls-dev meson
 | 
					$ sudo apt install python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libidn11-dev libmongoc-dev libbson-dev libyaml-dev libnghttp2-dev libmicrohttpd-dev libcurl4-gnutls-dev libnghttp2-dev meson
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Git clone.
 | 
					Git clone.
 | 
				
			||||||
@@ -78,7 +78,7 @@ $ cd build
 | 
				
			|||||||
$ meson test -v
 | 
					$ meson test -v
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Tip:** You can also check the result of `ninja -C build test` with a tool that captures packets. If you are running `wireshark`, select the `loopback` interface and set FILTER to `s1ap || gtpv2 || pfcp || diameter || gtp || ngap || http`.  You can see the virtually created packets. [testattach.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testattach.pcapng)/[testregistration.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testregistration.pcapng)
 | 
					**Tip:** You can also check the result of `ninja -C build test` with a tool that captures packets. If you are running `wireshark`, select the `loopback` interface and set FILTER to `s1ap || gtpv2 || pfcp || diameter || gtp || ngap || http2.data.data || http2.headers`.  You can see the virtually created packets. [testattach.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testattach.pcapng)/[testregistration.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testregistration.pcapng)
 | 
				
			||||||
{: .notice--info}
 | 
					{: .notice--info}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You need to perform the **installation process**.
 | 
					You need to perform the **installation process**.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,7 +70,7 @@ $ ip link show
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Install the depedencies for building the source code.
 | 
					Install the depedencies for building the source code.
 | 
				
			||||||
```bash
 | 
					```bash
 | 
				
			||||||
$ sudo dnf install python3 ninja-build gcc flex bison git lksctp-tools-devel libidn-devel gnutls-devel libgcrypt-devel openssl-devel cyrus-sasl-devel libyaml-devel mongo-c-driver-devel libmicrohttpd-devel libcurl-devel iproute
 | 
					$ sudo dnf install python3 ninja-build gcc flex bison git lksctp-tools-devel libidn-devel gnutls-devel libgcrypt-devel openssl-devel cyrus-sasl-devel libyaml-devel mongo-c-driver-devel libmicrohttpd-devel libcurl-devel libnghttp2-devel iproute
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Install Meson
 | 
					Install Meson
 | 
				
			||||||
@@ -104,7 +104,7 @@ $ cd build
 | 
				
			|||||||
$ meson test -v
 | 
					$ meson test -v
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Tip:** You can also check the result of `ninja -C build test` with a tool that captures packets. If you are running `wireshark`, select the `loopback` interface and set FILTER to `s1ap || gtpv2 || pfcp || diameter || gtp || ngap || http`.  You can see the virtually created packets. [testattach.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testattach.pcapng)/[testregistration.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testregistration.pcapng)
 | 
					**Tip:** You can also check the result of `ninja -C build test` with a tool that captures packets. If you are running `wireshark`, select the `loopback` interface and set FILTER to `s1ap || gtpv2 || pfcp || diameter || gtp || ngap || http2.data.data || http2.headers`.  You can see the virtually created packets. [testattach.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testattach.pcapng)/[testregistration.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testregistration.pcapng)
 | 
				
			||||||
{: .notice--info}
 | 
					{: .notice--info}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You need to perform the **installation process**.
 | 
					You need to perform the **installation process**.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -97,7 +97,7 @@ $ cd build
 | 
				
			|||||||
$ sudo meson test -v
 | 
					$ sudo meson test -v
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Tip:** You can also check the result of `ninja -C build test` with a tool that captures packets. If you are running `wireshark`, select the `loopback` interface and set FILTER to `s1ap || gtpv2 || pfcp || diameter || gtp || ngap || http`.  You can see the virtually created packets. [testattach.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testattach.pcapng)/[testregistration.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testregistration.pcapng)
 | 
					**Tip:** You can also check the result of `ninja -C build test` with a tool that captures packets. If you are running `wireshark`, select the `loopback` interface and set FILTER to `s1ap || gtpv2 || pfcp || diameter || gtp || ngap || http2.data.data || http2.headers`.  You can see the virtually created packets. [testattach.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testattach.pcapng)/[testregistration.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testregistration.pcapng)
 | 
				
			||||||
{: .notice--info}
 | 
					{: .notice--info}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You need to perform the **installation process**.
 | 
					You need to perform the **installation process**.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ $ sudo pfctl -e -f /etc/pf.anchors/org.open5gs
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Install the depedencies for building the source code.
 | 
					Install the depedencies for building the source code.
 | 
				
			||||||
```bash
 | 
					```bash
 | 
				
			||||||
$ brew install mongo-c-driver gnutls libgcrypt libidn libyaml libmicrohttpd curl pkg-config
 | 
					$ brew install mongo-c-driver gnutls libgcrypt libidn libyaml libmicrohttpd nghttp2 pkg-config
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Install Bison and Create soft link.
 | 
					Install Bison and Create soft link.
 | 
				
			||||||
@@ -121,7 +121,7 @@ $ cd build
 | 
				
			|||||||
$ sudo meson test -v
 | 
					$ sudo meson test -v
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Tip:** You can also check the result of `ninja -C build test` with a tool that captures packets. If you are running `wireshark`, select the `loopback` interface and set FILTER to `s1ap || gtpv2 || pfcp || diameter || gtp || ngap || http`.  You can see the virtually created packets. [testattach.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testattach.pcapng)/[testregistration.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testregistration.pcapng)
 | 
					**Tip:** You can also check the result of `ninja -C build test` with a tool that captures packets. If you are running `wireshark`, select the `loopback` interface and set FILTER to `s1ap || gtpv2 || pfcp || diameter || gtp || ngap || http2.data.data || http2.headers`.  You can see the virtually created packets. [testattach.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testattach.pcapng)/[testregistration.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testregistration.pcapng)
 | 
				
			||||||
{: .notice--info}
 | 
					{: .notice--info}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You need to perform the **installation process**.
 | 
					You need to perform the **installation process**.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,6 +31,8 @@ extern "C" {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct ogs_app_context_s {
 | 
					typedef struct ogs_app_context_s {
 | 
				
			||||||
 | 
					    const char *version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const char *file;
 | 
					    const char *file;
 | 
				
			||||||
    void *document;
 | 
					    void *document;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,7 +21,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int __ogs_app_domain;
 | 
					int __ogs_app_domain;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ogs_app_initialize(const char *default_config, const char *const argv[])
 | 
					int ogs_app_initialize(
 | 
				
			||||||
 | 
					        const char *version, const char *default_config,
 | 
				
			||||||
 | 
					        const char *const argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int rv, opt;
 | 
					    int rv, opt;
 | 
				
			||||||
    ogs_getopt_t options;
 | 
					    ogs_getopt_t options;
 | 
				
			||||||
@@ -39,6 +41,7 @@ int ogs_app_initialize(const char *default_config, const char *const argv[])
 | 
				
			|||||||
    ogs_app_setup_log();
 | 
					    ogs_app_setup_log();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_app_context_init();
 | 
					    ogs_app_context_init();
 | 
				
			||||||
 | 
					    ogs_app()->version = version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**************************************************************************
 | 
					    /**************************************************************************
 | 
				
			||||||
     * Stage 1 : Command Line Options
 | 
					     * Stage 1 : Command Line Options
 | 
				
			||||||
@@ -117,7 +120,27 @@ int ogs_app_initialize(const char *default_config, const char *const argv[])
 | 
				
			|||||||
        ogs_app()->db_uri = ogs_env_get("DB_URI");
 | 
					        ogs_app()->db_uri = ogs_env_get("DB_URI");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**************************************************************************
 | 
					    /**************************************************************************
 | 
				
			||||||
     * Stage 6 : Queue, Timer and Poll
 | 
					     * Stage 6 : Print Banner
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    if (ogs_app()->version) {
 | 
				
			||||||
 | 
					        ogs_log_print(OGS_LOG_INFO,
 | 
				
			||||||
 | 
					                "Open5GS daemon %s\n\n", ogs_app()->version);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ogs_info("Configuration: '%s'", ogs_app()->file);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (ogs_app()->logger.file) {
 | 
				
			||||||
 | 
					            ogs_info("File Logging: '%s'", ogs_app()->logger.file);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (ogs_app()->logger.level)
 | 
				
			||||||
 | 
					                ogs_info("LOG-LEVEL: '%s'", ogs_app()->logger.level);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (ogs_app()->logger.domain)
 | 
				
			||||||
 | 
					                ogs_info("LOG-DOMAIN: '%s'", ogs_app()->logger.domain);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**************************************************************************
 | 
				
			||||||
 | 
					     * Stage 7 : Queue, Timer and Poll
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    ogs_app()->queue = ogs_queue_create(ogs_app()->pool.event);
 | 
					    ogs_app()->queue = ogs_queue_create(ogs_app()->pool.event);
 | 
				
			||||||
    ogs_assert(ogs_app()->queue);
 | 
					    ogs_assert(ogs_app()->queue);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,7 +28,9 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif /* __cplusplus */
 | 
					#endif /* __cplusplus */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ogs_app_initialize(const char *default_config, const char *const argv[]);
 | 
					int ogs_app_initialize(
 | 
				
			||||||
 | 
					        const char *version, const char *default_config,
 | 
				
			||||||
 | 
					        const char *const argv[]);
 | 
				
			||||||
void ogs_app_terminate(void);
 | 
					void ogs_app_terminate(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ogs_app_config_read(void);
 | 
					int ogs_app_config_read(void);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,6 +36,7 @@ typedef DWORD ogs_err_t;
 | 
				
			|||||||
#define OGS_EACCES                  ERROR_ACCESS_DENIED
 | 
					#define OGS_EACCES                  ERROR_ACCESS_DENIED
 | 
				
			||||||
#define OGS_EEXIST                  ERROR_ALREADY_EXISTS
 | 
					#define OGS_EEXIST                  ERROR_ALREADY_EXISTS
 | 
				
			||||||
#define OGS_EEXIST_FILE             ERROR_FILE_EXISTS
 | 
					#define OGS_EEXIST_FILE             ERROR_FILE_EXISTS
 | 
				
			||||||
 | 
					#define OGS_ECONNRESET              WSAECONNRESET
 | 
				
			||||||
#define OGS_ETIMEDOUT               WSAETIMEDOUT
 | 
					#define OGS_ETIMEDOUT               WSAETIMEDOUT
 | 
				
			||||||
#define OGS_ECONNREFUSED            WSAECONNREFUSED
 | 
					#define OGS_ECONNREFUSED            WSAECONNREFUSED
 | 
				
			||||||
#define OGS_EBADF                   WSAEBADF
 | 
					#define OGS_EBADF                   WSAEBADF
 | 
				
			||||||
@@ -54,6 +55,7 @@ typedef int ogs_err_t;
 | 
				
			|||||||
#define OGS_EACCES                  EACCES
 | 
					#define OGS_EACCES                  EACCES
 | 
				
			||||||
#define OGS_EEXIST                  EEXIST
 | 
					#define OGS_EEXIST                  EEXIST
 | 
				
			||||||
#define OGS_EEXIST_FILE             EEXIST
 | 
					#define OGS_EEXIST_FILE             EEXIST
 | 
				
			||||||
 | 
					#define OGS_ECONNRESET              ECONNRESET
 | 
				
			||||||
#define OGS_ETIMEDOUT               ETIMEDOUT
 | 
					#define OGS_ETIMEDOUT               ETIMEDOUT
 | 
				
			||||||
#define OGS_ECONNREFUSED            ECONNREFUSED
 | 
					#define OGS_ECONNREFUSED            ECONNREFUSED
 | 
				
			||||||
#define OGS_EBADF                   EBADF
 | 
					#define OGS_EBADF                   EBADF
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -219,7 +219,70 @@ static int kqueue_process(ogs_pollset_t *pollset, ogs_time_t timeout)
 | 
				
			|||||||
        short when = 0;
 | 
					        short when = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (context->event_list[i].flags & EV_ERROR) {
 | 
					        if (context->event_list[i].flags & EV_ERROR) {
 | 
				
			||||||
            ogs_warn("kevent() error = 0x%x", context->event_list[i].flags);
 | 
								switch (context->event_list[i].data) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								/* Can occur on delete if we are not currently
 | 
				
			||||||
 | 
								 * watching any events on this fd.  That can
 | 
				
			||||||
 | 
								 * happen when the fd was closed and another
 | 
				
			||||||
 | 
								 * file was opened with that fd. */
 | 
				
			||||||
 | 
								case ENOENT:
 | 
				
			||||||
 | 
								/* Can occur for reasons not fully understood
 | 
				
			||||||
 | 
								 * on FreeBSD. */
 | 
				
			||||||
 | 
								case EINVAL:
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
					#if defined(__FreeBSD__)
 | 
				
			||||||
 | 
								/*
 | 
				
			||||||
 | 
								 * This currently occurs if an FD is closed
 | 
				
			||||||
 | 
								 * before the EV_DELETE makes it out via kevent().
 | 
				
			||||||
 | 
								 * The FreeBSD capabilities code sees the blank
 | 
				
			||||||
 | 
								 * capability set and rejects the request to
 | 
				
			||||||
 | 
								 * modify an event.
 | 
				
			||||||
 | 
								 *
 | 
				
			||||||
 | 
								 * To be strictly correct - when an FD is closed,
 | 
				
			||||||
 | 
								 * all the registered events are also removed.
 | 
				
			||||||
 | 
								 * Queuing EV_DELETE to a closed FD is wrong.
 | 
				
			||||||
 | 
								 * The event(s) should just be deleted from
 | 
				
			||||||
 | 
								 * the pending changelist.
 | 
				
			||||||
 | 
								 */
 | 
				
			||||||
 | 
								case ENOTCAPABLE:
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								/* Can occur on a delete if the fd is closed. */
 | 
				
			||||||
 | 
								case EBADF:
 | 
				
			||||||
 | 
									/* XXXX On NetBSD, we can also get EBADF if we
 | 
				
			||||||
 | 
									 * try to add the write side of a pipe, but
 | 
				
			||||||
 | 
									 * the read side has already been closed.
 | 
				
			||||||
 | 
									 * Other BSDs call this situation 'EPIPE'. It
 | 
				
			||||||
 | 
									 * would be good if we had a way to report
 | 
				
			||||||
 | 
									 * this situation. */
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								/* These two can occur on an add if the fd was one side
 | 
				
			||||||
 | 
								 * of a pipe, and the other side was closed. */
 | 
				
			||||||
 | 
								case EPERM:
 | 
				
			||||||
 | 
								case EPIPE:
 | 
				
			||||||
 | 
									/* Report read events, if we're listening for
 | 
				
			||||||
 | 
									 * them, so that the user can learn about any
 | 
				
			||||||
 | 
									 * add errors.  (If the operation was a
 | 
				
			||||||
 | 
									 * delete, then udata should be cleared.) */
 | 
				
			||||||
 | 
									if (context->event_list[i].udata) {
 | 
				
			||||||
 | 
										/* The operation was an add:
 | 
				
			||||||
 | 
										 * report the error as a read. */
 | 
				
			||||||
 | 
										when |= OGS_POLLIN;
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									} else {
 | 
				
			||||||
 | 
										/* The operation was a del:
 | 
				
			||||||
 | 
										 * report nothing. */
 | 
				
			||||||
 | 
										continue;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								/* Other errors shouldn't occur. */
 | 
				
			||||||
 | 
								default:
 | 
				
			||||||
 | 
					                ogs_error("kevent() error : flags = 0x%x, errno = %d",
 | 
				
			||||||
 | 
					                        context->event_list[i].flags,
 | 
				
			||||||
 | 
					                        (int)context->event_list[i].data);
 | 
				
			||||||
 | 
									return OGS_ERROR;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
        } else if (context->event_list[i].filter == EVFILT_READ) {
 | 
					        } else if (context->event_list[i].filter == EVFILT_READ) {
 | 
				
			||||||
            when |= OGS_POLLIN;
 | 
					            when |= OGS_POLLIN;
 | 
				
			||||||
        } else if (context->event_list[i].filter == EVFILT_WRITE) {
 | 
					        } else if (context->event_list[i].filter == EVFILT_WRITE) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,9 +43,9 @@ ogs_pollset_t *ogs_pollset_create(unsigned int capacity)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (ogs_pollset_actions_initialized == false) {
 | 
					    if (ogs_pollset_actions_initialized == false) {
 | 
				
			||||||
#if defined(HAVE_KQUEUE)
 | 
					#if defined(HAVE_KQUEUE)
 | 
				
			||||||
        ogs_pollset_actions = ogs_kqueue_actions;;
 | 
					        ogs_pollset_actions = ogs_kqueue_actions;
 | 
				
			||||||
#elif defined(HAVE_EPOLL)
 | 
					#elif defined(HAVE_EPOLL)
 | 
				
			||||||
        ogs_pollset_actions = ogs_epoll_actions;;
 | 
					        ogs_pollset_actions = ogs_epoll_actions;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
        ogs_pollset_actions = ogs_select_actions;
 | 
					        ogs_pollset_actions = ogs_select_actions;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -173,7 +173,6 @@ ogs_sock_t *ogs_sock_accept(ogs_sock_t *sock)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    new_fd = accept(sock->fd, &addr.sa, &addrlen);
 | 
					    new_fd = accept(sock->fd, &addr.sa, &addrlen);
 | 
				
			||||||
    if (new_fd < 0) {
 | 
					    if (new_fd < 0) {
 | 
				
			||||||
        ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, "accept failed");
 | 
					 | 
				
			||||||
        return NULL;
 | 
					        return NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -185,7 +184,7 @@ ogs_sock_t *ogs_sock_accept(ogs_sock_t *sock)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    memcpy(&new_sock->remote_addr, &addr, sizeof(new_sock->remote_addr));
 | 
					    memcpy(&new_sock->remote_addr, &addr, sizeof(new_sock->remote_addr));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return new_sock;;
 | 
					    return new_sock;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t ogs_write(ogs_socket_t fd, const void *buf, size_t len)
 | 
					ssize_t ogs_write(ogs_socket_t fd, const void *buf, size_t len)
 | 
				
			||||||
@@ -241,36 +240,20 @@ ssize_t ogs_sendto(ogs_socket_t fd,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ssize_t ogs_recv(ogs_socket_t fd, void *buf, size_t len, int flags)
 | 
					ssize_t ogs_recv(ogs_socket_t fd, void *buf, size_t len, int flags)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ssize_t size;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_assert(fd != INVALID_SOCKET);
 | 
					    ogs_assert(fd != INVALID_SOCKET);
 | 
				
			||||||
 | 
					    return recv(fd, buf, len, flags);
 | 
				
			||||||
    size = recv(fd, buf, len, flags);
 | 
					 | 
				
			||||||
    if (size < 0) {
 | 
					 | 
				
			||||||
        ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno,
 | 
					 | 
				
			||||||
                "recv(len:%d) failed", (int)len);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return size;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t ogs_recvfrom(ogs_socket_t fd,
 | 
					ssize_t ogs_recvfrom(ogs_socket_t fd,
 | 
				
			||||||
        void *buf, size_t len, int flags, ogs_sockaddr_t *from)
 | 
					        void *buf, size_t len, int flags, ogs_sockaddr_t *from)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ssize_t size;
 | 
					 | 
				
			||||||
    socklen_t addrlen = sizeof(struct sockaddr_storage);
 | 
					    socklen_t addrlen = sizeof(struct sockaddr_storage);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(fd != INVALID_SOCKET);
 | 
					    ogs_assert(fd != INVALID_SOCKET);
 | 
				
			||||||
    ogs_assert(from);
 | 
					    ogs_assert(from);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(from, 0, sizeof *from);
 | 
					    memset(from, 0, sizeof *from);
 | 
				
			||||||
    size = recvfrom(fd, buf, len, flags, &from->sa, &addrlen);
 | 
					    return recvfrom(fd, buf, len, flags, &from->sa, &addrlen);
 | 
				
			||||||
    if (size < 0) {
 | 
					 | 
				
			||||||
        ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno,
 | 
					 | 
				
			||||||
                "recvfrom(len:%d) failed", (int)len);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return size;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ogs_closesocket(ogs_socket_t fd)
 | 
					int ogs_closesocket(ogs_socket_t fd)
 | 
				
			||||||
@@ -330,15 +313,15 @@ int ogs_closeonexec(ogs_socket_t fd)
 | 
				
			|||||||
    int flags;
 | 
					    int flags;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(fd != INVALID_SOCKET);
 | 
					    ogs_assert(fd != INVALID_SOCKET);
 | 
				
			||||||
    flags = fcntl(fd, F_GETFL, NULL);
 | 
					    flags = fcntl(fd, F_GETFD, NULL);
 | 
				
			||||||
    if (flags < 0) {
 | 
					    if (flags < 0) {
 | 
				
			||||||
        ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, "F_GETFL failed");
 | 
					        ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, "F_GETFD failed");
 | 
				
			||||||
        return OGS_ERROR;
 | 
					        return OGS_ERROR;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (!(flags & FD_CLOEXEC)) {
 | 
					    if (!(flags & FD_CLOEXEC)) {
 | 
				
			||||||
        rc = fcntl(fd, F_SETFL, (flags | FD_CLOEXEC));
 | 
					        rc = fcntl(fd, F_SETFD, (flags | FD_CLOEXEC));
 | 
				
			||||||
        if (rc != OGS_OK) {
 | 
					        if (rc != OGS_OK) {
 | 
				
			||||||
            ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, "F_SETFL failed");
 | 
					            ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, "F_SETFD failed");
 | 
				
			||||||
            return OGS_ERROR;
 | 
					            return OGS_ERROR;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,7 +64,7 @@ typedef struct ogs_pfcp_xact_s {
 | 
				
			|||||||
    void            *assoc_xact;    /**< Associated GTP transaction */
 | 
					    void            *assoc_xact;    /**< Associated GTP transaction */
 | 
				
			||||||
    ogs_pkbuf_t     *gtpbuf;        /**< GTP packet buffer */
 | 
					    ogs_pkbuf_t     *gtpbuf;        /**< GTP packet buffer */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void            *assoc_session; /**< Associated SBI session */
 | 
					    void            *assoc_stream;  /**< Associated SBI session */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool            epc;            /**< EPC or 5GC */
 | 
					    bool            epc;            /**< EPC or 5GC */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -100,7 +100,7 @@ ogs_sbi_client_t *ogs_sbi_client_add(ogs_sockaddr_t *addr)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ogs_trace("ogs_sbi_client_add()");
 | 
					    ogs_trace("ogs_sbi_client_add()");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_copyaddrinfo(&client->addr, addr);
 | 
					    ogs_copyaddrinfo(&client->node.addr, addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_list_init(&client->connection_list);
 | 
					    ogs_list_init(&client->connection_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -143,8 +143,8 @@ void ogs_sbi_client_remove(ogs_sbi_client_t *client)
 | 
				
			|||||||
    ogs_assert(client->multi);
 | 
					    ogs_assert(client->multi);
 | 
				
			||||||
    curl_multi_cleanup(client->multi);
 | 
					    curl_multi_cleanup(client->multi);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(client->addr);
 | 
					    ogs_assert(client->node.addr);
 | 
				
			||||||
    ogs_freeaddrinfo(client->addr);
 | 
					    ogs_freeaddrinfo(client->node.addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_pool_free(&client_pool, client);
 | 
					    ogs_pool_free(&client_pool, client);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -156,8 +156,8 @@ ogs_sbi_client_t *ogs_sbi_client_find(ogs_sockaddr_t *addr)
 | 
				
			|||||||
    ogs_assert(addr);
 | 
					    ogs_assert(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_list_for_each(&ogs_sbi_self()->client_list, client) {
 | 
					    ogs_list_for_each(&ogs_sbi_self()->client_list, client) {
 | 
				
			||||||
        if (ogs_sockaddr_is_equal(client->addr, addr) == true &&
 | 
					        if (ogs_sockaddr_is_equal(client->node.addr, addr) == true &&
 | 
				
			||||||
            OGS_PORT(client->addr) == OGS_PORT(addr))
 | 
					            OGS_PORT(client->node.addr) == OGS_PORT(addr))
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -310,6 +310,11 @@ static connection_t *connection_add(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    curl_easy_setopt(conn->easy, CURLOPT_HTTPHEADER, conn->header_list);
 | 
					    curl_easy_setopt(conn->easy, CURLOPT_HTTPHEADER, conn->header_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if 1 /* Use HTTP2 */
 | 
				
			||||||
 | 
					    curl_easy_setopt(conn->easy,
 | 
				
			||||||
 | 
					            CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (ogs_hash_count(request->http.params)) {
 | 
					    if (ogs_hash_count(request->http.params)) {
 | 
				
			||||||
        request->h.uri = add_params_to_uri(conn->easy,
 | 
					        request->h.uri = add_params_to_uri(conn->easy,
 | 
				
			||||||
                            request->h.uri, request->http.params);
 | 
					                            request->h.uri, request->http.params);
 | 
				
			||||||
@@ -509,7 +514,7 @@ static size_t header_cb(void *ptr, size_t size, size_t nmemb, void *data)
 | 
				
			|||||||
    conn = data;
 | 
					    conn = data;
 | 
				
			||||||
    ogs_assert(conn);
 | 
					    ogs_assert(conn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (strncmp(ptr, OGS_SBI_LOCATION, strlen(OGS_SBI_LOCATION)) == 0) {
 | 
					    if (ogs_strncasecmp(ptr, OGS_SBI_LOCATION, strlen(OGS_SBI_LOCATION)) == 0) {
 | 
				
			||||||
        /* ptr : "Location: http://xxx/xxx/xxx\r\n"
 | 
					        /* ptr : "Location: http://xxx/xxx/xxx\r\n"
 | 
				
			||||||
           We need to truncate "Location" + ": " + "\r\n" in 'ptr' string */
 | 
					           We need to truncate "Location" + ": " + "\r\n" in 'ptr' string */
 | 
				
			||||||
        int len = strlen(ptr) - strlen(OGS_SBI_LOCATION) - 2 - 2;
 | 
					        int len = strlen(ptr) - strlen(OGS_SBI_LOCATION) - 2 - 2;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,9 +41,7 @@ extern "C" {
 | 
				
			|||||||
typedef int (*ogs_sbi_client_cb_f)(ogs_sbi_response_t *response, void *data);
 | 
					typedef int (*ogs_sbi_client_cb_f)(ogs_sbi_response_t *response, void *data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct ogs_sbi_client_s {
 | 
					typedef struct ogs_sbi_client_s {
 | 
				
			||||||
    ogs_lnode_t     lnode;
 | 
					    ogs_socknode_t  node;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_sockaddr_t  *addr;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct {
 | 
					    struct {
 | 
				
			||||||
        const char  *key;
 | 
					        const char  *key;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -684,18 +684,18 @@ void ogs_sbi_nf_instance_build_default(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    hostname = NULL;
 | 
					    hostname = NULL;
 | 
				
			||||||
    ogs_list_for_each(&ogs_sbi_self()->server_list, server) {
 | 
					    ogs_list_for_each(&ogs_sbi_self()->server_list, server) {
 | 
				
			||||||
        ogs_assert(server->addr);
 | 
					        ogs_assert(server->node.addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* First FQDN is selected */
 | 
					        /* First FQDN is selected */
 | 
				
			||||||
        if (!hostname) {
 | 
					        if (!hostname) {
 | 
				
			||||||
            hostname = ogs_gethostname(server->addr);
 | 
					            hostname = ogs_gethostname(server->node.addr);
 | 
				
			||||||
            if (hostname)
 | 
					            if (hostname)
 | 
				
			||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (nf_instance->num_of_ipv4 < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) {
 | 
					        if (nf_instance->num_of_ipv4 < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) {
 | 
				
			||||||
            ogs_sockaddr_t *addr = NULL;
 | 
					            ogs_sockaddr_t *addr = NULL;
 | 
				
			||||||
            ogs_copyaddrinfo(&addr, server->addr);
 | 
					            ogs_copyaddrinfo(&addr, server->node.addr);
 | 
				
			||||||
            ogs_assert(addr);
 | 
					            ogs_assert(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (addr->ogs_sa_family == AF_INET) {
 | 
					            if (addr->ogs_sa_family == AF_INET) {
 | 
				
			||||||
@@ -740,11 +740,11 @@ ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    hostname = NULL;
 | 
					    hostname = NULL;
 | 
				
			||||||
    ogs_list_for_each(&ogs_sbi_self()->server_list, server) {
 | 
					    ogs_list_for_each(&ogs_sbi_self()->server_list, server) {
 | 
				
			||||||
        ogs_assert(server->addr);
 | 
					        ogs_assert(server->node.addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* First FQDN is selected */
 | 
					        /* First FQDN is selected */
 | 
				
			||||||
        if (!hostname) {
 | 
					        if (!hostname) {
 | 
				
			||||||
            hostname = ogs_gethostname(server->addr);
 | 
					            hostname = ogs_gethostname(server->node.addr);
 | 
				
			||||||
            if (hostname)
 | 
					            if (hostname)
 | 
				
			||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -752,7 +752,7 @@ ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
 | 
				
			|||||||
        if (nf_service->num_of_addr < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) {
 | 
					        if (nf_service->num_of_addr < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) {
 | 
				
			||||||
            int port = 0;
 | 
					            int port = 0;
 | 
				
			||||||
            ogs_sockaddr_t *addr = NULL;
 | 
					            ogs_sockaddr_t *addr = NULL;
 | 
				
			||||||
            ogs_copyaddrinfo(&addr, server->addr);
 | 
					            ogs_copyaddrinfo(&addr, server->node.addr);
 | 
				
			||||||
            ogs_assert(addr);
 | 
					            ogs_assert(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            port = OGS_PORT(addr);
 | 
					            port = OGS_PORT(addr);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -122,7 +122,7 @@ typedef struct ogs_sbi_xact_s {
 | 
				
			|||||||
    ogs_sbi_request_t *request;
 | 
					    ogs_sbi_request_t *request;
 | 
				
			||||||
    ogs_timer_t *t_response;
 | 
					    ogs_timer_t *t_response;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_session_t *assoc_session;
 | 
					    ogs_sbi_stream_t *assoc_stream;
 | 
				
			||||||
    uint8_t state;
 | 
					    uint8_t state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_object_t *sbi_object;
 | 
					    ogs_sbi_object_t *sbi_object;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,7 +75,7 @@ char *ogs_sbi_server_uri(ogs_sbi_server_t *server, ogs_sbi_header_t *h)
 | 
				
			|||||||
    if (server->tls.key && server->tls.pem)
 | 
					    if (server->tls.key && server->tls.pem)
 | 
				
			||||||
        https = true;
 | 
					        https = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return ogs_uridup(https, server->addr, h);
 | 
					    return ogs_uridup(https, server->node.addr, h);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
char *ogs_sbi_client_uri(ogs_sbi_client_t *client, ogs_sbi_header_t *h)
 | 
					char *ogs_sbi_client_uri(ogs_sbi_client_t *client, ogs_sbi_header_t *h)
 | 
				
			||||||
@@ -88,7 +88,7 @@ char *ogs_sbi_client_uri(ogs_sbi_client_t *client, ogs_sbi_header_t *h)
 | 
				
			|||||||
    if (client->tls.key && client->tls.pem)
 | 
					    if (client->tls.key && client->tls.pem)
 | 
				
			||||||
        https = true;
 | 
					        https = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return ogs_uridup(https, client->addr, h);
 | 
					    return ogs_uridup(https, client->node.addr, h);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,10 @@ libsbi_sources = files('''
 | 
				
			|||||||
    conv.c
 | 
					    conv.c
 | 
				
			||||||
    message.c
 | 
					    message.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mhd-server.c
 | 
				
			||||||
 | 
					    nghttp2-server.c
 | 
				
			||||||
    server.c
 | 
					    server.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    client.c
 | 
					    client.c
 | 
				
			||||||
    context.c
 | 
					    context.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -40,8 +43,9 @@ libsbi_inc = include_directories('.')
 | 
				
			|||||||
sbi_cc_flags = ['-DOGS_SBI_COMPILATION']
 | 
					sbi_cc_flags = ['-DOGS_SBI_COMPILATION']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
libgnutls_dep = cc.find_library('gnutls', required : true)
 | 
					libgnutls_dep = cc.find_library('gnutls', required : true)
 | 
				
			||||||
 | 
					libnghttp2_dep = dependency('libnghttp2', version: '>=1.18.1')
 | 
				
			||||||
libmicrohttpd_dep = dependency('libmicrohttpd', version: '>=0.9.40')
 | 
					libmicrohttpd_dep = dependency('libmicrohttpd', version: '>=0.9.40')
 | 
				
			||||||
libcurl_dep = dependency('libcurl')
 | 
					libcurl_dep = dependency('libcurl', version: '>=7.52.1')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
libsbi = library('ogssbi',
 | 
					libsbi = library('ogssbi',
 | 
				
			||||||
    sources : libsbi_sources,
 | 
					    sources : libsbi_sources,
 | 
				
			||||||
@@ -53,6 +57,7 @@ libsbi = library('ogssbi',
 | 
				
			|||||||
                    libapp_dep,
 | 
					                    libapp_dep,
 | 
				
			||||||
                    libsbi_openapi_dep,
 | 
					                    libsbi_openapi_dep,
 | 
				
			||||||
                    libgnutls_dep,
 | 
					                    libgnutls_dep,
 | 
				
			||||||
 | 
					                    libnghttp2_dep,
 | 
				
			||||||
                    libmicrohttpd_dep,
 | 
					                    libmicrohttpd_dep,
 | 
				
			||||||
                    libcurl_dep],
 | 
					                    libcurl_dep],
 | 
				
			||||||
    install_rpath : libdir,
 | 
					    install_rpath : libdir,
 | 
				
			||||||
@@ -66,5 +71,6 @@ libsbi_dep = declare_dependency(
 | 
				
			|||||||
                    libapp_dep,
 | 
					                    libapp_dep,
 | 
				
			||||||
                    libsbi_openapi_dep,
 | 
					                    libsbi_openapi_dep,
 | 
				
			||||||
                    libgnutls_dep,
 | 
					                    libgnutls_dep,
 | 
				
			||||||
 | 
					                    libnghttp2_dep,
 | 
				
			||||||
                    libmicrohttpd_dep,
 | 
					                    libmicrohttpd_dep,
 | 
				
			||||||
                    libcurl_dep])
 | 
					                    libcurl_dep])
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -428,11 +428,12 @@ int ogs_sbi_parse_request(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    for (hi = ogs_hash_first(request->http.headers);
 | 
					    for (hi = ogs_hash_first(request->http.headers);
 | 
				
			||||||
            hi; hi = ogs_hash_next(hi)) {
 | 
					            hi; hi = ogs_hash_next(hi)) {
 | 
				
			||||||
        if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_ACCEPT_ENCODING)) {
 | 
					        if (!ogs_strcasecmp(ogs_hash_this_key(hi), OGS_SBI_ACCEPT_ENCODING)) {
 | 
				
			||||||
            message->http.content_encoding = ogs_hash_this_val(hi);
 | 
					            message->http.content_encoding = ogs_hash_this_val(hi);
 | 
				
			||||||
        } else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE)) {
 | 
					        } else if (!ogs_strcasecmp(
 | 
				
			||||||
 | 
					                    ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE)) {
 | 
				
			||||||
            message->http.content_type = ogs_hash_this_val(hi);
 | 
					            message->http.content_type = ogs_hash_this_val(hi);
 | 
				
			||||||
        } else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_ACCEPT)) {
 | 
					        } else if (!ogs_strcasecmp(ogs_hash_this_key(hi), OGS_SBI_ACCEPT)) {
 | 
				
			||||||
            message->http.accept = ogs_hash_this_val(hi);
 | 
					            message->http.accept = ogs_hash_this_val(hi);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -462,9 +463,9 @@ int ogs_sbi_parse_response(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    for (hi = ogs_hash_first(response->http.headers);
 | 
					    for (hi = ogs_hash_first(response->http.headers);
 | 
				
			||||||
            hi; hi = ogs_hash_next(hi)) {
 | 
					            hi; hi = ogs_hash_next(hi)) {
 | 
				
			||||||
        if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE)) {
 | 
					        if (!ogs_strcasecmp(ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE)) {
 | 
				
			||||||
            message->http.content_type = ogs_hash_this_val(hi);
 | 
					            message->http.content_type = ogs_hash_this_val(hi);
 | 
				
			||||||
        } else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_LOCATION)) {
 | 
					        } else if (!ogs_strcasecmp(ogs_hash_this_key(hi), OGS_SBI_LOCATION)) {
 | 
				
			||||||
            message->http.location = ogs_hash_this_val(hi);
 | 
					            message->http.location = ogs_hash_this_val(hi);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -741,6 +742,11 @@ static int parse_json(ogs_sbi_message_t *message,
 | 
				
			|||||||
    if (!json)
 | 
					    if (!json)
 | 
				
			||||||
        return OGS_OK;
 | 
					        return OGS_OK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!content_type) {
 | 
				
			||||||
 | 
					        ogs_error("No Content-type");
 | 
				
			||||||
 | 
					        return OGS_ERROR;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_log_print(OGS_LOG_TRACE, "%s", json);
 | 
					    ogs_log_print(OGS_LOG_TRACE, "%s", json);
 | 
				
			||||||
    item = cJSON_Parse(json);
 | 
					    item = cJSON_Parse(json);
 | 
				
			||||||
    if (!item) {
 | 
					    if (!item) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -139,6 +139,7 @@ extern "C" {
 | 
				
			|||||||
#define OGS_SBI_ACCEPT_ENCODING                     "Accept-Encoding"
 | 
					#define OGS_SBI_ACCEPT_ENCODING                     "Accept-Encoding"
 | 
				
			||||||
#define OGS_SBI_CONTENT_TYPE                        "Content-Type"
 | 
					#define OGS_SBI_CONTENT_TYPE                        "Content-Type"
 | 
				
			||||||
#define OGS_SBI_LOCATION                            "Location"
 | 
					#define OGS_SBI_LOCATION                            "Location"
 | 
				
			||||||
 | 
					#define OGS_SBI_EXPECT                              "Expect"
 | 
				
			||||||
#define OGS_SBI_APPLICATION_TYPE                    "application"
 | 
					#define OGS_SBI_APPLICATION_TYPE                    "application"
 | 
				
			||||||
#define OGS_SBI_APPLICATION_JSON_TYPE               "json"
 | 
					#define OGS_SBI_APPLICATION_JSON_TYPE               "json"
 | 
				
			||||||
#define OGS_SBI_APPLICATION_PROBLEM_TYPE            "problem+json"
 | 
					#define OGS_SBI_APPLICATION_PROBLEM_TYPE            "problem+json"
 | 
				
			||||||
@@ -273,12 +274,16 @@ typedef struct ogs_sbi_http_message_s {
 | 
				
			|||||||
} ogs_sbi_http_message_t;
 | 
					} ogs_sbi_http_message_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct ogs_sbi_request_s {
 | 
					typedef struct ogs_sbi_request_s {
 | 
				
			||||||
 | 
					    ogs_lnode_t lnode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_header_t h;
 | 
					    ogs_sbi_header_t h;
 | 
				
			||||||
    ogs_sbi_http_message_t http;
 | 
					    ogs_sbi_http_message_t http;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Used in microhttpd */
 | 
					    /* Used in microhttpd */
 | 
				
			||||||
    bool suspended;
 | 
					    bool suspended;
 | 
				
			||||||
    ogs_poll_t *poll;
 | 
					    struct {
 | 
				
			||||||
 | 
					        ogs_poll_t *write;
 | 
				
			||||||
 | 
					    } poll;
 | 
				
			||||||
} ogs_sbi_request_t;
 | 
					} ogs_sbi_request_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct ogs_sbi_response_s {
 | 
					typedef struct ogs_sbi_response_s {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										554
									
								
								lib/sbi/mhd-server.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										554
									
								
								lib/sbi/mhd-server.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,554 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Copyright (C) 2019 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 "ogs-app.h"
 | 
				
			||||||
 | 
					#include "ogs-sbi.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "microhttpd.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if MHD_VERSION >= 0x00097001
 | 
				
			||||||
 | 
					typedef enum MHD_Result _MHD_Result;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					typedef int _MHD_Result;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void server_init(int num_of_session_pool);
 | 
				
			||||||
 | 
					static void server_final(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void server_start(ogs_sbi_server_t *server,
 | 
				
			||||||
 | 
					        int (*cb)(ogs_sbi_request_t *request, void *data));
 | 
				
			||||||
 | 
					static void server_stop(ogs_sbi_server_t *server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void server_send_response(
 | 
				
			||||||
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_response_t *response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static ogs_sbi_server_t *server_from_stream(ogs_sbi_stream_t *stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const ogs_sbi_server_actions_t ogs_mhd_server_actions = {
 | 
				
			||||||
 | 
					    server_init,
 | 
				
			||||||
 | 
					    server_final,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    server_start,
 | 
				
			||||||
 | 
					    server_stop,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    server_send_response,
 | 
				
			||||||
 | 
					    server_from_stream,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void run(short when, ogs_socket_t fd, void *data);
 | 
				
			||||||
 | 
					static void notify_connection(void *cls,
 | 
				
			||||||
 | 
					        struct MHD_Connection *connection,
 | 
				
			||||||
 | 
					        void **socket_context,
 | 
				
			||||||
 | 
					        enum MHD_ConnectionNotificationCode toe);
 | 
				
			||||||
 | 
					static _MHD_Result access_handler(
 | 
				
			||||||
 | 
					        void *cls,
 | 
				
			||||||
 | 
					        struct MHD_Connection *connection,
 | 
				
			||||||
 | 
					        const char *url,
 | 
				
			||||||
 | 
					        const char *method,
 | 
				
			||||||
 | 
					        const char *version,
 | 
				
			||||||
 | 
					        const char *upload_data,
 | 
				
			||||||
 | 
					        size_t *upload_data_size,
 | 
				
			||||||
 | 
					        void **con_cls);
 | 
				
			||||||
 | 
					static void notify_completed(
 | 
				
			||||||
 | 
					        void *cls,
 | 
				
			||||||
 | 
					        struct MHD_Connection *connection,
 | 
				
			||||||
 | 
					        void **con_cls,
 | 
				
			||||||
 | 
					        enum MHD_RequestTerminationCode toe);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void session_timer_expired(void *data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct ogs_sbi_session_s {
 | 
				
			||||||
 | 
					    ogs_lnode_t             lnode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    struct MHD_Connection   *connection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_sbi_request_t       *request;
 | 
				
			||||||
 | 
					    ogs_sbi_server_t        *server;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /*
 | 
				
			||||||
 | 
					     * If the HTTP client closes the socket without sending an HTTP response,
 | 
				
			||||||
 | 
					     * there is no way to detect the socket disconnection after MHD_run().
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * In this case, the poll instance cannot be removed, so the CPU load
 | 
				
			||||||
 | 
					     * of the program using MHD is 100%. POLLIN (POLLRDHUP) is still created,
 | 
				
			||||||
 | 
					     * poll's callback function is still called.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * To solve this problem, we've created the timer to check
 | 
				
			||||||
 | 
					     * whether the user does not use the HTTP response. When the timer expires,
 | 
				
			||||||
 | 
					     * an assertion occurs and terminates the program.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * To avoid the above timer expiration, the user of HTTP server(MHD)
 | 
				
			||||||
 | 
					     * should send an HTTP response if an HTTP client(CURL) is requested.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    ogs_timer_t             *timer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void *data;
 | 
				
			||||||
 | 
					} ogs_sbi_session_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static OGS_POOL(session_pool, ogs_sbi_session_t);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void server_init(int num_of_session_pool)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ogs_pool_init(&session_pool, num_of_session_pool);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void server_final(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ogs_pool_final(&session_pool);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static ogs_sbi_session_t *session_add(ogs_sbi_server_t *server,
 | 
				
			||||||
 | 
					        ogs_sbi_request_t *request, struct MHD_Connection *connection)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ogs_sbi_session_t *sbi_sess = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_assert(server);
 | 
				
			||||||
 | 
					    ogs_assert(request);
 | 
				
			||||||
 | 
					    ogs_assert(connection);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_pool_alloc(&session_pool, &sbi_sess);
 | 
				
			||||||
 | 
					    ogs_assert(sbi_sess);
 | 
				
			||||||
 | 
					    memset(sbi_sess, 0, sizeof(ogs_sbi_session_t));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    sbi_sess->server = server;
 | 
				
			||||||
 | 
					    sbi_sess->request = request;
 | 
				
			||||||
 | 
					    sbi_sess->connection = connection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    sbi_sess->timer = ogs_timer_add(
 | 
				
			||||||
 | 
					            ogs_app()->timer_mgr, session_timer_expired, sbi_sess);
 | 
				
			||||||
 | 
					    ogs_assert(sbi_sess->timer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* If User does not send HTTP response within deadline,
 | 
				
			||||||
 | 
					     * Open5GS will assert this program. */
 | 
				
			||||||
 | 
					    ogs_timer_start(sbi_sess->timer,
 | 
				
			||||||
 | 
					            ogs_app()->time.message.sbi.connection_deadline);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_list_add(&server->session_list, sbi_sess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return sbi_sess;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void session_remove(ogs_sbi_session_t *sbi_sess)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    struct MHD_Connection *connection;
 | 
				
			||||||
 | 
					    ogs_sbi_server_t *server = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_assert(sbi_sess);
 | 
				
			||||||
 | 
					    server = sbi_sess->server;
 | 
				
			||||||
 | 
					    ogs_assert(server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_list_remove(&server->session_list, sbi_sess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_assert(sbi_sess->timer);
 | 
				
			||||||
 | 
					    ogs_timer_delete(sbi_sess->timer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    connection = sbi_sess->connection;
 | 
				
			||||||
 | 
					    ogs_assert(connection);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    MHD_resume_connection(connection);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_pool_free(&session_pool, sbi_sess);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void session_timer_expired(void *data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ogs_sbi_session_t *sbi_sess = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_assert(sbi_sess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_fatal("An HTTP request was received, "
 | 
				
			||||||
 | 
					                "but the HTTP response is missing.");
 | 
				
			||||||
 | 
					    ogs_fatal("Please send the related pcap files for this case.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    session_remove(sbi_sess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_assert_if_reached();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void session_remove_all(ogs_sbi_server_t *server)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ogs_sbi_session_t *sbi_sess = NULL, *next_sbi_sess = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_assert(server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_list_for_each_safe(&server->session_list, next_sbi_sess, sbi_sess)
 | 
				
			||||||
 | 
					        session_remove(sbi_sess);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void server_start(ogs_sbi_server_t *server,
 | 
				
			||||||
 | 
					        int (*cb)(ogs_sbi_request_t *request, void *data))
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    char buf[OGS_ADDRSTRLEN];
 | 
				
			||||||
 | 
					    ogs_sockaddr_t *addr = NULL;
 | 
				
			||||||
 | 
					    char *hostname = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if MHD_VERSION >= 0x00095300
 | 
				
			||||||
 | 
					    unsigned int mhd_flags = MHD_USE_ERROR_LOG;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    unsigned int mhd_flags = MHD_USE_DEBUG;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					    const union MHD_DaemonInfo *mhd_info = NULL;
 | 
				
			||||||
 | 
					#define MAX_NUM_OF_MHD_OPTION_ITEM 8
 | 
				
			||||||
 | 
					    struct MHD_OptionItem mhd_ops[MAX_NUM_OF_MHD_OPTION_ITEM];
 | 
				
			||||||
 | 
					    int index = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_assert(server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if MHD_VERSION >= 0x00095300
 | 
				
			||||||
 | 
					    mhd_flags |= MHD_ALLOW_SUSPEND_RESUME;
 | 
				
			||||||
 | 
					#elif MHD_VERSION >= 0x00093400
 | 
				
			||||||
 | 
					    mhd_flags |= MHD_USE_SUSPEND_RESUME;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    mhd_flags |= MHD_USE_PIPE_FOR_SHUTDOWN;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* Setup callback function */
 | 
				
			||||||
 | 
					    server->cb = cb;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mhd_ops[index].option = MHD_OPTION_NOTIFY_COMPLETED;
 | 
				
			||||||
 | 
					    mhd_ops[index].value = (intptr_t)notify_completed;
 | 
				
			||||||
 | 
					    mhd_ops[index].ptr_value = server;
 | 
				
			||||||
 | 
					    index++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mhd_ops[index].option = MHD_OPTION_NOTIFY_CONNECTION;
 | 
				
			||||||
 | 
					    mhd_ops[index].value = (intptr_t)¬ify_connection;
 | 
				
			||||||
 | 
					    mhd_ops[index].ptr_value = NULL;
 | 
				
			||||||
 | 
					    index++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    addr = server->node.addr;
 | 
				
			||||||
 | 
					    ogs_assert(addr);
 | 
				
			||||||
 | 
					    if (addr->ogs_sa_family == AF_INET6)
 | 
				
			||||||
 | 
					        mhd_flags |= MHD_USE_IPv6;
 | 
				
			||||||
 | 
					    mhd_ops[index].option = MHD_OPTION_SOCK_ADDR;
 | 
				
			||||||
 | 
					    mhd_ops[index].value = 0;
 | 
				
			||||||
 | 
					    mhd_ops[index].ptr_value = (void *)&addr->sa;
 | 
				
			||||||
 | 
					    index++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mhd_ops[index].option = MHD_OPTION_END;
 | 
				
			||||||
 | 
					    mhd_ops[index].value = 0;
 | 
				
			||||||
 | 
					    mhd_ops[index].ptr_value = NULL;
 | 
				
			||||||
 | 
					    index++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    server->mhd = MHD_start_daemon(
 | 
				
			||||||
 | 
					                mhd_flags,
 | 
				
			||||||
 | 
					                0,
 | 
				
			||||||
 | 
					                NULL, NULL,
 | 
				
			||||||
 | 
					                access_handler, server,
 | 
				
			||||||
 | 
					                MHD_OPTION_ARRAY, mhd_ops,
 | 
				
			||||||
 | 
					                MHD_OPTION_END);
 | 
				
			||||||
 | 
					    if (!server->mhd) {
 | 
				
			||||||
 | 
					        ogs_error("Cannot start SBI server");
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* Setup poll for server listening socket */
 | 
				
			||||||
 | 
					    mhd_info = MHD_get_daemon_info(server->mhd, MHD_DAEMON_INFO_LISTEN_FD);
 | 
				
			||||||
 | 
					    ogs_assert(mhd_info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    server->node.poll = ogs_pollset_add(ogs_app()->pollset,
 | 
				
			||||||
 | 
					            OGS_POLLIN, mhd_info->listen_fd, run, server->mhd);
 | 
				
			||||||
 | 
					    ogs_assert(server->node.poll);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    hostname = ogs_gethostname(addr);
 | 
				
			||||||
 | 
					    if (hostname)
 | 
				
			||||||
 | 
					        ogs_info("mhd_server() [%s]:%d", hostname, OGS_PORT(addr));
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        ogs_info("mhd_server() [%s]:%d", OGS_ADDR(addr, buf), OGS_PORT(addr));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void server_stop(ogs_sbi_server_t *server)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ogs_assert(server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (server->node.poll)
 | 
				
			||||||
 | 
					        ogs_pollset_remove(server->node.poll);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    session_remove_all(server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (server->mhd) {
 | 
				
			||||||
 | 
					        MHD_stop_daemon(server->mhd);
 | 
				
			||||||
 | 
					        server->mhd = NULL;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void server_send_response(
 | 
				
			||||||
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_response_t *response)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    int ret;
 | 
				
			||||||
 | 
					    int status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    struct MHD_Connection *connection = NULL;
 | 
				
			||||||
 | 
					    struct MHD_Response *mhd_response;
 | 
				
			||||||
 | 
					    struct MHD_Daemon *mhd_daemon = NULL;
 | 
				
			||||||
 | 
					    const union MHD_ConnectionInfo *mhd_info = NULL;
 | 
				
			||||||
 | 
					    MHD_socket mhd_socket = INVALID_SOCKET;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_hash_index_t *hi;
 | 
				
			||||||
 | 
					    ogs_sbi_request_t *request = NULL;
 | 
				
			||||||
 | 
					    ogs_sbi_session_t *sbi_sess = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    sbi_sess = (ogs_sbi_session_t *)stream;
 | 
				
			||||||
 | 
					    ogs_assert(sbi_sess);
 | 
				
			||||||
 | 
					    ogs_assert(response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    connection = sbi_sess->connection;
 | 
				
			||||||
 | 
					    ogs_assert(connection);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mhd_info = MHD_get_connection_info(
 | 
				
			||||||
 | 
					            connection, MHD_CONNECTION_INFO_DAEMON);
 | 
				
			||||||
 | 
					    ogs_assert(mhd_info);
 | 
				
			||||||
 | 
					    mhd_daemon = mhd_info->daemon;
 | 
				
			||||||
 | 
					    ogs_assert(mhd_daemon);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mhd_info = MHD_get_connection_info(
 | 
				
			||||||
 | 
					            connection, MHD_CONNECTION_INFO_CONNECTION_FD);
 | 
				
			||||||
 | 
					    ogs_assert(mhd_info);
 | 
				
			||||||
 | 
					    mhd_socket = mhd_info->connect_fd;
 | 
				
			||||||
 | 
					    ogs_assert(mhd_socket != INVALID_SOCKET);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (response->http.content) {
 | 
				
			||||||
 | 
					        mhd_response = MHD_create_response_from_buffer(
 | 
				
			||||||
 | 
					                response->http.content_length, response->http.content,
 | 
				
			||||||
 | 
					                MHD_RESPMEM_PERSISTENT);
 | 
				
			||||||
 | 
					        ogs_assert(mhd_response);
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        mhd_response = MHD_create_response_from_buffer(
 | 
				
			||||||
 | 
					                0, NULL, MHD_RESPMEM_PERSISTENT);
 | 
				
			||||||
 | 
					        ogs_assert(mhd_response);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (hi = ogs_hash_first(response->http.headers);
 | 
				
			||||||
 | 
					            hi; hi = ogs_hash_next(hi)) {
 | 
				
			||||||
 | 
					        const char *key = ogs_hash_this_key(hi);
 | 
				
			||||||
 | 
					        char *val = ogs_hash_this_val(hi);
 | 
				
			||||||
 | 
					        MHD_add_response_header(mhd_response, key, val);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    status = response->status;
 | 
				
			||||||
 | 
					    request = sbi_sess->request;
 | 
				
			||||||
 | 
					    ogs_assert(request);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_sbi_response_free(response);
 | 
				
			||||||
 | 
					    session_remove(sbi_sess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    request->poll.write = ogs_pollset_add(ogs_app()->pollset,
 | 
				
			||||||
 | 
					                    OGS_POLLOUT, mhd_socket, run, mhd_daemon);
 | 
				
			||||||
 | 
					    ogs_assert(request->poll.write);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ret = MHD_queue_response(connection, status, mhd_response);
 | 
				
			||||||
 | 
					    if (ret != MHD_YES) {
 | 
				
			||||||
 | 
					        ogs_fatal("MHD_queue_response_error [%d]", ret);
 | 
				
			||||||
 | 
					        ogs_assert_if_reached();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    MHD_destroy_response(mhd_response);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void run(short when, ogs_socket_t fd, void *data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    struct MHD_Daemon *mhd_daemon = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_assert(mhd_daemon);
 | 
				
			||||||
 | 
					    MHD_run(mhd_daemon);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void notify_connection(void *cls,
 | 
				
			||||||
 | 
					        struct MHD_Connection *connection,
 | 
				
			||||||
 | 
					        void **socket_context,
 | 
				
			||||||
 | 
					        enum MHD_ConnectionNotificationCode toe)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    struct MHD_Daemon *mhd_daemon = NULL;
 | 
				
			||||||
 | 
					    MHD_socket mhd_socket = INVALID_SOCKET;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const union MHD_ConnectionInfo *mhd_info = NULL;
 | 
				
			||||||
 | 
					    struct {
 | 
				
			||||||
 | 
					        ogs_poll_t *read;
 | 
				
			||||||
 | 
					    } poll;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    switch (toe) {
 | 
				
			||||||
 | 
					        case MHD_CONNECTION_NOTIFY_STARTED:
 | 
				
			||||||
 | 
					            mhd_info = MHD_get_connection_info(
 | 
				
			||||||
 | 
					                    connection, MHD_CONNECTION_INFO_DAEMON);
 | 
				
			||||||
 | 
					            ogs_assert(mhd_info);
 | 
				
			||||||
 | 
					            mhd_daemon = mhd_info->daemon;
 | 
				
			||||||
 | 
					            ogs_assert(mhd_daemon);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            mhd_info = MHD_get_connection_info(
 | 
				
			||||||
 | 
					                    connection, MHD_CONNECTION_INFO_CONNECTION_FD);
 | 
				
			||||||
 | 
					            ogs_assert(mhd_info);
 | 
				
			||||||
 | 
					            mhd_socket = mhd_info->connect_fd;
 | 
				
			||||||
 | 
					            ogs_assert(mhd_socket != INVALID_SOCKET);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            poll.read = ogs_pollset_add(ogs_app()->pollset,
 | 
				
			||||||
 | 
					                    OGS_POLLIN, mhd_socket, run, mhd_daemon);
 | 
				
			||||||
 | 
					            ogs_assert(poll.read);
 | 
				
			||||||
 | 
					            *socket_context = poll.read;
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        case MHD_CONNECTION_NOTIFY_CLOSED:
 | 
				
			||||||
 | 
					            poll.read = ogs_pollset_cycle(ogs_app()->pollset, *socket_context);
 | 
				
			||||||
 | 
					            if (poll.read)
 | 
				
			||||||
 | 
					                ogs_pollset_remove(poll.read);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int get_values(ogs_hash_t *hash,
 | 
				
			||||||
 | 
					        enum MHD_ValueKind kind, const char *key, const char *value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ogs_assert(hash);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!key || !value)
 | 
				
			||||||
 | 
					        return MHD_YES;     //  Ignore connection value if invalid!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_sbi_header_set(hash, key, value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return MHD_YES;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static _MHD_Result access_handler(
 | 
				
			||||||
 | 
					        void *cls,
 | 
				
			||||||
 | 
					        struct MHD_Connection *connection,
 | 
				
			||||||
 | 
					        const char *url,
 | 
				
			||||||
 | 
					        const char *method,
 | 
				
			||||||
 | 
					        const char *version,
 | 
				
			||||||
 | 
					        const char *upload_data,
 | 
				
			||||||
 | 
					        size_t *upload_data_size,
 | 
				
			||||||
 | 
					        void **con_cls)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ogs_sbi_server_t *server = NULL;
 | 
				
			||||||
 | 
					    ogs_sbi_request_t *request = NULL;
 | 
				
			||||||
 | 
					    ogs_sbi_session_t *sbi_sess = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    server = cls;
 | 
				
			||||||
 | 
					    ogs_assert(server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    request = *con_cls;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (request && request->suspended) {
 | 
				
			||||||
 | 
					        ogs_error("Suspended Request");
 | 
				
			||||||
 | 
					        return MHD_YES;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!request) {
 | 
				
			||||||
 | 
					        request = ogs_sbi_request_new();
 | 
				
			||||||
 | 
					        ogs_assert(request);
 | 
				
			||||||
 | 
					        *con_cls = request;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ogs_assert(request->http.params);
 | 
				
			||||||
 | 
					        MHD_get_connection_values(connection, MHD_GET_ARGUMENT_KIND,
 | 
				
			||||||
 | 
					                (MHD_KeyValueIterator)get_values, request->http.params);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ogs_assert(request->http.headers);
 | 
				
			||||||
 | 
					        MHD_get_connection_values(connection, MHD_HEADER_KIND,
 | 
				
			||||||
 | 
					                (MHD_KeyValueIterator)get_values, request->http.headers);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        request->h.method = ogs_strdup(method);
 | 
				
			||||||
 | 
					        request->h.uri = ogs_strdup(url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (ogs_sbi_header_get(request->http.headers, "Content-Length") ||
 | 
				
			||||||
 | 
					            ogs_sbi_header_get(request->http.headers, "Transfer-Encoding")) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // FIXME : check if POST_DATA is on MHD_POSTDATA_KIND
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return MHD_YES;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        goto suspend;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (*upload_data_size != 0) {
 | 
				
			||||||
 | 
					        size_t offset = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (request->http.content == NULL) {
 | 
				
			||||||
 | 
					            request->http.content_length = *upload_data_size;
 | 
				
			||||||
 | 
					            request->http.content =
 | 
				
			||||||
 | 
					                (char*)ogs_malloc(request->http.content_length + 1);
 | 
				
			||||||
 | 
					            ogs_assert(request->http.content);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            offset = request->http.content_length;
 | 
				
			||||||
 | 
					            if ((request->http.content_length +
 | 
				
			||||||
 | 
					                        *upload_data_size) > OGS_HUGE_LEN) {
 | 
				
			||||||
 | 
					                ogs_error("Overflow : Content-Length[%d], upload_data_size[%d]",
 | 
				
			||||||
 | 
					                            (int)request->http.content_length,
 | 
				
			||||||
 | 
					                            (int)*upload_data_size);
 | 
				
			||||||
 | 
					                *upload_data_size = 0;
 | 
				
			||||||
 | 
					                return MHD_YES;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            request->http.content_length += *upload_data_size;
 | 
				
			||||||
 | 
					            request->http.content = (char *)ogs_realloc(
 | 
				
			||||||
 | 
					                    request->http.content, request->http.content_length + 1);
 | 
				
			||||||
 | 
					            ogs_assert(request->http.content);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        memcpy(request->http.content + offset, upload_data, *upload_data_size);
 | 
				
			||||||
 | 
					        request->http.content[request->http.content_length] = '\0';
 | 
				
			||||||
 | 
					        *upload_data_size = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return MHD_YES;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					suspend:
 | 
				
			||||||
 | 
					    MHD_suspend_connection(connection);
 | 
				
			||||||
 | 
					    request->suspended = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    sbi_sess = session_add(server, request, connection);
 | 
				
			||||||
 | 
					    ogs_assert(sbi_sess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (server->cb) {
 | 
				
			||||||
 | 
					        if (server->cb(request, sbi_sess) != OGS_OK) {
 | 
				
			||||||
 | 
					            ogs_warn("server callback error");
 | 
				
			||||||
 | 
					            ogs_sbi_server_send_error((ogs_sbi_stream_t *)sbi_sess,
 | 
				
			||||||
 | 
					                    OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR, NULL,
 | 
				
			||||||
 | 
					                    "server callback error", NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return MHD_YES;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        ogs_fatal("server callback is not registered");
 | 
				
			||||||
 | 
					        ogs_assert_if_reached();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return MHD_YES;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void notify_completed(
 | 
				
			||||||
 | 
					        void *cls,
 | 
				
			||||||
 | 
					        struct MHD_Connection *connection,
 | 
				
			||||||
 | 
					        void **con_cls,
 | 
				
			||||||
 | 
					        enum MHD_RequestTerminationCode toe)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ogs_sbi_request_t *request = *con_cls;
 | 
				
			||||||
 | 
					    ogs_poll_t *poll = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_assert(request);
 | 
				
			||||||
 | 
					    poll = ogs_pollset_cycle(ogs_app()->pollset, request->poll.write);
 | 
				
			||||||
 | 
					    if (poll)
 | 
				
			||||||
 | 
					        ogs_pollset_remove(poll);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_sbi_request_free(request);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static ogs_sbi_server_t *server_from_stream(ogs_sbi_stream_t *stream)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ogs_sbi_session_t *sbi_sess = (ogs_sbi_session_t *)stream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_assert(sbi_sess);
 | 
				
			||||||
 | 
					    ogs_assert(sbi_sess->server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return sbi_sess->server;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										1232
									
								
								lib/sbi/nghttp2-server.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1232
									
								
								lib/sbi/nghttp2-server.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -21,7 +21,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
 | 
					bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
 | 
				
			||||||
        OpenAPI_nf_profile_t *NFProfile,
 | 
					        OpenAPI_nf_profile_t *NFProfile,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -32,32 +32,32 @@ bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile) {
 | 
					    if (!NFProfile) {
 | 
				
			||||||
        ogs_error("No NFProfile");
 | 
					        ogs_error("No NFProfile");
 | 
				
			||||||
        if (session)
 | 
					        if (stream)
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                        message, "No NFProfile", NULL);
 | 
					                        message, "No NFProfile", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile->nf_instance_id) {
 | 
					    if (!NFProfile->nf_instance_id) {
 | 
				
			||||||
        ogs_error("No NFProfile.NFInstanceId");
 | 
					        ogs_error("No NFProfile.NFInstanceId");
 | 
				
			||||||
        if (session)
 | 
					        if (stream)
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                        message, "NFProfile", "No NFInstanceId");
 | 
					                        message, "NFProfile", "No NFInstanceId");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile->nf_type) {
 | 
					    if (!NFProfile->nf_type) {
 | 
				
			||||||
        ogs_error("No NFProfile.NFType");
 | 
					        ogs_error("No NFProfile.NFType");
 | 
				
			||||||
        if (session)
 | 
					        if (stream)
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                        message, "NFProfile", "No NFType");
 | 
					                        message, "NFProfile", "No NFType");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile->nf_status) {
 | 
					    if (!NFProfile->nf_status) {
 | 
				
			||||||
        ogs_error("No NFProfile.NFStatus");
 | 
					        ogs_error("No NFProfile.NFStatus");
 | 
				
			||||||
        if (session)
 | 
					        if (stream)
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "NFProfile", "No NFStatus");
 | 
					                message, "NFProfile", "No NFStatus");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,7 +26,7 @@ extern "C" {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
 | 
					bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
 | 
				
			||||||
        OpenAPI_nf_profile_t *NFProfile,
 | 
					        OpenAPI_nf_profile_t *NFProfile,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,33 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Copyright (C) 2019 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/>.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef OGS_SBI_PRIVATE_H
 | 
					 | 
				
			||||||
#define OGS_SBI_PRIVATE_H
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "yuarel.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef __cplusplus
 | 
					 | 
				
			||||||
extern "C" {
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef __cplusplus
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif /* OGS_SBI_PRIVATE_H */
 | 
					 | 
				
			||||||
							
								
								
									
										559
									
								
								lib/sbi/server.c
									
									
									
									
									
								
							
							
						
						
									
										559
									
								
								lib/sbi/server.c
									
									
									
									
									
								
							@@ -20,158 +20,37 @@
 | 
				
			|||||||
#include "ogs-app.h"
 | 
					#include "ogs-app.h"
 | 
				
			||||||
#include "ogs-sbi.h"
 | 
					#include "ogs-sbi.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "microhttpd.h"
 | 
					extern const ogs_sbi_server_actions_t ogs_mhd_server_actions;
 | 
				
			||||||
 | 
					extern const ogs_sbi_server_actions_t ogs_nghttp2_server_actions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if MHD_VERSION >= 0x00097001
 | 
					ogs_sbi_server_actions_t ogs_sbi_server_actions;
 | 
				
			||||||
typedef enum MHD_Result _MHD_Result;
 | 
					bool ogs_sbi_server_actions_initialized = false;
 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
typedef int _MHD_Result;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef struct ogs_sbi_session_s {
 | 
					 | 
				
			||||||
    ogs_lnode_t             lnode;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    struct MHD_Connection   *connection;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_sbi_request_t       *request;
 | 
					 | 
				
			||||||
    ogs_sbi_server_t        *server;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
     * The HTTP server(MHD) should send an HTTP response
 | 
					 | 
				
			||||||
     * if an HTTP client(CURL) is requested.
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * If the HTTP client closes the socket without sending an HTTP response,
 | 
					 | 
				
			||||||
     * the CPU load of a program using MHD is 100%. This is because
 | 
					 | 
				
			||||||
     * POLLIN(POLLRDHUP) is generated. So, the callback function of poll
 | 
					 | 
				
			||||||
     * continues to be called.
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * I've created the timer to check whether the user does not use
 | 
					 | 
				
			||||||
     * the HTTP response. When the timer expires, an assertion occurs and
 | 
					 | 
				
			||||||
     * terminates the program.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    ogs_timer_t             *timer;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    void *data;
 | 
					 | 
				
			||||||
} ogs_sbi_session_t;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
static OGS_POOL(server_pool, ogs_sbi_server_t);
 | 
					static OGS_POOL(server_pool, ogs_sbi_server_t);
 | 
				
			||||||
static OGS_POOL(session_pool, ogs_sbi_session_t);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void run(short when, ogs_socket_t fd, void *data);
 | 
					void ogs_sbi_server_init(int num_of_stream_pool)
 | 
				
			||||||
static void notify_connection(void *cls,
 | 
					 | 
				
			||||||
        struct MHD_Connection *connection,
 | 
					 | 
				
			||||||
        void **socket_context,
 | 
					 | 
				
			||||||
        enum MHD_ConnectionNotificationCode toe);
 | 
					 | 
				
			||||||
static _MHD_Result access_handler(
 | 
					 | 
				
			||||||
        void *cls,
 | 
					 | 
				
			||||||
        struct MHD_Connection *connection,
 | 
					 | 
				
			||||||
        const char *url,
 | 
					 | 
				
			||||||
        const char *method,
 | 
					 | 
				
			||||||
        const char *version,
 | 
					 | 
				
			||||||
        const char *upload_data,
 | 
					 | 
				
			||||||
        size_t *upload_data_size,
 | 
					 | 
				
			||||||
        void **con_cls);
 | 
					 | 
				
			||||||
static void notify_completed(
 | 
					 | 
				
			||||||
        void *cls,
 | 
					 | 
				
			||||||
        struct MHD_Connection *connection,
 | 
					 | 
				
			||||||
        void **con_cls,
 | 
					 | 
				
			||||||
        enum MHD_RequestTerminationCode toe);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void session_timer_expired(void *data);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void ogs_sbi_server_init(int num_of_session_pool)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    if (ogs_sbi_server_actions_initialized == false) {
 | 
				
			||||||
 | 
					#if 1 /* Use HTTP2 */
 | 
				
			||||||
 | 
					        ogs_sbi_server_actions = ogs_nghttp2_server_actions;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					        ogs_sbi_server_actions = ogs_mhd_server_actions;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_sbi_server_actions.init(num_of_stream_pool);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_list_init(&ogs_sbi_self()->server_list);
 | 
					    ogs_list_init(&ogs_sbi_self()->server_list);
 | 
				
			||||||
    ogs_pool_init(&server_pool, ogs_app()->pool.nf);
 | 
					    ogs_pool_init(&server_pool, ogs_app()->pool.nf);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_pool_init(&session_pool, num_of_session_pool);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ogs_sbi_server_final(void)
 | 
					void ogs_sbi_server_final(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_server_remove_all();
 | 
					    ogs_sbi_server_remove_all();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_pool_final(&server_pool);
 | 
					    ogs_pool_final(&server_pool);
 | 
				
			||||||
    ogs_pool_final(&session_pool);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ogs_sbi_session_t *session_add(ogs_sbi_server_t *server,
 | 
					    ogs_sbi_server_actions.cleanup();
 | 
				
			||||||
        ogs_sbi_request_t *request, struct MHD_Connection *connection)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_assert(server);
 | 
					 | 
				
			||||||
    ogs_assert(request);
 | 
					 | 
				
			||||||
    ogs_assert(connection);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_pool_alloc(&session_pool, &session);
 | 
					 | 
				
			||||||
    ogs_assert(session);
 | 
					 | 
				
			||||||
    memset(session, 0, sizeof(ogs_sbi_session_t));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    session->server = server;
 | 
					 | 
				
			||||||
    session->request = request;
 | 
					 | 
				
			||||||
    session->connection = connection;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    session->timer = ogs_timer_add(
 | 
					 | 
				
			||||||
            ogs_app()->timer_mgr, session_timer_expired, session);
 | 
					 | 
				
			||||||
    ogs_assert(session->timer);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* If User does not send http response within deadline,
 | 
					 | 
				
			||||||
     * Open5GS will assert this program. */
 | 
					 | 
				
			||||||
    ogs_timer_start(session->timer,
 | 
					 | 
				
			||||||
            ogs_app()->time.message.sbi.connection_deadline);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_list_add(&server->suspended_session_list, session);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return session;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void session_remove(ogs_sbi_session_t *session)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    struct MHD_Connection *connection;
 | 
					 | 
				
			||||||
    ogs_sbi_server_t *server = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_assert(session);
 | 
					 | 
				
			||||||
    server = session->server;
 | 
					 | 
				
			||||||
    ogs_assert(server);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_list_remove(&server->suspended_session_list, session);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_assert(session->timer);
 | 
					 | 
				
			||||||
    ogs_timer_delete(session->timer);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    connection = session->connection;
 | 
					 | 
				
			||||||
    ogs_assert(connection);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    MHD_resume_connection(connection);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_pool_free(&session_pool, session);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void session_timer_expired(void *data)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    session = data;
 | 
					 | 
				
			||||||
    ogs_assert(session);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_fatal("An HTTP request was received, "
 | 
					 | 
				
			||||||
                "but the HTTP response is missing.");
 | 
					 | 
				
			||||||
    ogs_fatal("Please send the related pcap files for this case.");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    session_remove(session);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_assert_if_reached();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void session_remove_all(ogs_sbi_server_t *server)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    ogs_sbi_session_t *session = NULL, *next_session = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_assert(server);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_list_for_each_safe(
 | 
					 | 
				
			||||||
            &server->suspended_session_list, next_session, session)
 | 
					 | 
				
			||||||
        session_remove(session);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ogs_sbi_server_t *ogs_sbi_server_add(ogs_sockaddr_t *addr)
 | 
					ogs_sbi_server_t *ogs_sbi_server_add(ogs_sockaddr_t *addr)
 | 
				
			||||||
@@ -184,8 +63,7 @@ ogs_sbi_server_t *ogs_sbi_server_add(ogs_sockaddr_t *addr)
 | 
				
			|||||||
    ogs_assert(server);
 | 
					    ogs_assert(server);
 | 
				
			||||||
    memset(server, 0, sizeof(ogs_sbi_server_t));
 | 
					    memset(server, 0, sizeof(ogs_sbi_server_t));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_list_init(&server->suspended_session_list);
 | 
					    ogs_copyaddrinfo(&server->node.addr, addr);
 | 
				
			||||||
    ogs_copyaddrinfo(&server->addr, addr);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_list_add(&ogs_sbi_self()->server_list, server);
 | 
					    ogs_list_add(&ogs_sbi_self()->server_list, server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -198,10 +76,8 @@ void ogs_sbi_server_remove(ogs_sbi_server_t *server)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ogs_list_remove(&ogs_sbi_self()->server_list, server);
 | 
					    ogs_list_remove(&ogs_sbi_self()->server_list, server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_server_stop(server);
 | 
					    ogs_assert(server->node.addr);
 | 
				
			||||||
 | 
					    ogs_freeaddrinfo(server->node.addr);
 | 
				
			||||||
    ogs_assert(server->addr);
 | 
					 | 
				
			||||||
    ogs_freeaddrinfo(server->addr);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_pool_free(&server_pool, server);
 | 
					    ogs_pool_free(&server_pool, server);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -214,117 +90,13 @@ void ogs_sbi_server_remove_all(void)
 | 
				
			|||||||
        ogs_sbi_server_remove(server);
 | 
					        ogs_sbi_server_remove(server);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ogs_sbi_server_start(ogs_sbi_server_t *server, int (*cb)(
 | 
					void ogs_sbi_server_start_all(
 | 
				
			||||||
            ogs_sbi_server_t *server, ogs_sbi_session_t *session,
 | 
					        int (*cb)(ogs_sbi_request_t *request, void *data))
 | 
				
			||||||
            ogs_sbi_request_t *request))
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    char buf[OGS_ADDRSTRLEN];
 | 
					 | 
				
			||||||
    ogs_sockaddr_t *addr = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if MHD_VERSION >= 0x00095300
 | 
					 | 
				
			||||||
    unsigned int mhd_flags = MHD_USE_ERROR_LOG;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    unsigned int mhd_flags = MHD_USE_DEBUG;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    const union MHD_DaemonInfo *mhd_info = NULL;
 | 
					 | 
				
			||||||
#define MAX_NUM_OF_MHD_OPTION_ITEM 8
 | 
					 | 
				
			||||||
    struct MHD_OptionItem mhd_ops[MAX_NUM_OF_MHD_OPTION_ITEM];
 | 
					 | 
				
			||||||
    int index = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_assert(server);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if MHD_VERSION >= 0x00095300
 | 
					 | 
				
			||||||
    mhd_flags |= MHD_ALLOW_SUSPEND_RESUME;
 | 
					 | 
				
			||||||
#elif MHD_VERSION >= 0x00093400
 | 
					 | 
				
			||||||
    mhd_flags |= MHD_USE_SUSPEND_RESUME;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    mhd_flags |= MHD_USE_PIPE_FOR_SHUTDOWN;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* Setup callback function */
 | 
					 | 
				
			||||||
    server->cb = cb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    mhd_ops[index].option = MHD_OPTION_NOTIFY_COMPLETED;
 | 
					 | 
				
			||||||
    mhd_ops[index].value = (intptr_t)notify_completed;
 | 
					 | 
				
			||||||
    mhd_ops[index].ptr_value = server;
 | 
					 | 
				
			||||||
    index++;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    mhd_ops[index].option = MHD_OPTION_NOTIFY_CONNECTION;
 | 
					 | 
				
			||||||
    mhd_ops[index].value = (intptr_t)¬ify_connection;
 | 
					 | 
				
			||||||
    mhd_ops[index].ptr_value = NULL;
 | 
					 | 
				
			||||||
    index++;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    addr = server->addr;
 | 
					 | 
				
			||||||
    ogs_assert(addr);
 | 
					 | 
				
			||||||
    if (addr->ogs_sa_family == AF_INET6)
 | 
					 | 
				
			||||||
        mhd_flags |= MHD_USE_IPv6;
 | 
					 | 
				
			||||||
    mhd_ops[index].option = MHD_OPTION_SOCK_ADDR;
 | 
					 | 
				
			||||||
    mhd_ops[index].value = 0;
 | 
					 | 
				
			||||||
    mhd_ops[index].ptr_value = (void *)&addr->sa;
 | 
					 | 
				
			||||||
    index++;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    mhd_ops[index].option = MHD_OPTION_END;
 | 
					 | 
				
			||||||
    mhd_ops[index].value = 0;
 | 
					 | 
				
			||||||
    mhd_ops[index].ptr_value = NULL;
 | 
					 | 
				
			||||||
    index++;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    server->mhd = MHD_start_daemon(
 | 
					 | 
				
			||||||
                mhd_flags,
 | 
					 | 
				
			||||||
                0,
 | 
					 | 
				
			||||||
                NULL, NULL,
 | 
					 | 
				
			||||||
                access_handler, server,
 | 
					 | 
				
			||||||
                MHD_OPTION_ARRAY, mhd_ops,
 | 
					 | 
				
			||||||
                MHD_OPTION_END);
 | 
					 | 
				
			||||||
    if (!server->mhd) {
 | 
					 | 
				
			||||||
        ogs_error("Cannot start SBI server");
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* Setup poll for server listening socket */
 | 
					 | 
				
			||||||
    mhd_info = MHD_get_daemon_info(server->mhd, MHD_DAEMON_INFO_LISTEN_FD);
 | 
					 | 
				
			||||||
    ogs_assert(mhd_info);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    server->poll = ogs_pollset_add(ogs_app()->pollset,
 | 
					 | 
				
			||||||
            OGS_POLLIN, mhd_info->listen_fd, run, server->mhd);
 | 
					 | 
				
			||||||
    ogs_assert(server->poll);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (addr) {
 | 
					 | 
				
			||||||
        char *hostname = ogs_gethostname(addr);
 | 
					 | 
				
			||||||
        if (hostname)
 | 
					 | 
				
			||||||
            ogs_info("sbi_server() [%s]:%d",
 | 
					 | 
				
			||||||
                    hostname, OGS_PORT(addr));
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
            ogs_info("sbi_server() [%s]:%d",
 | 
					 | 
				
			||||||
                    OGS_ADDR(addr, buf), OGS_PORT(addr));
 | 
					 | 
				
			||||||
    } else
 | 
					 | 
				
			||||||
        ogs_info("sbi_server() [any]:any");
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void ogs_sbi_server_start_all(int (*cb)(
 | 
					 | 
				
			||||||
            ogs_sbi_server_t *server, ogs_sbi_session_t *session,
 | 
					 | 
				
			||||||
            ogs_sbi_request_t *request))
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_server_t *server = NULL, *next_server = NULL;
 | 
					    ogs_sbi_server_t *server = NULL, *next_server = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_list_for_each_safe(&ogs_sbi_self()->server_list, next_server, server)
 | 
					    ogs_list_for_each_safe(&ogs_sbi_self()->server_list, next_server, server)
 | 
				
			||||||
        ogs_sbi_server_start(server, cb);
 | 
					        ogs_sbi_server_actions.start(server, cb);
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void ogs_sbi_server_stop(ogs_sbi_server_t *server)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    ogs_assert(server);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (server->poll) {
 | 
					 | 
				
			||||||
        ogs_pollset_remove(server->poll);
 | 
					 | 
				
			||||||
        server->poll = NULL;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    session_remove_all(server);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (server->mhd) {
 | 
					 | 
				
			||||||
        MHD_stop_daemon(server->mhd);
 | 
					 | 
				
			||||||
        server->mhd = NULL;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ogs_sbi_server_stop_all(void)
 | 
					void ogs_sbi_server_stop_all(void)
 | 
				
			||||||
@@ -332,86 +104,22 @@ void ogs_sbi_server_stop_all(void)
 | 
				
			|||||||
    ogs_sbi_server_t *server = NULL, *next_server = NULL;
 | 
					    ogs_sbi_server_t *server = NULL, *next_server = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_list_for_each_safe(&ogs_sbi_self()->server_list, next_server, server)
 | 
					    ogs_list_for_each_safe(&ogs_sbi_self()->server_list, next_server, server)
 | 
				
			||||||
        ogs_sbi_server_stop(server);
 | 
					        ogs_sbi_server_actions.stop(server);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ogs_sbi_server_send_response(
 | 
					void ogs_sbi_server_send_response(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_response_t *response)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_response_t *response)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int ret;
 | 
					    ogs_sbi_server_actions.send_response(stream, response);
 | 
				
			||||||
    int status;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    struct MHD_Connection *connection = NULL;
 | 
					 | 
				
			||||||
    struct MHD_Response *mhd_response;
 | 
					 | 
				
			||||||
    struct MHD_Daemon *mhd_daemon = NULL;
 | 
					 | 
				
			||||||
    const union MHD_ConnectionInfo *mhd_info = NULL;
 | 
					 | 
				
			||||||
    MHD_socket mhd_socket = INVALID_SOCKET;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_hash_index_t *hi;
 | 
					 | 
				
			||||||
    ogs_sbi_request_t *request = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_assert(response);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_assert(session);
 | 
					 | 
				
			||||||
    connection = session->connection;
 | 
					 | 
				
			||||||
    ogs_assert(connection);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    mhd_info = MHD_get_connection_info(
 | 
					 | 
				
			||||||
            connection, MHD_CONNECTION_INFO_DAEMON);
 | 
					 | 
				
			||||||
    ogs_assert(mhd_info);
 | 
					 | 
				
			||||||
    mhd_daemon = mhd_info->daemon;
 | 
					 | 
				
			||||||
    ogs_assert(mhd_daemon);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    mhd_info = MHD_get_connection_info(
 | 
					 | 
				
			||||||
            connection, MHD_CONNECTION_INFO_CONNECTION_FD);
 | 
					 | 
				
			||||||
    ogs_assert(mhd_info);
 | 
					 | 
				
			||||||
    mhd_socket = mhd_info->connect_fd;
 | 
					 | 
				
			||||||
    ogs_assert(mhd_socket != INVALID_SOCKET);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (response->http.content) {
 | 
					 | 
				
			||||||
        mhd_response = MHD_create_response_from_buffer(
 | 
					 | 
				
			||||||
                response->http.content_length, response->http.content,
 | 
					 | 
				
			||||||
                MHD_RESPMEM_PERSISTENT);
 | 
					 | 
				
			||||||
        ogs_assert(mhd_response);
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        mhd_response = MHD_create_response_from_buffer(
 | 
					 | 
				
			||||||
                0, NULL, MHD_RESPMEM_PERSISTENT);
 | 
					 | 
				
			||||||
        ogs_assert(mhd_response);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (hi = ogs_hash_first(response->http.headers);
 | 
					 | 
				
			||||||
            hi; hi = ogs_hash_next(hi)) {
 | 
					 | 
				
			||||||
        const char *key = ogs_hash_this_key(hi);
 | 
					 | 
				
			||||||
        char *val = ogs_hash_this_val(hi);
 | 
					 | 
				
			||||||
        MHD_add_response_header(mhd_response, key, val);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    status = response->status;
 | 
					 | 
				
			||||||
    request = session->request;
 | 
					 | 
				
			||||||
    ogs_assert(request);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_sbi_response_free(response);
 | 
					 | 
				
			||||||
    session_remove(session);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    request->poll = ogs_pollset_add(ogs_app()->pollset,
 | 
					 | 
				
			||||||
                    OGS_POLLOUT, mhd_socket, run, mhd_daemon);
 | 
					 | 
				
			||||||
    ogs_assert(request->poll);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ret = MHD_queue_response(connection, status, mhd_response);
 | 
					 | 
				
			||||||
    if (ret != MHD_YES) {
 | 
					 | 
				
			||||||
        ogs_fatal("MHD_queue_response_error [%d]", ret);
 | 
					 | 
				
			||||||
        ogs_assert_if_reached();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    MHD_destroy_response(mhd_response);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ogs_sbi_server_send_problem(
 | 
					void ogs_sbi_server_send_problem(
 | 
				
			||||||
        ogs_sbi_session_t *session, OpenAPI_problem_details_t *problem)
 | 
					        ogs_sbi_stream_t *stream, OpenAPI_problem_details_t *problem)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_message_t message;
 | 
					    ogs_sbi_message_t message;
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(problem);
 | 
					    ogs_assert(problem);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(&message, 0, sizeof(message));
 | 
					    memset(&message, 0, sizeof(message));
 | 
				
			||||||
@@ -422,16 +130,16 @@ void ogs_sbi_server_send_problem(
 | 
				
			|||||||
    response = ogs_sbi_build_response(&message, problem->status);
 | 
					    response = ogs_sbi_build_response(&message, problem->status);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ogs_sbi_server_send_error(ogs_sbi_session_t *session,
 | 
					void ogs_sbi_server_send_error(ogs_sbi_stream_t *stream,
 | 
				
			||||||
        int status, ogs_sbi_message_t *message,
 | 
					        int status, ogs_sbi_message_t *message,
 | 
				
			||||||
        const char *title, const char *detail)
 | 
					        const char *title, const char *detail)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    OpenAPI_problem_details_t problem;
 | 
					    OpenAPI_problem_details_t problem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(&problem, 0, sizeof(problem));
 | 
					    memset(&problem, 0, sizeof(problem));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -450,7 +158,7 @@ void ogs_sbi_server_send_error(ogs_sbi_session_t *session,
 | 
				
			|||||||
    problem.title = (char*)title;
 | 
					    problem.title = (char*)title;
 | 
				
			||||||
    problem.detail = (char*)detail;
 | 
					    problem.detail = (char*)detail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_server_send_problem(session, &problem);
 | 
					    ogs_sbi_server_send_problem(stream, &problem);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (problem.type)
 | 
					    if (problem.type)
 | 
				
			||||||
        ogs_free(problem.type);
 | 
					        ogs_free(problem.type);
 | 
				
			||||||
@@ -458,206 +166,7 @@ void ogs_sbi_server_send_error(ogs_sbi_session_t *session,
 | 
				
			|||||||
        ogs_free(problem.instance);
 | 
					        ogs_free(problem.instance);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void run(short when, ogs_socket_t fd, void *data)
 | 
					ogs_sbi_server_t *ogs_sbi_server_from_stream(ogs_sbi_stream_t *stream)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct MHD_Daemon *mhd_daemon = data;
 | 
					    return ogs_sbi_server_actions.from_stream(stream);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_assert(mhd_daemon);
 | 
					 | 
				
			||||||
    MHD_run(mhd_daemon);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void notify_connection(void *cls,
 | 
					 | 
				
			||||||
        struct MHD_Connection *connection,
 | 
					 | 
				
			||||||
        void **socket_context,
 | 
					 | 
				
			||||||
        enum MHD_ConnectionNotificationCode toe)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    struct MHD_Daemon *mhd_daemon = NULL;
 | 
					 | 
				
			||||||
    MHD_socket mhd_socket = INVALID_SOCKET;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const union MHD_ConnectionInfo *mhd_info = NULL;
 | 
					 | 
				
			||||||
    ogs_poll_t *poll = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    switch (toe) {
 | 
					 | 
				
			||||||
        case MHD_CONNECTION_NOTIFY_STARTED:
 | 
					 | 
				
			||||||
            mhd_info = MHD_get_connection_info(
 | 
					 | 
				
			||||||
                    connection, MHD_CONNECTION_INFO_DAEMON);
 | 
					 | 
				
			||||||
            ogs_assert(mhd_info);
 | 
					 | 
				
			||||||
            mhd_daemon = mhd_info->daemon;
 | 
					 | 
				
			||||||
            ogs_assert(mhd_daemon);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            mhd_info = MHD_get_connection_info(
 | 
					 | 
				
			||||||
                    connection, MHD_CONNECTION_INFO_CONNECTION_FD);
 | 
					 | 
				
			||||||
            ogs_assert(mhd_info);
 | 
					 | 
				
			||||||
            mhd_socket = mhd_info->connect_fd;
 | 
					 | 
				
			||||||
            ogs_assert(mhd_socket != INVALID_SOCKET);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            poll = ogs_pollset_add(ogs_app()->pollset,
 | 
					 | 
				
			||||||
                    OGS_POLLIN, mhd_socket, run, mhd_daemon);
 | 
					 | 
				
			||||||
            ogs_assert(poll);
 | 
					 | 
				
			||||||
            *socket_context = poll;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        case MHD_CONNECTION_NOTIFY_CLOSED:
 | 
					 | 
				
			||||||
            poll = *socket_context;
 | 
					 | 
				
			||||||
            ogs_pollset_remove(poll);
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static int get_values(ogs_hash_t *hash,
 | 
					 | 
				
			||||||
        enum MHD_ValueKind kind, const char *key, const char *value)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    ogs_assert(hash);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!key || !value)
 | 
					 | 
				
			||||||
        return MHD_YES;     //  Ignore connection value if invalid!
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_sbi_header_set(hash, key, value);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return MHD_YES;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static _MHD_Result access_handler(
 | 
					 | 
				
			||||||
        void *cls,
 | 
					 | 
				
			||||||
        struct MHD_Connection *connection,
 | 
					 | 
				
			||||||
        const char *url,
 | 
					 | 
				
			||||||
        const char *method,
 | 
					 | 
				
			||||||
        const char *version,
 | 
					 | 
				
			||||||
        const char *upload_data,
 | 
					 | 
				
			||||||
        size_t *upload_data_size,
 | 
					 | 
				
			||||||
        void **con_cls)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    ogs_sbi_server_t *server = NULL;
 | 
					 | 
				
			||||||
    ogs_sbi_request_t *request = NULL;
 | 
					 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    server = cls;
 | 
					 | 
				
			||||||
    ogs_assert(server);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    request = *con_cls;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (request && request->suspended) {
 | 
					 | 
				
			||||||
        ogs_error("Suspended Request");
 | 
					 | 
				
			||||||
        return MHD_YES;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!request) {
 | 
					 | 
				
			||||||
        request = ogs_sbi_request_new();
 | 
					 | 
				
			||||||
        ogs_assert(request);
 | 
					 | 
				
			||||||
        *con_cls = request;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ogs_assert(request->http.params);
 | 
					 | 
				
			||||||
        MHD_get_connection_values(connection, MHD_GET_ARGUMENT_KIND,
 | 
					 | 
				
			||||||
                (MHD_KeyValueIterator)get_values, request->http.params);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ogs_assert(request->http.headers);
 | 
					 | 
				
			||||||
        MHD_get_connection_values(connection, MHD_HEADER_KIND,
 | 
					 | 
				
			||||||
                (MHD_KeyValueIterator)get_values, request->http.headers);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        request->h.method = ogs_strdup(method);
 | 
					 | 
				
			||||||
        request->h.uri = ogs_strdup(url);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (ogs_sbi_header_get(request->http.headers, "Content-Length") ||
 | 
					 | 
				
			||||||
            ogs_sbi_header_get(request->http.headers, "Transfer-Encoding")) {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // FIXME : check if POST_DATA is on MHD_POSTDATA_KIND
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return MHD_YES;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        goto suspend;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (*upload_data_size != 0) {
 | 
					 | 
				
			||||||
        size_t offset = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (request->http.content == NULL) {
 | 
					 | 
				
			||||||
            request->http.content_length = *upload_data_size;
 | 
					 | 
				
			||||||
            request->http.content =
 | 
					 | 
				
			||||||
                (char*)ogs_malloc(request->http.content_length + 1);
 | 
					 | 
				
			||||||
            ogs_assert(request->http.content);
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            offset = request->http.content_length;
 | 
					 | 
				
			||||||
            if ((request->http.content_length +
 | 
					 | 
				
			||||||
                        *upload_data_size) > OGS_HUGE_LEN) {
 | 
					 | 
				
			||||||
                ogs_error("Overflow : Content-Length[%d], upload_data_size[%d]",
 | 
					 | 
				
			||||||
                            (int)request->http.content_length,
 | 
					 | 
				
			||||||
                            (int)*upload_data_size);
 | 
					 | 
				
			||||||
                *upload_data_size = 0;
 | 
					 | 
				
			||||||
                return MHD_YES;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            request->http.content_length += *upload_data_size;
 | 
					 | 
				
			||||||
            request->http.content = (char *)ogs_realloc(
 | 
					 | 
				
			||||||
                    request->http.content, request->http.content_length + 1);
 | 
					 | 
				
			||||||
            ogs_assert(request->http.content);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        memcpy(request->http.content + offset, upload_data, *upload_data_size);
 | 
					 | 
				
			||||||
        request->http.content[request->http.content_length] = '\0';
 | 
					 | 
				
			||||||
        *upload_data_size = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return MHD_YES;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
suspend:
 | 
					 | 
				
			||||||
    MHD_suspend_connection(connection);
 | 
					 | 
				
			||||||
    request->suspended = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    session = session_add(server, request, connection);
 | 
					 | 
				
			||||||
    ogs_assert(session);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (server->cb) {
 | 
					 | 
				
			||||||
        if (server->cb(server, session, request) != OGS_OK) {
 | 
					 | 
				
			||||||
            ogs_warn("server callback error");
 | 
					 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR, NULL,
 | 
					 | 
				
			||||||
                    "server callback error", NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return MHD_YES;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        ogs_fatal("server callback is not registered");
 | 
					 | 
				
			||||||
        ogs_assert_if_reached();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return MHD_YES;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void notify_completed(
 | 
					 | 
				
			||||||
        void *cls,
 | 
					 | 
				
			||||||
        struct MHD_Connection *connection,
 | 
					 | 
				
			||||||
        void **con_cls,
 | 
					 | 
				
			||||||
        enum MHD_RequestTerminationCode toe)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    ogs_sbi_request_t *request = *con_cls;
 | 
					 | 
				
			||||||
    ogs_poll_t *poll = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_assert(request);
 | 
					 | 
				
			||||||
    poll = request->poll;
 | 
					 | 
				
			||||||
    if (poll)
 | 
					 | 
				
			||||||
        ogs_pollset_remove(poll);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_sbi_request_free(request);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void ogs_sbi_session_set_data(ogs_sbi_session_t *session, void *data)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    ogs_assert(session);
 | 
					 | 
				
			||||||
    ogs_assert(data);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    session->data = data;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void *ogs_sbi_session_get_data(ogs_sbi_session_t *session)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    ogs_assert(session);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return session->data;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ogs_sbi_server_t *ogs_sbi_session_get_server(ogs_sbi_session_t *session)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    ogs_assert(session);
 | 
					 | 
				
			||||||
    ogs_assert(session->server);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return session->server;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,30 +28,36 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct ogs_sbi_server_s ogs_sbi_server_t;
 | 
					typedef struct ogs_sbi_stream_s ogs_sbi_stream_t;
 | 
				
			||||||
typedef struct ogs_sbi_session_s ogs_sbi_session_t;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct ogs_sbi_server_s {
 | 
					typedef struct ogs_sbi_server_s {
 | 
				
			||||||
    ogs_lnode_t     lnode;                  /* A node of list_t */
 | 
					    ogs_socknode_t  node;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_sockaddr_t  *addr;                  /* Listen socket address */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct {
 | 
					    struct {
 | 
				
			||||||
        const char  *key;
 | 
					        const char  *key;
 | 
				
			||||||
        const char  *pem;
 | 
					        const char  *pem;
 | 
				
			||||||
    } tls;
 | 
					    } tls;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int (*cb)(ogs_sbi_server_t *server, ogs_sbi_session_t *session,
 | 
					    int (*cb)(ogs_sbi_request_t *request, void *data);
 | 
				
			||||||
            ogs_sbi_request_t *request);
 | 
					    ogs_list_t      session_list;
 | 
				
			||||||
    void *data;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_list_t      suspended_session_list; /* MHD suspended list */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    void            *mhd;                   /* MHD instance */
 | 
					 | 
				
			||||||
    ogs_poll_t      *poll;                  /* MHD server poll */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void            *mhd; /* Used by MHD */
 | 
				
			||||||
} ogs_sbi_server_t;
 | 
					} ogs_sbi_server_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct ogs_sbi_server_actions_s {
 | 
				
			||||||
 | 
					    void (*init)(int num_of_stream_pool);
 | 
				
			||||||
 | 
					    void (*cleanup)(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void (*start)(ogs_sbi_server_t *server,
 | 
				
			||||||
 | 
					            int (*cb)(ogs_sbi_request_t *request, void *data));
 | 
				
			||||||
 | 
					    void (*stop)(ogs_sbi_server_t *server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void (*send_response)(
 | 
				
			||||||
 | 
					            ogs_sbi_stream_t *stream, ogs_sbi_response_t *response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ogs_sbi_server_t *(*from_stream)(ogs_sbi_stream_t *stream);
 | 
				
			||||||
 | 
					} ogs_sbi_server_actions_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ogs_sbi_server_init(int num_of_connection_pool);
 | 
					void ogs_sbi_server_init(int num_of_connection_pool);
 | 
				
			||||||
void ogs_sbi_server_final(void);
 | 
					void ogs_sbi_server_final(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -59,26 +65,19 @@ ogs_sbi_server_t *ogs_sbi_server_add(ogs_sockaddr_t *addr);
 | 
				
			|||||||
void ogs_sbi_server_remove(ogs_sbi_server_t *server);
 | 
					void ogs_sbi_server_remove(ogs_sbi_server_t *server);
 | 
				
			||||||
void ogs_sbi_server_remove_all(void);
 | 
					void ogs_sbi_server_remove_all(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ogs_sbi_server_start(ogs_sbi_server_t *server, int (*cb)(
 | 
					void ogs_sbi_server_start_all(
 | 
				
			||||||
            ogs_sbi_server_t *server, ogs_sbi_session_t *session,
 | 
					        int (*cb)(ogs_sbi_request_t *request, void *data));
 | 
				
			||||||
            ogs_sbi_request_t *request));
 | 
					 | 
				
			||||||
void ogs_sbi_server_start_all(int (*cb)(
 | 
					 | 
				
			||||||
            ogs_sbi_server_t *server, ogs_sbi_session_t *session,
 | 
					 | 
				
			||||||
            ogs_sbi_request_t *request));
 | 
					 | 
				
			||||||
void ogs_sbi_server_stop(ogs_sbi_server_t *server);
 | 
					 | 
				
			||||||
void ogs_sbi_server_stop_all(void);
 | 
					void ogs_sbi_server_stop_all(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ogs_sbi_server_send_response(
 | 
					void ogs_sbi_server_send_response(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_response_t *response);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_response_t *response);
 | 
				
			||||||
void ogs_sbi_server_send_error(ogs_sbi_session_t *session,
 | 
					void ogs_sbi_server_send_error(ogs_sbi_stream_t *stream,
 | 
				
			||||||
        int status, ogs_sbi_message_t *message,
 | 
					        int status, ogs_sbi_message_t *message,
 | 
				
			||||||
        const char *title, const char *detail);
 | 
					        const char *title, const char *detail);
 | 
				
			||||||
void ogs_sbi_server_send_problem(
 | 
					void ogs_sbi_server_send_problem(
 | 
				
			||||||
        ogs_sbi_session_t *session, OpenAPI_problem_details_t *problem);
 | 
					        ogs_sbi_stream_t *stream, OpenAPI_problem_details_t *problem);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ogs_sbi_session_set_data(ogs_sbi_session_t *session, void *data);
 | 
					ogs_sbi_server_t *ogs_sbi_server_from_stream(ogs_sbi_stream_t *stream);
 | 
				
			||||||
void *ogs_sbi_session_get_data(ogs_sbi_session_t *session);
 | 
					 | 
				
			||||||
ogs_sbi_server_t *ogs_sbi_session_get_server(ogs_sbi_session_t *session);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,7 +65,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
    ogs_sbi_object_t *sbi_object = NULL;
 | 
					    ogs_sbi_object_t *sbi_object = NULL;
 | 
				
			||||||
    ogs_sbi_xact_t *sbi_xact = NULL;
 | 
					    ogs_sbi_xact_t *sbi_xact = NULL;
 | 
				
			||||||
    int state = AMF_UPDATE_SM_CONTEXT_NO_STATE;
 | 
					    int state = AMF_UPDATE_SM_CONTEXT_NO_STATE;
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
    ogs_sbi_request_t *sbi_request = NULL;
 | 
					    ogs_sbi_request_t *sbi_request = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
@@ -100,14 +100,14 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
    case AMF_EVT_SBI_SERVER:
 | 
					    case AMF_EVT_SBI_SERVER:
 | 
				
			||||||
        sbi_request = e->sbi.request;
 | 
					        sbi_request = e->sbi.request;
 | 
				
			||||||
        ogs_assert(sbi_request);
 | 
					        ogs_assert(sbi_request);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        rv = ogs_sbi_parse_request(&sbi_message, sbi_request);
 | 
					        rv = ogs_sbi_parse_request(&sbi_message, sbi_request);
 | 
				
			||||||
        if (rv != OGS_OK) {
 | 
					        if (rv != OGS_OK) {
 | 
				
			||||||
            /* 'sbi_message' buffer is released in ogs_sbi_parse_request() */
 | 
					            /* 'sbi_message' buffer is released in ogs_sbi_parse_request() */
 | 
				
			||||||
            ogs_error("cannot parse HTTP sbi_message");
 | 
					            ogs_error("cannot parse HTTP sbi_message");
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    NULL, "cannot parse HTTP sbi_message", NULL);
 | 
					                    NULL, "cannot parse HTTP sbi_message", NULL);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -123,7 +123,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
        ogs_assert(api_version);
 | 
					        ogs_assert(api_version);
 | 
				
			||||||
        if (strcmp(sbi_message.h.api.version, api_version) != 0) {
 | 
					        if (strcmp(sbi_message.h.api.version, api_version) != 0) {
 | 
				
			||||||
            ogs_error("Not supported version [%s]", sbi_message.h.api.version);
 | 
					            ogs_error("Not supported version [%s]", sbi_message.h.api.version);
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    &sbi_message, "Not supported version", NULL);
 | 
					                    &sbi_message, "Not supported version", NULL);
 | 
				
			||||||
            ogs_sbi_message_free(&sbi_message);
 | 
					            ogs_sbi_message_free(&sbi_message);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
@@ -136,13 +136,13 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
            CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY)
 | 
					            CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY)
 | 
				
			||||||
                SWITCH(sbi_message.h.method)
 | 
					                SWITCH(sbi_message.h.method)
 | 
				
			||||||
                CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
					                CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
				
			||||||
                    amf_nnrf_handle_nf_status_notify(session, &sbi_message);
 | 
					                    amf_nnrf_handle_nf_status_notify(stream, &sbi_message);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("Invalid HTTP method [%s]",
 | 
					                    ogs_error("Invalid HTTP method [%s]",
 | 
				
			||||||
                            sbi_message.h.method);
 | 
					                            sbi_message.h.method);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					                            OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
                            &sbi_message,
 | 
					                            &sbi_message,
 | 
				
			||||||
                            "Invalid HTTP method", sbi_message.h.method);
 | 
					                            "Invalid HTTP method", sbi_message.h.method);
 | 
				
			||||||
@@ -152,7 +152,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("Invalid resource name [%s]",
 | 
					                ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                        sbi_message.h.resource.component[0]);
 | 
					                        sbi_message.h.resource.component[0]);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
				
			||||||
                        "Invalid resource name",
 | 
					                        "Invalid resource name",
 | 
				
			||||||
                        sbi_message.h.resource.component[0]);
 | 
					                        sbi_message.h.resource.component[0]);
 | 
				
			||||||
@@ -170,7 +170,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("Invalid HTTP method [%s]",
 | 
					                    ogs_error("Invalid HTTP method [%s]",
 | 
				
			||||||
                            sbi_message.h.method);
 | 
					                            sbi_message.h.method);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					                            OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
                            &sbi_message,
 | 
					                            &sbi_message,
 | 
				
			||||||
                            "Invalid HTTP method", sbi_message.h.method);
 | 
					                            "Invalid HTTP method", sbi_message.h.method);
 | 
				
			||||||
@@ -180,7 +180,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("Invalid resource name [%s]",
 | 
					                ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                        sbi_message.h.resource.component[0]);
 | 
					                        sbi_message.h.resource.component[0]);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
				
			||||||
                        "Invalid resource name",
 | 
					                        "Invalid resource name",
 | 
				
			||||||
                        sbi_message.h.resource.component[0]);
 | 
					                        sbi_message.h.resource.component[0]);
 | 
				
			||||||
@@ -195,9 +195,9 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
                    SWITCH(sbi_message.h.method)
 | 
					                    SWITCH(sbi_message.h.method)
 | 
				
			||||||
                    CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
					                    CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
				
			||||||
                        rv = amf_namf_comm_handle_n1_n2_message_transfer(
 | 
					                        rv = amf_namf_comm_handle_n1_n2_message_transfer(
 | 
				
			||||||
                                session, &sbi_message);
 | 
					                                stream, &sbi_message);
 | 
				
			||||||
                        if (rv != OGS_OK) {
 | 
					                        if (rv != OGS_OK) {
 | 
				
			||||||
                            ogs_sbi_server_send_error(session,
 | 
					                            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                                OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
					                                OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
				
			||||||
                                "No N1N2MessageTransferReqData", NULL);
 | 
					                                "No N1N2MessageTransferReqData", NULL);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
@@ -206,7 +206,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
                    DEFAULT
 | 
					                    DEFAULT
 | 
				
			||||||
                        ogs_error("Invalid HTTP method [%s]",
 | 
					                        ogs_error("Invalid HTTP method [%s]",
 | 
				
			||||||
                                sbi_message.h.method);
 | 
					                                sbi_message.h.method);
 | 
				
			||||||
                        ogs_sbi_server_send_error(session,
 | 
					                        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                                OGS_SBI_HTTP_STATUS_FORBIDDEN, &sbi_message,
 | 
					                                OGS_SBI_HTTP_STATUS_FORBIDDEN, &sbi_message,
 | 
				
			||||||
                                "Invalid HTTP method", sbi_message.h.method);
 | 
					                                "Invalid HTTP method", sbi_message.h.method);
 | 
				
			||||||
                    END
 | 
					                    END
 | 
				
			||||||
@@ -215,7 +215,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("Invalid resource name [%s]",
 | 
					                    ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                            sbi_message.h.resource.component[2]);
 | 
					                            sbi_message.h.resource.component[2]);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
					                            OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
				
			||||||
                            "Invalid resource name",
 | 
					                            "Invalid resource name",
 | 
				
			||||||
                            sbi_message.h.resource.component[2]);
 | 
					                            sbi_message.h.resource.component[2]);
 | 
				
			||||||
@@ -225,7 +225,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("Invalid resource name [%s]",
 | 
					                ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                        sbi_message.h.resource.component[0]);
 | 
					                        sbi_message.h.resource.component[0]);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
				
			||||||
                        "Invalid resource name",
 | 
					                        "Invalid resource name",
 | 
				
			||||||
                        sbi_message.h.resource.component[0]);
 | 
					                        sbi_message.h.resource.component[0]);
 | 
				
			||||||
@@ -236,13 +236,13 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
            SWITCH(sbi_message.h.resource.component[1])
 | 
					            SWITCH(sbi_message.h.resource.component[1])
 | 
				
			||||||
            CASE(OGS_SBI_RESOURCE_NAME_SM_CONTEXT_STATUS)
 | 
					            CASE(OGS_SBI_RESOURCE_NAME_SM_CONTEXT_STATUS)
 | 
				
			||||||
                amf_namf_callback_handle_sm_context_status(
 | 
					                amf_namf_callback_handle_sm_context_status(
 | 
				
			||||||
                        session, &sbi_message);
 | 
					                        stream, &sbi_message);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("Invalid resource name [%s]",
 | 
					                ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                        sbi_message.h.resource.component[1]);
 | 
					                        sbi_message.h.resource.component[1]);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
				
			||||||
                        "Invalid resource name",
 | 
					                        "Invalid resource name",
 | 
				
			||||||
                        sbi_message.h.resource.component[1]);
 | 
					                        sbi_message.h.resource.component[1]);
 | 
				
			||||||
@@ -251,7 +251,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("Invalid API name [%s]", sbi_message.h.service.name);
 | 
					            ogs_error("Invalid API name [%s]", sbi_message.h.service.name);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
				
			||||||
                    "Invalid API name", sbi_message.h.resource.component[0]);
 | 
					                    "Invalid API name", sbi_message.h.resource.component[0]);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,8 +26,6 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct ogs_sbi_server_s ogs_sbi_server_t;
 | 
					 | 
				
			||||||
typedef struct ogs_sbi_session_s ogs_sbi_session_t;
 | 
					 | 
				
			||||||
typedef struct ogs_sbi_request_s ogs_sbi_request_t;
 | 
					typedef struct ogs_sbi_request_s ogs_sbi_request_t;
 | 
				
			||||||
typedef struct ogs_sbi_response_s ogs_sbi_response_t;
 | 
					typedef struct ogs_sbi_response_s ogs_sbi_response_t;
 | 
				
			||||||
typedef struct ogs_sbi_message_s ogs_sbi_message_t;
 | 
					typedef struct ogs_sbi_message_s ogs_sbi_message_t;
 | 
				
			||||||
@@ -72,12 +70,7 @@ typedef struct amf_event_s {
 | 
				
			|||||||
    int timer_id;
 | 
					    int timer_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct {
 | 
					    struct {
 | 
				
			||||||
        /* OGS_EVT_SBI_SERVER */
 | 
					 | 
				
			||||||
        ogs_sbi_request_t *request;
 | 
					        ogs_sbi_request_t *request;
 | 
				
			||||||
        ogs_sbi_session_t *session;
 | 
					 | 
				
			||||||
        ogs_sbi_server_t *server;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /* OGS_EVT_SBI_CLIENT */
 | 
					 | 
				
			||||||
        ogs_sbi_response_t *response;
 | 
					        ogs_sbi_response_t *response;
 | 
				
			||||||
        void *data;
 | 
					        void *data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,7 @@
 | 
				
			|||||||
#include "sbi-path.h"
 | 
					#include "sbi-path.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int amf_namf_comm_handle_n1_n2_message_transfer(
 | 
					int amf_namf_comm_handle_n1_n2_message_transfer(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int status;
 | 
					    int status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -53,7 +53,7 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
 | 
				
			|||||||
    OpenAPI_n2_info_content_t *n2InfoContent = NULL;
 | 
					    OpenAPI_n2_info_content_t *n2InfoContent = NULL;
 | 
				
			||||||
    OpenAPI_ref_to_binary_data_t *ngapData = NULL;
 | 
					    OpenAPI_ref_to_binary_data_t *ngapData = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    N1N2MessageTransferReqData = recvmsg->N1N2MessageTransferReqData;
 | 
					    N1N2MessageTransferReqData = recvmsg->N1N2MessageTransferReqData;
 | 
				
			||||||
@@ -186,13 +186,13 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(&sendmsg, status);
 | 
					    response = ogs_sbi_build_response(&sendmsg, status);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return OGS_OK;
 | 
					    return OGS_OK;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int amf_namf_callback_handle_sm_context_status(
 | 
					int amf_namf_callback_handle_sm_context_status(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int status = OGS_SBI_HTTP_STATUS_NO_CONTENT;
 | 
					    int status = OGS_SBI_HTTP_STATUS_NO_CONTENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -207,7 +207,7 @@ int amf_namf_callback_handle_sm_context_status(
 | 
				
			|||||||
    OpenAPI_sm_context_status_notification_t *SmContextStatusNotification;
 | 
					    OpenAPI_sm_context_status_notification_t *SmContextStatusNotification;
 | 
				
			||||||
    OpenAPI_status_info_t *StatusInfo;
 | 
					    OpenAPI_status_info_t *StatusInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!recvmsg->h.resource.component[0]) {
 | 
					    if (!recvmsg->h.resource.component[0]) {
 | 
				
			||||||
@@ -286,7 +286,7 @@ cleanup:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(&sendmsg, status);
 | 
					    response = ogs_sbi_build_response(&sendmsg, status);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return OGS_OK;
 | 
					    return OGS_OK;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,9 +27,9 @@ extern "C" {
 | 
				
			|||||||
#include "context.h"
 | 
					#include "context.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int amf_namf_comm_handle_n1_n2_message_transfer(
 | 
					int amf_namf_comm_handle_n1_n2_message_transfer(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
 | 
				
			||||||
int amf_namf_callback_handle_sm_context_status(
 | 
					int amf_namf_callback_handle_sm_context_status(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -155,7 +155,7 @@ void amf_nf_state_will_register(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
        case AMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
					        case AMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
				
			||||||
            client = nf_instance->client;
 | 
					            client = nf_instance->client;
 | 
				
			||||||
            ogs_assert(client);
 | 
					            ogs_assert(client);
 | 
				
			||||||
            addr = client->addr;
 | 
					            addr = client->node.addr;
 | 
				
			||||||
            ogs_assert(addr);
 | 
					            ogs_assert(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
					            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
				
			||||||
@@ -362,7 +362,7 @@ void amf_nf_state_exception(ogs_fsm_t *s, amf_event_t *e)
 | 
				
			|||||||
        case AMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
					        case AMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
				
			||||||
            client = nf_instance->client;
 | 
					            client = nf_instance->client;
 | 
				
			||||||
            ogs_assert(client);
 | 
					            ogs_assert(client);
 | 
				
			||||||
            addr = client->addr;
 | 
					            addr = client->node.addr;
 | 
				
			||||||
            ogs_assert(addr);
 | 
					            ogs_assert(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
					            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -91,7 +91,7 @@ void amf_nnrf_handle_nf_status_subscribe(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool amf_nnrf_handle_nf_status_notify(
 | 
					bool amf_nnrf_handle_nf_status_notify(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
    OpenAPI_notification_data_t *NotificationData = NULL;
 | 
					    OpenAPI_notification_data_t *NotificationData = NULL;
 | 
				
			||||||
@@ -99,13 +99,13 @@ bool amf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
    bool handled;
 | 
					    bool handled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    NotificationData = message->NotificationData;
 | 
					    NotificationData = message->NotificationData;
 | 
				
			||||||
    if (!NotificationData) {
 | 
					    if (!NotificationData) {
 | 
				
			||||||
        ogs_error("No NotificationData");
 | 
					        ogs_error("No NotificationData");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NotificationData", NULL);
 | 
					                message, "No NotificationData", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -113,21 +113,21 @@ bool amf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    NFProfile = NotificationData->nf_profile;
 | 
					    NFProfile = NotificationData->nf_profile;
 | 
				
			||||||
    if (!NFProfile) {
 | 
					    if (!NFProfile) {
 | 
				
			||||||
        ogs_error("No NFProfile");
 | 
					        ogs_error("No NFProfile");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", NULL);
 | 
					                message, "No NFProfile", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile->nf_instance_id) {
 | 
					    if (!NFProfile->nf_instance_id) {
 | 
				
			||||||
        ogs_error("No NFProfile.NFInstanceId");
 | 
					        ogs_error("No NFProfile.NFInstanceId");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", "NFInstanceId");
 | 
					                message, "No NFProfile", "NFInstanceId");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile->nf_instance_id) {
 | 
					    if (!NFProfile->nf_instance_id) {
 | 
				
			||||||
        ogs_error("No NFProfile.NFInstanceId");
 | 
					        ogs_error("No NFProfile.NFInstanceId");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", "NFInstanceId");
 | 
					                message, "No NFProfile", "NFInstanceId");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -135,7 +135,7 @@ bool amf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
 | 
					    if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
 | 
				
			||||||
        ogs_warn("[%s] The notification is not allowed",
 | 
					        ogs_warn("[%s] The notification is not allowed",
 | 
				
			||||||
                NFProfile->nf_instance_id);
 | 
					                NFProfile->nf_instance_id);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
                message, "The notification is not allowed",
 | 
					                message, "The notification is not allowed",
 | 
				
			||||||
                NFProfile->nf_instance_id);
 | 
					                NFProfile->nf_instance_id);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -161,7 +161,7 @@ bool amf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        handled = ogs_sbi_nnrf_handle_nf_profile(
 | 
					        handled = ogs_sbi_nnrf_handle_nf_profile(
 | 
				
			||||||
                    nf_instance, NFProfile, session, message);
 | 
					                    nf_instance, NFProfile, stream, message);
 | 
				
			||||||
        if (!handled) {
 | 
					        if (!handled) {
 | 
				
			||||||
            AMF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            AMF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -172,7 +172,7 @@ bool amf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
        handled = ogs_sbi_client_associate(nf_instance);
 | 
					        handled = ogs_sbi_client_associate(nf_instance);
 | 
				
			||||||
        if (!handled) {
 | 
					        if (!handled) {
 | 
				
			||||||
            ogs_error("[%s] Cannot associate NF EndPoint", nf_instance->id);
 | 
					            ogs_error("[%s] Cannot associate NF EndPoint", nf_instance->id);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    message, "Cannot find NF EndPoint", nf_instance->id);
 | 
					                    message, "Cannot find NF EndPoint", nf_instance->id);
 | 
				
			||||||
            AMF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            AMF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
@@ -186,7 +186,7 @@ bool amf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
            AMF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            AMF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            ogs_warn("[%s] (NRF-notify) Not found", NFProfile->nf_instance_id);
 | 
					            ogs_warn("[%s] (NRF-notify) Not found", NFProfile->nf_instance_id);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                message, "Not found", message->h.resource.component[1]);
 | 
					                message, "Not found", message->h.resource.component[1]);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -196,7 +196,7 @@ bool amf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
                            NotificationData->event);
 | 
					                            NotificationData->event);
 | 
				
			||||||
        ogs_error("Not supported event [%d:%s]",
 | 
					        ogs_error("Not supported event [%d:%s]",
 | 
				
			||||||
                NotificationData->event, eventstr ? eventstr : "Unknown");
 | 
					                NotificationData->event, eventstr ? eventstr : "Unknown");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "Not supported event",
 | 
					                message, "Not supported event",
 | 
				
			||||||
                eventstr ? eventstr : "Unknown");
 | 
					                eventstr ? eventstr : "Unknown");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -204,7 +204,7 @@ bool amf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					    response = ogs_sbi_build_response(message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ void amf_nnrf_handle_nf_status_subscribe(
 | 
				
			|||||||
        ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool amf_nnrf_handle_nf_status_notify(
 | 
					bool amf_nnrf_handle_nf_status_notify(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void amf_nnrf_handle_nf_discover(
 | 
					void amf_nnrf_handle_nf_discover(
 | 
				
			||||||
        ogs_sbi_xact_t *xact, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_xact_t *xact, ogs_sbi_message_t *message);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,21 +22,19 @@
 | 
				
			|||||||
#include "nausf-build.h"
 | 
					#include "nausf-build.h"
 | 
				
			||||||
#include "nudm-build.h"
 | 
					#include "nudm-build.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int server_cb(ogs_sbi_server_t *server,
 | 
					static int server_cb(ogs_sbi_request_t *request, void *data)
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_request_t *request)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    amf_event_t *e = NULL;
 | 
					    amf_event_t *e = NULL;
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					 | 
				
			||||||
    ogs_assert(request);
 | 
					    ogs_assert(request);
 | 
				
			||||||
 | 
					    ogs_assert(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    e = amf_event_new(AMF_EVT_SBI_SERVER);
 | 
					    e = amf_event_new(AMF_EVT_SBI_SERVER);
 | 
				
			||||||
    ogs_assert(e);
 | 
					    ogs_assert(e);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    e->sbi.server = server;
 | 
					 | 
				
			||||||
    e->sbi.session = session;
 | 
					 | 
				
			||||||
    e->sbi.request = request;
 | 
					    e->sbi.request = request;
 | 
				
			||||||
 | 
					    e->sbi.data = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
					    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
				
			||||||
    if (rv != OGS_OK) {
 | 
					    if (rv != OGS_OK) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,7 +38,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
    ogs_sbi_request_t *request = NULL;
 | 
					    ogs_sbi_request_t *request = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
@@ -69,21 +69,21 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
    case AUSF_EVT_SBI_SERVER:
 | 
					    case AUSF_EVT_SBI_SERVER:
 | 
				
			||||||
        request = e->sbi.request;
 | 
					        request = e->sbi.request;
 | 
				
			||||||
        ogs_assert(request);
 | 
					        ogs_assert(request);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        rv = ogs_sbi_parse_request(&message, request);
 | 
					        rv = ogs_sbi_parse_request(&message, request);
 | 
				
			||||||
        if (rv != OGS_OK) {
 | 
					        if (rv != OGS_OK) {
 | 
				
			||||||
            /* 'message' buffer is released in ogs_sbi_parse_request() */
 | 
					            /* 'message' buffer is released in ogs_sbi_parse_request() */
 | 
				
			||||||
            ogs_error("cannot parse HTTP message");
 | 
					            ogs_error("cannot parse HTTP message");
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    NULL, "cannot parse HTTP message", NULL);
 | 
					                    NULL, "cannot parse HTTP message", NULL);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (strcmp(message.h.api.version, OGS_SBI_API_V1) != 0) {
 | 
					        if (strcmp(message.h.api.version, OGS_SBI_API_V1) != 0) {
 | 
				
			||||||
            ogs_error("Not supported version [%s]", message.h.api.version);
 | 
					            ogs_error("Not supported version [%s]", message.h.api.version);
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    &message, "Not supported version", NULL);
 | 
					                    &message, "Not supported version", NULL);
 | 
				
			||||||
            ogs_sbi_message_free(&message);
 | 
					            ogs_sbi_message_free(&message);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
@@ -96,13 +96,13 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
            CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY)
 | 
					            CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY)
 | 
				
			||||||
                SWITCH(message.h.method)
 | 
					                SWITCH(message.h.method)
 | 
				
			||||||
                CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
					                CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
				
			||||||
                    ausf_nnrf_handle_nf_status_notify(session, &message);
 | 
					                    ausf_nnrf_handle_nf_status_notify(stream, &message);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("Invalid HTTP method [%s]",
 | 
					                    ogs_error("Invalid HTTP method [%s]",
 | 
				
			||||||
                            message.h.method);
 | 
					                            message.h.method);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					                            OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
                            &message,
 | 
					                            &message,
 | 
				
			||||||
                            "Invalid HTTP method", message.h.method);
 | 
					                            "Invalid HTTP method", message.h.method);
 | 
				
			||||||
@@ -112,7 +112,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("Invalid resource name [%s]",
 | 
					                ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                        message.h.resource.component[0]);
 | 
					                        message.h.resource.component[0]);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
				
			||||||
                        "Unknown resource name",
 | 
					                        "Unknown resource name",
 | 
				
			||||||
                        message.h.resource.component[0]);
 | 
					                        message.h.resource.component[0]);
 | 
				
			||||||
@@ -144,7 +144,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (!ausf_ue) {
 | 
					            if (!ausf_ue) {
 | 
				
			||||||
                ogs_error("Not found [%s]", message.h.method);
 | 
					                ogs_error("Not found [%s]", message.h.method);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					                    OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                    &message, "Not found", message.h.method);
 | 
					                    &message, "Not found", message.h.method);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
@@ -163,7 +163,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("Invalid API name [%s]", message.h.service.name);
 | 
					            ogs_error("Invalid API name [%s]", message.h.service.name);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
				
			||||||
                    "Invalid API name", message.h.resource.component[0]);
 | 
					                    "Invalid API name", message.h.resource.component[0]);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
@@ -285,7 +285,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            e->ausf_ue = ausf_ue;
 | 
					            e->ausf_ue = ausf_ue;
 | 
				
			||||||
            e->sbi.message = &message;
 | 
					            e->sbi.message = &message;
 | 
				
			||||||
            e->sbi.session = sbi_xact->assoc_session;
 | 
					            e->sbi.data = sbi_xact->assoc_stream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_sbi_xact_remove(sbi_xact);
 | 
					            ogs_sbi_xact_remove(sbi_xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -338,13 +338,13 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
            sbi_xact = e->sbi.data;
 | 
					            sbi_xact = e->sbi.data;
 | 
				
			||||||
            ogs_assert(sbi_xact);
 | 
					            ogs_assert(sbi_xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            session = sbi_xact->assoc_session;
 | 
					            stream = sbi_xact->assoc_stream;
 | 
				
			||||||
            ogs_assert(session);
 | 
					            ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_sbi_xact_remove(sbi_xact);
 | 
					            ogs_sbi_xact_remove(sbi_xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_error("Cannot receive SBI message");
 | 
					            ogs_error("Cannot receive SBI message");
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
 | 
					                    OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
 | 
				
			||||||
                    "Cannot receive SBI message", NULL);
 | 
					                    "Cannot receive SBI message", NULL);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,8 +26,6 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct ogs_sbi_server_s ogs_sbi_server_t;
 | 
					 | 
				
			||||||
typedef struct ogs_sbi_session_s ogs_sbi_session_t;
 | 
					 | 
				
			||||||
typedef struct ogs_sbi_request_s ogs_sbi_request_t;
 | 
					typedef struct ogs_sbi_request_s ogs_sbi_request_t;
 | 
				
			||||||
typedef struct ogs_sbi_response_s ogs_sbi_response_t;
 | 
					typedef struct ogs_sbi_response_s ogs_sbi_response_t;
 | 
				
			||||||
typedef struct ogs_sbi_message_s ogs_sbi_message_t;
 | 
					typedef struct ogs_sbi_message_s ogs_sbi_message_t;
 | 
				
			||||||
@@ -52,12 +50,7 @@ typedef struct ausf_event_s {
 | 
				
			|||||||
    int timer_id;
 | 
					    int timer_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct {
 | 
					    struct {
 | 
				
			||||||
        /* OGS_EVT_SBI_SERVER */
 | 
					 | 
				
			||||||
        ogs_sbi_request_t *request;
 | 
					        ogs_sbi_request_t *request;
 | 
				
			||||||
        ogs_sbi_session_t *session;
 | 
					 | 
				
			||||||
        ogs_sbi_server_t *server;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /* OGS_EVT_SBI_CLIENT */
 | 
					 | 
				
			||||||
        ogs_sbi_response_t *response;
 | 
					        ogs_sbi_response_t *response;
 | 
				
			||||||
        void *data;
 | 
					        void *data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,19 +22,19 @@
 | 
				
			|||||||
#include "nausf-handler.h"
 | 
					#include "nausf-handler.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ausf_nausf_auth_handle_authenticate(ausf_ue_t *ausf_ue,
 | 
					bool ausf_nausf_auth_handle_authenticate(ausf_ue_t *ausf_ue,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    OpenAPI_authentication_info_t *AuthenticationInfo = NULL;
 | 
					    OpenAPI_authentication_info_t *AuthenticationInfo = NULL;
 | 
				
			||||||
    char *serving_network_name = NULL;
 | 
					    char *serving_network_name = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(ausf_ue);
 | 
					    ogs_assert(ausf_ue);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    AuthenticationInfo = recvmsg->AuthenticationInfo;
 | 
					    AuthenticationInfo = recvmsg->AuthenticationInfo;
 | 
				
			||||||
    if (!AuthenticationInfo) {
 | 
					    if (!AuthenticationInfo) {
 | 
				
			||||||
        ogs_error("[%s] No AuthenticationInfo", ausf_ue->suci);
 | 
					        ogs_error("[%s] No AuthenticationInfo", ausf_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "[%s] No AuthenticationInfo", ausf_ue->suci);
 | 
					                recvmsg, "[%s] No AuthenticationInfo", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -42,7 +42,7 @@ bool ausf_nausf_auth_handle_authenticate(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
    serving_network_name = AuthenticationInfo->serving_network_name;
 | 
					    serving_network_name = AuthenticationInfo->serving_network_name;
 | 
				
			||||||
    if (!serving_network_name) {
 | 
					    if (!serving_network_name) {
 | 
				
			||||||
        ogs_error("[%s] No servingNetworkName", ausf_ue->suci);
 | 
					        ogs_error("[%s] No servingNetworkName", ausf_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "[%s] No servingNetworkName", ausf_ue->suci);
 | 
					                recvmsg, "[%s] No servingNetworkName", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -51,7 +51,7 @@ bool ausf_nausf_auth_handle_authenticate(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
        ogs_free(ausf_ue->serving_network_name);
 | 
					        ogs_free(ausf_ue->serving_network_name);
 | 
				
			||||||
    ausf_ue->serving_network_name = ogs_strdup(serving_network_name);
 | 
					    ausf_ue->serving_network_name = ogs_strdup(serving_network_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ausf_sbi_discover_and_send(OpenAPI_nf_type_UDM, ausf_ue, session,
 | 
					    ausf_sbi_discover_and_send(OpenAPI_nf_type_UDM, ausf_ue, stream,
 | 
				
			||||||
            AuthenticationInfo->resynchronization_info,
 | 
					            AuthenticationInfo->resynchronization_info,
 | 
				
			||||||
            ausf_nudm_ueau_build_get);
 | 
					            ausf_nudm_ueau_build_get);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -59,20 +59,20 @@ bool ausf_nausf_auth_handle_authenticate(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ausf_nausf_auth_handle_authenticate_confirmation(ausf_ue_t *ausf_ue,
 | 
					bool ausf_nausf_auth_handle_authenticate_confirmation(ausf_ue_t *ausf_ue,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    OpenAPI_confirmation_data_t *ConfirmationData = NULL;
 | 
					    OpenAPI_confirmation_data_t *ConfirmationData = NULL;
 | 
				
			||||||
    char *res_star_string = NULL;
 | 
					    char *res_star_string = NULL;
 | 
				
			||||||
    uint8_t res_star[OGS_KEYSTRLEN(OGS_MAX_RES_LEN)];
 | 
					    uint8_t res_star[OGS_KEYSTRLEN(OGS_MAX_RES_LEN)];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(ausf_ue);
 | 
					    ogs_assert(ausf_ue);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ConfirmationData = recvmsg->ConfirmationData;
 | 
					    ConfirmationData = recvmsg->ConfirmationData;
 | 
				
			||||||
    if (!ConfirmationData) {
 | 
					    if (!ConfirmationData) {
 | 
				
			||||||
        ogs_error("[%s] No ConfirmationData", ausf_ue->suci);
 | 
					        ogs_error("[%s] No ConfirmationData", ausf_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "[%s] No ConfirmationData", ausf_ue->suci);
 | 
					                recvmsg, "[%s] No ConfirmationData", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -80,7 +80,7 @@ bool ausf_nausf_auth_handle_authenticate_confirmation(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
    res_star_string = ConfirmationData->res_star;
 | 
					    res_star_string = ConfirmationData->res_star;
 | 
				
			||||||
    if (!res_star_string) {
 | 
					    if (!res_star_string) {
 | 
				
			||||||
        ogs_error("[%s] No ConfirmationData.resStar", ausf_ue->suci);
 | 
					        ogs_error("[%s] No ConfirmationData.resStar", ausf_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "[%s] No ConfirmationData.resStar", ausf_ue->suci);
 | 
					                recvmsg, "[%s] No ConfirmationData.resStar", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -97,7 +97,7 @@ bool ausf_nausf_auth_handle_authenticate_confirmation(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
        ausf_ue->auth_result = OpenAPI_auth_result_AUTHENTICATION_SUCCESS;
 | 
					        ausf_ue->auth_result = OpenAPI_auth_result_AUTHENTICATION_SUCCESS;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ausf_sbi_discover_and_send(OpenAPI_nf_type_UDM, ausf_ue, session, NULL,
 | 
					    ausf_sbi_discover_and_send(OpenAPI_nf_type_UDM, ausf_ue, stream, NULL,
 | 
				
			||||||
            ausf_nudm_ueau_build_result_confirmation_inform);
 | 
					            ausf_nudm_ueau_build_result_confirmation_inform);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,9 +27,9 @@ extern "C" {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ausf_nausf_auth_handle_authenticate(ausf_ue_t *ausf_ue,
 | 
					bool ausf_nausf_auth_handle_authenticate(ausf_ue_t *ausf_ue,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
 | 
				
			||||||
bool ausf_nausf_auth_handle_authenticate_confirmation(ausf_ue_t *ausf_ue,
 | 
					bool ausf_nausf_auth_handle_authenticate_confirmation(ausf_ue_t *ausf_ue,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -155,7 +155,7 @@ void ausf_nf_state_will_register(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
        case AUSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
					        case AUSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
				
			||||||
            client = nf_instance->client;
 | 
					            client = nf_instance->client;
 | 
				
			||||||
            ogs_assert(client);
 | 
					            ogs_assert(client);
 | 
				
			||||||
            addr = client->addr;
 | 
					            addr = client->node.addr;
 | 
				
			||||||
            ogs_assert(addr);
 | 
					            ogs_assert(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
					            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
				
			||||||
@@ -364,7 +364,7 @@ void ausf_nf_state_exception(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
        case AUSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
					        case AUSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
				
			||||||
            client = nf_instance->client;
 | 
					            client = nf_instance->client;
 | 
				
			||||||
            ogs_assert(client);
 | 
					            ogs_assert(client);
 | 
				
			||||||
            addr = client->addr;
 | 
					            addr = client->node.addr;
 | 
				
			||||||
            ogs_assert(addr);
 | 
					            ogs_assert(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
					            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -89,7 +89,7 @@ void ausf_nnrf_handle_nf_status_subscribe(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ausf_nnrf_handle_nf_status_notify(
 | 
					bool ausf_nnrf_handle_nf_status_notify(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
    OpenAPI_notification_data_t *NotificationData = NULL;
 | 
					    OpenAPI_notification_data_t *NotificationData = NULL;
 | 
				
			||||||
@@ -97,13 +97,13 @@ bool ausf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
    bool handled;
 | 
					    bool handled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    NotificationData = message->NotificationData;
 | 
					    NotificationData = message->NotificationData;
 | 
				
			||||||
    if (!NotificationData) {
 | 
					    if (!NotificationData) {
 | 
				
			||||||
        ogs_error("No NotificationData");
 | 
					        ogs_error("No NotificationData");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NotificationData", NULL);
 | 
					                message, "No NotificationData", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -111,21 +111,21 @@ bool ausf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    NFProfile = NotificationData->nf_profile;
 | 
					    NFProfile = NotificationData->nf_profile;
 | 
				
			||||||
    if (!NFProfile) {
 | 
					    if (!NFProfile) {
 | 
				
			||||||
        ogs_error("No NFProfile");
 | 
					        ogs_error("No NFProfile");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", NULL);
 | 
					                message, "No NFProfile", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile->nf_instance_id) {
 | 
					    if (!NFProfile->nf_instance_id) {
 | 
				
			||||||
        ogs_error("No NFProfile.NFInstanceId");
 | 
					        ogs_error("No NFProfile.NFInstanceId");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", "NFInstanceId");
 | 
					                message, "No NFProfile", "NFInstanceId");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile->nf_instance_id) {
 | 
					    if (!NFProfile->nf_instance_id) {
 | 
				
			||||||
        ogs_error("No NFProfile.NFInstanceId");
 | 
					        ogs_error("No NFProfile.NFInstanceId");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", "NFInstanceId");
 | 
					                message, "No NFProfile", "NFInstanceId");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -133,7 +133,7 @@ bool ausf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
 | 
					    if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
 | 
				
			||||||
        ogs_warn("The notification is not allowed [%s]",
 | 
					        ogs_warn("The notification is not allowed [%s]",
 | 
				
			||||||
                NFProfile->nf_instance_id);
 | 
					                NFProfile->nf_instance_id);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
                message, "The notification is not allowed",
 | 
					                message, "The notification is not allowed",
 | 
				
			||||||
                NFProfile->nf_instance_id);
 | 
					                NFProfile->nf_instance_id);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -159,7 +159,7 @@ bool ausf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        handled = ogs_sbi_nnrf_handle_nf_profile(
 | 
					        handled = ogs_sbi_nnrf_handle_nf_profile(
 | 
				
			||||||
                    nf_instance, NFProfile, session, message);
 | 
					                    nf_instance, NFProfile, stream, message);
 | 
				
			||||||
        if (!handled) {
 | 
					        if (!handled) {
 | 
				
			||||||
            AUSF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            AUSF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -170,7 +170,7 @@ bool ausf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
        handled = ogs_sbi_client_associate(nf_instance);
 | 
					        handled = ogs_sbi_client_associate(nf_instance);
 | 
				
			||||||
        if (!handled) {
 | 
					        if (!handled) {
 | 
				
			||||||
            ogs_error("[%s] Cannot associate NF EndPoint", nf_instance->id);
 | 
					            ogs_error("[%s] Cannot associate NF EndPoint", nf_instance->id);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    message, "Cannot find NF EndPoint", nf_instance->id);
 | 
					                    message, "Cannot find NF EndPoint", nf_instance->id);
 | 
				
			||||||
            AUSF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            AUSF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
@@ -184,7 +184,7 @@ bool ausf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
            AUSF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            AUSF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            ogs_warn("[%s] (NRF-notify) Not found", NFProfile->nf_instance_id);
 | 
					            ogs_warn("[%s] (NRF-notify) Not found", NFProfile->nf_instance_id);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                message, "Not found", message->h.resource.component[1]);
 | 
					                message, "Not found", message->h.resource.component[1]);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -194,7 +194,7 @@ bool ausf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
                            NotificationData->event);
 | 
					                            NotificationData->event);
 | 
				
			||||||
        ogs_error("Not supported event [%d:%s]",
 | 
					        ogs_error("Not supported event [%d:%s]",
 | 
				
			||||||
                NotificationData->event, eventstr ? eventstr : "Unknown");
 | 
					                NotificationData->event, eventstr ? eventstr : "Unknown");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "Not supported event",
 | 
					                message, "Not supported event",
 | 
				
			||||||
                eventstr ? eventstr : "Unknown");
 | 
					                eventstr ? eventstr : "Unknown");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -202,7 +202,7 @@ bool ausf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					    response = ogs_sbi_build_response(message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -212,7 +212,7 @@ void ausf_nnrf_handle_nf_discover(
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_object_t *sbi_object = NULL;
 | 
					    ogs_sbi_object_t *sbi_object = NULL;
 | 
				
			||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    OpenAPI_search_result_t *SearchResult = NULL;
 | 
					    OpenAPI_search_result_t *SearchResult = NULL;
 | 
				
			||||||
    OpenAPI_lnode_t *node = NULL;
 | 
					    OpenAPI_lnode_t *node = NULL;
 | 
				
			||||||
@@ -221,8 +221,8 @@ void ausf_nnrf_handle_nf_discover(
 | 
				
			|||||||
    ogs_assert(xact);
 | 
					    ogs_assert(xact);
 | 
				
			||||||
    sbi_object = xact->sbi_object;
 | 
					    sbi_object = xact->sbi_object;
 | 
				
			||||||
    ogs_assert(sbi_object);
 | 
					    ogs_assert(sbi_object);
 | 
				
			||||||
    session = xact->assoc_session;
 | 
					    stream = xact->assoc_stream;
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SearchResult = message->SearchResult;
 | 
					    SearchResult = message->SearchResult;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ void ausf_nnrf_handle_nf_status_subscribe(
 | 
				
			|||||||
        ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ausf_nnrf_handle_nf_status_notify(
 | 
					bool ausf_nnrf_handle_nf_status_notify(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ausf_nnrf_handle_nf_discover(
 | 
					void ausf_nnrf_handle_nf_discover(
 | 
				
			||||||
        ogs_sbi_xact_t *xact, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_xact_t *xact, ogs_sbi_message_t *message);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,7 +33,7 @@ static const char *links_member_name(OpenAPI_auth_type_e auth_type)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
					bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_server_t *server = NULL;
 | 
					    ogs_sbi_server_t *server = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -51,8 +51,8 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
    OpenAPI_links_value_schema_t LinksValueSchemeValue;
 | 
					    OpenAPI_links_value_schema_t LinksValueSchemeValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(ausf_ue);
 | 
					    ogs_assert(ausf_ue);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    server = ogs_sbi_session_get_server(session);
 | 
					    server = ogs_sbi_server_from_stream(stream);
 | 
				
			||||||
    ogs_assert(server);
 | 
					    ogs_assert(server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
@@ -60,7 +60,7 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
    AuthenticationInfoResult = recvmsg->AuthenticationInfoResult;
 | 
					    AuthenticationInfoResult = recvmsg->AuthenticationInfoResult;
 | 
				
			||||||
    if (!AuthenticationInfoResult) {
 | 
					    if (!AuthenticationInfoResult) {
 | 
				
			||||||
        ogs_error("[%s] No AuthenticationInfoResult", ausf_ue->suci);
 | 
					        ogs_error("[%s] No AuthenticationInfoResult", ausf_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					                OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
                recvmsg, "No AuthenticationInfoResult", ausf_ue->suci);
 | 
					                recvmsg, "No AuthenticationInfoResult", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -70,7 +70,7 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
            OpenAPI_auth_type_5G_AKA) {
 | 
					            OpenAPI_auth_type_5G_AKA) {
 | 
				
			||||||
        ogs_error("[%s] Not supported Auth Method [%d]",
 | 
					        ogs_error("[%s] Not supported Auth Method [%d]",
 | 
				
			||||||
            ausf_ue->suci, AuthenticationInfoResult->auth_type);
 | 
					            ausf_ue->suci, AuthenticationInfoResult->auth_type);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
            OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					            OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
            recvmsg, "Not supported Auth Method", ausf_ue->suci);
 | 
					            recvmsg, "Not supported Auth Method", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -80,7 +80,7 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
        AuthenticationInfoResult->authentication_vector;
 | 
					        AuthenticationInfoResult->authentication_vector;
 | 
				
			||||||
    if (!AuthenticationVector) {
 | 
					    if (!AuthenticationVector) {
 | 
				
			||||||
        ogs_error("[%s] No AuthenticationVector", ausf_ue->suci);
 | 
					        ogs_error("[%s] No AuthenticationVector", ausf_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
            OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					            OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
            recvmsg, "No AuthenticationVector", ausf_ue->suci);
 | 
					            recvmsg, "No AuthenticationVector", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -89,7 +89,7 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
    if (AuthenticationVector->av_type != OpenAPI_av_type_5G_HE_AKA) {
 | 
					    if (AuthenticationVector->av_type != OpenAPI_av_type_5G_HE_AKA) {
 | 
				
			||||||
        ogs_error("[%s] Not supported Auth Method [%d]",
 | 
					        ogs_error("[%s] Not supported Auth Method [%d]",
 | 
				
			||||||
            ausf_ue->suci, AuthenticationVector->av_type);
 | 
					            ausf_ue->suci, AuthenticationVector->av_type);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
            OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					            OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
            recvmsg, "Not supported Auth Method", ausf_ue->suci);
 | 
					            recvmsg, "Not supported Auth Method", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -97,7 +97,7 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (!AuthenticationVector->rand) {
 | 
					    if (!AuthenticationVector->rand) {
 | 
				
			||||||
        ogs_error("[%s] No AuthenticationVector.rand", ausf_ue->suci);
 | 
					        ogs_error("[%s] No AuthenticationVector.rand", ausf_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
            OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					            OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
            recvmsg, "No AuthenticationVector.rand", ausf_ue->suci);
 | 
					            recvmsg, "No AuthenticationVector.rand", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -106,7 +106,7 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
    if (!AuthenticationVector->xres_star) {
 | 
					    if (!AuthenticationVector->xres_star) {
 | 
				
			||||||
        ogs_error("[%s] No AuthenticationVector.xresStar",
 | 
					        ogs_error("[%s] No AuthenticationVector.xresStar",
 | 
				
			||||||
                ausf_ue->suci);
 | 
					                ausf_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
            OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					            OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
            recvmsg, "No AuthenticationVector.xresStar", ausf_ue->suci);
 | 
					            recvmsg, "No AuthenticationVector.xresStar", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -114,7 +114,7 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (!AuthenticationVector->autn) {
 | 
					    if (!AuthenticationVector->autn) {
 | 
				
			||||||
        ogs_error("[%s] No AuthenticationVector.autn", ausf_ue->suci);
 | 
					        ogs_error("[%s] No AuthenticationVector.autn", ausf_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
            OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					            OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
            recvmsg, "No AuthenticationVector.autn", ausf_ue->suci);
 | 
					            recvmsg, "No AuthenticationVector.autn", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -122,7 +122,7 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (!AuthenticationVector->kausf) {
 | 
					    if (!AuthenticationVector->kausf) {
 | 
				
			||||||
        ogs_error("[%s] No AuthenticationVector.kausf", ausf_ue->suci);
 | 
					        ogs_error("[%s] No AuthenticationVector.kausf", ausf_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
            OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					            OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
            recvmsg, "No AuthenticationVector.kausf", ausf_ue->suci);
 | 
					            recvmsg, "No AuthenticationVector.kausf", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -194,7 +194,7 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
    response = ogs_sbi_build_response(&sendmsg,
 | 
					    response = ogs_sbi_build_response(&sendmsg,
 | 
				
			||||||
        OGS_SBI_HTTP_STATUS_CREATED);
 | 
					        OGS_SBI_HTTP_STATUS_CREATED);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    OpenAPI_list_free(UeAuthenticationCtx._links);
 | 
					    OpenAPI_list_free(UeAuthenticationCtx._links);
 | 
				
			||||||
    OpenAPI_map_free(LinksValueScheme);
 | 
					    OpenAPI_map_free(LinksValueScheme);
 | 
				
			||||||
@@ -206,7 +206,7 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ausf_nudm_ueau_handle_result_confirmation_inform(ausf_ue_t *ausf_ue,
 | 
					bool ausf_nudm_ueau_handle_result_confirmation_inform(ausf_ue_t *ausf_ue,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_message_t sendmsg;
 | 
					    ogs_sbi_message_t sendmsg;
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
@@ -217,21 +217,21 @@ bool ausf_nudm_ueau_handle_result_confirmation_inform(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
    OpenAPI_auth_event_t *AuthEvent = NULL;
 | 
					    OpenAPI_auth_event_t *AuthEvent = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(ausf_ue);
 | 
					    ogs_assert(ausf_ue);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    AuthEvent = recvmsg->AuthEvent;
 | 
					    AuthEvent = recvmsg->AuthEvent;
 | 
				
			||||||
    if (!AuthEvent) {
 | 
					    if (!AuthEvent) {
 | 
				
			||||||
        ogs_error("[%s] No AuthEvent", ausf_ue->suci);
 | 
					        ogs_error("[%s] No AuthEvent", ausf_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "No AuthEvent", ausf_ue->suci);
 | 
					                recvmsg, "No AuthEvent", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!recvmsg->http.location) {
 | 
					    if (!recvmsg->http.location) {
 | 
				
			||||||
        ogs_error("[%s] No Location", ausf_ue->suci);
 | 
					        ogs_error("[%s] No Location", ausf_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "No Location", ausf_ue->suci);
 | 
					                recvmsg, "No Location", ausf_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -262,7 +262,7 @@ bool ausf_nudm_ueau_handle_result_confirmation_inform(ausf_ue_t *ausf_ue,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
					    response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,9 +27,9 @@ extern "C" {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
					bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
 | 
				
			||||||
bool ausf_nudm_ueau_handle_result_confirmation_inform(ausf_ue_t *ausf_ue,
 | 
					bool ausf_nudm_ueau_handle_result_confirmation_inform(ausf_ue_t *ausf_ue,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,21 +19,19 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "sbi-path.h"
 | 
					#include "sbi-path.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int server_cb(ogs_sbi_server_t *server,
 | 
					static int server_cb(ogs_sbi_request_t *request, void *data)
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_request_t *request)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ausf_event_t *e = NULL;
 | 
					    ausf_event_t *e = NULL;
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					 | 
				
			||||||
    ogs_assert(request);
 | 
					    ogs_assert(request);
 | 
				
			||||||
 | 
					    ogs_assert(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    e = ausf_event_new(AUSF_EVT_SBI_SERVER);
 | 
					    e = ausf_event_new(AUSF_EVT_SBI_SERVER);
 | 
				
			||||||
    ogs_assert(e);
 | 
					    ogs_assert(e);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    e->sbi.server = server;
 | 
					 | 
				
			||||||
    e->sbi.session = session;
 | 
					 | 
				
			||||||
    e->sbi.request = request;
 | 
					    e->sbi.request = request;
 | 
				
			||||||
 | 
					    e->sbi.data = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
					    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
				
			||||||
    if (rv != OGS_OK) {
 | 
					    if (rv != OGS_OK) {
 | 
				
			||||||
@@ -120,26 +118,26 @@ void ausf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ausf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
 | 
					void ausf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
 | 
				
			||||||
        ausf_ue_t *ausf_ue, ogs_sbi_session_t *session, void *data,
 | 
					        ausf_ue_t *ausf_ue, ogs_sbi_stream_t *stream, void *data,
 | 
				
			||||||
        ogs_sbi_request_t *(*build)(ausf_ue_t *ausf_ue, void *data))
 | 
					        ogs_sbi_request_t *(*build)(ausf_ue_t *ausf_ue, void *data))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_xact_t *xact = NULL;
 | 
					    ogs_sbi_xact_t *xact = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(target_nf_type);
 | 
					    ogs_assert(target_nf_type);
 | 
				
			||||||
    ogs_assert(ausf_ue);
 | 
					    ogs_assert(ausf_ue);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(build);
 | 
					    ogs_assert(build);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xact = ogs_sbi_xact_add(target_nf_type, &ausf_ue->sbi, data,
 | 
					    xact = ogs_sbi_xact_add(target_nf_type, &ausf_ue->sbi, data,
 | 
				
			||||||
            (ogs_sbi_build_f)build, ausf_timer_sbi_client_wait_expire);
 | 
					            (ogs_sbi_build_f)build, ausf_timer_sbi_client_wait_expire);
 | 
				
			||||||
    ogs_assert(xact);
 | 
					    ogs_assert(xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xact->assoc_session = session;
 | 
					    xact->assoc_stream = stream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (ogs_sbi_discover_and_send(xact,
 | 
					    if (ogs_sbi_discover_and_send(xact,
 | 
				
			||||||
            (ogs_fsm_handler_t)ausf_nf_state_registered, client_cb) != true) {
 | 
					            (ogs_fsm_handler_t)ausf_nf_state_registered, client_cb) != true) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
            OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
 | 
					            OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
 | 
				
			||||||
            "Cannot discover", ausf_ue->suci);
 | 
					            "Cannot discover", ausf_ue->suci);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,7 @@ void ausf_sbi_close(void);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void ausf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
 | 
					void ausf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
 | 
				
			||||||
void ausf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
 | 
					void ausf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
 | 
				
			||||||
        ausf_ue_t *ausf_ue, ogs_sbi_session_t *session, void *data,
 | 
					        ausf_ue_t *ausf_ue, ogs_sbi_stream_t *stream, void *data,
 | 
				
			||||||
        ogs_sbi_request_t *(*build)(ausf_ue_t *ausf_ue, void *data));
 | 
					        ogs_sbi_request_t *(*build)(ausf_ue_t *ausf_ue, void *data));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,8 +55,7 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
    bool handled;
 | 
					    bool handled;
 | 
				
			||||||
    ausf_ue_t *ausf_ue = NULL;
 | 
					    ausf_ue_t *ausf_ue = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_server_t *server = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					 | 
				
			||||||
    ogs_sbi_message_t *message = NULL;
 | 
					    ogs_sbi_message_t *message = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(s);
 | 
					    ogs_assert(s);
 | 
				
			||||||
@@ -77,15 +76,13 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
    case AUSF_EVT_SBI_SERVER:
 | 
					    case AUSF_EVT_SBI_SERVER:
 | 
				
			||||||
        message = e->sbi.message;
 | 
					        message = e->sbi.message;
 | 
				
			||||||
        ogs_assert(message);
 | 
					        ogs_assert(message);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
        server = e->sbi.server;
 | 
					 | 
				
			||||||
        ogs_assert(server);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SWITCH(message->h.method)
 | 
					        SWITCH(message->h.method)
 | 
				
			||||||
        CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
					        CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
				
			||||||
            handled = ausf_nausf_auth_handle_authenticate(
 | 
					            handled = ausf_nausf_auth_handle_authenticate(
 | 
				
			||||||
                    ausf_ue, session, message);
 | 
					                    ausf_ue, stream, message);
 | 
				
			||||||
            if (!handled) {
 | 
					            if (!handled) {
 | 
				
			||||||
                ogs_error("[%s] Cannot handle SBI message",
 | 
					                ogs_error("[%s] Cannot handle SBI message",
 | 
				
			||||||
                        ausf_ue->suci);
 | 
					                        ausf_ue->suci);
 | 
				
			||||||
@@ -94,7 +91,7 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
            break;
 | 
					            break;
 | 
				
			||||||
        CASE(OGS_SBI_HTTP_METHOD_PUT)
 | 
					        CASE(OGS_SBI_HTTP_METHOD_PUT)
 | 
				
			||||||
            handled = ausf_nausf_auth_handle_authenticate_confirmation(
 | 
					            handled = ausf_nausf_auth_handle_authenticate_confirmation(
 | 
				
			||||||
                    ausf_ue, session, message);
 | 
					                    ausf_ue, stream, message);
 | 
				
			||||||
            if (!handled) {
 | 
					            if (!handled) {
 | 
				
			||||||
                ogs_error("[%s] Cannot handle SBI message",
 | 
					                ogs_error("[%s] Cannot handle SBI message",
 | 
				
			||||||
                        ausf_ue->suci);
 | 
					                        ausf_ue->suci);
 | 
				
			||||||
@@ -104,7 +101,7 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("[%s] Invalid HTTP method [%s]",
 | 
					            ogs_error("[%s] Invalid HTTP method [%s]",
 | 
				
			||||||
                    ausf_ue->suci, message->h.method);
 | 
					                    ausf_ue->suci, message->h.method);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_FORBIDDEN, message,
 | 
					                    OGS_SBI_HTTP_STATUS_FORBIDDEN, message,
 | 
				
			||||||
                    "Invalid HTTP method", message->h.method);
 | 
					                    "Invalid HTTP method", message->h.method);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
@@ -117,8 +114,8 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        ausf_ue = e->ausf_ue;
 | 
					        ausf_ue = e->ausf_ue;
 | 
				
			||||||
        ogs_assert(ausf_ue);
 | 
					        ogs_assert(ausf_ue);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SWITCH(message->h.service.name)
 | 
					        SWITCH(message->h.service.name)
 | 
				
			||||||
        CASE(OGS_SBI_SERVICE_NAME_NUDM_UEAU)
 | 
					        CASE(OGS_SBI_SERVICE_NAME_NUDM_UEAU)
 | 
				
			||||||
@@ -132,19 +129,19 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
 | 
				
			|||||||
                        ausf_ue->suci, message->res_status);
 | 
					                        ausf_ue->suci, message->res_status);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                ogs_sbi_server_send_error(
 | 
					                ogs_sbi_server_send_error(
 | 
				
			||||||
                    session, message->res_status,
 | 
					                    stream, message->res_status,
 | 
				
			||||||
                    NULL, "HTTP response error", ausf_ue->suci);
 | 
					                    NULL, "HTTP response error", ausf_ue->suci);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            SWITCH(message->h.resource.component[1])
 | 
					            SWITCH(message->h.resource.component[1])
 | 
				
			||||||
            CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION)
 | 
					            CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION)
 | 
				
			||||||
                ausf_nudm_ueau_handle_get(ausf_ue, session, message);
 | 
					                ausf_nudm_ueau_handle_get(ausf_ue, stream, message);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS)
 | 
					            CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS)
 | 
				
			||||||
                ausf_nudm_ueau_handle_result_confirmation_inform(
 | 
					                ausf_nudm_ueau_handle_result_confirmation_inform(
 | 
				
			||||||
                        ausf_ue, session, message);
 | 
					                        ausf_ue, stream, message);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										25
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								src/main.c
									
									
									
									
									
								
							@@ -24,11 +24,9 @@
 | 
				
			|||||||
#include "ogs-app.h"
 | 
					#include "ogs-app.h"
 | 
				
			||||||
#include "version.h"
 | 
					#include "version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const char *version = "Open5GS daemon " OPEN5GS_VERSION;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void show_version(void)
 | 
					static void show_version(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    printf("%s\n\n", version);
 | 
					    printf("Open5GS %s\n\n", OPEN5GS_VERSION);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void show_help(const char *name)
 | 
					static void show_help(const char *name)
 | 
				
			||||||
@@ -47,23 +45,6 @@ static void show_help(const char *name)
 | 
				
			|||||||
       "\n", name);
 | 
					       "\n", name);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void show_running_config(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    ogs_log_print(OGS_LOG_INFO, "%s\n\n", version);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ogs_info("Configuration: '%s'", ogs_app()->file);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (ogs_app()->logger.file) {
 | 
					 | 
				
			||||||
        ogs_info("File Logging: '%s'", ogs_app()->logger.file);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (ogs_app()->logger.level)
 | 
					 | 
				
			||||||
            ogs_info("LOG-LEVEL: '%s'", ogs_app()->logger.level);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (ogs_app()->logger.domain)
 | 
					 | 
				
			||||||
            ogs_info("LOG-DOMAIN: '%s'", ogs_app()->logger.domain);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static int check_signal(int signum)
 | 
					static int check_signal(int signum)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    switch (signum) {
 | 
					    switch (signum) {
 | 
				
			||||||
@@ -203,7 +184,7 @@ int main(int argc, const char *const argv[])
 | 
				
			|||||||
    ogs_signal_init();
 | 
					    ogs_signal_init();
 | 
				
			||||||
    ogs_setup_signal_thread();
 | 
					    ogs_setup_signal_thread();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rv = ogs_app_initialize(DEFAULT_CONFIG_FILENAME, argv_out);
 | 
					    rv = ogs_app_initialize(OPEN5GS_VERSION, DEFAULT_CONFIG_FILENAME, argv_out);
 | 
				
			||||||
    if (rv != OGS_OK) {
 | 
					    if (rv != OGS_OK) {
 | 
				
			||||||
        if (rv == OGS_RETRY)
 | 
					        if (rv == OGS_RETRY)
 | 
				
			||||||
            return EXIT_SUCCESS;
 | 
					            return EXIT_SUCCESS;
 | 
				
			||||||
@@ -212,8 +193,6 @@ int main(int argc, const char *const argv[])
 | 
				
			|||||||
        return OGS_ERROR;
 | 
					        return OGS_ERROR;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    show_running_config();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rv = app_initialize(argv_out);
 | 
					    rv = app_initialize(argv_out);
 | 
				
			||||||
    if (rv != OGS_OK) {
 | 
					    if (rv != OGS_OK) {
 | 
				
			||||||
        if (rv == OGS_RETRY)
 | 
					        if (rv == OGS_RETRY)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,8 +26,6 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct ogs_sbi_server_s ogs_sbi_server_t;
 | 
					 | 
				
			||||||
typedef struct ogs_sbi_session_s ogs_sbi_session_t;
 | 
					 | 
				
			||||||
typedef struct ogs_sbi_request_s ogs_sbi_request_t;
 | 
					typedef struct ogs_sbi_request_s ogs_sbi_request_t;
 | 
				
			||||||
typedef struct ogs_sbi_response_s ogs_sbi_response_t;
 | 
					typedef struct ogs_sbi_response_s ogs_sbi_response_t;
 | 
				
			||||||
typedef struct ogs_sbi_message_s ogs_sbi_message_t;
 | 
					typedef struct ogs_sbi_message_s ogs_sbi_message_t;
 | 
				
			||||||
@@ -50,12 +48,7 @@ typedef struct nrf_event_s {
 | 
				
			|||||||
    int timer_id;
 | 
					    int timer_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct {
 | 
					    struct {
 | 
				
			||||||
        /* OGS_EVT_SBI_SERVER */
 | 
					 | 
				
			||||||
        ogs_sbi_request_t *request;
 | 
					        ogs_sbi_request_t *request;
 | 
				
			||||||
        ogs_sbi_session_t *session;
 | 
					 | 
				
			||||||
        ogs_sbi_server_t *server;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /* OGS_EVT_SBI_CLIENT */
 | 
					 | 
				
			||||||
        ogs_sbi_response_t *response;
 | 
					        ogs_sbi_response_t *response;
 | 
				
			||||||
        void *data;
 | 
					        void *data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -86,7 +86,7 @@ void nrf_nf_state_will_register(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
    bool handled;
 | 
					    bool handled;
 | 
				
			||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
    ogs_sbi_message_t *message = NULL;
 | 
					    ogs_sbi_message_t *message = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(s);
 | 
					    ogs_assert(s);
 | 
				
			||||||
@@ -107,8 +107,8 @@ void nrf_nf_state_will_register(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
    case NRF_EVT_SBI_SERVER:
 | 
					    case NRF_EVT_SBI_SERVER:
 | 
				
			||||||
        message = e->sbi.message;
 | 
					        message = e->sbi.message;
 | 
				
			||||||
        ogs_assert(message);
 | 
					        ogs_assert(message);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SWITCH(message->h.service.name)
 | 
					        SWITCH(message->h.service.name)
 | 
				
			||||||
        CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM)
 | 
					        CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM)
 | 
				
			||||||
@@ -120,7 +120,7 @@ void nrf_nf_state_will_register(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
                CASE(OGS_SBI_HTTP_METHOD_PUT)
 | 
					                CASE(OGS_SBI_HTTP_METHOD_PUT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    handled = nrf_nnrf_handle_nf_register(
 | 
					                    handled = nrf_nnrf_handle_nf_register(
 | 
				
			||||||
                            nf_instance, session, message);
 | 
					                            nf_instance, stream, message);
 | 
				
			||||||
                    if (handled == false)
 | 
					                    if (handled == false)
 | 
				
			||||||
                        OGS_FSM_TRAN(s, nrf_nf_state_exception);
 | 
					                        OGS_FSM_TRAN(s, nrf_nf_state_exception);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
@@ -128,7 +128,7 @@ void nrf_nf_state_will_register(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("[%s] Invalid HTTP method [%s]",
 | 
					                    ogs_error("[%s] Invalid HTTP method [%s]",
 | 
				
			||||||
                            nf_instance->id, message->h.method);
 | 
					                            nf_instance->id, message->h.method);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message,
 | 
					                            OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message,
 | 
				
			||||||
                            "Invalid HTTP method", message->h.method);
 | 
					                            "Invalid HTTP method", message->h.method);
 | 
				
			||||||
                END
 | 
					                END
 | 
				
			||||||
@@ -137,7 +137,7 @@ void nrf_nf_state_will_register(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("[%s] Invalid resource name [%s]",
 | 
					                ogs_error("[%s] Invalid resource name [%s]",
 | 
				
			||||||
                        nf_instance->id, message->h.resource.component[0]);
 | 
					                        nf_instance->id, message->h.resource.component[0]);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message,
 | 
					                        OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message,
 | 
				
			||||||
                        "Invalid resource name",
 | 
					                        "Invalid resource name",
 | 
				
			||||||
                        message->h.resource.component[0]);
 | 
					                        message->h.resource.component[0]);
 | 
				
			||||||
@@ -147,7 +147,7 @@ void nrf_nf_state_will_register(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("[%s] Invalid API name [%s]",
 | 
					            ogs_error("[%s] Invalid API name [%s]",
 | 
				
			||||||
                    nf_instance->id, message->h.service.name);
 | 
					                    nf_instance->id, message->h.service.name);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message,
 | 
					                    OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message,
 | 
				
			||||||
                    "Invalid resource name", message->h.service.name);
 | 
					                    "Invalid resource name", message->h.service.name);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
@@ -158,7 +158,7 @@ void nrf_nf_state_will_register(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
    default:
 | 
					    default:
 | 
				
			||||||
        ogs_error("[%s] Unknown event %s",
 | 
					        ogs_error("[%s] Unknown event %s",
 | 
				
			||||||
                nf_instance->id, nrf_event_get_name(e));
 | 
					                nf_instance->id, nrf_event_get_name(e));
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					                OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
                message, "Unknown event", nrf_event_get_name(e));
 | 
					                message, "Unknown event", nrf_event_get_name(e));
 | 
				
			||||||
        OGS_FSM_TRAN(s, nrf_nf_state_exception);
 | 
					        OGS_FSM_TRAN(s, nrf_nf_state_exception);
 | 
				
			||||||
@@ -171,7 +171,7 @@ void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
    bool handled;
 | 
					    bool handled;
 | 
				
			||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
    ogs_sbi_message_t *message = NULL;
 | 
					    ogs_sbi_message_t *message = NULL;
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -210,8 +210,8 @@ void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
    case NRF_EVT_SBI_SERVER:
 | 
					    case NRF_EVT_SBI_SERVER:
 | 
				
			||||||
        message = e->sbi.message;
 | 
					        message = e->sbi.message;
 | 
				
			||||||
        ogs_assert(message);
 | 
					        ogs_assert(message);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SWITCH(message->h.service.name)
 | 
					        SWITCH(message->h.service.name)
 | 
				
			||||||
        CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM)
 | 
					        CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM)
 | 
				
			||||||
@@ -231,7 +231,7 @@ void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    handled = nrf_nnrf_handle_nf_update(
 | 
					                    handled = nrf_nnrf_handle_nf_update(
 | 
				
			||||||
                            nf_instance, session, message);
 | 
					                            nf_instance, stream, message);
 | 
				
			||||||
                    if (handled == false)
 | 
					                    if (handled == false)
 | 
				
			||||||
                        OGS_FSM_TRAN(s, nrf_nf_state_exception);
 | 
					                        OGS_FSM_TRAN(s, nrf_nf_state_exception);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
@@ -240,14 +240,14 @@ void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
                    response = ogs_sbi_build_response(
 | 
					                    response = ogs_sbi_build_response(
 | 
				
			||||||
                            message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					                            message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
                    ogs_assert(response);
 | 
					                    ogs_assert(response);
 | 
				
			||||||
                    ogs_sbi_server_send_response(session, response);
 | 
					                    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
                    OGS_FSM_TRAN(s, nrf_nf_state_de_registered);
 | 
					                    OGS_FSM_TRAN(s, nrf_nf_state_de_registered);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("[%s] Invalid HTTP method [%s]",
 | 
					                    ogs_error("[%s] Invalid HTTP method [%s]",
 | 
				
			||||||
                            nf_instance->id, message->h.method);
 | 
					                            nf_instance->id, message->h.method);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message,
 | 
					                            OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message,
 | 
				
			||||||
                            "Invalid HTTP method", message->h.method);
 | 
					                            "Invalid HTTP method", message->h.method);
 | 
				
			||||||
                END
 | 
					                END
 | 
				
			||||||
@@ -256,7 +256,7 @@ void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("[%s] Invalid resource name [%s]",
 | 
					                ogs_error("[%s] Invalid resource name [%s]",
 | 
				
			||||||
                        nf_instance->id, message->h.resource.component[0]);
 | 
					                        nf_instance->id, message->h.resource.component[0]);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message,
 | 
					                        OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message,
 | 
				
			||||||
                        "Invalid resource name",
 | 
					                        "Invalid resource name",
 | 
				
			||||||
                        message->h.resource.component[0]);
 | 
					                        message->h.resource.component[0]);
 | 
				
			||||||
@@ -266,7 +266,7 @@ void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("[%s] Invalid API name [%s]",
 | 
					            ogs_error("[%s] Invalid API name [%s]",
 | 
				
			||||||
                    nf_instance->id, message->h.service.name);
 | 
					                    nf_instance->id, message->h.service.name);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message,
 | 
					                    OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message,
 | 
				
			||||||
                    "Invalid resource name", message->h.service.name);
 | 
					                    "Invalid resource name", message->h.service.name);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
@@ -275,7 +275,7 @@ void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
    default:
 | 
					    default:
 | 
				
			||||||
        ogs_error("[%s] Unknown event %s",
 | 
					        ogs_error("[%s] Unknown event %s",
 | 
				
			||||||
                nf_instance->id, nrf_event_get_name(e));
 | 
					                nf_instance->id, nrf_event_get_name(e));
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					                OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
                message, "Unknown event", nrf_event_get_name(e));
 | 
					                message, "Unknown event", nrf_event_get_name(e));
 | 
				
			||||||
        OGS_FSM_TRAN(s, nrf_nf_state_exception);
 | 
					        OGS_FSM_TRAN(s, nrf_nf_state_exception);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@
 | 
				
			|||||||
#include "nnrf-handler.h"
 | 
					#include "nnrf-handler.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool nrf_nnrf_handle_nf_register(ogs_sbi_nf_instance_t *nf_instance,
 | 
					bool nrf_nnrf_handle_nf_register(ogs_sbi_nf_instance_t *nf_instance,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int status;
 | 
					    int status;
 | 
				
			||||||
    bool handled;
 | 
					    bool handled;
 | 
				
			||||||
@@ -29,20 +29,20 @@ bool nrf_nnrf_handle_nf_register(ogs_sbi_nf_instance_t *nf_instance,
 | 
				
			|||||||
    OpenAPI_nf_profile_t *NFProfile = NULL;
 | 
					    OpenAPI_nf_profile_t *NFProfile = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(nf_instance);
 | 
					    ogs_assert(nf_instance);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    NFProfile = message->NFProfile;
 | 
					    NFProfile = message->NFProfile;
 | 
				
			||||||
    if (!NFProfile) {
 | 
					    if (!NFProfile) {
 | 
				
			||||||
        ogs_error("No NFProfile");
 | 
					        ogs_error("No NFProfile");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", NULL);
 | 
					                message, "No NFProfile", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* ogs_sbi_nnrf_handle_nf_profile() sends error response */
 | 
					    /* ogs_sbi_nnrf_handle_nf_profile() sends error response */
 | 
				
			||||||
    handled = ogs_sbi_nnrf_handle_nf_profile(
 | 
					    handled = ogs_sbi_nnrf_handle_nf_profile(
 | 
				
			||||||
                nf_instance, NFProfile, session, message);
 | 
					                nf_instance, NFProfile, stream, message);
 | 
				
			||||||
    if (!handled) return false;
 | 
					    if (!handled) return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (OGS_FSM_CHECK(&nf_instance->sm, nrf_nf_state_will_register)) {
 | 
					    if (OGS_FSM_CHECK(&nf_instance->sm, nrf_nf_state_will_register)) {
 | 
				
			||||||
@@ -55,31 +55,31 @@ bool nrf_nnrf_handle_nf_register(ogs_sbi_nf_instance_t *nf_instance,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(message, status);
 | 
					    response = ogs_sbi_build_response(message, status);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool nrf_nnrf_handle_nf_update(ogs_sbi_nf_instance_t *nf_instance,
 | 
					bool nrf_nnrf_handle_nf_update(ogs_sbi_nf_instance_t *nf_instance,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
    OpenAPI_list_t *PatchItemList = NULL;
 | 
					    OpenAPI_list_t *PatchItemList = NULL;
 | 
				
			||||||
    OpenAPI_lnode_t *node;
 | 
					    OpenAPI_lnode_t *node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(nf_instance);
 | 
					    ogs_assert(nf_instance);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SWITCH(message->h.method)
 | 
					    SWITCH(message->h.method)
 | 
				
			||||||
    CASE(OGS_SBI_HTTP_METHOD_PUT)
 | 
					    CASE(OGS_SBI_HTTP_METHOD_PUT)
 | 
				
			||||||
        return nrf_nnrf_handle_nf_register(
 | 
					        return nrf_nnrf_handle_nf_register(
 | 
				
			||||||
                nf_instance, session, message);
 | 
					                nf_instance, stream, message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    CASE(OGS_SBI_HTTP_METHOD_PATCH)
 | 
					    CASE(OGS_SBI_HTTP_METHOD_PATCH)
 | 
				
			||||||
        PatchItemList = message->PatchItemList;
 | 
					        PatchItemList = message->PatchItemList;
 | 
				
			||||||
        if (!PatchItemList) {
 | 
					        if (!PatchItemList) {
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    message, "No PatchItemList Array", NULL);
 | 
					                    message, "No PatchItemList Array", NULL);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -87,7 +87,7 @@ bool nrf_nnrf_handle_nf_update(ogs_sbi_nf_instance_t *nf_instance,
 | 
				
			|||||||
        OpenAPI_list_for_each(PatchItemList, node) {
 | 
					        OpenAPI_list_for_each(PatchItemList, node) {
 | 
				
			||||||
            OpenAPI_patch_item_t *patch_item = node->data;
 | 
					            OpenAPI_patch_item_t *patch_item = node->data;
 | 
				
			||||||
            if (!patch_item) {
 | 
					            if (!patch_item) {
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                        message, "No PatchItemList", NULL);
 | 
					                        message, "No PatchItemList", NULL);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
@@ -97,7 +97,7 @@ bool nrf_nnrf_handle_nf_update(ogs_sbi_nf_instance_t *nf_instance,
 | 
				
			|||||||
        response = ogs_sbi_build_response(
 | 
					        response = ogs_sbi_build_response(
 | 
				
			||||||
                message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					                message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
        ogs_assert(response);
 | 
					        ogs_assert(response);
 | 
				
			||||||
        ogs_sbi_server_send_response(session, response);
 | 
					        ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DEFAULT
 | 
					    DEFAULT
 | 
				
			||||||
@@ -110,7 +110,7 @@ bool nrf_nnrf_handle_nf_update(ogs_sbi_nf_instance_t *nf_instance,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool nrf_nnrf_handle_nf_status_subscribe(
 | 
					bool nrf_nnrf_handle_nf_status_subscribe(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int status;
 | 
					    int status;
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
@@ -122,18 +122,18 @@ bool nrf_nnrf_handle_nf_status_subscribe(
 | 
				
			|||||||
    ogs_uuid_t uuid;
 | 
					    ogs_uuid_t uuid;
 | 
				
			||||||
    char id[OGS_UUID_FORMATTED_LENGTH + 1];
 | 
					    char id[OGS_UUID_FORMATTED_LENGTH + 1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SubscriptionData = message->SubscriptionData;
 | 
					    SubscriptionData = message->SubscriptionData;
 | 
				
			||||||
    if (!SubscriptionData) {
 | 
					    if (!SubscriptionData) {
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No SubscriptionData", NULL);
 | 
					                message, "No SubscriptionData", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SubscriptionData->nf_status_notification_uri) {
 | 
					    if (!SubscriptionData->nf_status_notification_uri) {
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No SubscriptionData", "NFStatusNotificationURL");
 | 
					                message, "No SubscriptionData", "NFStatusNotificationURL");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -163,7 +163,7 @@ bool nrf_nnrf_handle_nf_status_subscribe(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    addr = ogs_sbi_getaddr_from_uri(subscription->notification_uri);
 | 
					    addr = ogs_sbi_getaddr_from_uri(subscription->notification_uri);
 | 
				
			||||||
    if (!addr) {
 | 
					    if (!addr) {
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "Invalid URI", subscription->notification_uri);
 | 
					                message, "Invalid URI", subscription->notification_uri);
 | 
				
			||||||
        ogs_sbi_subscription_remove(subscription);
 | 
					        ogs_sbi_subscription_remove(subscription);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -195,16 +195,16 @@ bool nrf_nnrf_handle_nf_status_subscribe(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(message, status);
 | 
					    response = ogs_sbi_build_response(message, status);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool nrf_nnrf_handle_nf_status_unsubscribe(
 | 
					bool nrf_nnrf_handle_nf_status_unsubscribe(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_subscription_t *subscription = NULL;
 | 
					    ogs_sbi_subscription_t *subscription = NULL;
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    subscription = ogs_sbi_subscription_find(message->h.resource.component[1]);
 | 
					    subscription = ogs_sbi_subscription_find(message->h.resource.component[1]);
 | 
				
			||||||
@@ -215,10 +215,10 @@ bool nrf_nnrf_handle_nf_status_unsubscribe(
 | 
				
			|||||||
        response = ogs_sbi_build_response(
 | 
					        response = ogs_sbi_build_response(
 | 
				
			||||||
                message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					                message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
        ogs_assert(response);
 | 
					        ogs_assert(response);
 | 
				
			||||||
        ogs_sbi_server_send_response(session, response);
 | 
					        ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        ogs_error("Not found [%s]", message->h.resource.component[1]);
 | 
					        ogs_error("Not found [%s]", message->h.resource.component[1]);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                message, "Not found", message->h.resource.component[1]);
 | 
					                message, "Not found", message->h.resource.component[1]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -227,7 +227,7 @@ bool nrf_nnrf_handle_nf_status_unsubscribe(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool nrf_nnrf_handle_nf_list_retrieval(
 | 
					bool nrf_nnrf_handle_nf_list_retrieval(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_message_t sendmsg;
 | 
					    ogs_sbi_message_t sendmsg;
 | 
				
			||||||
    ogs_sbi_server_t *server = NULL;
 | 
					    ogs_sbi_server_t *server = NULL;
 | 
				
			||||||
@@ -238,8 +238,8 @@ bool nrf_nnrf_handle_nf_list_retrieval(
 | 
				
			|||||||
    ogs_sbi_links_t *links = NULL;
 | 
					    ogs_sbi_links_t *links = NULL;
 | 
				
			||||||
    OpenAPI_lnode_t *node = NULL;
 | 
					    OpenAPI_lnode_t *node = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    server = ogs_sbi_session_get_server(session);
 | 
					    server = ogs_sbi_server_from_stream(stream);
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    links = ogs_calloc(1, sizeof(*links));
 | 
					    links = ogs_calloc(1, sizeof(*links));
 | 
				
			||||||
@@ -274,7 +274,7 @@ bool nrf_nnrf_handle_nf_list_retrieval(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
					    response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    OpenAPI_list_for_each(links->items, node) {
 | 
					    OpenAPI_list_for_each(links->items, node) {
 | 
				
			||||||
        if (!node->data) continue;
 | 
					        if (!node->data) continue;
 | 
				
			||||||
@@ -288,7 +288,7 @@ bool nrf_nnrf_handle_nf_list_retrieval(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool nrf_nnrf_handle_nf_profile_retrieval(
 | 
					bool nrf_nnrf_handle_nf_profile_retrieval(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_message_t sendmsg;
 | 
					    ogs_sbi_message_t sendmsg;
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
@@ -296,14 +296,14 @@ bool nrf_nnrf_handle_nf_profile_retrieval(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    OpenAPI_nf_profile_t *NFProfile = NULL;
 | 
					    OpenAPI_nf_profile_t *NFProfile = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(recvmsg->h.resource.component[1]);
 | 
					    ogs_assert(recvmsg->h.resource.component[1]);
 | 
				
			||||||
    nf_instance = ogs_sbi_nf_instance_find(recvmsg->h.resource.component[1]);
 | 
					    nf_instance = ogs_sbi_nf_instance_find(recvmsg->h.resource.component[1]);
 | 
				
			||||||
    if (!nf_instance) {
 | 
					    if (!nf_instance) {
 | 
				
			||||||
        ogs_error("Not found [%s]", recvmsg->h.resource.component[1]);
 | 
					        ogs_error("Not found [%s]", recvmsg->h.resource.component[1]);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                recvmsg, "Not found", recvmsg->h.resource.component[1]);
 | 
					                recvmsg, "Not found", recvmsg->h.resource.component[1]);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -317,7 +317,7 @@ bool nrf_nnrf_handle_nf_profile_retrieval(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
					    response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_nnrf_free_nf_profile(NFProfile);
 | 
					    ogs_sbi_nnrf_free_nf_profile(NFProfile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -325,7 +325,7 @@ bool nrf_nnrf_handle_nf_profile_retrieval(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool nrf_nnrf_handle_nf_discover(
 | 
					bool nrf_nnrf_handle_nf_discover(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_message_t sendmsg;
 | 
					    ogs_sbi_message_t sendmsg;
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
@@ -335,18 +335,18 @@ bool nrf_nnrf_handle_nf_discover(
 | 
				
			|||||||
    OpenAPI_lnode_t *node = NULL;
 | 
					    OpenAPI_lnode_t *node = NULL;
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!recvmsg->param.target_nf_type) {
 | 
					    if (!recvmsg->param.target_nf_type) {
 | 
				
			||||||
        ogs_error("No target-nf-type [%s]", recvmsg->h.uri);
 | 
					        ogs_error("No target-nf-type [%s]", recvmsg->h.uri);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "No target-nf-type", NULL);
 | 
					                recvmsg, "No target-nf-type", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (!recvmsg->param.requester_nf_type) {
 | 
					    if (!recvmsg->param.requester_nf_type) {
 | 
				
			||||||
        ogs_error("No requester-nf-type [%s]", recvmsg->h.uri);
 | 
					        ogs_error("No requester-nf-type [%s]", recvmsg->h.uri);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "No requester-nf-type", NULL);
 | 
					                recvmsg, "No requester-nf-type", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -401,7 +401,7 @@ bool nrf_nnrf_handle_nf_discover(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
					    response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    OpenAPI_list_for_each(SearchResult->nf_instances, node) {
 | 
					    OpenAPI_list_for_each(SearchResult->nf_instances, node) {
 | 
				
			||||||
        OpenAPI_nf_profile_t *NFProfile = NULL;
 | 
					        OpenAPI_nf_profile_t *NFProfile = NULL;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,22 +28,22 @@ extern "C" {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool nrf_nnrf_handle_nf_register(ogs_sbi_nf_instance_t *nf_instance,
 | 
					bool nrf_nnrf_handle_nf_register(ogs_sbi_nf_instance_t *nf_instance,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
bool nrf_nnrf_handle_nf_update(ogs_sbi_nf_instance_t *nf_instance,
 | 
					bool nrf_nnrf_handle_nf_update(ogs_sbi_nf_instance_t *nf_instance,
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool nrf_nnrf_handle_nf_status_subscribe(
 | 
					bool nrf_nnrf_handle_nf_status_subscribe(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
bool nrf_nnrf_handle_nf_status_unsubscribe(
 | 
					bool nrf_nnrf_handle_nf_status_unsubscribe(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool nrf_nnrf_handle_nf_list_retrieval(
 | 
					bool nrf_nnrf_handle_nf_list_retrieval(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
bool nrf_nnrf_handle_nf_profile_retrieval(
 | 
					bool nrf_nnrf_handle_nf_profile_retrieval(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool nrf_nnrf_handle_nf_discover(
 | 
					bool nrf_nnrf_handle_nf_discover(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,7 +39,7 @@ void nrf_state_final(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
 | 
					void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
    ogs_sbi_request_t *request = NULL;
 | 
					    ogs_sbi_request_t *request = NULL;
 | 
				
			||||||
    ogs_sbi_message_t message;
 | 
					    ogs_sbi_message_t message;
 | 
				
			||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
@@ -66,21 +66,21 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
    case NRF_EVT_SBI_SERVER:
 | 
					    case NRF_EVT_SBI_SERVER:
 | 
				
			||||||
        request = e->sbi.request;
 | 
					        request = e->sbi.request;
 | 
				
			||||||
        ogs_assert(request);
 | 
					        ogs_assert(request);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        rv = ogs_sbi_parse_request(&message, request);
 | 
					        rv = ogs_sbi_parse_request(&message, request);
 | 
				
			||||||
        if (rv != OGS_OK) {
 | 
					        if (rv != OGS_OK) {
 | 
				
			||||||
            /* 'message' buffer is released in ogs_sbi_parse_request() */
 | 
					            /* 'message' buffer is released in ogs_sbi_parse_request() */
 | 
				
			||||||
            ogs_error("cannot parse HTTP message");
 | 
					            ogs_error("cannot parse HTTP message");
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    NULL, "cannot parse HTTP message", NULL);
 | 
					                    NULL, "cannot parse HTTP message", NULL);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (strcmp(message.h.api.version, OGS_SBI_API_V1) != 0) {
 | 
					        if (strcmp(message.h.api.version, OGS_SBI_API_V1) != 0) {
 | 
				
			||||||
            ogs_error("Not supported version [%s]", message.h.api.version);
 | 
					            ogs_error("Not supported version [%s]", message.h.api.version);
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    &message, "Not supported version", NULL);
 | 
					                    &message, "Not supported version", NULL);
 | 
				
			||||||
            ogs_sbi_message_free(&message);
 | 
					            ogs_sbi_message_free(&message);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
@@ -94,9 +94,9 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
                SWITCH(message.h.method)
 | 
					                SWITCH(message.h.method)
 | 
				
			||||||
                CASE(OGS_SBI_HTTP_METHOD_GET)
 | 
					                CASE(OGS_SBI_HTTP_METHOD_GET)
 | 
				
			||||||
                    if (message.h.resource.component[1]) {
 | 
					                    if (message.h.resource.component[1]) {
 | 
				
			||||||
                        nrf_nnrf_handle_nf_profile_retrieval(session, &message);
 | 
					                        nrf_nnrf_handle_nf_profile_retrieval(stream, &message);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        nrf_nnrf_handle_nf_list_retrieval(session, &message);
 | 
					                        nrf_nnrf_handle_nf_list_retrieval(stream, &message);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -114,7 +114,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
                        DEFAULT
 | 
					                        DEFAULT
 | 
				
			||||||
                            ogs_warn("Not found [%s]",
 | 
					                            ogs_warn("Not found [%s]",
 | 
				
			||||||
                                    message.h.resource.component[1]);
 | 
					                                    message.h.resource.component[1]);
 | 
				
			||||||
                            ogs_sbi_server_send_error(session,
 | 
					                            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					                                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                                &message, "Not found",
 | 
					                                &message, "Not found",
 | 
				
			||||||
                                message.h.resource.component[1]);
 | 
					                                message.h.resource.component[1]);
 | 
				
			||||||
@@ -147,17 +147,17 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
            CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
 | 
					            CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
 | 
				
			||||||
                SWITCH(message.h.method)
 | 
					                SWITCH(message.h.method)
 | 
				
			||||||
                CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
					                CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
				
			||||||
                    nrf_nnrf_handle_nf_status_subscribe(session, &message);
 | 
					                    nrf_nnrf_handle_nf_status_subscribe(stream, &message);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                CASE(OGS_SBI_HTTP_METHOD_DELETE)
 | 
					                CASE(OGS_SBI_HTTP_METHOD_DELETE)
 | 
				
			||||||
                    nrf_nnrf_handle_nf_status_unsubscribe(session, &message);
 | 
					                    nrf_nnrf_handle_nf_status_unsubscribe(stream, &message);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("Invalid HTTP method [%s]",
 | 
					                    ogs_error("Invalid HTTP method [%s]",
 | 
				
			||||||
                            message.h.method);
 | 
					                            message.h.method);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_FORBIDDEN, &message,
 | 
					                            OGS_SBI_HTTP_STATUS_FORBIDDEN, &message,
 | 
				
			||||||
                            "Invalid HTTP method", message.h.method);
 | 
					                            "Invalid HTTP method", message.h.method);
 | 
				
			||||||
                END
 | 
					                END
 | 
				
			||||||
@@ -166,7 +166,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("Invalid resource name [%s]",
 | 
					                ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                        message.h.resource.component[0]);
 | 
					                        message.h.resource.component[0]);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
				
			||||||
                        "Invalid resource name",
 | 
					                        "Invalid resource name",
 | 
				
			||||||
                        message.h.resource.component[0]);
 | 
					                        message.h.resource.component[0]);
 | 
				
			||||||
@@ -180,13 +180,13 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                SWITCH(message.h.method)
 | 
					                SWITCH(message.h.method)
 | 
				
			||||||
                CASE(OGS_SBI_HTTP_METHOD_GET)
 | 
					                CASE(OGS_SBI_HTTP_METHOD_GET)
 | 
				
			||||||
                    nrf_nnrf_handle_nf_discover(session, &message);
 | 
					                    nrf_nnrf_handle_nf_discover(stream, &message);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("Invalid HTTP method [%s]",
 | 
					                    ogs_error("Invalid HTTP method [%s]",
 | 
				
			||||||
                            message.h.method);
 | 
					                            message.h.method);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_FORBIDDEN, &message,
 | 
					                            OGS_SBI_HTTP_STATUS_FORBIDDEN, &message,
 | 
				
			||||||
                            "Invalid HTTP method", message.h.method);
 | 
					                            "Invalid HTTP method", message.h.method);
 | 
				
			||||||
                END
 | 
					                END
 | 
				
			||||||
@@ -196,7 +196,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("Invalid resource name [%s]",
 | 
					                ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                        message.h.resource.component[0]);
 | 
					                        message.h.resource.component[0]);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
				
			||||||
                        "Invalid resource name",
 | 
					                        "Invalid resource name",
 | 
				
			||||||
                        message.h.resource.component[0]);
 | 
					                        message.h.resource.component[0]);
 | 
				
			||||||
@@ -205,7 +205,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("Invalid API name [%s]", message.h.service.name);
 | 
					            ogs_error("Invalid API name [%s]", message.h.service.name);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
				
			||||||
                    "Invalid API name", message.h.resource.component[0]);
 | 
					                    "Invalid API name", message.h.resource.component[0]);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,21 +19,19 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "sbi-path.h"
 | 
					#include "sbi-path.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int server_cb(ogs_sbi_server_t *server,
 | 
					static int server_cb(ogs_sbi_request_t *request, void *data)
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_request_t *request)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    nrf_event_t *e = NULL;
 | 
					    nrf_event_t *e = NULL;
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					 | 
				
			||||||
    ogs_assert(request);
 | 
					    ogs_assert(request);
 | 
				
			||||||
 | 
					    ogs_assert(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    e = nrf_event_new(NRF_EVT_SBI_SERVER);
 | 
					    e = nrf_event_new(NRF_EVT_SBI_SERVER);
 | 
				
			||||||
    ogs_assert(e);
 | 
					    ogs_assert(e);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    e->sbi.server = server;
 | 
					 | 
				
			||||||
    e->sbi.session = session;
 | 
					 | 
				
			||||||
    e->sbi.request = request;
 | 
					    e->sbi.request = request;
 | 
				
			||||||
 | 
					    e->sbi.data = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
					    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
				
			||||||
    if (rv != OGS_OK) {
 | 
					    if (rv != OGS_OK) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,8 +33,6 @@ typedef struct ogs_pfcp_xact_s ogs_pfcp_xact_t;
 | 
				
			|||||||
typedef struct ogs_pfcp_message_s ogs_pfcp_message_t;
 | 
					typedef struct ogs_pfcp_message_s ogs_pfcp_message_t;
 | 
				
			||||||
typedef struct smf_sess_s smf_sess_t;
 | 
					typedef struct smf_sess_s smf_sess_t;
 | 
				
			||||||
typedef struct smf_upf_s smf_upf_t;
 | 
					typedef struct smf_upf_s smf_upf_t;
 | 
				
			||||||
typedef struct ogs_sbi_server_s ogs_sbi_server_t;
 | 
					 | 
				
			||||||
typedef struct ogs_sbi_session_s ogs_sbi_session_t;
 | 
					 | 
				
			||||||
typedef struct ogs_sbi_request_s ogs_sbi_request_t;
 | 
					typedef struct ogs_sbi_request_s ogs_sbi_request_t;
 | 
				
			||||||
typedef struct ogs_sbi_response_s ogs_sbi_response_t;
 | 
					typedef struct ogs_sbi_response_s ogs_sbi_response_t;
 | 
				
			||||||
typedef struct ogs_sbi_message_s ogs_sbi_message_t;
 | 
					typedef struct ogs_sbi_message_s ogs_sbi_message_t;
 | 
				
			||||||
@@ -80,12 +78,7 @@ typedef struct smf_event_s {
 | 
				
			|||||||
    ogs_pfcp_message_t *pfcp_message;
 | 
					    ogs_pfcp_message_t *pfcp_message;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct {
 | 
					    struct {
 | 
				
			||||||
        /* OGS_EVT_SBI_SERVER */
 | 
					 | 
				
			||||||
        ogs_sbi_request_t *request;
 | 
					        ogs_sbi_request_t *request;
 | 
				
			||||||
        ogs_sbi_session_t *session;
 | 
					 | 
				
			||||||
        ogs_sbi_server_t *server;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /* OGS_EVT_SBI_CLIENT */
 | 
					 | 
				
			||||||
        ogs_sbi_response_t *response;
 | 
					        ogs_sbi_response_t *response;
 | 
				
			||||||
        void *data;
 | 
					        void *data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,7 @@
 | 
				
			|||||||
#define OGS_LOG_DOMAIN __gsm_log_domain
 | 
					#define OGS_LOG_DOMAIN __gsm_log_domain
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int gsm_handle_pdu_session_establishment_request(
 | 
					int gsm_handle_pdu_session_establishment_request(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session,
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream,
 | 
				
			||||||
        ogs_nas_5gs_pdu_session_establishment_request_t *
 | 
					        ogs_nas_5gs_pdu_session_establishment_request_t *
 | 
				
			||||||
            pdu_session_establishment_request)
 | 
					            pdu_session_establishment_request)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -37,7 +37,7 @@ int gsm_handle_pdu_session_establishment_request(
 | 
				
			|||||||
    ogs_nas_ssc_mode_t *ssc_mode = NULL;
 | 
					    ogs_nas_ssc_mode_t *ssc_mode = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(pdu_session_establishment_request);
 | 
					    ogs_assert(pdu_session_establishment_request);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pdu_session_type = &pdu_session_establishment_request->pdu_session_type;
 | 
					    pdu_session_type = &pdu_session_establishment_request->pdu_session_type;
 | 
				
			||||||
@@ -64,7 +64,7 @@ int gsm_handle_pdu_session_establishment_request(
 | 
				
			|||||||
                extended_protocol_configuration_options);
 | 
					                extended_protocol_configuration_options);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    smf_sbi_discover_and_send(OpenAPI_nf_type_UDM, sess, session,
 | 
					    smf_sbi_discover_and_send(OpenAPI_nf_type_UDM, sess, stream,
 | 
				
			||||||
            (char *)OGS_SBI_RESOURCE_NAME_SM_DATA, smf_nudm_sdm_build_get);
 | 
					            (char *)OGS_SBI_RESOURCE_NAME_SM_DATA, smf_nudm_sdm_build_get);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return OGS_OK;
 | 
					    return OGS_OK;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@ extern "C" {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int gsm_handle_pdu_session_establishment_request(
 | 
					int gsm_handle_pdu_session_establishment_request(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session,
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream,
 | 
				
			||||||
        ogs_nas_5gs_pdu_session_establishment_request_t *
 | 
					        ogs_nas_5gs_pdu_session_establishment_request_t *
 | 
				
			||||||
            pdu_session_establishment_request);
 | 
					            pdu_session_establishment_request);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,7 +46,7 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ogs_nas_5gs_message_t *nas_message = NULL;
 | 
					    ogs_nas_5gs_message_t *nas_message = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
    ogs_sbi_message_t *sbi_message = NULL;
 | 
					    ogs_sbi_message_t *sbi_message = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(s);
 | 
					    ogs_assert(s);
 | 
				
			||||||
@@ -67,27 +67,27 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
    case SMF_EVT_SBI_SERVER:
 | 
					    case SMF_EVT_SBI_SERVER:
 | 
				
			||||||
        sbi_message = e->sbi.message;
 | 
					        sbi_message = e->sbi.message;
 | 
				
			||||||
        ogs_assert(sbi_message);
 | 
					        ogs_assert(sbi_message);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SWITCH(sbi_message->h.service.name)
 | 
					        SWITCH(sbi_message->h.service.name)
 | 
				
			||||||
        CASE(OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION)
 | 
					        CASE(OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION)
 | 
				
			||||||
            SWITCH(sbi_message->h.resource.component[2])
 | 
					            SWITCH(sbi_message->h.resource.component[2])
 | 
				
			||||||
            CASE(OGS_SBI_RESOURCE_NAME_MODIFY)
 | 
					            CASE(OGS_SBI_RESOURCE_NAME_MODIFY)
 | 
				
			||||||
                smf_nsmf_handle_update_sm_context(sess, session, sbi_message);
 | 
					                smf_nsmf_handle_update_sm_context(sess, stream, sbi_message);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            CASE(OGS_SBI_RESOURCE_NAME_RELEASE)
 | 
					            CASE(OGS_SBI_RESOURCE_NAME_RELEASE)
 | 
				
			||||||
                smf_nsmf_handle_release_sm_context(sess, session, sbi_message);
 | 
					                smf_nsmf_handle_release_sm_context(sess, stream, sbi_message);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                smf_nsmf_handle_create_sm_context(sess, session, sbi_message);
 | 
					                smf_nsmf_handle_create_sm_context(sess, stream, sbi_message);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            END
 | 
					            END
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("Invalid API name [%s]", sbi_message->h.service.name);
 | 
					            ogs_error("Invalid API name [%s]", sbi_message->h.service.name);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, sbi_message,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, sbi_message,
 | 
				
			||||||
                    "Invalid API name", sbi_message->h.service.name);
 | 
					                    "Invalid API name", sbi_message->h.service.name);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
@@ -102,8 +102,8 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
        smf_ue = sess->smf_ue;
 | 
					        smf_ue = sess->smf_ue;
 | 
				
			||||||
        ogs_assert(smf_ue);
 | 
					        ogs_assert(smf_ue);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SWITCH(sbi_message->h.service.name)
 | 
					        SWITCH(sbi_message->h.service.name)
 | 
				
			||||||
        CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM)
 | 
					        CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM)
 | 
				
			||||||
@@ -113,14 +113,14 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
                    ogs_error("[%s] HTTP response error [%d]",
 | 
					                    ogs_error("[%s] HTTP response error [%d]",
 | 
				
			||||||
                        smf_ue->supi, sbi_message->res_status);
 | 
					                        smf_ue->supi, sbi_message->res_status);
 | 
				
			||||||
                    ogs_sbi_server_send_error(
 | 
					                    ogs_sbi_server_send_error(
 | 
				
			||||||
                        session, sbi_message->res_status,
 | 
					                        stream, sbi_message->res_status,
 | 
				
			||||||
                        NULL, "HTTP response error", smf_ue->supi);
 | 
					                        NULL, "HTTP response error", smf_ue->supi);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (smf_nudm_sdm_handle_get(
 | 
					                if (smf_nudm_sdm_handle_get(
 | 
				
			||||||
                            sess, session, sbi_message) != true) {
 | 
					                            sess, stream, sbi_message) != true) {
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					                            OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
                            sbi_message, "HTTP response error", smf_ue->supi);
 | 
					                            sbi_message, "HTTP response error", smf_ue->supi);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -129,7 +129,7 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("Invalid resource name [%s]",
 | 
					                ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                        sbi_message->h.resource.component[1]);
 | 
					                        sbi_message->h.resource.component[1]);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, sbi_message,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, sbi_message,
 | 
				
			||||||
                        "Invalid resource name",
 | 
					                        "Invalid resource name",
 | 
				
			||||||
                        sbi_message->h.resource.component[1]);
 | 
					                        sbi_message->h.resource.component[1]);
 | 
				
			||||||
@@ -166,14 +166,14 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
        ogs_assert(nas_message);
 | 
					        ogs_assert(nas_message);
 | 
				
			||||||
        sess = e->sess;
 | 
					        sess = e->sess;
 | 
				
			||||||
        ogs_assert(sess);
 | 
					        ogs_assert(sess);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
        smf_ue = sess->smf_ue;
 | 
					        smf_ue = sess->smf_ue;
 | 
				
			||||||
        ogs_assert(smf_ue);
 | 
					        ogs_assert(smf_ue);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        switch (nas_message->gsm.h.message_type) {
 | 
					        switch (nas_message->gsm.h.message_type) {
 | 
				
			||||||
        case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST:
 | 
					        case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST:
 | 
				
			||||||
            rv = gsm_handle_pdu_session_establishment_request(sess, session,
 | 
					            rv = gsm_handle_pdu_session_establishment_request(sess, stream,
 | 
				
			||||||
                    &nas_message->gsm.pdu_session_establishment_request);
 | 
					                    &nas_message->gsm.pdu_session_establishment_request);
 | 
				
			||||||
            if (rv != OGS_OK) {
 | 
					            if (rv != OGS_OK) {
 | 
				
			||||||
                ogs_error("[%s:%d] Cannot handle NAS message",
 | 
					                ogs_error("[%s:%d] Cannot handle NAS message",
 | 
				
			||||||
@@ -184,18 +184,18 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        case OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST:
 | 
					        case OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST:
 | 
				
			||||||
            smf_5gc_pfcp_send_session_deletion_request(
 | 
					            smf_5gc_pfcp_send_session_deletion_request(
 | 
				
			||||||
                    sess, session, OGS_PFCP_DELETE_TRIGGER_UE_REQUESTED);
 | 
					                    sess, stream, OGS_PFCP_DELETE_TRIGGER_UE_REQUESTED);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE:
 | 
					        case OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE:
 | 
				
			||||||
            smf_sbi_send_response(session, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					            smf_sbi_send_response(stream, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /*
 | 
					            /*
 | 
				
			||||||
             * Race condition for PDU session release complete
 | 
					             * Race condition for PDU session release complete
 | 
				
			||||||
             *  - CLIENT : /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
 | 
					             *  - CLIENT : /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
 | 
				
			||||||
             *  - SERVER : /namf-callback/v1/{supi}/sm-context-status/{psi})
 | 
					             *  - SERVER : /namf-callback/v1/{supi}/sm-context-status/{psi})
 | 
				
			||||||
             *
 | 
					             *
 | 
				
			||||||
             * smf_sbi_send_response(session, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					             * smf_sbi_send_response(stream, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
             * smf_sbi_send_sm_context_status_notify(sess);
 | 
					             * smf_sbi_send_sm_context_status_notify(sess);
 | 
				
			||||||
             *
 | 
					             *
 | 
				
			||||||
             * When executed as above,
 | 
					             * When executed as above,
 | 
				
			||||||
@@ -212,7 +212,7 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
                    nas_message->gsm.h.message_type);
 | 
					                    nas_message->gsm.h.message_type);
 | 
				
			||||||
            ogs_assert(strerror);
 | 
					            ogs_assert(strerror);
 | 
				
			||||||
            ogs_error("%s", strerror);
 | 
					            ogs_error("%s", strerror);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, NULL, strerror, NULL);
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, NULL, strerror, NULL);
 | 
				
			||||||
            ogs_free(strerror);
 | 
					            ogs_free(strerror);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
@@ -223,8 +223,8 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
    case SMF_EVT_NGAP_MESSAGE:
 | 
					    case SMF_EVT_NGAP_MESSAGE:
 | 
				
			||||||
        sess = e->sess;
 | 
					        sess = e->sess;
 | 
				
			||||||
        ogs_assert(sess);
 | 
					        ogs_assert(sess);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
        smf_ue = sess->smf_ue;
 | 
					        smf_ue = sess->smf_ue;
 | 
				
			||||||
        ogs_assert(smf_ue);
 | 
					        ogs_assert(smf_ue);
 | 
				
			||||||
        pkbuf = e->pkbuf;
 | 
					        pkbuf = e->pkbuf;
 | 
				
			||||||
@@ -234,7 +234,7 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
        switch (e->ngap.type) {
 | 
					        switch (e->ngap.type) {
 | 
				
			||||||
        case OpenAPI_n2_sm_info_type_PDU_RES_SETUP_RSP:
 | 
					        case OpenAPI_n2_sm_info_type_PDU_RES_SETUP_RSP:
 | 
				
			||||||
            rv = ngap_handle_pdu_session_resource_setup_response_transfer(
 | 
					            rv = ngap_handle_pdu_session_resource_setup_response_transfer(
 | 
				
			||||||
                    sess, session, pkbuf);
 | 
					                    sess, stream, pkbuf);
 | 
				
			||||||
            if (rv != OGS_OK) {
 | 
					            if (rv != OGS_OK) {
 | 
				
			||||||
                ogs_error("[%s:%d] Cannot handle NGAP message",
 | 
					                ogs_error("[%s:%d] Cannot handle NGAP message",
 | 
				
			||||||
                        smf_ue->supi, sess->psi);
 | 
					                        smf_ue->supi, sess->psi);
 | 
				
			||||||
@@ -243,7 +243,7 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case OpenAPI_n2_sm_info_type_PDU_RES_REL_RSP:
 | 
					        case OpenAPI_n2_sm_info_type_PDU_RES_REL_RSP:
 | 
				
			||||||
            smf_sbi_send_response(session, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					            smf_sbi_send_response(stream, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        default:
 | 
					        default:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -101,7 +101,7 @@ void smf_5gc_n4_handle_session_establishment_response(
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    uint8_t pfcp_cause_value = OGS_PFCP_CAUSE_REQUEST_ACCEPTED;
 | 
					    uint8_t pfcp_cause_value = OGS_PFCP_CAUSE_REQUEST_ACCEPTED;
 | 
				
			||||||
    uint8_t offending_ie_value = 0;
 | 
					    uint8_t offending_ie_value = 0;
 | 
				
			||||||
@@ -111,8 +111,8 @@ void smf_5gc_n4_handle_session_establishment_response(
 | 
				
			|||||||
    ogs_assert(xact);
 | 
					    ogs_assert(xact);
 | 
				
			||||||
    ogs_assert(rsp);
 | 
					    ogs_assert(rsp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    session = xact->assoc_session;
 | 
					    stream = xact->assoc_stream;
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_pfcp_xact_commit(xact);
 | 
					    ogs_pfcp_xact_commit(xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -184,7 +184,7 @@ void smf_5gc_n4_handle_session_establishment_response(
 | 
				
			|||||||
    ogs_assert(up_f_seid);
 | 
					    ogs_assert(up_f_seid);
 | 
				
			||||||
    sess->upf_n4_seid = be64toh(up_f_seid->seid);
 | 
					    sess->upf_n4_seid = be64toh(up_f_seid->seid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    smf_sbi_discover_and_send(OpenAPI_nf_type_AMF, sess, session, NULL,
 | 
					    smf_sbi_discover_and_send(OpenAPI_nf_type_AMF, sess, stream, NULL,
 | 
				
			||||||
            smf_namf_comm_build_n1_n2_message_transfer);
 | 
					            smf_namf_comm_build_n1_n2_message_transfer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if 0
 | 
					#if 0
 | 
				
			||||||
@@ -198,13 +198,13 @@ void smf_5gc_n4_handle_session_modification_response(
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    int status = 0;
 | 
					    int status = 0;
 | 
				
			||||||
    uint64_t flags = 0;
 | 
					    uint64_t flags = 0;
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(xact);
 | 
					    ogs_assert(xact);
 | 
				
			||||||
    ogs_assert(rsp);
 | 
					    ogs_assert(rsp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    session = xact->assoc_session;
 | 
					    stream = xact->assoc_stream;
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    flags = xact->modify_flags;
 | 
					    flags = xact->modify_flags;
 | 
				
			||||||
    ogs_assert(flags);
 | 
					    ogs_assert(flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -265,7 +265,7 @@ void smf_5gc_n4_handle_session_modification_response(
 | 
				
			|||||||
    if (status != OGS_SBI_HTTP_STATUS_OK) {
 | 
					    if (status != OGS_SBI_HTTP_STATUS_OK) {
 | 
				
			||||||
        char *strerror = ogs_msprintf(
 | 
					        char *strerror = ogs_msprintf(
 | 
				
			||||||
                "PFCP Cause [%d] : Not Accepted", rsp->cause.u8);
 | 
					                "PFCP Cause [%d] : Not Accepted", rsp->cause.u8);
 | 
				
			||||||
        smf_sbi_send_sm_context_update_error(session, status, strerror,
 | 
					        smf_sbi_send_sm_context_update_error(stream, status, strerror,
 | 
				
			||||||
                NULL, NULL, NULL);
 | 
					                NULL, NULL, NULL);
 | 
				
			||||||
        ogs_free(strerror);
 | 
					        ogs_free(strerror);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
@@ -274,19 +274,19 @@ void smf_5gc_n4_handle_session_modification_response(
 | 
				
			|||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (sess->upf_n3_addr == NULL && sess->upf_n3_addr6 == NULL) {
 | 
					    if (sess->upf_n3_addr == NULL && sess->upf_n3_addr6 == NULL) {
 | 
				
			||||||
        smf_sbi_send_sm_context_update_error(session, status, "No UP F_TEID",
 | 
					        smf_sbi_send_sm_context_update_error(stream, status, "No UP F_TEID",
 | 
				
			||||||
                NULL, NULL, NULL);
 | 
					                NULL, NULL, NULL);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (flags & OGS_PFCP_MODIFY_ACTIVATE) {
 | 
					    if (flags & OGS_PFCP_MODIFY_ACTIVATE) {
 | 
				
			||||||
        /* ACTIVATED Is NOT Inlcuded in RESPONSE */
 | 
					        /* ACTIVATED Is NOT Inlcuded in RESPONSE */
 | 
				
			||||||
        smf_sbi_send_sm_context_updated_data(sess, session, 0);
 | 
					        smf_sbi_send_sm_context_updated_data(sess, stream, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    } else if (flags & OGS_PFCP_MODIFY_DEACTIVATE) {
 | 
					    } else if (flags & OGS_PFCP_MODIFY_DEACTIVATE) {
 | 
				
			||||||
        /* Only ACTIVING & DEACTIVATED is Included */
 | 
					        /* Only ACTIVING & DEACTIVATED is Included */
 | 
				
			||||||
        smf_sbi_send_sm_context_updated_data(
 | 
					        smf_sbi_send_sm_context_updated_data(
 | 
				
			||||||
                sess, session, OpenAPI_up_cnx_state_DEACTIVATED);
 | 
					                sess, stream, OpenAPI_up_cnx_state_DEACTIVATED);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -297,7 +297,7 @@ void smf_5gc_n4_handle_session_deletion_response(
 | 
				
			|||||||
    int status = 0;
 | 
					    int status = 0;
 | 
				
			||||||
    int trigger;
 | 
					    int trigger;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_message_t sendmsg;
 | 
					    ogs_sbi_message_t sendmsg;
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
@@ -305,8 +305,8 @@ void smf_5gc_n4_handle_session_deletion_response(
 | 
				
			|||||||
    ogs_assert(xact);
 | 
					    ogs_assert(xact);
 | 
				
			||||||
    ogs_assert(rsp);
 | 
					    ogs_assert(rsp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    session = xact->assoc_session;
 | 
					    stream = xact->assoc_stream;
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    trigger = xact->delete_trigger;
 | 
					    trigger = xact->delete_trigger;
 | 
				
			||||||
    ogs_assert(trigger);
 | 
					    ogs_assert(trigger);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -332,7 +332,7 @@ void smf_5gc_n4_handle_session_deletion_response(
 | 
				
			|||||||
    if (status != OGS_SBI_HTTP_STATUS_OK) {
 | 
					    if (status != OGS_SBI_HTTP_STATUS_OK) {
 | 
				
			||||||
        char *strerror = ogs_msprintf(
 | 
					        char *strerror = ogs_msprintf(
 | 
				
			||||||
                "PFCP Cause [%d] : Not Accepted", rsp->cause.u8);
 | 
					                "PFCP Cause [%d] : Not Accepted", rsp->cause.u8);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, status, NULL, NULL, NULL);
 | 
					        ogs_sbi_server_send_error(stream, status, NULL, NULL, NULL);
 | 
				
			||||||
        ogs_free(strerror);
 | 
					        ogs_free(strerror);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -341,7 +341,7 @@ void smf_5gc_n4_handle_session_deletion_response(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (trigger == OGS_PFCP_DELETE_TRIGGER_UE_REQUESTED) {
 | 
					    if (trigger == OGS_PFCP_DELETE_TRIGGER_UE_REQUESTED) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        smf_sbi_send_sm_context_updated_data_in_session_deletion(sess, session);
 | 
					        smf_sbi_send_sm_context_updated_data_in_session_deletion(sess, stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -350,7 +350,7 @@ void smf_5gc_n4_handle_session_deletion_response(
 | 
				
			|||||||
        response = ogs_sbi_build_response(
 | 
					        response = ogs_sbi_build_response(
 | 
				
			||||||
                &sendmsg, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					                &sendmsg, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
        ogs_assert(response);
 | 
					        ogs_assert(response);
 | 
				
			||||||
        ogs_sbi_server_send_response(session, response);
 | 
					        ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SMF_SESS_CLEAR(sess);
 | 
					        SMF_SESS_CLEAR(sess);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@
 | 
				
			|||||||
#include "nas-path.h"
 | 
					#include "nas-path.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void nas_5gs_send_to_gsm(
 | 
					void nas_5gs_send_to_gsm(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session, ogs_pkbuf_t *pkbuf)
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream, ogs_pkbuf_t *pkbuf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
    smf_event_t *e = NULL;
 | 
					    smf_event_t *e = NULL;
 | 
				
			||||||
@@ -31,7 +31,7 @@ void nas_5gs_send_to_gsm(
 | 
				
			|||||||
    e = smf_event_new(SMF_EVT_5GSM_MESSAGE);
 | 
					    e = smf_event_new(SMF_EVT_5GSM_MESSAGE);
 | 
				
			||||||
    ogs_assert(e);
 | 
					    ogs_assert(e);
 | 
				
			||||||
    e->sess = sess;
 | 
					    e->sess = sess;
 | 
				
			||||||
    e->sbi.session = session;
 | 
					    e->sbi.data = stream;
 | 
				
			||||||
    e->pkbuf = pkbuf;
 | 
					    e->pkbuf = pkbuf;
 | 
				
			||||||
    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
					    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
				
			||||||
    if (rv != OGS_OK) {
 | 
					    if (rv != OGS_OK) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@ extern "C" {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void nas_5gs_send_to_gsm(
 | 
					void nas_5gs_send_to_gsm(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session, ogs_pkbuf_t *pkbuf);
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream, ogs_pkbuf_t *pkbuf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -155,7 +155,7 @@ void smf_nf_state_will_register(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
        case SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
					        case SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
				
			||||||
            client = nf_instance->client;
 | 
					            client = nf_instance->client;
 | 
				
			||||||
            ogs_assert(client);
 | 
					            ogs_assert(client);
 | 
				
			||||||
            addr = client->addr;
 | 
					            addr = client->node.addr;
 | 
				
			||||||
            ogs_assert(addr);
 | 
					            ogs_assert(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
					            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
				
			||||||
@@ -365,7 +365,7 @@ void smf_nf_state_exception(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
        case SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
					        case SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
				
			||||||
            client = nf_instance->client;
 | 
					            client = nf_instance->client;
 | 
				
			||||||
            ogs_assert(client);
 | 
					            ogs_assert(client);
 | 
				
			||||||
            addr = client->addr;
 | 
					            addr = client->node.addr;
 | 
				
			||||||
            ogs_assert(addr);
 | 
					            ogs_assert(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
					            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@
 | 
				
			|||||||
#include "pfcp-path.h"
 | 
					#include "pfcp-path.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ngap_handle_pdu_session_resource_setup_response_transfer(
 | 
					int ngap_handle_pdu_session_resource_setup_response_transfer(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session, ogs_pkbuf_t *pkbuf)
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream, ogs_pkbuf_t *pkbuf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    smf_ue_t *smf_ue = NULL;
 | 
					    smf_ue_t *smf_ue = NULL;
 | 
				
			||||||
    smf_bearer_t *qos_flow = NULL;
 | 
					    smf_bearer_t *qos_flow = NULL;
 | 
				
			||||||
@@ -44,7 +44,7 @@ int ngap_handle_pdu_session_resource_setup_response_transfer(
 | 
				
			|||||||
    NGAP_AssociatedQosFlowList_t *associatedQosFlowList = NULL;
 | 
					    NGAP_AssociatedQosFlowList_t *associatedQosFlowList = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(pkbuf);
 | 
					    ogs_assert(pkbuf);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
    smf_ue = sess->smf_ue;
 | 
					    smf_ue = sess->smf_ue;
 | 
				
			||||||
@@ -56,7 +56,7 @@ int ngap_handle_pdu_session_resource_setup_response_transfer(
 | 
				
			|||||||
    if (rv != OGS_OK) {
 | 
					    if (rv != OGS_OK) {
 | 
				
			||||||
        ogs_error("[%s:%d] Cannot decode NGAP message",
 | 
					        ogs_error("[%s:%d] Cannot decode NGAP message",
 | 
				
			||||||
                smf_ue->supi, sess->psi);
 | 
					                smf_ue->supi, sess->psi);
 | 
				
			||||||
        smf_sbi_send_sm_context_update_error(session,
 | 
					        smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                "No N2 SM Info Type", smf_ue->supi, NULL, NULL);
 | 
					                "No N2 SM Info Type", smf_ue->supi, NULL, NULL);
 | 
				
			||||||
        goto cleanup;
 | 
					        goto cleanup;
 | 
				
			||||||
@@ -74,7 +74,7 @@ int ngap_handle_pdu_session_resource_setup_response_transfer(
 | 
				
			|||||||
            "[%s:%d] Unknown NGAP_UPTransportLayerInformation.present [%d]",
 | 
					            "[%s:%d] Unknown NGAP_UPTransportLayerInformation.present [%d]",
 | 
				
			||||||
            smf_ue->supi, sess->psi,
 | 
					            smf_ue->supi, sess->psi,
 | 
				
			||||||
            uPTransportLayerInformation->present);
 | 
					            uPTransportLayerInformation->present);
 | 
				
			||||||
        smf_sbi_send_sm_context_update_error(session,
 | 
					        smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                "Unknown NGAP_UPTransportLayerInformation.present",
 | 
					                "Unknown NGAP_UPTransportLayerInformation.present",
 | 
				
			||||||
                smf_ue->supi, NULL, NULL);
 | 
					                smf_ue->supi, NULL, NULL);
 | 
				
			||||||
@@ -94,7 +94,7 @@ int ngap_handle_pdu_session_resource_setup_response_transfer(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (!qos_flow) {
 | 
					    if (!qos_flow) {
 | 
				
			||||||
        ogs_error("[%s:%d] No QoS flow", smf_ue->supi, sess->psi);
 | 
					        ogs_error("[%s:%d] No QoS flow", smf_ue->supi, sess->psi);
 | 
				
			||||||
        smf_sbi_send_sm_context_update_error(session,
 | 
					        smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                "No QoS flow", smf_ue->supi, NULL, NULL);
 | 
					                "No QoS flow", smf_ue->supi, NULL, NULL);
 | 
				
			||||||
        goto cleanup;
 | 
					        goto cleanup;
 | 
				
			||||||
@@ -103,7 +103,7 @@ int ngap_handle_pdu_session_resource_setup_response_transfer(
 | 
				
			|||||||
    gTPTunnel = uPTransportLayerInformation->choice.gTPTunnel;
 | 
					    gTPTunnel = uPTransportLayerInformation->choice.gTPTunnel;
 | 
				
			||||||
    if (!gTPTunnel) {
 | 
					    if (!gTPTunnel) {
 | 
				
			||||||
        ogs_error("[%s:%d] No GTPTunnel", smf_ue->supi, sess->psi);
 | 
					        ogs_error("[%s:%d] No GTPTunnel", smf_ue->supi, sess->psi);
 | 
				
			||||||
        smf_sbi_send_sm_context_update_error(session,
 | 
					        smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                "No GTPTunnel", smf_ue->supi, NULL, NULL);
 | 
					                "No GTPTunnel", smf_ue->supi, NULL, NULL);
 | 
				
			||||||
        goto cleanup;
 | 
					        goto cleanup;
 | 
				
			||||||
@@ -134,10 +134,10 @@ int ngap_handle_pdu_session_resource_setup_response_transfer(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (far_update) {
 | 
					    if (far_update) {
 | 
				
			||||||
        smf_5gc_pfcp_send_qos_flow_modification_request(
 | 
					        smf_5gc_pfcp_send_qos_flow_modification_request(
 | 
				
			||||||
                qos_flow, session, OGS_PFCP_MODIFY_ACTIVATE);
 | 
					                qos_flow, stream, OGS_PFCP_MODIFY_ACTIVATE);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        /* ACTIVATED Is NOT Inlcuded in RESPONSE */
 | 
					        /* ACTIVATED Is NOT Inlcuded in RESPONSE */
 | 
				
			||||||
        smf_sbi_send_sm_context_updated_data(sess, session, 0);
 | 
					        smf_sbi_send_sm_context_updated_data(sess, stream, 0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rv = OGS_OK;
 | 
					    rv = OGS_OK;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@ extern "C" {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ngap_handle_pdu_session_resource_setup_response_transfer(
 | 
					int ngap_handle_pdu_session_resource_setup_response_transfer(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session, ogs_pkbuf_t *pkbuf);
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream, ogs_pkbuf_t *pkbuf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@
 | 
				
			|||||||
#include "ngap-path.h"
 | 
					#include "ngap-path.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ngap_send_to_n2sm(smf_sess_t *sess,
 | 
					void ngap_send_to_n2sm(smf_sess_t *sess,
 | 
				
			||||||
        ogs_sbi_session_t *session, int type, ogs_pkbuf_t *pkbuf)
 | 
					        ogs_sbi_stream_t *stream, int type, ogs_pkbuf_t *pkbuf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
    smf_event_t *e = NULL;
 | 
					    smf_event_t *e = NULL;
 | 
				
			||||||
@@ -31,7 +31,7 @@ void ngap_send_to_n2sm(smf_sess_t *sess,
 | 
				
			|||||||
    e = smf_event_new(SMF_EVT_NGAP_MESSAGE);
 | 
					    e = smf_event_new(SMF_EVT_NGAP_MESSAGE);
 | 
				
			||||||
    ogs_assert(e);
 | 
					    ogs_assert(e);
 | 
				
			||||||
    e->sess = sess;
 | 
					    e->sess = sess;
 | 
				
			||||||
    e->sbi.session = session;
 | 
					    e->sbi.data = stream;
 | 
				
			||||||
    e->pkbuf = pkbuf;
 | 
					    e->pkbuf = pkbuf;
 | 
				
			||||||
    e->ngap.type = type;
 | 
					    e->ngap.type = type;
 | 
				
			||||||
    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
					    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@ extern "C" {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ngap_send_to_n2sm(smf_sess_t *sess,
 | 
					void ngap_send_to_n2sm(smf_sess_t *sess,
 | 
				
			||||||
        ogs_sbi_session_t *session, int type, ogs_pkbuf_t *pkbuf);
 | 
					        ogs_sbi_stream_t *stream, int type, ogs_pkbuf_t *pkbuf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -89,7 +89,7 @@ void smf_nnrf_handle_nf_status_subscribe(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool smf_nnrf_handle_nf_status_notify(
 | 
					bool smf_nnrf_handle_nf_status_notify(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
    OpenAPI_notification_data_t *NotificationData = NULL;
 | 
					    OpenAPI_notification_data_t *NotificationData = NULL;
 | 
				
			||||||
@@ -97,13 +97,13 @@ bool smf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
    bool handled;
 | 
					    bool handled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    NotificationData = message->NotificationData;
 | 
					    NotificationData = message->NotificationData;
 | 
				
			||||||
    if (!NotificationData) {
 | 
					    if (!NotificationData) {
 | 
				
			||||||
        ogs_error("No NotificationData");
 | 
					        ogs_error("No NotificationData");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NotificationData", NULL);
 | 
					                message, "No NotificationData", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -111,21 +111,21 @@ bool smf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    NFProfile = NotificationData->nf_profile;
 | 
					    NFProfile = NotificationData->nf_profile;
 | 
				
			||||||
    if (!NFProfile) {
 | 
					    if (!NFProfile) {
 | 
				
			||||||
        ogs_error("No NFProfile");
 | 
					        ogs_error("No NFProfile");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", NULL);
 | 
					                message, "No NFProfile", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile->nf_instance_id) {
 | 
					    if (!NFProfile->nf_instance_id) {
 | 
				
			||||||
        ogs_error("No NFProfile.NFInstanceId");
 | 
					        ogs_error("No NFProfile.NFInstanceId");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", "NFInstanceId");
 | 
					                message, "No NFProfile", "NFInstanceId");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile->nf_instance_id) {
 | 
					    if (!NFProfile->nf_instance_id) {
 | 
				
			||||||
        ogs_error("No NFProfile.NFInstanceId");
 | 
					        ogs_error("No NFProfile.NFInstanceId");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", "NFInstanceId");
 | 
					                message, "No NFProfile", "NFInstanceId");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -133,7 +133,7 @@ bool smf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
 | 
					    if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
 | 
				
			||||||
        ogs_warn("[%s] The notification is not allowed",
 | 
					        ogs_warn("[%s] The notification is not allowed",
 | 
				
			||||||
                NFProfile->nf_instance_id);
 | 
					                NFProfile->nf_instance_id);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
                message, "The notification is not allowed",
 | 
					                message, "The notification is not allowed",
 | 
				
			||||||
                NFProfile->nf_instance_id);
 | 
					                NFProfile->nf_instance_id);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -159,7 +159,7 @@ bool smf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        handled = ogs_sbi_nnrf_handle_nf_profile(
 | 
					        handled = ogs_sbi_nnrf_handle_nf_profile(
 | 
				
			||||||
                    nf_instance, NFProfile, session, message);
 | 
					                    nf_instance, NFProfile, stream, message);
 | 
				
			||||||
        if (!handled) {
 | 
					        if (!handled) {
 | 
				
			||||||
            SMF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            SMF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -170,7 +170,7 @@ bool smf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
        handled = ogs_sbi_client_associate(nf_instance);
 | 
					        handled = ogs_sbi_client_associate(nf_instance);
 | 
				
			||||||
        if (!handled) {
 | 
					        if (!handled) {
 | 
				
			||||||
            ogs_error("[%s] Cannot associate NF EndPoint", nf_instance->id);
 | 
					            ogs_error("[%s] Cannot associate NF EndPoint", nf_instance->id);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    message, "Cannot find NF EndPoint", nf_instance->id);
 | 
					                    message, "Cannot find NF EndPoint", nf_instance->id);
 | 
				
			||||||
            SMF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            SMF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
@@ -184,7 +184,7 @@ bool smf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
            SMF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            SMF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            ogs_warn("[%s] (NRF-notify) Not found", NFProfile->nf_instance_id);
 | 
					            ogs_warn("[%s] (NRF-notify) Not found", NFProfile->nf_instance_id);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                message, "Not found", message->h.resource.component[1]);
 | 
					                message, "Not found", message->h.resource.component[1]);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -194,7 +194,7 @@ bool smf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
                            NotificationData->event);
 | 
					                            NotificationData->event);
 | 
				
			||||||
        ogs_error("Not supported event [%d:%s]",
 | 
					        ogs_error("Not supported event [%d:%s]",
 | 
				
			||||||
                NotificationData->event, eventstr ? eventstr : "Unknown");
 | 
					                NotificationData->event, eventstr ? eventstr : "Unknown");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "Not supported event",
 | 
					                message, "Not supported event",
 | 
				
			||||||
                eventstr ? eventstr : "Unknown");
 | 
					                eventstr ? eventstr : "Unknown");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -202,7 +202,7 @@ bool smf_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					    response = ogs_sbi_build_response(message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -212,7 +212,7 @@ void smf_nnrf_handle_nf_discover(
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_object_t *sbi_object = NULL;
 | 
					    ogs_sbi_object_t *sbi_object = NULL;
 | 
				
			||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    OpenAPI_search_result_t *SearchResult = NULL;
 | 
					    OpenAPI_search_result_t *SearchResult = NULL;
 | 
				
			||||||
    OpenAPI_lnode_t *node = NULL;
 | 
					    OpenAPI_lnode_t *node = NULL;
 | 
				
			||||||
@@ -221,8 +221,8 @@ void smf_nnrf_handle_nf_discover(
 | 
				
			|||||||
    ogs_assert(xact);
 | 
					    ogs_assert(xact);
 | 
				
			||||||
    sbi_object = xact->sbi_object;
 | 
					    sbi_object = xact->sbi_object;
 | 
				
			||||||
    ogs_assert(sbi_object);
 | 
					    ogs_assert(sbi_object);
 | 
				
			||||||
    session = xact->assoc_session;
 | 
					    stream = xact->assoc_stream;
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SearchResult = message->SearchResult;
 | 
					    SearchResult = message->SearchResult;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ void smf_nnrf_handle_nf_status_subscribe(
 | 
				
			|||||||
        ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool smf_nnrf_handle_nf_status_notify(
 | 
					bool smf_nnrf_handle_nf_status_notify(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_nnrf_handle_nf_discover(
 | 
					void smf_nnrf_handle_nf_discover(
 | 
				
			||||||
        ogs_sbi_xact_t *xact, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_xact_t *xact, ogs_sbi_message_t *message);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@
 | 
				
			|||||||
#include "nsmf-handler.h"
 | 
					#include "nsmf-handler.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool smf_nsmf_handle_create_sm_context(
 | 
					bool smf_nsmf_handle_create_sm_context(
 | 
				
			||||||
    smf_sess_t *sess, ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					    smf_sess_t *sess, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    smf_ue_t *smf_ue = NULL;
 | 
					    smf_ue_t *smf_ue = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -39,7 +39,7 @@ bool smf_nsmf_handle_create_sm_context(
 | 
				
			|||||||
    OpenAPI_plmn_id_nid_t *servingNetwork = NULL;
 | 
					    OpenAPI_plmn_id_nid_t *servingNetwork = NULL;
 | 
				
			||||||
    OpenAPI_ref_to_binary_data_t *n1SmMsg = NULL;
 | 
					    OpenAPI_ref_to_binary_data_t *n1SmMsg = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
@@ -52,7 +52,7 @@ bool smf_nsmf_handle_create_sm_context(
 | 
				
			|||||||
                smf_ue->supi, sess->psi);
 | 
					                smf_ue->supi, sess->psi);
 | 
				
			||||||
        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
					        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
				
			||||||
            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
					            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
				
			||||||
        smf_sbi_send_sm_context_create_error(session,
 | 
					        smf_sbi_send_sm_context_create_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                "No SmContextCreateData", smf_ue->supi, n1smbuf);
 | 
					                "No SmContextCreateData", smf_ue->supi, n1smbuf);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -63,7 +63,7 @@ bool smf_nsmf_handle_create_sm_context(
 | 
				
			|||||||
        ogs_error("[%s:%d] No sNssai", smf_ue->supi, sess->psi);
 | 
					        ogs_error("[%s:%d] No sNssai", smf_ue->supi, sess->psi);
 | 
				
			||||||
        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
					        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
				
			||||||
            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
					            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
				
			||||||
        smf_sbi_send_sm_context_create_error(session,
 | 
					        smf_sbi_send_sm_context_create_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                "No sNssai", smf_ue->supi, n1smbuf);
 | 
					                "No sNssai", smf_ue->supi, n1smbuf);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -75,7 +75,7 @@ bool smf_nsmf_handle_create_sm_context(
 | 
				
			|||||||
                smf_ue->supi, sess->psi);
 | 
					                smf_ue->supi, sess->psi);
 | 
				
			||||||
        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
					        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
				
			||||||
            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
					            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
				
			||||||
        smf_sbi_send_sm_context_create_error(session,
 | 
					        smf_sbi_send_sm_context_create_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                "No servingNetwork", smf_ue->supi, n1smbuf);
 | 
					                "No servingNetwork", smf_ue->supi, n1smbuf);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -86,7 +86,7 @@ bool smf_nsmf_handle_create_sm_context(
 | 
				
			|||||||
        ogs_error("[%s:%d] No UeLocation", smf_ue->supi, sess->psi);
 | 
					        ogs_error("[%s:%d] No UeLocation", smf_ue->supi, sess->psi);
 | 
				
			||||||
        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
					        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
				
			||||||
            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
					            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
				
			||||||
        smf_sbi_send_sm_context_create_error(session,
 | 
					        smf_sbi_send_sm_context_create_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                "No UeLocation", smf_ue->supi, n1smbuf);
 | 
					                "No UeLocation", smf_ue->supi, n1smbuf);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -100,7 +100,7 @@ bool smf_nsmf_handle_create_sm_context(
 | 
				
			|||||||
        ogs_error("[%s:%d] No NrLocation", smf_ue->supi, sess->psi);
 | 
					        ogs_error("[%s:%d] No NrLocation", smf_ue->supi, sess->psi);
 | 
				
			||||||
        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
					        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
				
			||||||
            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
					            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
				
			||||||
        smf_sbi_send_sm_context_create_error(session,
 | 
					        smf_sbi_send_sm_context_create_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                "No UeLocation", smf_ue->supi, n1smbuf);
 | 
					                "No UeLocation", smf_ue->supi, n1smbuf);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -111,7 +111,7 @@ bool smf_nsmf_handle_create_sm_context(
 | 
				
			|||||||
        ogs_error("[%s:%d] No n1SmMsg", smf_ue->supi, sess->psi);
 | 
					        ogs_error("[%s:%d] No n1SmMsg", smf_ue->supi, sess->psi);
 | 
				
			||||||
        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
					        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
				
			||||||
            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
					            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
				
			||||||
        smf_sbi_send_sm_context_create_error(session,
 | 
					        smf_sbi_send_sm_context_create_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                "No n1SmMsg", smf_ue->supi, n1smbuf);
 | 
					                "No n1SmMsg", smf_ue->supi, n1smbuf);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -123,7 +123,7 @@ bool smf_nsmf_handle_create_sm_context(
 | 
				
			|||||||
                smf_ue->supi, sess->psi, n1SmMsg->content_id);
 | 
					                smf_ue->supi, sess->psi, n1SmMsg->content_id);
 | 
				
			||||||
        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
					        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
				
			||||||
            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
					            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
				
			||||||
        smf_sbi_send_sm_context_create_error(session,
 | 
					        smf_sbi_send_sm_context_create_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                "No N1 SM Content", smf_ue->supi, n1smbuf);
 | 
					                "No N1 SM Content", smf_ue->supi, n1smbuf);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -134,7 +134,7 @@ bool smf_nsmf_handle_create_sm_context(
 | 
				
			|||||||
                smf_ue->supi, sess->psi);
 | 
					                smf_ue->supi, sess->psi);
 | 
				
			||||||
        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
					        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
				
			||||||
            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
					            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
				
			||||||
        smf_sbi_send_sm_context_create_error(session,
 | 
					        smf_sbi_send_sm_context_create_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                "No SmContextStatusNotification", smf_ue->supi, n1smbuf);
 | 
					                "No SmContextStatusNotification", smf_ue->supi, n1smbuf);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -147,7 +147,7 @@ bool smf_nsmf_handle_create_sm_context(
 | 
				
			|||||||
                SmContextCreateData->sm_context_status_uri);
 | 
					                SmContextCreateData->sm_context_status_uri);
 | 
				
			||||||
        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
					        n1smbuf = gsm_build_pdu_session_establishment_reject(sess,
 | 
				
			||||||
            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
					            OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
				
			||||||
        smf_sbi_send_sm_context_create_error(session,
 | 
					        smf_sbi_send_sm_context_create_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST, "Invalid URI",
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST, "Invalid URI",
 | 
				
			||||||
                SmContextCreateData->sm_context_status_uri, n1smbuf);
 | 
					                SmContextCreateData->sm_context_status_uri, n1smbuf);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -195,13 +195,13 @@ bool smf_nsmf_handle_create_sm_context(
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    n1smbuf = ogs_pkbuf_copy(n1smbuf);
 | 
					    n1smbuf = ogs_pkbuf_copy(n1smbuf);
 | 
				
			||||||
    ogs_assert(n1smbuf);
 | 
					    ogs_assert(n1smbuf);
 | 
				
			||||||
    nas_5gs_send_to_gsm(sess, session, n1smbuf);
 | 
					    nas_5gs_send_to_gsm(sess, stream, n1smbuf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool smf_nsmf_handle_update_sm_context(
 | 
					bool smf_nsmf_handle_update_sm_context(
 | 
				
			||||||
    smf_sess_t *sess, ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					    smf_sess_t *sess, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
    smf_ue_t *smf_ue = NULL;
 | 
					    smf_ue_t *smf_ue = NULL;
 | 
				
			||||||
@@ -216,7 +216,7 @@ bool smf_nsmf_handle_update_sm_context(
 | 
				
			|||||||
    ogs_pkbuf_t *n1smbuf = NULL;
 | 
					    ogs_pkbuf_t *n1smbuf = NULL;
 | 
				
			||||||
    ogs_pkbuf_t *n2smbuf = NULL;
 | 
					    ogs_pkbuf_t *n2smbuf = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
@@ -227,7 +227,7 @@ bool smf_nsmf_handle_update_sm_context(
 | 
				
			|||||||
    if (!SmContextUpdateData) {
 | 
					    if (!SmContextUpdateData) {
 | 
				
			||||||
        ogs_error("[%s:%d] No SmContextUpdateData",
 | 
					        ogs_error("[%s:%d] No SmContextUpdateData",
 | 
				
			||||||
                smf_ue->supi, sess->psi);
 | 
					                smf_ue->supi, sess->psi);
 | 
				
			||||||
        smf_sbi_send_sm_context_update_error(session,
 | 
					        smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                "No SmContextUpdateData", smf_ue->supi, NULL, NULL);
 | 
					                "No SmContextUpdateData", smf_ue->supi, NULL, NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -261,7 +261,7 @@ bool smf_nsmf_handle_update_sm_context(
 | 
				
			|||||||
            ogs_error("[%s:%d] No n1SmMsg", smf_ue->supi, sess->psi);
 | 
					            ogs_error("[%s:%d] No n1SmMsg", smf_ue->supi, sess->psi);
 | 
				
			||||||
            n1smbuf = gsm_build_pdu_session_release_reject(sess,
 | 
					            n1smbuf = gsm_build_pdu_session_release_reject(sess,
 | 
				
			||||||
                OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
					                OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
				
			||||||
            smf_sbi_send_sm_context_update_error(session,
 | 
					            smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    "No n1SmMsg", smf_ue->supi, n1smbuf, NULL);
 | 
					                    "No n1SmMsg", smf_ue->supi, n1smbuf, NULL);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -273,7 +273,7 @@ bool smf_nsmf_handle_update_sm_context(
 | 
				
			|||||||
                    smf_ue->supi, sess->psi, n1SmMsg->content_id);
 | 
					                    smf_ue->supi, sess->psi, n1SmMsg->content_id);
 | 
				
			||||||
            n1smbuf = gsm_build_pdu_session_release_reject(sess,
 | 
					            n1smbuf = gsm_build_pdu_session_release_reject(sess,
 | 
				
			||||||
                OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
					                OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION);
 | 
				
			||||||
            smf_sbi_send_sm_context_update_error(session,
 | 
					            smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    "No N1 SM Content", smf_ue->supi, n1smbuf, NULL);
 | 
					                    "No N1 SM Content", smf_ue->supi, n1smbuf, NULL);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -286,7 +286,7 @@ bool smf_nsmf_handle_update_sm_context(
 | 
				
			|||||||
         */
 | 
					         */
 | 
				
			||||||
        n1smbuf = ogs_pkbuf_copy(n1smbuf);
 | 
					        n1smbuf = ogs_pkbuf_copy(n1smbuf);
 | 
				
			||||||
        ogs_assert(n1smbuf);
 | 
					        ogs_assert(n1smbuf);
 | 
				
			||||||
        nas_5gs_send_to_gsm(sess, session, n1smbuf);
 | 
					        nas_5gs_send_to_gsm(sess, stream, n1smbuf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@@ -298,7 +298,7 @@ bool smf_nsmf_handle_update_sm_context(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (!SmContextUpdateData->n2_sm_info_type) {
 | 
					        if (!SmContextUpdateData->n2_sm_info_type) {
 | 
				
			||||||
            ogs_error("[%s:%d] No n2SmInfoType", smf_ue->supi, sess->psi);
 | 
					            ogs_error("[%s:%d] No n2SmInfoType", smf_ue->supi, sess->psi);
 | 
				
			||||||
            smf_sbi_send_sm_context_update_error(session,
 | 
					            smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    "No n2SmInfoType", smf_ue->supi, NULL, NULL);
 | 
					                    "No n2SmInfoType", smf_ue->supi, NULL, NULL);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -308,7 +308,7 @@ bool smf_nsmf_handle_update_sm_context(
 | 
				
			|||||||
        if (!n2SmMsg || !n2SmMsg->content_id) {
 | 
					        if (!n2SmMsg || !n2SmMsg->content_id) {
 | 
				
			||||||
            ogs_error("[%s:%d] No N2SmInfo.content_id",
 | 
					            ogs_error("[%s:%d] No N2SmInfo.content_id",
 | 
				
			||||||
                    smf_ue->supi, sess->psi);
 | 
					                    smf_ue->supi, sess->psi);
 | 
				
			||||||
            smf_sbi_send_sm_context_update_error(session,
 | 
					            smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    "No n2SmInfo.content_id", smf_ue->supi, NULL, NULL);
 | 
					                    "No n2SmInfo.content_id", smf_ue->supi, NULL, NULL);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -317,7 +317,7 @@ bool smf_nsmf_handle_update_sm_context(
 | 
				
			|||||||
        n2smbuf = ogs_sbi_find_part_by_content_id(message, n2SmMsg->content_id);
 | 
					        n2smbuf = ogs_sbi_find_part_by_content_id(message, n2SmMsg->content_id);
 | 
				
			||||||
        if (!n2smbuf) {
 | 
					        if (!n2smbuf) {
 | 
				
			||||||
            ogs_error("[%s:%d] No N2 SM Content", smf_ue->supi, sess->psi);
 | 
					            ogs_error("[%s:%d] No N2 SM Content", smf_ue->supi, sess->psi);
 | 
				
			||||||
            smf_sbi_send_sm_context_update_error(session,
 | 
					            smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    "No N2 SM Content", smf_ue->supi, NULL, NULL);
 | 
					                    "No N2 SM Content", smf_ue->supi, NULL, NULL);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -331,12 +331,12 @@ bool smf_nsmf_handle_update_sm_context(
 | 
				
			|||||||
        n2smbuf = ogs_pkbuf_copy(n2smbuf);
 | 
					        n2smbuf = ogs_pkbuf_copy(n2smbuf);
 | 
				
			||||||
        ogs_assert(n2smbuf);
 | 
					        ogs_assert(n2smbuf);
 | 
				
			||||||
        ngap_send_to_n2sm(
 | 
					        ngap_send_to_n2sm(
 | 
				
			||||||
                sess, session, SmContextUpdateData->n2_sm_info_type, n2smbuf);
 | 
					                sess, stream, SmContextUpdateData->n2_sm_info_type, n2smbuf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        if (!SmContextUpdateData->up_cnx_state) {
 | 
					        if (!SmContextUpdateData->up_cnx_state) {
 | 
				
			||||||
            ogs_error("[%s:%d] No upCnxState", smf_ue->supi, sess->psi);
 | 
					            ogs_error("[%s:%d] No upCnxState", smf_ue->supi, sess->psi);
 | 
				
			||||||
            smf_sbi_send_sm_context_update_error(session,
 | 
					            smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    "No upCnxState", smf_ue->supi, NULL, NULL);
 | 
					                    "No upCnxState", smf_ue->supi, NULL, NULL);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -349,7 +349,7 @@ bool smf_nsmf_handle_update_sm_context(
 | 
				
			|||||||
         * Handle DEACTIVATED
 | 
					         * Handle DEACTIVATED
 | 
				
			||||||
         ********************************************************/
 | 
					         ********************************************************/
 | 
				
			||||||
            smf_5gc_pfcp_send_session_modification_request(
 | 
					            smf_5gc_pfcp_send_session_modification_request(
 | 
				
			||||||
                    sess, session, OGS_PFCP_MODIFY_DEACTIVATE);
 | 
					                    sess, stream, OGS_PFCP_MODIFY_DEACTIVATE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        } else if (SmContextUpdateData->up_cnx_state ==
 | 
					        } else if (SmContextUpdateData->up_cnx_state ==
 | 
				
			||||||
                OpenAPI_up_cnx_state_ACTIVATING) {
 | 
					                OpenAPI_up_cnx_state_ACTIVATING) {
 | 
				
			||||||
@@ -424,7 +424,7 @@ bool smf_nsmf_handle_update_sm_context(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
					            response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
				
			||||||
            ogs_assert(response);
 | 
					            ogs_assert(response);
 | 
				
			||||||
            ogs_sbi_server_send_response(session, response);
 | 
					            ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            for (i = 0; i < sendmsg.num_of_part; i++)
 | 
					            for (i = 0; i < sendmsg.num_of_part; i++)
 | 
				
			||||||
                if (sendmsg.part[i].pkbuf)
 | 
					                if (sendmsg.part[i].pkbuf)
 | 
				
			||||||
@@ -435,7 +435,7 @@ bool smf_nsmf_handle_update_sm_context(
 | 
				
			|||||||
                smf_ue->supi, sess->psi,
 | 
					                smf_ue->supi, sess->psi,
 | 
				
			||||||
                SmContextUpdateData->up_cnx_state);
 | 
					                SmContextUpdateData->up_cnx_state);
 | 
				
			||||||
            ogs_error("%s", strerror);
 | 
					            ogs_error("%s", strerror);
 | 
				
			||||||
            smf_sbi_send_sm_context_update_error(session,
 | 
					            smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, strerror,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, strerror,
 | 
				
			||||||
                    NULL, NULL, NULL);
 | 
					                    NULL, NULL, NULL);
 | 
				
			||||||
            ogs_free(strerror);
 | 
					            ogs_free(strerror);
 | 
				
			||||||
@@ -447,11 +447,11 @@ bool smf_nsmf_handle_update_sm_context(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool smf_nsmf_handle_release_sm_context(
 | 
					bool smf_nsmf_handle_release_sm_context(
 | 
				
			||||||
    smf_sess_t *sess, ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					    smf_sess_t *sess, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    OpenAPI_sm_context_release_data_t *SmContextReleaseData = NULL;
 | 
					    OpenAPI_sm_context_release_data_t *SmContextReleaseData = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -482,7 +482,7 @@ bool smf_nsmf_handle_release_sm_context(
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    smf_5gc_pfcp_send_session_deletion_request(sess, session,
 | 
					    smf_5gc_pfcp_send_session_deletion_request(sess, stream,
 | 
				
			||||||
            OGS_PFCP_DELETE_TRIGGER_AMF_RELEASE_SM_CONTEXT);
 | 
					            OGS_PFCP_DELETE_TRIGGER_AMF_RELEASE_SM_CONTEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,11 +27,11 @@ extern "C" {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool smf_nsmf_handle_create_sm_context(
 | 
					bool smf_nsmf_handle_create_sm_context(
 | 
				
			||||||
    smf_sess_t *sess, ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					    smf_sess_t *sess, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
bool smf_nsmf_handle_update_sm_context(
 | 
					bool smf_nsmf_handle_update_sm_context(
 | 
				
			||||||
    smf_sess_t *sess, ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					    smf_sess_t *sess, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
bool smf_nsmf_handle_release_sm_context(
 | 
					bool smf_nsmf_handle_release_sm_context(
 | 
				
			||||||
    smf_sess_t *sess, ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					    smf_sess_t *sess, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@
 | 
				
			|||||||
#include "nudm-handler.h"
 | 
					#include "nudm-handler.h"
 | 
				
			||||||
#include "pfcp-path.h"
 | 
					#include "pfcp-path.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_session_t *session,
 | 
					bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_stream_t *stream,
 | 
				
			||||||
        ogs_sbi_message_t *recvmsg)
 | 
					        ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    char buf1[OGS_ADDRSTRLEN];
 | 
					    char buf1[OGS_ADDRSTRLEN];
 | 
				
			||||||
@@ -55,10 +55,10 @@ bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_session_t *session,
 | 
				
			|||||||
    OpenAPI_lnode_t *node = NULL, *node2 = NULL;
 | 
					    OpenAPI_lnode_t *node = NULL, *node2 = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    smf_ue = sess->smf_ue;
 | 
					    smf_ue = sess->smf_ue;
 | 
				
			||||||
    ogs_assert(smf_ue);
 | 
					    ogs_assert(smf_ue);
 | 
				
			||||||
    server = ogs_sbi_session_get_server(session);
 | 
					    server = ogs_sbi_server_from_stream(stream);
 | 
				
			||||||
    ogs_assert(server);
 | 
					    ogs_assert(server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
@@ -257,7 +257,7 @@ bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_session_t *session,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_CREATED);
 | 
					    response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_CREATED);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_free(sendmsg.http.location);
 | 
					    ogs_free(sendmsg.http.location);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -334,7 +334,7 @@ bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_session_t *session,
 | 
				
			|||||||
    dl_pdr->precedence = 0xffffffff;
 | 
					    dl_pdr->precedence = 0xffffffff;
 | 
				
			||||||
    ul_pdr->precedence = 0xffffffff;
 | 
					    ul_pdr->precedence = 0xffffffff;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    smf_5gc_pfcp_send_session_establishment_request(sess, session);
 | 
					    smf_5gc_pfcp_send_session_establishment_request(sess, stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,7 +26,7 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_session_t *session,
 | 
					bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_stream_t *stream,
 | 
				
			||||||
        ogs_sbi_message_t *recvmsg);
 | 
					        ogs_sbi_message_t *recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -180,7 +180,7 @@ static void sess_5gc_timeout(ogs_pfcp_xact_t *xact, void *data)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    smf_ue_t *smf_ue = NULL;
 | 
					    smf_ue_t *smf_ue = NULL;
 | 
				
			||||||
    smf_sess_t *sess = NULL;
 | 
					    smf_sess_t *sess = NULL;
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
    uint8_t type;
 | 
					    uint8_t type;
 | 
				
			||||||
    char *strerror = NULL;
 | 
					    char *strerror = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -189,8 +189,8 @@ static void sess_5gc_timeout(ogs_pfcp_xact_t *xact, void *data)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    sess = data;
 | 
					    sess = data;
 | 
				
			||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
    session = xact->assoc_session;
 | 
					    stream = xact->assoc_stream;
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    smf_ue = sess->smf_ue;
 | 
					    smf_ue = sess->smf_ue;
 | 
				
			||||||
    ogs_assert(smf_ue);
 | 
					    ogs_assert(smf_ue);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -202,14 +202,14 @@ static void sess_5gc_timeout(ogs_pfcp_xact_t *xact, void *data)
 | 
				
			|||||||
    case OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE:
 | 
					    case OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE:
 | 
				
			||||||
        strerror = ogs_msprintf("[%s:%d] No PFCP session modification response",
 | 
					        strerror = ogs_msprintf("[%s:%d] No PFCP session modification response",
 | 
				
			||||||
                smf_ue->supi, sess->psi);
 | 
					                smf_ue->supi, sess->psi);
 | 
				
			||||||
        smf_sbi_send_sm_context_update_error(session,
 | 
					        smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT,
 | 
					                OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT,
 | 
				
			||||||
                strerror, NULL, NULL, NULL);
 | 
					                strerror, NULL, NULL, NULL);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case OGS_PFCP_SESSION_DELETION_REQUEST_TYPE:
 | 
					    case OGS_PFCP_SESSION_DELETION_REQUEST_TYPE:
 | 
				
			||||||
        strerror = ogs_msprintf("[%s:%d] No PFCP session deletion response",
 | 
					        strerror = ogs_msprintf("[%s:%d] No PFCP session deletion response",
 | 
				
			||||||
                smf_ue->supi, sess->psi);
 | 
					                smf_ue->supi, sess->psi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL, strerror, NULL);
 | 
					                OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL, strerror, NULL);
 | 
				
			||||||
        ogs_free(strerror);
 | 
					        ogs_free(strerror);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
@@ -243,7 +243,7 @@ static void sess_epc_timeout(ogs_pfcp_xact_t *xact, void *data)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_5gc_pfcp_send_session_establishment_request(
 | 
					void smf_5gc_pfcp_send_session_establishment_request(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session)
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
    ogs_pkbuf_t *n4buf = NULL;
 | 
					    ogs_pkbuf_t *n4buf = NULL;
 | 
				
			||||||
@@ -251,7 +251,7 @@ void smf_5gc_pfcp_send_session_establishment_request(
 | 
				
			|||||||
    ogs_pfcp_xact_t *xact = NULL;
 | 
					    ogs_pfcp_xact_t *xact = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(&h, 0, sizeof(ogs_pfcp_header_t));
 | 
					    memset(&h, 0, sizeof(ogs_pfcp_header_t));
 | 
				
			||||||
    h.type = OGS_PFCP_SESSION_ESTABLISHMENT_REQUEST_TYPE;
 | 
					    h.type = OGS_PFCP_SESSION_ESTABLISHMENT_REQUEST_TYPE;
 | 
				
			||||||
@@ -263,14 +263,14 @@ void smf_5gc_pfcp_send_session_establishment_request(
 | 
				
			|||||||
    xact = ogs_pfcp_xact_local_create(
 | 
					    xact = ogs_pfcp_xact_local_create(
 | 
				
			||||||
            sess->pfcp_node, &h, n4buf, sess_5gc_timeout, sess);
 | 
					            sess->pfcp_node, &h, n4buf, sess_5gc_timeout, sess);
 | 
				
			||||||
    ogs_expect_or_return(xact);
 | 
					    ogs_expect_or_return(xact);
 | 
				
			||||||
    xact->assoc_session = session;
 | 
					    xact->assoc_stream = stream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rv = ogs_pfcp_xact_commit(xact);
 | 
					    rv = ogs_pfcp_xact_commit(xact);
 | 
				
			||||||
    ogs_expect(rv == OGS_OK);
 | 
					    ogs_expect(rv == OGS_OK);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_5gc_pfcp_send_session_modification_request(
 | 
					void smf_5gc_pfcp_send_session_modification_request(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session, uint64_t flags)
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream, uint64_t flags)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
    ogs_pkbuf_t *n4buf = NULL;
 | 
					    ogs_pkbuf_t *n4buf = NULL;
 | 
				
			||||||
@@ -278,7 +278,7 @@ void smf_5gc_pfcp_send_session_modification_request(
 | 
				
			|||||||
    ogs_pfcp_xact_t *xact = NULL;
 | 
					    ogs_pfcp_xact_t *xact = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(&h, 0, sizeof(ogs_pfcp_header_t));
 | 
					    memset(&h, 0, sizeof(ogs_pfcp_header_t));
 | 
				
			||||||
    h.type = OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE;
 | 
					    h.type = OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE;
 | 
				
			||||||
@@ -290,7 +290,7 @@ void smf_5gc_pfcp_send_session_modification_request(
 | 
				
			|||||||
    xact = ogs_pfcp_xact_local_create(
 | 
					    xact = ogs_pfcp_xact_local_create(
 | 
				
			||||||
            sess->pfcp_node, &h, n4buf, sess_5gc_timeout, sess);
 | 
					            sess->pfcp_node, &h, n4buf, sess_5gc_timeout, sess);
 | 
				
			||||||
    ogs_expect_or_return(xact);
 | 
					    ogs_expect_or_return(xact);
 | 
				
			||||||
    xact->assoc_session = session;
 | 
					    xact->assoc_stream = stream;
 | 
				
			||||||
    xact->modify_flags = flags | OGS_PFCP_MODIFY_SESSION;
 | 
					    xact->modify_flags = flags | OGS_PFCP_MODIFY_SESSION;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rv = ogs_pfcp_xact_commit(xact);
 | 
					    rv = ogs_pfcp_xact_commit(xact);
 | 
				
			||||||
@@ -298,7 +298,7 @@ void smf_5gc_pfcp_send_session_modification_request(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_5gc_pfcp_send_qos_flow_modification_request(smf_bearer_t *qos_flow,
 | 
					void smf_5gc_pfcp_send_qos_flow_modification_request(smf_bearer_t *qos_flow,
 | 
				
			||||||
        ogs_sbi_session_t *session, uint64_t flags)
 | 
					        ogs_sbi_stream_t *stream, uint64_t flags)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
    ogs_pkbuf_t *n4buf = NULL;
 | 
					    ogs_pkbuf_t *n4buf = NULL;
 | 
				
			||||||
@@ -310,7 +310,7 @@ void smf_5gc_pfcp_send_qos_flow_modification_request(smf_bearer_t *qos_flow,
 | 
				
			|||||||
    sess = qos_flow->sess;
 | 
					    sess = qos_flow->sess;
 | 
				
			||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(&h, 0, sizeof(ogs_pfcp_header_t));
 | 
					    memset(&h, 0, sizeof(ogs_pfcp_header_t));
 | 
				
			||||||
    h.type = OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE;
 | 
					    h.type = OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE;
 | 
				
			||||||
@@ -323,7 +323,7 @@ void smf_5gc_pfcp_send_qos_flow_modification_request(smf_bearer_t *qos_flow,
 | 
				
			|||||||
            sess->pfcp_node, &h, n4buf, sess_5gc_timeout, qos_flow);
 | 
					            sess->pfcp_node, &h, n4buf, sess_5gc_timeout, qos_flow);
 | 
				
			||||||
    ogs_expect_or_return(xact);
 | 
					    ogs_expect_or_return(xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xact->assoc_session = session;
 | 
					    xact->assoc_stream = stream;
 | 
				
			||||||
    xact->modify_flags = flags;
 | 
					    xact->modify_flags = flags;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rv = ogs_pfcp_xact_commit(xact);
 | 
					    rv = ogs_pfcp_xact_commit(xact);
 | 
				
			||||||
@@ -331,7 +331,7 @@ void smf_5gc_pfcp_send_qos_flow_modification_request(smf_bearer_t *qos_flow,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_5gc_pfcp_send_session_deletion_request(
 | 
					void smf_5gc_pfcp_send_session_deletion_request(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session, int trigger)
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream, int trigger)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
    ogs_pkbuf_t *n4buf = NULL;
 | 
					    ogs_pkbuf_t *n4buf = NULL;
 | 
				
			||||||
@@ -339,7 +339,7 @@ void smf_5gc_pfcp_send_session_deletion_request(
 | 
				
			|||||||
    ogs_pfcp_xact_t *xact = NULL;
 | 
					    ogs_pfcp_xact_t *xact = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(trigger);
 | 
					    ogs_assert(trigger);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(&h, 0, sizeof(ogs_pfcp_header_t));
 | 
					    memset(&h, 0, sizeof(ogs_pfcp_header_t));
 | 
				
			||||||
@@ -352,7 +352,7 @@ void smf_5gc_pfcp_send_session_deletion_request(
 | 
				
			|||||||
    xact = ogs_pfcp_xact_local_create(
 | 
					    xact = ogs_pfcp_xact_local_create(
 | 
				
			||||||
            sess->pfcp_node, &h, n4buf, sess_5gc_timeout, sess);
 | 
					            sess->pfcp_node, &h, n4buf, sess_5gc_timeout, sess);
 | 
				
			||||||
    ogs_expect_or_return(xact);
 | 
					    ogs_expect_or_return(xact);
 | 
				
			||||||
    xact->assoc_session = session;
 | 
					    xact->assoc_stream = stream;
 | 
				
			||||||
    xact->delete_trigger = trigger;
 | 
					    xact->delete_trigger = trigger;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rv = ogs_pfcp_xact_commit(xact);
 | 
					    rv = ogs_pfcp_xact_commit(xact);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,13 +30,13 @@ int smf_pfcp_open(void);
 | 
				
			|||||||
void smf_pfcp_close(void);
 | 
					void smf_pfcp_close(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_5gc_pfcp_send_session_establishment_request(
 | 
					void smf_5gc_pfcp_send_session_establishment_request(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session);
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream);
 | 
				
			||||||
void smf_5gc_pfcp_send_session_modification_request(
 | 
					void smf_5gc_pfcp_send_session_modification_request(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session, uint64_t flags);
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream, uint64_t flags);
 | 
				
			||||||
void smf_5gc_pfcp_send_qos_flow_modification_request(smf_bearer_t *qos_flow,
 | 
					void smf_5gc_pfcp_send_qos_flow_modification_request(smf_bearer_t *qos_flow,
 | 
				
			||||||
        ogs_sbi_session_t *session, uint64_t flags);
 | 
					        ogs_sbi_stream_t *stream, uint64_t flags);
 | 
				
			||||||
void smf_5gc_pfcp_send_session_deletion_request(
 | 
					void smf_5gc_pfcp_send_session_deletion_request(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session, int trigger);
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream, int trigger);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_epc_pfcp_send_session_establishment_request(
 | 
					void smf_epc_pfcp_send_session_establishment_request(
 | 
				
			||||||
        smf_sess_t *sess, void *gtp_xact);
 | 
					        smf_sess_t *sess, void *gtp_xact);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,21 +21,19 @@
 | 
				
			|||||||
#include "ngap-path.h"
 | 
					#include "ngap-path.h"
 | 
				
			||||||
#include "sbi-path.h"
 | 
					#include "sbi-path.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int server_cb(ogs_sbi_server_t *server,
 | 
					static int server_cb(ogs_sbi_request_t *request, void *data)
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_request_t *request)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    smf_event_t *e = NULL;
 | 
					    smf_event_t *e = NULL;
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					 | 
				
			||||||
    ogs_assert(request);
 | 
					    ogs_assert(request);
 | 
				
			||||||
 | 
					    ogs_assert(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    e = smf_event_new(SMF_EVT_SBI_SERVER);
 | 
					    e = smf_event_new(SMF_EVT_SBI_SERVER);
 | 
				
			||||||
    ogs_assert(e);
 | 
					    ogs_assert(e);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    e->sbi.server = server;
 | 
					 | 
				
			||||||
    e->sbi.session = session;
 | 
					 | 
				
			||||||
    e->sbi.request = request;
 | 
					    e->sbi.request = request;
 | 
				
			||||||
 | 
					    e->sbi.data = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
					    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
				
			||||||
    if (rv != OGS_OK) {
 | 
					    if (rv != OGS_OK) {
 | 
				
			||||||
@@ -122,7 +120,7 @@ void smf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
 | 
					void smf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session, void *data,
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream, void *data,
 | 
				
			||||||
        ogs_sbi_request_t *(*build)(smf_sess_t *sess, void *data))
 | 
					        ogs_sbi_request_t *(*build)(smf_sess_t *sess, void *data))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_xact_t *xact = NULL;
 | 
					    ogs_sbi_xact_t *xact = NULL;
 | 
				
			||||||
@@ -134,40 +132,40 @@ void smf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
 | 
				
			|||||||
    smf_ue = sess->smf_ue;
 | 
					    smf_ue = sess->smf_ue;
 | 
				
			||||||
    ogs_assert(smf_ue);
 | 
					    ogs_assert(smf_ue);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(build);
 | 
					    ogs_assert(build);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xact = ogs_sbi_xact_add(target_nf_type, &sess->sbi, data,
 | 
					    xact = ogs_sbi_xact_add(target_nf_type, &sess->sbi, data,
 | 
				
			||||||
            (ogs_sbi_build_f)build, smf_timer_sbi_client_wait_expire);
 | 
					            (ogs_sbi_build_f)build, smf_timer_sbi_client_wait_expire);
 | 
				
			||||||
    ogs_assert(xact);
 | 
					    ogs_assert(xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xact->assoc_session = session;
 | 
					    xact->assoc_stream = stream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (ogs_sbi_discover_and_send(xact,
 | 
					    if (ogs_sbi_discover_and_send(xact,
 | 
				
			||||||
            (ogs_fsm_handler_t)smf_nf_state_registered, client_cb) != true) {
 | 
					            (ogs_fsm_handler_t)smf_nf_state_registered, client_cb) != true) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
 | 
					                OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
 | 
				
			||||||
                "Cannot discover", smf_ue->supi);
 | 
					                "Cannot discover", smf_ue->supi);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_sbi_send_response(ogs_sbi_session_t *session, int status)
 | 
					void smf_sbi_send_response(ogs_sbi_stream_t *stream, int status)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_message_t sendmsg;
 | 
					    ogs_sbi_message_t sendmsg;
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(&sendmsg, 0, sizeof(sendmsg));
 | 
					    memset(&sendmsg, 0, sizeof(sendmsg));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(&sendmsg, status);
 | 
					    response = ogs_sbi_build_response(&sendmsg, status);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_sbi_send_sm_context_create_error(
 | 
					void smf_sbi_send_sm_context_create_error(
 | 
				
			||||||
        ogs_sbi_session_t *session,
 | 
					        ogs_sbi_stream_t *stream,
 | 
				
			||||||
        int status, const char *title, const char *detail,
 | 
					        int status, const char *title, const char *detail,
 | 
				
			||||||
        ogs_pkbuf_t *n1smbuf)
 | 
					        ogs_pkbuf_t *n1smbuf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -178,7 +176,7 @@ void smf_sbi_send_sm_context_create_error(
 | 
				
			|||||||
    OpenAPI_problem_details_t problem;
 | 
					    OpenAPI_problem_details_t problem;
 | 
				
			||||||
    OpenAPI_ref_to_binary_data_t n1SmMsg;
 | 
					    OpenAPI_ref_to_binary_data_t n1SmMsg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(&problem, 0, sizeof(problem));
 | 
					    memset(&problem, 0, sizeof(problem));
 | 
				
			||||||
    problem.status = status;
 | 
					    problem.status = status;
 | 
				
			||||||
@@ -203,14 +201,14 @@ void smf_sbi_send_sm_context_create_error(
 | 
				
			|||||||
    response = ogs_sbi_build_response(&sendmsg, problem.status);
 | 
					    response = ogs_sbi_build_response(&sendmsg, problem.status);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (n1smbuf)
 | 
					    if (n1smbuf)
 | 
				
			||||||
        ogs_pkbuf_free(n1smbuf);
 | 
					        ogs_pkbuf_free(n1smbuf);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_sbi_send_sm_context_updated_data(smf_sess_t *sess,
 | 
					void smf_sbi_send_sm_context_updated_data(smf_sess_t *sess,
 | 
				
			||||||
        ogs_sbi_session_t *session, OpenAPI_up_cnx_state_e up_cnx_state)
 | 
					        ogs_sbi_stream_t *stream, OpenAPI_up_cnx_state_e up_cnx_state)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int status;
 | 
					    int status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -220,7 +218,7 @@ void smf_sbi_send_sm_context_updated_data(smf_sess_t *sess,
 | 
				
			|||||||
    OpenAPI_sm_context_updated_data_t SmContextUpdatedData;
 | 
					    OpenAPI_sm_context_updated_data_t SmContextUpdatedData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(&sendmsg, 0, sizeof(sendmsg));
 | 
					    memset(&sendmsg, 0, sizeof(sendmsg));
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@@ -236,11 +234,11 @@ void smf_sbi_send_sm_context_updated_data(smf_sess_t *sess,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(&sendmsg, status);
 | 
					    response = ogs_sbi_build_response(&sendmsg, status);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_sbi_send_sm_context_updated_data_in_session_deletion(
 | 
					void smf_sbi_send_sm_context_updated_data_in_session_deletion(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session)
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -252,7 +250,7 @@ void smf_sbi_send_sm_context_updated_data_in_session_deletion(
 | 
				
			|||||||
    OpenAPI_ref_to_binary_data_t n2SmInfo;
 | 
					    OpenAPI_ref_to_binary_data_t n2SmInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(sess);
 | 
					    ogs_assert(sess);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(&sendmsg, 0, sizeof(sendmsg));
 | 
					    memset(&sendmsg, 0, sizeof(sendmsg));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -296,14 +294,14 @@ void smf_sbi_send_sm_context_updated_data_in_session_deletion(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
					    response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (i = 0; i < sendmsg.num_of_part; i++)
 | 
					    for (i = 0; i < sendmsg.num_of_part; i++)
 | 
				
			||||||
        ogs_pkbuf_free(sendmsg.part[i].pkbuf);
 | 
					        ogs_pkbuf_free(sendmsg.part[i].pkbuf);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_sbi_send_sm_context_update_error(
 | 
					void smf_sbi_send_sm_context_update_error(
 | 
				
			||||||
        ogs_sbi_session_t *session,
 | 
					        ogs_sbi_stream_t *stream,
 | 
				
			||||||
        int status, const char *title, const char *detail,
 | 
					        int status, const char *title, const char *detail,
 | 
				
			||||||
        ogs_pkbuf_t *n1smbuf, ogs_pkbuf_t *n2smbuf)
 | 
					        ogs_pkbuf_t *n1smbuf, ogs_pkbuf_t *n2smbuf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -315,7 +313,7 @@ void smf_sbi_send_sm_context_update_error(
 | 
				
			|||||||
    OpenAPI_ref_to_binary_data_t n1SmMsg;
 | 
					    OpenAPI_ref_to_binary_data_t n1SmMsg;
 | 
				
			||||||
    OpenAPI_ref_to_binary_data_t n2SmInfo;
 | 
					    OpenAPI_ref_to_binary_data_t n2SmInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(&problem, 0, sizeof(problem));
 | 
					    memset(&problem, 0, sizeof(problem));
 | 
				
			||||||
    problem.status = status;
 | 
					    problem.status = status;
 | 
				
			||||||
@@ -353,7 +351,7 @@ void smf_sbi_send_sm_context_update_error(
 | 
				
			|||||||
    response = ogs_sbi_build_response(&sendmsg, problem.status);
 | 
					    response = ogs_sbi_build_response(&sendmsg, problem.status);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (n1smbuf)
 | 
					    if (n1smbuf)
 | 
				
			||||||
        ogs_pkbuf_free(n1smbuf);
 | 
					        ogs_pkbuf_free(n1smbuf);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,21 +34,21 @@ void smf_sbi_close(void);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void smf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
 | 
					void smf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
 | 
				
			||||||
void smf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
 | 
					void smf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session, void *data,
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream, void *data,
 | 
				
			||||||
        ogs_sbi_request_t *(*build)(smf_sess_t *sess, void *data));
 | 
					        ogs_sbi_request_t *(*build)(smf_sess_t *sess, void *data));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_sbi_send_response(ogs_sbi_session_t *session, int status);
 | 
					void smf_sbi_send_response(ogs_sbi_stream_t *stream, int status);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smf_sbi_send_sm_context_create_error(
 | 
					void smf_sbi_send_sm_context_create_error(
 | 
				
			||||||
        ogs_sbi_session_t *session,
 | 
					        ogs_sbi_stream_t *stream,
 | 
				
			||||||
        int status, const char *title, const char *detail,
 | 
					        int status, const char *title, const char *detail,
 | 
				
			||||||
        ogs_pkbuf_t *n1smbuf);
 | 
					        ogs_pkbuf_t *n1smbuf);
 | 
				
			||||||
void smf_sbi_send_sm_context_updated_data(smf_sess_t *sess,
 | 
					void smf_sbi_send_sm_context_updated_data(smf_sess_t *sess,
 | 
				
			||||||
        ogs_sbi_session_t *session, OpenAPI_up_cnx_state_e up_cnx_state);
 | 
					        ogs_sbi_stream_t *stream, OpenAPI_up_cnx_state_e up_cnx_state);
 | 
				
			||||||
void smf_sbi_send_sm_context_updated_data_in_session_deletion(
 | 
					void smf_sbi_send_sm_context_updated_data_in_session_deletion(
 | 
				
			||||||
        smf_sess_t *sess, ogs_sbi_session_t *session);
 | 
					        smf_sess_t *sess, ogs_sbi_stream_t *stream);
 | 
				
			||||||
void smf_sbi_send_sm_context_update_error(
 | 
					void smf_sbi_send_sm_context_update_error(
 | 
				
			||||||
        ogs_sbi_session_t *session,
 | 
					        ogs_sbi_stream_t *stream,
 | 
				
			||||||
        int status, const char *title, const char *detail,
 | 
					        int status, const char *title, const char *detail,
 | 
				
			||||||
        ogs_pkbuf_t *n1smbuf, ogs_pkbuf_t *n2smbuf);
 | 
					        ogs_pkbuf_t *n1smbuf, ogs_pkbuf_t *n2smbuf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,7 +61,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
    ogs_pfcp_xact_t *pfcp_xact = NULL;
 | 
					    ogs_pfcp_xact_t *pfcp_xact = NULL;
 | 
				
			||||||
    ogs_pfcp_message_t pfcp_message;
 | 
					    ogs_pfcp_message_t pfcp_message;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
    ogs_sbi_request_t *sbi_request = NULL;
 | 
					    ogs_sbi_request_t *sbi_request = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
@@ -259,14 +259,14 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
    case SMF_EVT_SBI_SERVER:
 | 
					    case SMF_EVT_SBI_SERVER:
 | 
				
			||||||
        sbi_request = e->sbi.request;
 | 
					        sbi_request = e->sbi.request;
 | 
				
			||||||
        ogs_assert(sbi_request);
 | 
					        ogs_assert(sbi_request);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        rv = ogs_sbi_parse_request(&sbi_message, sbi_request);
 | 
					        rv = ogs_sbi_parse_request(&sbi_message, sbi_request);
 | 
				
			||||||
        if (rv != OGS_OK) {
 | 
					        if (rv != OGS_OK) {
 | 
				
			||||||
            /* 'sbi_message' buffer is released in ogs_sbi_parse_request() */
 | 
					            /* 'sbi_message' buffer is released in ogs_sbi_parse_request() */
 | 
				
			||||||
            ogs_error("cannot parse HTTP sbi_message");
 | 
					            ogs_error("cannot parse HTTP sbi_message");
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    NULL, "cannot parse HTTP sbi_message", NULL);
 | 
					                    NULL, "cannot parse HTTP sbi_message", NULL);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -282,7 +282,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
        ogs_assert(api_version);
 | 
					        ogs_assert(api_version);
 | 
				
			||||||
        if (strcmp(sbi_message.h.api.version, api_version) != 0) {
 | 
					        if (strcmp(sbi_message.h.api.version, api_version) != 0) {
 | 
				
			||||||
            ogs_error("Not supported version [%s]", sbi_message.h.api.version);
 | 
					            ogs_error("Not supported version [%s]", sbi_message.h.api.version);
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    &sbi_message, "Not supported version", NULL);
 | 
					                    &sbi_message, "Not supported version", NULL);
 | 
				
			||||||
            ogs_sbi_message_free(&sbi_message);
 | 
					            ogs_sbi_message_free(&sbi_message);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
@@ -295,13 +295,13 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
            CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY)
 | 
					            CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY)
 | 
				
			||||||
                SWITCH(sbi_message.h.method)
 | 
					                SWITCH(sbi_message.h.method)
 | 
				
			||||||
                CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
					                CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
				
			||||||
                    smf_nnrf_handle_nf_status_notify(session, &sbi_message);
 | 
					                    smf_nnrf_handle_nf_status_notify(stream, &sbi_message);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("Invalid HTTP method [%s]",
 | 
					                    ogs_error("Invalid HTTP method [%s]",
 | 
				
			||||||
                            sbi_message.h.method);
 | 
					                            sbi_message.h.method);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					                            OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
                            &sbi_message,
 | 
					                            &sbi_message,
 | 
				
			||||||
                            "Invalid HTTP method", sbi_message.h.method);
 | 
					                            "Invalid HTTP method", sbi_message.h.method);
 | 
				
			||||||
@@ -311,7 +311,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("Invalid resource name [%s]",
 | 
					                ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                        sbi_message.h.resource.component[0]);
 | 
					                        sbi_message.h.resource.component[0]);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
				
			||||||
                        "Invalid resource name",
 | 
					                        "Invalid resource name",
 | 
				
			||||||
                        sbi_message.h.resource.component[0]);
 | 
					                        sbi_message.h.resource.component[0]);
 | 
				
			||||||
@@ -329,7 +329,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
                        if (!sbi_message.h.resource.component[1]) {
 | 
					                        if (!sbi_message.h.resource.component[1]) {
 | 
				
			||||||
                            ogs_error("No smContextRef [%s]",
 | 
					                            ogs_error("No smContextRef [%s]",
 | 
				
			||||||
                                    sbi_message.h.resource.component[2]);
 | 
					                                    sbi_message.h.resource.component[2]);
 | 
				
			||||||
                            smf_sbi_send_sm_context_update_error(session,
 | 
					                            smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                                    "No smContextRef",
 | 
					                                    "No smContextRef",
 | 
				
			||||||
                                    sbi_message.h.resource.component[2],
 | 
					                                    sbi_message.h.resource.component[2],
 | 
				
			||||||
@@ -342,7 +342,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        if (!sess) {
 | 
					                        if (!sess) {
 | 
				
			||||||
                            ogs_warn("Not found [%s]", sbi_message.h.uri);
 | 
					                            ogs_warn("Not found [%s]", sbi_message.h.uri);
 | 
				
			||||||
                            smf_sbi_send_sm_context_update_error(session,
 | 
					                            smf_sbi_send_sm_context_update_error(stream,
 | 
				
			||||||
                                    OGS_SBI_HTTP_STATUS_NOT_FOUND, "Not found",
 | 
					                                    OGS_SBI_HTTP_STATUS_NOT_FOUND, "Not found",
 | 
				
			||||||
                                    sbi_message.h.uri, NULL, NULL);
 | 
					                                    sbi_message.h.uri, NULL, NULL);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
@@ -356,7 +356,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("Invalid HTTP method [%s]", sbi_message.h.method);
 | 
					                    ogs_error("Invalid HTTP method [%s]", sbi_message.h.method);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
					                            OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
				
			||||||
                            "Invalid HTTP method", sbi_message.h.method);
 | 
					                            "Invalid HTTP method", sbi_message.h.method);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
@@ -380,7 +380,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("Invalid resource name [%s]",
 | 
					                ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                        sbi_message.h.resource.component[0]);
 | 
					                        sbi_message.h.resource.component[0]);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
				
			||||||
                        "Invalid resource name",
 | 
					                        "Invalid resource name",
 | 
				
			||||||
                        sbi_message.h.resource.component[0]);
 | 
					                        sbi_message.h.resource.component[0]);
 | 
				
			||||||
@@ -389,7 +389,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("Invalid API name [%s]", sbi_message.h.service.name);
 | 
					            ogs_error("Invalid API name [%s]", sbi_message.h.service.name);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message,
 | 
				
			||||||
                    "Invalid API name", sbi_message.h.service.name);
 | 
					                    "Invalid API name", sbi_message.h.service.name);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
@@ -524,7 +524,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            e->sess = sess;
 | 
					            e->sess = sess;
 | 
				
			||||||
            e->sbi.message = &sbi_message;
 | 
					            e->sbi.message = &sbi_message;
 | 
				
			||||||
            e->sbi.session = sbi_xact->assoc_session;
 | 
					            e->sbi.data = sbi_xact->assoc_stream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_sbi_xact_remove(sbi_xact);
 | 
					            ogs_sbi_xact_remove(sbi_xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -576,13 +576,13 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
            sbi_xact = e->sbi.data;
 | 
					            sbi_xact = e->sbi.data;
 | 
				
			||||||
            ogs_assert(sbi_xact);
 | 
					            ogs_assert(sbi_xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            session = sbi_xact->assoc_session;
 | 
					            stream = sbi_xact->assoc_stream;
 | 
				
			||||||
            ogs_assert(session);
 | 
					            ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_sbi_xact_remove(sbi_xact);
 | 
					            ogs_sbi_xact_remove(sbi_xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_error("Cannot receive SBI message");
 | 
					            ogs_error("Cannot receive SBI message");
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
 | 
					                    OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
 | 
				
			||||||
                    "Cannot receive SBI message", NULL);
 | 
					                    "Cannot receive SBI message", NULL);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
@@ -606,8 +606,8 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
    case SMF_EVT_5GSM_MESSAGE:
 | 
					    case SMF_EVT_5GSM_MESSAGE:
 | 
				
			||||||
        sess = e->sess;
 | 
					        sess = e->sess;
 | 
				
			||||||
        ogs_assert(sess);
 | 
					        ogs_assert(sess);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
        pkbuf = e->pkbuf;
 | 
					        pkbuf = e->pkbuf;
 | 
				
			||||||
        ogs_assert(pkbuf);
 | 
					        ogs_assert(pkbuf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -635,8 +635,8 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
 | 
				
			|||||||
    case SMF_EVT_NGAP_MESSAGE:
 | 
					    case SMF_EVT_NGAP_MESSAGE:
 | 
				
			||||||
        sess = e->sess;
 | 
					        sess = e->sess;
 | 
				
			||||||
        ogs_assert(sess);
 | 
					        ogs_assert(sess);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
        pkbuf = e->pkbuf;
 | 
					        pkbuf = e->pkbuf;
 | 
				
			||||||
        ogs_assert(pkbuf);
 | 
					        ogs_assert(pkbuf);
 | 
				
			||||||
        ogs_assert(e->ngap.type);
 | 
					        ogs_assert(e->ngap.type);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,8 +26,6 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct ogs_sbi_server_s ogs_sbi_server_t;
 | 
					 | 
				
			||||||
typedef struct ogs_sbi_session_s ogs_sbi_session_t;
 | 
					 | 
				
			||||||
typedef struct ogs_sbi_request_s ogs_sbi_request_t;
 | 
					typedef struct ogs_sbi_request_s ogs_sbi_request_t;
 | 
				
			||||||
typedef struct ogs_sbi_response_s ogs_sbi_response_t;
 | 
					typedef struct ogs_sbi_response_s ogs_sbi_response_t;
 | 
				
			||||||
typedef struct ogs_sbi_message_s ogs_sbi_message_t;
 | 
					typedef struct ogs_sbi_message_s ogs_sbi_message_t;
 | 
				
			||||||
@@ -52,12 +50,7 @@ typedef struct udm_event_s {
 | 
				
			|||||||
    int timer_id;
 | 
					    int timer_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct {
 | 
					    struct {
 | 
				
			||||||
        /* OGS_EVT_SBI_SERVER */
 | 
					 | 
				
			||||||
        ogs_sbi_request_t *request;
 | 
					        ogs_sbi_request_t *request;
 | 
				
			||||||
        ogs_sbi_session_t *session;
 | 
					 | 
				
			||||||
        ogs_sbi_server_t *server;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /* OGS_EVT_SBI_CLIENT */
 | 
					 | 
				
			||||||
        ogs_sbi_response_t *response;
 | 
					        ogs_sbi_response_t *response;
 | 
				
			||||||
        void *data;
 | 
					        void *data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -155,7 +155,7 @@ void udm_nf_state_will_register(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
        case UDM_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
					        case UDM_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
				
			||||||
            client = nf_instance->client;
 | 
					            client = nf_instance->client;
 | 
				
			||||||
            ogs_assert(client);
 | 
					            ogs_assert(client);
 | 
				
			||||||
            addr = client->addr;
 | 
					            addr = client->node.addr;
 | 
				
			||||||
            ogs_assert(addr);
 | 
					            ogs_assert(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
					            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
				
			||||||
@@ -364,7 +364,7 @@ void udm_nf_state_exception(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
        case UDM_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
					        case UDM_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
				
			||||||
            client = nf_instance->client;
 | 
					            client = nf_instance->client;
 | 
				
			||||||
            ogs_assert(client);
 | 
					            ogs_assert(client);
 | 
				
			||||||
            addr = client->addr;
 | 
					            addr = client->node.addr;
 | 
				
			||||||
            ogs_assert(addr);
 | 
					            ogs_assert(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
					            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -89,7 +89,7 @@ void udm_nnrf_handle_nf_status_subscribe(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udm_nnrf_handle_nf_status_notify(
 | 
					bool udm_nnrf_handle_nf_status_notify(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
    OpenAPI_notification_data_t *NotificationData = NULL;
 | 
					    OpenAPI_notification_data_t *NotificationData = NULL;
 | 
				
			||||||
@@ -97,13 +97,13 @@ bool udm_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
    bool handled;
 | 
					    bool handled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    NotificationData = message->NotificationData;
 | 
					    NotificationData = message->NotificationData;
 | 
				
			||||||
    if (!NotificationData) {
 | 
					    if (!NotificationData) {
 | 
				
			||||||
        ogs_error("No NotificationData");
 | 
					        ogs_error("No NotificationData");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NotificationData", NULL);
 | 
					                message, "No NotificationData", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -111,21 +111,21 @@ bool udm_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    NFProfile = NotificationData->nf_profile;
 | 
					    NFProfile = NotificationData->nf_profile;
 | 
				
			||||||
    if (!NFProfile) {
 | 
					    if (!NFProfile) {
 | 
				
			||||||
        ogs_error("No NFProfile");
 | 
					        ogs_error("No NFProfile");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", NULL);
 | 
					                message, "No NFProfile", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile->nf_instance_id) {
 | 
					    if (!NFProfile->nf_instance_id) {
 | 
				
			||||||
        ogs_error("No NFProfile.NFInstanceId");
 | 
					        ogs_error("No NFProfile.NFInstanceId");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", "NFInstanceId");
 | 
					                message, "No NFProfile", "NFInstanceId");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile->nf_instance_id) {
 | 
					    if (!NFProfile->nf_instance_id) {
 | 
				
			||||||
        ogs_error("No NFProfile.NFInstanceId");
 | 
					        ogs_error("No NFProfile.NFInstanceId");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", "NFInstanceId");
 | 
					                message, "No NFProfile", "NFInstanceId");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -133,7 +133,7 @@ bool udm_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
 | 
					    if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
 | 
				
			||||||
        ogs_warn("The notification is not allowed [%s]",
 | 
					        ogs_warn("The notification is not allowed [%s]",
 | 
				
			||||||
                NFProfile->nf_instance_id);
 | 
					                NFProfile->nf_instance_id);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
                message, "The notification is not allowed",
 | 
					                message, "The notification is not allowed",
 | 
				
			||||||
                NFProfile->nf_instance_id);
 | 
					                NFProfile->nf_instance_id);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -159,7 +159,7 @@ bool udm_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        handled = ogs_sbi_nnrf_handle_nf_profile(
 | 
					        handled = ogs_sbi_nnrf_handle_nf_profile(
 | 
				
			||||||
                    nf_instance, NFProfile, session, message);
 | 
					                    nf_instance, NFProfile, stream, message);
 | 
				
			||||||
        if (!handled) {
 | 
					        if (!handled) {
 | 
				
			||||||
            UDM_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            UDM_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -170,7 +170,7 @@ bool udm_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
        handled = ogs_sbi_client_associate(nf_instance);
 | 
					        handled = ogs_sbi_client_associate(nf_instance);
 | 
				
			||||||
        if (!handled) {
 | 
					        if (!handled) {
 | 
				
			||||||
            ogs_error("[%s] Cannot associate NF EndPoint", nf_instance->id);
 | 
					            ogs_error("[%s] Cannot associate NF EndPoint", nf_instance->id);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    message, "Cannot find NF EndPoint", nf_instance->id);
 | 
					                    message, "Cannot find NF EndPoint", nf_instance->id);
 | 
				
			||||||
            UDM_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            UDM_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
@@ -184,7 +184,7 @@ bool udm_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
            UDM_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            UDM_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            ogs_warn("[%s] (NRF-notify) Not found", NFProfile->nf_instance_id);
 | 
					            ogs_warn("[%s] (NRF-notify) Not found", NFProfile->nf_instance_id);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                message, "Not found", message->h.resource.component[1]);
 | 
					                message, "Not found", message->h.resource.component[1]);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -194,7 +194,7 @@ bool udm_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
                            NotificationData->event);
 | 
					                            NotificationData->event);
 | 
				
			||||||
        ogs_error("Not supported event [%d:%s]",
 | 
					        ogs_error("Not supported event [%d:%s]",
 | 
				
			||||||
                NotificationData->event, eventstr ? eventstr : "Unknown");
 | 
					                NotificationData->event, eventstr ? eventstr : "Unknown");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "Not supported event",
 | 
					                message, "Not supported event",
 | 
				
			||||||
                eventstr ? eventstr : "Unknown");
 | 
					                eventstr ? eventstr : "Unknown");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -202,7 +202,7 @@ bool udm_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					    response = ogs_sbi_build_response(message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -212,7 +212,7 @@ void udm_nnrf_handle_nf_discover(
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_object_t *sbi_object = NULL;
 | 
					    ogs_sbi_object_t *sbi_object = NULL;
 | 
				
			||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    OpenAPI_search_result_t *SearchResult = NULL;
 | 
					    OpenAPI_search_result_t *SearchResult = NULL;
 | 
				
			||||||
    OpenAPI_lnode_t *node = NULL;
 | 
					    OpenAPI_lnode_t *node = NULL;
 | 
				
			||||||
@@ -221,8 +221,8 @@ void udm_nnrf_handle_nf_discover(
 | 
				
			|||||||
    ogs_assert(xact);
 | 
					    ogs_assert(xact);
 | 
				
			||||||
    sbi_object = xact->sbi_object;
 | 
					    sbi_object = xact->sbi_object;
 | 
				
			||||||
    ogs_assert(sbi_object);
 | 
					    ogs_assert(sbi_object);
 | 
				
			||||||
    session = xact->assoc_session;
 | 
					    stream = xact->assoc_stream;
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SearchResult = message->SearchResult;
 | 
					    SearchResult = message->SearchResult;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ void udm_nnrf_handle_nf_status_subscribe(
 | 
				
			|||||||
        ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udm_nnrf_handle_nf_status_notify(
 | 
					bool udm_nnrf_handle_nf_status_notify(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void udm_nnrf_handle_nf_discover(
 | 
					void udm_nnrf_handle_nf_discover(
 | 
				
			||||||
        ogs_sbi_xact_t *xact, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_xact_t *xact, ogs_sbi_message_t *message);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@
 | 
				
			|||||||
#include "nudm-handler.h"
 | 
					#include "nudm-handler.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udm_nudm_ueau_handle_get(
 | 
					bool udm_nudm_ueau_handle_get(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    OpenAPI_authentication_info_request_t *AuthenticationInfoRequest = NULL;
 | 
					    OpenAPI_authentication_info_request_t *AuthenticationInfoRequest = NULL;
 | 
				
			||||||
    OpenAPI_resynchronization_info_t *ResynchronizationInfo = NULL;
 | 
					    OpenAPI_resynchronization_info_t *ResynchronizationInfo = NULL;
 | 
				
			||||||
@@ -30,13 +30,13 @@ bool udm_nudm_ueau_handle_get(
 | 
				
			|||||||
    char *ausf_instance_id = NULL;
 | 
					    char *ausf_instance_id = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(udm_ue);
 | 
					    ogs_assert(udm_ue);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    AuthenticationInfoRequest = recvmsg->AuthenticationInfoRequest;
 | 
					    AuthenticationInfoRequest = recvmsg->AuthenticationInfoRequest;
 | 
				
			||||||
    if (!AuthenticationInfoRequest) {
 | 
					    if (!AuthenticationInfoRequest) {
 | 
				
			||||||
        ogs_error("[%s] No AuthenticationInfoRequest", udm_ue->suci);
 | 
					        ogs_error("[%s] No AuthenticationInfoRequest", udm_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "No AuthenticationInfoRequest", udm_ue->suci);
 | 
					                recvmsg, "No AuthenticationInfoRequest", udm_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -44,7 +44,7 @@ bool udm_nudm_ueau_handle_get(
 | 
				
			|||||||
    serving_network_name = AuthenticationInfoRequest->serving_network_name;
 | 
					    serving_network_name = AuthenticationInfoRequest->serving_network_name;
 | 
				
			||||||
    if (!AuthenticationInfoRequest) {
 | 
					    if (!AuthenticationInfoRequest) {
 | 
				
			||||||
        ogs_error("[%s] No servingNetworkName", udm_ue->suci);
 | 
					        ogs_error("[%s] No servingNetworkName", udm_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "No servingNetworkName", udm_ue->suci);
 | 
					                recvmsg, "No servingNetworkName", udm_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -56,7 +56,7 @@ bool udm_nudm_ueau_handle_get(
 | 
				
			|||||||
    ausf_instance_id = AuthenticationInfoRequest->ausf_instance_id;
 | 
					    ausf_instance_id = AuthenticationInfoRequest->ausf_instance_id;
 | 
				
			||||||
    if (!AuthenticationInfoRequest) {
 | 
					    if (!AuthenticationInfoRequest) {
 | 
				
			||||||
        ogs_error("[%s] No ausfInstanceId", udm_ue->suci);
 | 
					        ogs_error("[%s] No ausfInstanceId", udm_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "No ausfInstanceId", udm_ue->suci);
 | 
					                recvmsg, "No ausfInstanceId", udm_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -68,7 +68,7 @@ bool udm_nudm_ueau_handle_get(
 | 
				
			|||||||
    ResynchronizationInfo = AuthenticationInfoRequest->resynchronization_info;
 | 
					    ResynchronizationInfo = AuthenticationInfoRequest->resynchronization_info;
 | 
				
			||||||
    if (!ResynchronizationInfo) {
 | 
					    if (!ResynchronizationInfo) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, session, NULL,
 | 
					        udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, stream, NULL,
 | 
				
			||||||
                    udm_nudr_dr_build_authentication_subscription);
 | 
					                    udm_nudr_dr_build_authentication_subscription);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
@@ -80,7 +80,7 @@ bool udm_nudm_ueau_handle_get(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (!ResynchronizationInfo->rand) {
 | 
					        if (!ResynchronizationInfo->rand) {
 | 
				
			||||||
            ogs_error("[%s] No RAND", udm_ue->suci);
 | 
					            ogs_error("[%s] No RAND", udm_ue->suci);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    recvmsg, "No RAND", udm_ue->suci);
 | 
					                    recvmsg, "No RAND", udm_ue->suci);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -88,7 +88,7 @@ bool udm_nudm_ueau_handle_get(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (!ResynchronizationInfo->auts) {
 | 
					        if (!ResynchronizationInfo->auts) {
 | 
				
			||||||
            ogs_error("[%s] No AUTS", udm_ue->suci);
 | 
					            ogs_error("[%s] No AUTS", udm_ue->suci);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    recvmsg, "No AUTS", udm_ue->suci);
 | 
					                    recvmsg, "No AUTS", udm_ue->suci);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -106,7 +106,7 @@ bool udm_nudm_ueau_handle_get(
 | 
				
			|||||||
            ogs_log_hexdump(OGS_LOG_ERROR, udm_ue->rand, sizeof(udm_ue)->rand);
 | 
					            ogs_log_hexdump(OGS_LOG_ERROR, udm_ue->rand, sizeof(udm_ue)->rand);
 | 
				
			||||||
            ogs_log_hexdump(OGS_LOG_ERROR, rand, sizeof(rand));
 | 
					            ogs_log_hexdump(OGS_LOG_ERROR, rand, sizeof(rand));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    recvmsg, "Invalid RAND", udm_ue->suci);
 | 
					                    recvmsg, "Invalid RAND", udm_ue->suci);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -120,7 +120,7 @@ bool udm_nudm_ueau_handle_get(
 | 
				
			|||||||
            ogs_log_hexdump(OGS_LOG_ERROR, mac_s, OGS_MAC_S_LEN);
 | 
					            ogs_log_hexdump(OGS_LOG_ERROR, mac_s, OGS_MAC_S_LEN);
 | 
				
			||||||
            ogs_log_hexdump(OGS_LOG_ERROR, auts + OGS_SQN_LEN, OGS_MAC_S_LEN);
 | 
					            ogs_log_hexdump(OGS_LOG_ERROR, auts + OGS_SQN_LEN, OGS_MAC_S_LEN);
 | 
				
			||||||
            ogs_log_hexdump(OGS_LOG_ERROR, sqn_ms, OGS_SQN_LEN);
 | 
					            ogs_log_hexdump(OGS_LOG_ERROR, sqn_ms, OGS_SQN_LEN);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_UNAUTHORIZED,
 | 
					                    OGS_SBI_HTTP_STATUS_UNAUTHORIZED,
 | 
				
			||||||
                    recvmsg, "Re-sync MAC failed", udm_ue->suci);
 | 
					                    recvmsg, "Re-sync MAC failed", udm_ue->suci);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -152,7 +152,7 @@ bool udm_nudm_ueau_handle_get(
 | 
				
			|||||||
        ogs_uint64_to_buffer(sqn, OGS_SQN_LEN, udm_ue->sqn);
 | 
					        ogs_uint64_to_buffer(sqn, OGS_SQN_LEN, udm_ue->sqn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        udm_sbi_discover_and_send(OpenAPI_nf_type_UDR,
 | 
					        udm_sbi_discover_and_send(OpenAPI_nf_type_UDR,
 | 
				
			||||||
                udm_ue, session, udm_ue->sqn,
 | 
					                udm_ue, stream, udm_ue->sqn,
 | 
				
			||||||
                udm_nudr_dr_build_authentication_subscription);
 | 
					                udm_nudr_dr_build_authentication_subscription);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -160,15 +160,15 @@ bool udm_nudm_ueau_handle_get(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udm_nudm_ueau_handle_result_confirmation_inform(
 | 
					bool udm_nudm_ueau_handle_result_confirmation_inform(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_assert(udm_ue);
 | 
					    ogs_assert(udm_ue);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!message->AuthEvent) {
 | 
					    if (!message->AuthEvent) {
 | 
				
			||||||
        ogs_error("[%s] No AuthEvent", udm_ue->suci);
 | 
					        ogs_error("[%s] No AuthEvent", udm_ue->suci);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No AuthEvent", udm_ue->suci);
 | 
					                message, "No AuthEvent", udm_ue->suci);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -176,33 +176,33 @@ bool udm_nudm_ueau_handle_result_confirmation_inform(
 | 
				
			|||||||
    udm_ue->auth_event = OpenAPI_auth_event_copy(
 | 
					    udm_ue->auth_event = OpenAPI_auth_event_copy(
 | 
				
			||||||
            udm_ue->auth_event, message->AuthEvent);
 | 
					            udm_ue->auth_event, message->AuthEvent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, session, NULL,
 | 
					    udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, stream, NULL,
 | 
				
			||||||
            udm_nudr_dr_build_update_authentication_status);
 | 
					            udm_nudr_dr_build_update_authentication_status);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udm_nudm_uecm_handle_registration(
 | 
					bool udm_nudm_uecm_handle_registration(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    OpenAPI_amf3_gpp_access_registration_t *Amf3GppAccessRegistration = NULL;
 | 
					    OpenAPI_amf3_gpp_access_registration_t *Amf3GppAccessRegistration = NULL;
 | 
				
			||||||
    OpenAPI_guami_t *Guami = NULL;
 | 
					    OpenAPI_guami_t *Guami = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(udm_ue);
 | 
					    ogs_assert(udm_ue);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Amf3GppAccessRegistration = message->Amf3GppAccessRegistration;
 | 
					    Amf3GppAccessRegistration = message->Amf3GppAccessRegistration;
 | 
				
			||||||
    if (!Amf3GppAccessRegistration) {
 | 
					    if (!Amf3GppAccessRegistration) {
 | 
				
			||||||
        ogs_error("[%s] No Amf3GppAccessRegistration", udm_ue->supi);
 | 
					        ogs_error("[%s] No Amf3GppAccessRegistration", udm_ue->supi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No Amf3GppAccessRegistration", udm_ue->supi);
 | 
					                message, "No Amf3GppAccessRegistration", udm_ue->supi);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!Amf3GppAccessRegistration->dereg_callback_uri) {
 | 
					    if (!Amf3GppAccessRegistration->dereg_callback_uri) {
 | 
				
			||||||
        ogs_error("[%s] No dregCallbackUri", udm_ue->supi);
 | 
					        ogs_error("[%s] No dregCallbackUri", udm_ue->supi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No dregCallbackUri", udm_ue->supi);
 | 
					                message, "No dregCallbackUri", udm_ue->supi);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -210,35 +210,35 @@ bool udm_nudm_uecm_handle_registration(
 | 
				
			|||||||
    Guami = Amf3GppAccessRegistration->guami;
 | 
					    Guami = Amf3GppAccessRegistration->guami;
 | 
				
			||||||
    if (!Guami) {
 | 
					    if (!Guami) {
 | 
				
			||||||
        ogs_error("[%s] No Guami", udm_ue->supi);
 | 
					        ogs_error("[%s] No Guami", udm_ue->supi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No Guami", udm_ue->supi);
 | 
					                message, "No Guami", udm_ue->supi);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!Guami->amf_id) {
 | 
					    if (!Guami->amf_id) {
 | 
				
			||||||
        ogs_error("[%s] No Guami.AmfId", udm_ue->supi);
 | 
					        ogs_error("[%s] No Guami.AmfId", udm_ue->supi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No Guami.AmfId", udm_ue->supi);
 | 
					                message, "No Guami.AmfId", udm_ue->supi);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!Guami->plmn_id) {
 | 
					    if (!Guami->plmn_id) {
 | 
				
			||||||
        ogs_error("[%s] No PlmnId", udm_ue->supi);
 | 
					        ogs_error("[%s] No PlmnId", udm_ue->supi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No PlmnId", udm_ue->supi);
 | 
					                message, "No PlmnId", udm_ue->supi);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!Guami->plmn_id->mnc) {
 | 
					    if (!Guami->plmn_id->mnc) {
 | 
				
			||||||
        ogs_error("[%s] No PlmnId.Mnc", udm_ue->supi);
 | 
					        ogs_error("[%s] No PlmnId.Mnc", udm_ue->supi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No PlmnId.Mnc", udm_ue->supi);
 | 
					                message, "No PlmnId.Mnc", udm_ue->supi);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!Guami->plmn_id->mcc) {
 | 
					    if (!Guami->plmn_id->mcc) {
 | 
				
			||||||
        ogs_error("[%s] No PlmnId.Mcc", udm_ue->supi);
 | 
					        ogs_error("[%s] No PlmnId.Mcc", udm_ue->supi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No PlmnId.Mcc", udm_ue->supi);
 | 
					                message, "No PlmnId.Mcc", udm_ue->supi);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -255,20 +255,20 @@ bool udm_nudm_uecm_handle_registration(
 | 
				
			|||||||
            udm_ue->amf_3gpp_access_registration,
 | 
					            udm_ue->amf_3gpp_access_registration,
 | 
				
			||||||
                message->Amf3GppAccessRegistration);
 | 
					                message->Amf3GppAccessRegistration);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, session, NULL,
 | 
					    udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, stream, NULL,
 | 
				
			||||||
            udm_nudr_dr_build_update_amf_context);
 | 
					            udm_nudr_dr_build_update_amf_context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udm_nudm_sdm_handle_subscription_provisioned(
 | 
					bool udm_nudm_sdm_handle_subscription_provisioned(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_message_t sendmsg;
 | 
					    ogs_sbi_message_t sendmsg;
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(udm_ue);
 | 
					    ogs_assert(udm_ue);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SWITCH(recvmsg->h.resource.component[1])
 | 
					    SWITCH(recvmsg->h.resource.component[1])
 | 
				
			||||||
@@ -277,7 +277,7 @@ bool udm_nudm_sdm_handle_subscription_provisioned(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
					        response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
				
			||||||
        ogs_assert(response);
 | 
					        ogs_assert(response);
 | 
				
			||||||
        ogs_sbi_server_send_response(session, response);
 | 
					        ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,15 +27,15 @@ extern "C" {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udm_nudm_ueau_handle_get(
 | 
					bool udm_nudm_ueau_handle_get(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
 | 
				
			||||||
bool udm_nudm_ueau_handle_result_confirmation_inform(
 | 
					bool udm_nudm_ueau_handle_result_confirmation_inform(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udm_nudm_uecm_handle_registration(
 | 
					bool udm_nudm_uecm_handle_registration(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udm_nudm_sdm_handle_subscription_provisioned(
 | 
					bool udm_nudm_sdm_handle_subscription_provisioned(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@
 | 
				
			|||||||
#include "nudr-handler.h"
 | 
					#include "nudr-handler.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udm_nudr_dr_handle_subscription_authentication(
 | 
					bool udm_nudr_dr_handle_subscription_authentication(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_server_t *server = NULL;
 | 
					    ogs_sbi_server_t *server = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -59,8 +59,8 @@ bool udm_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
    OpenAPI_authentication_vector_t AuthenticationVector;
 | 
					    OpenAPI_authentication_vector_t AuthenticationVector;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(udm_ue);
 | 
					    ogs_assert(udm_ue);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    server = ogs_sbi_session_get_server(session);
 | 
					    server = ogs_sbi_server_from_stream(stream);
 | 
				
			||||||
    ogs_assert(server);
 | 
					    ogs_assert(server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
@@ -73,7 +73,7 @@ bool udm_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
            AuthenticationSubscription = recvmsg->AuthenticationSubscription;
 | 
					            AuthenticationSubscription = recvmsg->AuthenticationSubscription;
 | 
				
			||||||
            if (!AuthenticationSubscription) {
 | 
					            if (!AuthenticationSubscription) {
 | 
				
			||||||
                ogs_error("[%s] No AuthenticationSubscription", udm_ue->suci);
 | 
					                ogs_error("[%s] No AuthenticationSubscription", udm_ue->suci);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					                        OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
                        recvmsg, "No AuthenticationSubscription", udm_ue->suci);
 | 
					                        recvmsg, "No AuthenticationSubscription", udm_ue->suci);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
@@ -84,7 +84,7 @@ bool udm_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
                ogs_error("[%s] Not supported Auth Method [%d]",
 | 
					                ogs_error("[%s] Not supported Auth Method [%d]",
 | 
				
			||||||
                        udm_ue->suci,
 | 
					                        udm_ue->suci,
 | 
				
			||||||
                        AuthenticationSubscription->authentication_method);
 | 
					                        AuthenticationSubscription->authentication_method);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					                        OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
                        recvmsg, "Not supported Auth Method", udm_ue->suci);
 | 
					                        recvmsg, "Not supported Auth Method", udm_ue->suci);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
@@ -93,14 +93,14 @@ bool udm_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (!AuthenticationSubscription->enc_permanent_key) {
 | 
					            if (!AuthenticationSubscription->enc_permanent_key) {
 | 
				
			||||||
                ogs_error("[%s] No encPermanentKey", udm_ue->suci);
 | 
					                ogs_error("[%s] No encPermanentKey", udm_ue->suci);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					                        OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
                        recvmsg, "No encPermanentKey", udm_ue->suci);
 | 
					                        recvmsg, "No encPermanentKey", udm_ue->suci);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (!AuthenticationSubscription->enc_opc_key) {
 | 
					            if (!AuthenticationSubscription->enc_opc_key) {
 | 
				
			||||||
                ogs_error("[%s] No encPermanentKey", udm_ue->suci);
 | 
					                ogs_error("[%s] No encPermanentKey", udm_ue->suci);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					                    OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
                    recvmsg, "No encPermanentKey", udm_ue->suci);
 | 
					                    recvmsg, "No encPermanentKey", udm_ue->suci);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
@@ -108,21 +108,21 @@ bool udm_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
            if (!AuthenticationSubscription->authentication_management_field) {
 | 
					            if (!AuthenticationSubscription->authentication_management_field) {
 | 
				
			||||||
                ogs_error("[%s] No authenticationManagementField",
 | 
					                ogs_error("[%s] No authenticationManagementField",
 | 
				
			||||||
                        udm_ue->suci);
 | 
					                        udm_ue->suci);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					                    OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
                    recvmsg, "No authenticationManagementField", udm_ue->suci);
 | 
					                    recvmsg, "No authenticationManagementField", udm_ue->suci);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (!AuthenticationSubscription->sequence_number) {
 | 
					            if (!AuthenticationSubscription->sequence_number) {
 | 
				
			||||||
                ogs_error("[%s] No SequenceNumber", udm_ue->suci);
 | 
					                ogs_error("[%s] No SequenceNumber", udm_ue->suci);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					                    OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
                    recvmsg, "No SequenceNumber", udm_ue->suci);
 | 
					                    recvmsg, "No SequenceNumber", udm_ue->suci);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (!AuthenticationSubscription->sequence_number->sqn) {
 | 
					            if (!AuthenticationSubscription->sequence_number->sqn) {
 | 
				
			||||||
                ogs_error("[%s] No SequenceNumber.sqn", udm_ue->suci);
 | 
					                ogs_error("[%s] No SequenceNumber.sqn", udm_ue->suci);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					                    OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
                    recvmsg, "No SequenceNumber.sqn", udm_ue->suci);
 | 
					                    recvmsg, "No SequenceNumber.sqn", udm_ue->suci);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
@@ -205,13 +205,13 @@ bool udm_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
					            response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
				
			||||||
            ogs_assert(response);
 | 
					            ogs_assert(response);
 | 
				
			||||||
            ogs_sbi_server_send_response(session, response);
 | 
					            ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("Invalid HTTP method [%s]", recvmsg->h.method);
 | 
					            ogs_error("Invalid HTTP method [%s]", recvmsg->h.method);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_FORBIDDEN, recvmsg,
 | 
					                    OGS_SBI_HTTP_STATUS_FORBIDDEN, recvmsg,
 | 
				
			||||||
                    "Invalid HTTP method", recvmsg->h.method);
 | 
					                    "Invalid HTTP method", recvmsg->h.method);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
@@ -235,7 +235,7 @@ bool udm_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
        response = ogs_sbi_build_response(&sendmsg,
 | 
					        response = ogs_sbi_build_response(&sendmsg,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_CREATED);
 | 
					                OGS_SBI_HTTP_STATUS_CREATED);
 | 
				
			||||||
        ogs_assert(response);
 | 
					        ogs_assert(response);
 | 
				
			||||||
        ogs_sbi_server_send_response(session, response);
 | 
					        ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ogs_free(sendmsg.http.location);
 | 
					        ogs_free(sendmsg.http.location);
 | 
				
			||||||
        OpenAPI_auth_event_free(sendmsg.AuthEvent);
 | 
					        OpenAPI_auth_event_free(sendmsg.AuthEvent);
 | 
				
			||||||
@@ -251,7 +251,7 @@ bool udm_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udm_nudr_dr_handle_subscription_context(
 | 
					bool udm_nudr_dr_handle_subscription_context(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_server_t *server = NULL;
 | 
					    ogs_sbi_server_t *server = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -264,8 +264,8 @@ bool udm_nudr_dr_handle_subscription_context(
 | 
				
			|||||||
    OpenAPI_amf3_gpp_access_registration_t *Amf3GppAccessRegistration = NULL;
 | 
					    OpenAPI_amf3_gpp_access_registration_t *Amf3GppAccessRegistration = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(udm_ue);
 | 
					    ogs_assert(udm_ue);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    server = ogs_sbi_session_get_server(session);
 | 
					    server = ogs_sbi_server_from_stream(stream);
 | 
				
			||||||
    ogs_assert(server);
 | 
					    ogs_assert(server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
@@ -275,14 +275,14 @@ bool udm_nudr_dr_handle_subscription_context(
 | 
				
			|||||||
        Amf3GppAccessRegistration = udm_ue->amf_3gpp_access_registration;
 | 
					        Amf3GppAccessRegistration = udm_ue->amf_3gpp_access_registration;
 | 
				
			||||||
        if (!Amf3GppAccessRegistration) {
 | 
					        if (!Amf3GppAccessRegistration) {
 | 
				
			||||||
            ogs_error("[%s] No Amf3GppAccessRegistration", udm_ue->supi);
 | 
					            ogs_error("[%s] No Amf3GppAccessRegistration", udm_ue->supi);
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    recvmsg, "No Amf3GppAccessRegistration", udm_ue->supi);
 | 
					                    recvmsg, "No Amf3GppAccessRegistration", udm_ue->supi);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!Amf3GppAccessRegistration->amf_instance_id) {
 | 
					        if (!Amf3GppAccessRegistration->amf_instance_id) {
 | 
				
			||||||
            ogs_error("[%s] No amfInstanceId", udm_ue->supi);
 | 
					            ogs_error("[%s] No amfInstanceId", udm_ue->supi);
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    recvmsg, "No amfInstanceId", udm_ue->supi);
 | 
					                    recvmsg, "No amfInstanceId", udm_ue->supi);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -315,7 +315,7 @@ bool udm_nudr_dr_handle_subscription_context(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        response = ogs_sbi_build_response(&sendmsg, status);
 | 
					        response = ogs_sbi_build_response(&sendmsg, status);
 | 
				
			||||||
        ogs_assert(response);
 | 
					        ogs_assert(response);
 | 
				
			||||||
        ogs_sbi_server_send_response(session, response);
 | 
					        ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ogs_free(sendmsg.http.location);
 | 
					        ogs_free(sendmsg.http.location);
 | 
				
			||||||
        OpenAPI_amf3_gpp_access_registration_free(
 | 
					        OpenAPI_amf3_gpp_access_registration_free(
 | 
				
			||||||
@@ -331,7 +331,7 @@ bool udm_nudr_dr_handle_subscription_context(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udm_nudr_dr_handle_subscription_provisioned(
 | 
					bool udm_nudr_dr_handle_subscription_provisioned(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_server_t *server = NULL;
 | 
					    ogs_sbi_server_t *server = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -339,8 +339,8 @@ bool udm_nudr_dr_handle_subscription_provisioned(
 | 
				
			|||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(udm_ue);
 | 
					    ogs_assert(udm_ue);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    server = ogs_sbi_session_get_server(session);
 | 
					    server = ogs_sbi_server_from_stream(stream);
 | 
				
			||||||
    ogs_assert(server);
 | 
					    ogs_assert(server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
@@ -357,7 +357,7 @@ bool udm_nudr_dr_handle_subscription_provisioned(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        response = ogs_sbi_build_response(&sendmsg, recvmsg->res_status);
 | 
					        response = ogs_sbi_build_response(&sendmsg, recvmsg->res_status);
 | 
				
			||||||
        ogs_assert(response);
 | 
					        ogs_assert(response);
 | 
				
			||||||
        ogs_sbi_server_send_response(session, response);
 | 
					        ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        OpenAPI_access_and_mobility_subscription_data_free(
 | 
					        OpenAPI_access_and_mobility_subscription_data_free(
 | 
				
			||||||
                sendmsg.AccessAndMobilitySubscriptionData);
 | 
					                sendmsg.AccessAndMobilitySubscriptionData);
 | 
				
			||||||
@@ -368,7 +368,7 @@ bool udm_nudr_dr_handle_subscription_provisioned(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        response = ogs_sbi_build_response(&sendmsg, recvmsg->res_status);
 | 
					        response = ogs_sbi_build_response(&sendmsg, recvmsg->res_status);
 | 
				
			||||||
        ogs_assert(response);
 | 
					        ogs_assert(response);
 | 
				
			||||||
        ogs_sbi_server_send_response(session, response);
 | 
					        ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -383,7 +383,7 @@ bool udm_nudr_dr_handle_subscription_provisioned(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        response = ogs_sbi_build_response(&sendmsg, recvmsg->res_status);
 | 
					        response = ogs_sbi_build_response(&sendmsg, recvmsg->res_status);
 | 
				
			||||||
        ogs_assert(response);
 | 
					        ogs_assert(response);
 | 
				
			||||||
        ogs_sbi_server_send_response(session, response);
 | 
					        ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        OpenAPI_session_management_subscription_data_free(
 | 
					        OpenAPI_session_management_subscription_data_free(
 | 
				
			||||||
                sendmsg.SessionManagementSubscriptionData);
 | 
					                sendmsg.SessionManagementSubscriptionData);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,11 +27,11 @@ extern "C" {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udm_nudr_dr_handle_subscription_authentication(
 | 
					bool udm_nudr_dr_handle_subscription_authentication(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
 | 
				
			||||||
bool udm_nudr_dr_handle_subscription_context(
 | 
					bool udm_nudr_dr_handle_subscription_context(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
 | 
				
			||||||
bool udm_nudr_dr_handle_subscription_provisioned(
 | 
					bool udm_nudr_dr_handle_subscription_provisioned(
 | 
				
			||||||
    udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
 | 
					    udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,21 +19,19 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "sbi-path.h"
 | 
					#include "sbi-path.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int server_cb(ogs_sbi_server_t *server,
 | 
					static int server_cb(ogs_sbi_request_t *request, void *data)
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_request_t *request)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    udm_event_t *e = NULL;
 | 
					    udm_event_t *e = NULL;
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					 | 
				
			||||||
    ogs_assert(request);
 | 
					    ogs_assert(request);
 | 
				
			||||||
 | 
					    ogs_assert(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    e = udm_event_new(UDM_EVT_SBI_SERVER);
 | 
					    e = udm_event_new(UDM_EVT_SBI_SERVER);
 | 
				
			||||||
    ogs_assert(e);
 | 
					    ogs_assert(e);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    e->sbi.server = server;
 | 
					 | 
				
			||||||
    e->sbi.session = session;
 | 
					 | 
				
			||||||
    e->sbi.request = request;
 | 
					    e->sbi.request = request;
 | 
				
			||||||
 | 
					    e->sbi.data = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
					    rv = ogs_queue_push(ogs_app()->queue, e);
 | 
				
			||||||
    if (rv != OGS_OK) {
 | 
					    if (rv != OGS_OK) {
 | 
				
			||||||
@@ -130,26 +128,26 @@ void udm_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void udm_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
 | 
					void udm_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
 | 
				
			||||||
        udm_ue_t *udm_ue, ogs_sbi_session_t *session, void *data,
 | 
					        udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, void *data,
 | 
				
			||||||
        ogs_sbi_request_t *(*build)(udm_ue_t *udm_ue, void *data))
 | 
					        ogs_sbi_request_t *(*build)(udm_ue_t *udm_ue, void *data))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_xact_t *xact = NULL;
 | 
					    ogs_sbi_xact_t *xact = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(target_nf_type);
 | 
					    ogs_assert(target_nf_type);
 | 
				
			||||||
    ogs_assert(udm_ue);
 | 
					    ogs_assert(udm_ue);
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(build);
 | 
					    ogs_assert(build);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xact = ogs_sbi_xact_add(target_nf_type, &udm_ue->sbi, data,
 | 
					    xact = ogs_sbi_xact_add(target_nf_type, &udm_ue->sbi, data,
 | 
				
			||||||
            (ogs_sbi_build_f)build, udm_timer_sbi_client_wait_expire);
 | 
					            (ogs_sbi_build_f)build, udm_timer_sbi_client_wait_expire);
 | 
				
			||||||
    ogs_assert(xact);
 | 
					    ogs_assert(xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xact->assoc_session = session;
 | 
					    xact->assoc_stream = stream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (ogs_sbi_discover_and_send(xact,
 | 
					    if (ogs_sbi_discover_and_send(xact,
 | 
				
			||||||
            (ogs_fsm_handler_t)udm_nf_state_registered, client_cb) != true) {
 | 
					            (ogs_fsm_handler_t)udm_nf_state_registered, client_cb) != true) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
 | 
					                OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
 | 
				
			||||||
                "Cannot discover", udm_ue->suci);
 | 
					                "Cannot discover", udm_ue->suci);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,7 +33,7 @@ void udm_sbi_close(void);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void udm_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
 | 
					void udm_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
 | 
				
			||||||
void udm_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
 | 
					void udm_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
 | 
				
			||||||
        udm_ue_t *udm_ue, ogs_sbi_session_t *session, void *data,
 | 
					        udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, void *data,
 | 
				
			||||||
        ogs_sbi_request_t *(*build)(udm_ue_t *udm_ue, void *data));
 | 
					        ogs_sbi_request_t *(*build)(udm_ue_t *udm_ue, void *data));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,7 +39,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
    const char *api_version = NULL;
 | 
					    const char *api_version = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
    ogs_sbi_request_t *request = NULL;
 | 
					    ogs_sbi_request_t *request = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
@@ -70,14 +70,14 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
    case UDM_EVT_SBI_SERVER:
 | 
					    case UDM_EVT_SBI_SERVER:
 | 
				
			||||||
        request = e->sbi.request;
 | 
					        request = e->sbi.request;
 | 
				
			||||||
        ogs_assert(request);
 | 
					        ogs_assert(request);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        rv = ogs_sbi_parse_request(&message, request);
 | 
					        rv = ogs_sbi_parse_request(&message, request);
 | 
				
			||||||
        if (rv != OGS_OK) {
 | 
					        if (rv != OGS_OK) {
 | 
				
			||||||
            /* 'message' buffer is released in ogs_sbi_parse_request() */
 | 
					            /* 'message' buffer is released in ogs_sbi_parse_request() */
 | 
				
			||||||
            ogs_error("cannot parse HTTP message");
 | 
					            ogs_error("cannot parse HTTP message");
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    NULL, "cannot parse HTTP message", NULL);
 | 
					                    NULL, "cannot parse HTTP message", NULL);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -92,7 +92,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (strcmp(message.h.api.version, api_version) != 0) {
 | 
					        if (strcmp(message.h.api.version, api_version) != 0) {
 | 
				
			||||||
            ogs_error("Not supported version [%s]", message.h.api.version);
 | 
					            ogs_error("Not supported version [%s]", message.h.api.version);
 | 
				
			||||||
            ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					            ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    &message, "Not supported version", NULL);
 | 
					                    &message, "Not supported version", NULL);
 | 
				
			||||||
            ogs_sbi_message_free(&message);
 | 
					            ogs_sbi_message_free(&message);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
@@ -105,13 +105,13 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
            CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY)
 | 
					            CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY)
 | 
				
			||||||
                SWITCH(message.h.method)
 | 
					                SWITCH(message.h.method)
 | 
				
			||||||
                CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
					                CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
				
			||||||
                    udm_nnrf_handle_nf_status_notify(session, &message);
 | 
					                    udm_nnrf_handle_nf_status_notify(stream, &message);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("Invalid HTTP method [%s]",
 | 
					                    ogs_error("Invalid HTTP method [%s]",
 | 
				
			||||||
                            message.h.method);
 | 
					                            message.h.method);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_FORBIDDEN, &message,
 | 
					                            OGS_SBI_HTTP_STATUS_FORBIDDEN, &message,
 | 
				
			||||||
                            "Invalid HTTP method", message.h.method);
 | 
					                            "Invalid HTTP method", message.h.method);
 | 
				
			||||||
                END
 | 
					                END
 | 
				
			||||||
@@ -120,7 +120,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("Invalid resource name [%s]",
 | 
					                ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                        message.h.resource.component[0]);
 | 
					                        message.h.resource.component[0]);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
				
			||||||
                        "Unknown resource name",
 | 
					                        "Unknown resource name",
 | 
				
			||||||
                        message.h.resource.component[0]);
 | 
					                        message.h.resource.component[0]);
 | 
				
			||||||
@@ -132,7 +132,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
        CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM)
 | 
					        CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM)
 | 
				
			||||||
            if (!message.h.resource.component[0]) {
 | 
					            if (!message.h.resource.component[0]) {
 | 
				
			||||||
                ogs_error("Not found [%s]", message.h.method);
 | 
					                ogs_error("Not found [%s]", message.h.method);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					                    OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                    &message, "Not found", message.h.method);
 | 
					                    &message, "Not found", message.h.method);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
@@ -140,7 +140,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (!message.h.resource.component[1]) {
 | 
					            if (!message.h.resource.component[1]) {
 | 
				
			||||||
                ogs_error("Invalid resource name [%s]", message.h.method);
 | 
					                ogs_error("Invalid resource name [%s]", message.h.method);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    &message, "Invalid resource name", message.h.method);
 | 
					                    &message, "Invalid resource name", message.h.method);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
@@ -163,7 +163,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (!udm_ue) {
 | 
					            if (!udm_ue) {
 | 
				
			||||||
                ogs_error("Not found [%s]", message.h.method);
 | 
					                ogs_error("Not found [%s]", message.h.method);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					                    OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                    &message, "Not found", message.h.method);
 | 
					                    &message, "Not found", message.h.method);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
@@ -182,7 +182,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("Invalid API name [%s]", message.h.service.name);
 | 
					            ogs_error("Invalid API name [%s]", message.h.service.name);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message,
 | 
				
			||||||
                    "Invalid API name", message.h.service.name);
 | 
					                    "Invalid API name", message.h.service.name);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
@@ -313,7 +313,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                e->udm_ue = udm_ue;
 | 
					                e->udm_ue = udm_ue;
 | 
				
			||||||
                e->sbi.message = &message;
 | 
					                e->sbi.message = &message;
 | 
				
			||||||
                e->sbi.session = sbi_xact->assoc_session;
 | 
					                e->sbi.data = sbi_xact->assoc_stream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                ogs_sbi_xact_remove(sbi_xact);
 | 
					                ogs_sbi_xact_remove(sbi_xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -374,13 +374,13 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
            sbi_xact = e->sbi.data;
 | 
					            sbi_xact = e->sbi.data;
 | 
				
			||||||
            ogs_assert(sbi_xact);
 | 
					            ogs_assert(sbi_xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            session = sbi_xact->assoc_session;
 | 
					            stream = sbi_xact->assoc_stream;
 | 
				
			||||||
            ogs_assert(session);
 | 
					            ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_sbi_xact_remove(sbi_xact);
 | 
					            ogs_sbi_xact_remove(sbi_xact);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_error("Cannot receive SBI message");
 | 
					            ogs_error("Cannot receive SBI message");
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
 | 
					                    OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
 | 
				
			||||||
                    "Cannot receive SBI message", NULL);
 | 
					                    "Cannot receive SBI message", NULL);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,7 +38,7 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
    bool handled;
 | 
					    bool handled;
 | 
				
			||||||
    udm_ue_t *udm_ue = NULL;
 | 
					    udm_ue_t *udm_ue = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_sbi_session_t *session = NULL;
 | 
					    ogs_sbi_stream_t *stream = NULL;
 | 
				
			||||||
    ogs_sbi_message_t *message = NULL;
 | 
					    ogs_sbi_message_t *message = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(s);
 | 
					    ogs_assert(s);
 | 
				
			||||||
@@ -59,8 +59,8 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
    case UDM_EVT_SBI_SERVER:
 | 
					    case UDM_EVT_SBI_SERVER:
 | 
				
			||||||
        message = e->sbi.message;
 | 
					        message = e->sbi.message;
 | 
				
			||||||
        ogs_assert(message);
 | 
					        ogs_assert(message);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SWITCH(message->h.service.name)
 | 
					        SWITCH(message->h.service.name)
 | 
				
			||||||
        CASE(OGS_SBI_SERVICE_NAME_NUDM_UEAU)
 | 
					        CASE(OGS_SBI_SERVICE_NAME_NUDM_UEAU)
 | 
				
			||||||
@@ -68,16 +68,16 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
            CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
					            CASE(OGS_SBI_HTTP_METHOD_POST)
 | 
				
			||||||
                SWITCH(message->h.resource.component[1])
 | 
					                SWITCH(message->h.resource.component[1])
 | 
				
			||||||
                CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION)
 | 
					                CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION)
 | 
				
			||||||
                    udm_nudm_ueau_handle_get(udm_ue, session, message);
 | 
					                    udm_nudm_ueau_handle_get(udm_ue, stream, message);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS)
 | 
					                CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS)
 | 
				
			||||||
                    udm_nudm_ueau_handle_result_confirmation_inform(
 | 
					                    udm_nudm_ueau_handle_result_confirmation_inform(
 | 
				
			||||||
                            udm_ue, session, message);
 | 
					                            udm_ue, stream, message);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("[%s] Invalid resource name [%s]",
 | 
					                    ogs_error("[%s] Invalid resource name [%s]",
 | 
				
			||||||
                            udm_ue->suci, message->h.resource.component[1]);
 | 
					                            udm_ue->suci, message->h.resource.component[1]);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_BAD_REQUEST, message,
 | 
					                            OGS_SBI_HTTP_STATUS_BAD_REQUEST, message,
 | 
				
			||||||
                            "Invalid resource name", message->h.method);
 | 
					                            "Invalid resource name", message->h.method);
 | 
				
			||||||
                END
 | 
					                END
 | 
				
			||||||
@@ -86,7 +86,7 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("[%s] Invalid HTTP method [%s]",
 | 
					                ogs_error("[%s] Invalid HTTP method [%s]",
 | 
				
			||||||
                        udm_ue->suci, message->h.method);
 | 
					                        udm_ue->suci, message->h.method);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_FORBIDDEN, message,
 | 
					                        OGS_SBI_HTTP_STATUS_FORBIDDEN, message,
 | 
				
			||||||
                        "Invalid HTTP method", message->h.method);
 | 
					                        "Invalid HTTP method", message->h.method);
 | 
				
			||||||
            END
 | 
					            END
 | 
				
			||||||
@@ -97,13 +97,13 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
            CASE(OGS_SBI_HTTP_METHOD_PUT)
 | 
					            CASE(OGS_SBI_HTTP_METHOD_PUT)
 | 
				
			||||||
                SWITCH(message->h.resource.component[1])
 | 
					                SWITCH(message->h.resource.component[1])
 | 
				
			||||||
                CASE(OGS_SBI_RESOURCE_NAME_REGISTRATIONS)
 | 
					                CASE(OGS_SBI_RESOURCE_NAME_REGISTRATIONS)
 | 
				
			||||||
                    udm_nudm_uecm_handle_registration(udm_ue, session, message);
 | 
					                    udm_nudm_uecm_handle_registration(udm_ue, stream, message);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("[%s] Invalid resource name [%s]",
 | 
					                    ogs_error("[%s] Invalid resource name [%s]",
 | 
				
			||||||
                            udm_ue->suci, message->h.resource.component[1]);
 | 
					                            udm_ue->suci, message->h.resource.component[1]);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_BAD_REQUEST, message,
 | 
					                            OGS_SBI_HTTP_STATUS_BAD_REQUEST, message,
 | 
				
			||||||
                            "Invalid HTTP method", message->h.method);
 | 
					                            "Invalid HTTP method", message->h.method);
 | 
				
			||||||
                END
 | 
					                END
 | 
				
			||||||
@@ -111,7 +111,7 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("[%s] Invalid HTTP method [%s]",
 | 
					                ogs_error("[%s] Invalid HTTP method [%s]",
 | 
				
			||||||
                        udm_ue->suci, message->h.method);
 | 
					                        udm_ue->suci, message->h.method);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_FORBIDDEN, message,
 | 
					                        OGS_SBI_HTTP_STATUS_FORBIDDEN, message,
 | 
				
			||||||
                        "Invalid HTTP method", message->h.method);
 | 
					                        "Invalid HTTP method", message->h.method);
 | 
				
			||||||
            END
 | 
					            END
 | 
				
			||||||
@@ -125,19 +125,19 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
                CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA)
 | 
					                CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA)
 | 
				
			||||||
                CASE(OGS_SBI_RESOURCE_NAME_SM_DATA)
 | 
					                CASE(OGS_SBI_RESOURCE_NAME_SM_DATA)
 | 
				
			||||||
                    udm_sbi_discover_and_send(
 | 
					                    udm_sbi_discover_and_send(
 | 
				
			||||||
                        OpenAPI_nf_type_UDR, udm_ue, session, message,
 | 
					                        OpenAPI_nf_type_UDR, udm_ue, stream, message,
 | 
				
			||||||
                        udm_nudr_dr_build_query_subscription_provisioned);
 | 
					                        udm_nudr_dr_build_query_subscription_provisioned);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA)
 | 
					                CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA)
 | 
				
			||||||
                    udm_nudm_sdm_handle_subscription_provisioned(
 | 
					                    udm_nudm_sdm_handle_subscription_provisioned(
 | 
				
			||||||
                            udm_ue, session, message);
 | 
					                            udm_ue, stream, message);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    ogs_error("[%s] Invalid resource name [%s]",
 | 
					                    ogs_error("[%s] Invalid resource name [%s]",
 | 
				
			||||||
                            udm_ue->suci, message->h.resource.component[1]);
 | 
					                            udm_ue->suci, message->h.resource.component[1]);
 | 
				
			||||||
                    ogs_sbi_server_send_error(session,
 | 
					                    ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                            OGS_SBI_HTTP_STATUS_BAD_REQUEST, message,
 | 
					                            OGS_SBI_HTTP_STATUS_BAD_REQUEST, message,
 | 
				
			||||||
                            "Invalid resource name", message->h.method);
 | 
					                            "Invalid resource name", message->h.method);
 | 
				
			||||||
                END
 | 
					                END
 | 
				
			||||||
@@ -145,7 +145,7 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
            DEFAULT
 | 
					            DEFAULT
 | 
				
			||||||
                ogs_error("[%s] Invalid HTTP method [%s]",
 | 
					                ogs_error("[%s] Invalid HTTP method [%s]",
 | 
				
			||||||
                        udm_ue->supi, message->h.method);
 | 
					                        udm_ue->supi, message->h.method);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_NOT_FOUND, message,
 | 
					                        OGS_SBI_HTTP_STATUS_NOT_FOUND, message,
 | 
				
			||||||
                        "Invalid HTTP method", message->h.method);
 | 
					                        "Invalid HTTP method", message->h.method);
 | 
				
			||||||
            END
 | 
					            END
 | 
				
			||||||
@@ -153,7 +153,7 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("Invalid API name [%s]", message->h.service.name);
 | 
					            ogs_error("Invalid API name [%s]", message->h.service.name);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, message,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, message,
 | 
				
			||||||
                    "Invalid API name", message->h.service.name);
 | 
					                    "Invalid API name", message->h.service.name);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
@@ -165,8 +165,8 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        udm_ue = e->udm_ue;
 | 
					        udm_ue = e->udm_ue;
 | 
				
			||||||
        ogs_assert(udm_ue);
 | 
					        ogs_assert(udm_ue);
 | 
				
			||||||
        session = e->sbi.session;
 | 
					        stream = e->sbi.data;
 | 
				
			||||||
        ogs_assert(session);
 | 
					        ogs_assert(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SWITCH(message->h.service.name)
 | 
					        SWITCH(message->h.service.name)
 | 
				
			||||||
        CASE(OGS_SBI_SERVICE_NAME_NUDR_DR)
 | 
					        CASE(OGS_SBI_SERVICE_NAME_NUDR_DR)
 | 
				
			||||||
@@ -185,13 +185,13 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
                                udm_ue->suci, message->res_status);
 | 
					                                udm_ue->suci, message->res_status);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        ogs_sbi_server_send_error(
 | 
					                        ogs_sbi_server_send_error(
 | 
				
			||||||
                            session, message->res_status,
 | 
					                            stream, message->res_status,
 | 
				
			||||||
                            NULL, "HTTP response error", udm_ue->suci);
 | 
					                            NULL, "HTTP response error", udm_ue->suci);
 | 
				
			||||||
                        break;
 | 
					                        break;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    udm_nudr_dr_handle_subscription_authentication(
 | 
					                    udm_nudr_dr_handle_subscription_authentication(
 | 
				
			||||||
                            udm_ue, session, message);
 | 
					                            udm_ue, stream, message);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                CASE(OGS_SBI_RESOURCE_NAME_CONTEXT_DATA)
 | 
					                CASE(OGS_SBI_RESOURCE_NAME_CONTEXT_DATA)
 | 
				
			||||||
@@ -199,23 +199,23 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
                        ogs_error("[%s] HTTP response error [%d]",
 | 
					                        ogs_error("[%s] HTTP response error [%d]",
 | 
				
			||||||
                            udm_ue->suci, message->res_status);
 | 
					                            udm_ue->suci, message->res_status);
 | 
				
			||||||
                        ogs_sbi_server_send_error(
 | 
					                        ogs_sbi_server_send_error(
 | 
				
			||||||
                            session, message->res_status,
 | 
					                            stream, message->res_status,
 | 
				
			||||||
                            NULL, "HTTP response error", udm_ue->suci);
 | 
					                            NULL, "HTTP response error", udm_ue->suci);
 | 
				
			||||||
                        break;
 | 
					                        break;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    udm_nudr_dr_handle_subscription_context(
 | 
					                    udm_nudr_dr_handle_subscription_context(
 | 
				
			||||||
                            udm_ue, session, message);
 | 
					                            udm_ue, stream, message);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                DEFAULT
 | 
					                DEFAULT
 | 
				
			||||||
                    SWITCH(message->h.resource.component[3])
 | 
					                    SWITCH(message->h.resource.component[3])
 | 
				
			||||||
                    CASE(OGS_SBI_RESOURCE_NAME_PROVISIONED_DATA)
 | 
					                    CASE(OGS_SBI_RESOURCE_NAME_PROVISIONED_DATA)
 | 
				
			||||||
                        handled = udm_nudr_dr_handle_subscription_provisioned(
 | 
					                        handled = udm_nudr_dr_handle_subscription_provisioned(
 | 
				
			||||||
                                udm_ue, session, message);
 | 
					                                udm_ue, stream, message);
 | 
				
			||||||
                        if (!handled) {
 | 
					                        if (!handled) {
 | 
				
			||||||
                            ogs_sbi_server_send_error(
 | 
					                            ogs_sbi_server_send_error(
 | 
				
			||||||
                                session, message->res_status,
 | 
					                                stream, message->res_status,
 | 
				
			||||||
                                NULL, "HTTP response error", udm_ue->suci);
 | 
					                                NULL, "HTTP response error", udm_ue->suci);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        break;
 | 
					                        break;
 | 
				
			||||||
@@ -236,7 +236,7 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("Invalid API name [%s]", message->h.service.name);
 | 
					            ogs_error("Invalid API name [%s]", message->h.service.name);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, message,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST, message,
 | 
				
			||||||
                    "Invalid API name", message->h.resource.component[0]);
 | 
					                    "Invalid API name", message->h.resource.component[0]);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,8 +26,6 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct ogs_sbi_server_s ogs_sbi_server_t;
 | 
					 | 
				
			||||||
typedef struct ogs_sbi_session_s ogs_sbi_session_t;
 | 
					 | 
				
			||||||
typedef struct ogs_sbi_request_s ogs_sbi_request_t;
 | 
					typedef struct ogs_sbi_request_s ogs_sbi_request_t;
 | 
				
			||||||
typedef struct ogs_sbi_response_s ogs_sbi_response_t;
 | 
					typedef struct ogs_sbi_response_s ogs_sbi_response_t;
 | 
				
			||||||
typedef struct ogs_sbi_message_s ogs_sbi_message_t;
 | 
					typedef struct ogs_sbi_message_s ogs_sbi_message_t;
 | 
				
			||||||
@@ -50,12 +48,7 @@ typedef struct udr_event_s {
 | 
				
			|||||||
    int timer_id;
 | 
					    int timer_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct {
 | 
					    struct {
 | 
				
			||||||
        /* OGS_EVT_SBI_SERVER */
 | 
					 | 
				
			||||||
        ogs_sbi_request_t *request;
 | 
					        ogs_sbi_request_t *request;
 | 
				
			||||||
        ogs_sbi_session_t *session;
 | 
					 | 
				
			||||||
        ogs_sbi_server_t *server;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /* OGS_EVT_SBI_CLIENT */
 | 
					 | 
				
			||||||
        ogs_sbi_response_t *response;
 | 
					        ogs_sbi_response_t *response;
 | 
				
			||||||
        void *data;
 | 
					        void *data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -155,7 +155,7 @@ void udr_nf_state_will_register(ogs_fsm_t *s, udr_event_t *e)
 | 
				
			|||||||
        case UDR_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
					        case UDR_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
				
			||||||
            client = nf_instance->client;
 | 
					            client = nf_instance->client;
 | 
				
			||||||
            ogs_assert(client);
 | 
					            ogs_assert(client);
 | 
				
			||||||
            addr = client->addr;
 | 
					            addr = client->node.addr;
 | 
				
			||||||
            ogs_assert(addr);
 | 
					            ogs_assert(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
					            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
				
			||||||
@@ -364,7 +364,7 @@ void udr_nf_state_exception(ogs_fsm_t *s, udr_event_t *e)
 | 
				
			|||||||
        case UDR_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
					        case UDR_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
 | 
				
			||||||
            client = nf_instance->client;
 | 
					            client = nf_instance->client;
 | 
				
			||||||
            ogs_assert(client);
 | 
					            ogs_assert(client);
 | 
				
			||||||
            addr = client->addr;
 | 
					            addr = client->node.addr;
 | 
				
			||||||
            ogs_assert(addr);
 | 
					            ogs_assert(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
					            ogs_warn("[%s] Retry to registration with NRF", nf_instance->id);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -89,7 +89,7 @@ void udr_nnrf_handle_nf_status_subscribe(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udr_nnrf_handle_nf_status_notify(
 | 
					bool udr_nnrf_handle_nf_status_notify(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
    OpenAPI_notification_data_t *NotificationData = NULL;
 | 
					    OpenAPI_notification_data_t *NotificationData = NULL;
 | 
				
			||||||
@@ -97,13 +97,13 @@ bool udr_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
					    ogs_sbi_nf_instance_t *nf_instance = NULL;
 | 
				
			||||||
    bool handled;
 | 
					    bool handled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(message);
 | 
					    ogs_assert(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    NotificationData = message->NotificationData;
 | 
					    NotificationData = message->NotificationData;
 | 
				
			||||||
    if (!NotificationData) {
 | 
					    if (!NotificationData) {
 | 
				
			||||||
        ogs_error("No NotificationData");
 | 
					        ogs_error("No NotificationData");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NotificationData", NULL);
 | 
					                message, "No NotificationData", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -111,21 +111,21 @@ bool udr_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    NFProfile = NotificationData->nf_profile;
 | 
					    NFProfile = NotificationData->nf_profile;
 | 
				
			||||||
    if (!NFProfile) {
 | 
					    if (!NFProfile) {
 | 
				
			||||||
        ogs_error("No NFProfile");
 | 
					        ogs_error("No NFProfile");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", NULL);
 | 
					                message, "No NFProfile", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile->nf_instance_id) {
 | 
					    if (!NFProfile->nf_instance_id) {
 | 
				
			||||||
        ogs_error("No NFProfile.NFInstanceId");
 | 
					        ogs_error("No NFProfile.NFInstanceId");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", "NFInstanceId");
 | 
					                message, "No NFProfile", "NFInstanceId");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!NFProfile->nf_instance_id) {
 | 
					    if (!NFProfile->nf_instance_id) {
 | 
				
			||||||
        ogs_error("No NFProfile.NFInstanceId");
 | 
					        ogs_error("No NFProfile.NFInstanceId");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "No NFProfile", "NFInstanceId");
 | 
					                message, "No NFProfile", "NFInstanceId");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -133,7 +133,7 @@ bool udr_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
    if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
 | 
					    if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
 | 
				
			||||||
        ogs_warn("The notification is not allowed [%s]",
 | 
					        ogs_warn("The notification is not allowed [%s]",
 | 
				
			||||||
                NFProfile->nf_instance_id);
 | 
					                NFProfile->nf_instance_id);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
                message, "The notification is not allowed",
 | 
					                message, "The notification is not allowed",
 | 
				
			||||||
                NFProfile->nf_instance_id);
 | 
					                NFProfile->nf_instance_id);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -159,7 +159,7 @@ bool udr_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        handled = ogs_sbi_nnrf_handle_nf_profile(
 | 
					        handled = ogs_sbi_nnrf_handle_nf_profile(
 | 
				
			||||||
                    nf_instance, NFProfile, session, message);
 | 
					                    nf_instance, NFProfile, stream, message);
 | 
				
			||||||
        if (!handled) {
 | 
					        if (!handled) {
 | 
				
			||||||
            UDR_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            UDR_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -170,7 +170,7 @@ bool udr_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
        handled = ogs_sbi_client_associate(nf_instance);
 | 
					        handled = ogs_sbi_client_associate(nf_instance);
 | 
				
			||||||
        if (!handled) {
 | 
					        if (!handled) {
 | 
				
			||||||
            ogs_error("[%s] Cannot associate NF EndPoint", nf_instance->id);
 | 
					            ogs_error("[%s] Cannot associate NF EndPoint", nf_instance->id);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                    OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                    message, "Cannot find NF EndPoint", nf_instance->id);
 | 
					                    message, "Cannot find NF EndPoint", nf_instance->id);
 | 
				
			||||||
            UDR_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            UDR_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
@@ -184,7 +184,7 @@ bool udr_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
            UDR_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
					            UDR_NF_INSTANCE_CLEAR("NRF-notify", nf_instance);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            ogs_warn("[%s] (NRF-notify) Not found", NFProfile->nf_instance_id);
 | 
					            ogs_warn("[%s] (NRF-notify) Not found", NFProfile->nf_instance_id);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					                OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                message, "Not found", message->h.resource.component[1]);
 | 
					                message, "Not found", message->h.resource.component[1]);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -194,7 +194,7 @@ bool udr_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
                            NotificationData->event);
 | 
					                            NotificationData->event);
 | 
				
			||||||
        ogs_error("Not supported event [%d:%s]",
 | 
					        ogs_error("Not supported event [%d:%s]",
 | 
				
			||||||
                NotificationData->event, eventstr ? eventstr : "Unknown");
 | 
					                NotificationData->event, eventstr ? eventstr : "Unknown");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                message, "Not supported event",
 | 
					                message, "Not supported event",
 | 
				
			||||||
                eventstr ? eventstr : "Unknown");
 | 
					                eventstr ? eventstr : "Unknown");
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -202,7 +202,7 @@ bool udr_nnrf_handle_nf_status_notify(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    response = ogs_sbi_build_response(message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					    response = ogs_sbi_build_response(message, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
    ogs_assert(response);
 | 
					    ogs_assert(response);
 | 
				
			||||||
    ogs_sbi_server_send_response(session, response);
 | 
					    ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ void udr_nnrf_handle_nf_status_subscribe(
 | 
				
			|||||||
        ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udr_nnrf_handle_nf_status_notify(
 | 
					bool udr_nnrf_handle_nf_status_notify(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *message);
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@
 | 
				
			|||||||
#include "nudr-handler.h"
 | 
					#include "nudr-handler.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udr_nudr_dr_handle_subscription_authentication(
 | 
					bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int rv;
 | 
					    int rv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -44,13 +44,13 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
    OpenAPI_list_t *PatchItemList = NULL;
 | 
					    OpenAPI_list_t *PatchItemList = NULL;
 | 
				
			||||||
    OpenAPI_lnode_t *node = NULL;
 | 
					    OpenAPI_lnode_t *node = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    supi = recvmsg->h.resource.component[1];
 | 
					    supi = recvmsg->h.resource.component[1];
 | 
				
			||||||
    if (!supi) {
 | 
					    if (!supi) {
 | 
				
			||||||
        ogs_error("No SUPI");
 | 
					        ogs_error("No SUPI");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "No SUPI", NULL);
 | 
					                recvmsg, "No SUPI", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -58,7 +58,7 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
    if (strncmp(supi,
 | 
					    if (strncmp(supi,
 | 
				
			||||||
            OGS_ID_SUPI_TYPE_IMSI, strlen(OGS_ID_SUPI_TYPE_IMSI)) != 0) {
 | 
					            OGS_ID_SUPI_TYPE_IMSI, strlen(OGS_ID_SUPI_TYPE_IMSI)) != 0) {
 | 
				
			||||||
        ogs_error("[%s] Unknown SUPI Type", supi);
 | 
					        ogs_error("[%s] Unknown SUPI Type", supi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
                recvmsg, "Unknwon SUPI Type", supi);
 | 
					                recvmsg, "Unknwon SUPI Type", supi);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -66,7 +66,7 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
    rv = ogs_dbi_auth_info(supi, &auth_info);
 | 
					    rv = ogs_dbi_auth_info(supi, &auth_info);
 | 
				
			||||||
    if (rv != OGS_OK) {
 | 
					    if (rv != OGS_OK) {
 | 
				
			||||||
        ogs_warn("[%s] Cannot find SUPI in DB", supi);
 | 
					        ogs_warn("[%s] Cannot find SUPI in DB", supi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                recvmsg, "Cannot find SUPI Type", supi);
 | 
					                recvmsg, "Cannot find SUPI Type", supi);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -113,7 +113,7 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
            response = ogs_sbi_build_response(
 | 
					            response = ogs_sbi_build_response(
 | 
				
			||||||
                    &sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
					                    &sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
				
			||||||
            ogs_assert(response);
 | 
					            ogs_assert(response);
 | 
				
			||||||
            ogs_sbi_server_send_response(session, response);
 | 
					            ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -124,7 +124,7 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            PatchItemList = recvmsg->PatchItemList;
 | 
					            PatchItemList = recvmsg->PatchItemList;
 | 
				
			||||||
            if (!PatchItemList) {
 | 
					            if (!PatchItemList) {
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                        recvmsg, "No PatchItemList Array", NULL);
 | 
					                        recvmsg, "No PatchItemList Array", NULL);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
@@ -138,7 +138,7 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!sqn_string) {
 | 
					            if (!sqn_string) {
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                        OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                        recvmsg, "No PatchItemList", NULL);
 | 
					                        recvmsg, "No PatchItemList", NULL);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
@@ -151,7 +151,7 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
            rv = ogs_dbi_update_sqn(supi, sqn);
 | 
					            rv = ogs_dbi_update_sqn(supi, sqn);
 | 
				
			||||||
            if (rv != OGS_OK) {
 | 
					            if (rv != OGS_OK) {
 | 
				
			||||||
                ogs_fatal("[%s] Cannot update SQN", supi);
 | 
					                ogs_fatal("[%s] Cannot update SQN", supi);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					                        OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
                        recvmsg, "Cannot update SQN", supi);
 | 
					                        recvmsg, "Cannot update SQN", supi);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
@@ -160,7 +160,7 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
            rv = ogs_dbi_increment_sqn(supi);
 | 
					            rv = ogs_dbi_increment_sqn(supi);
 | 
				
			||||||
            if (rv != OGS_OK) {
 | 
					            if (rv != OGS_OK) {
 | 
				
			||||||
                ogs_fatal("[%s] Cannot increment SQN", supi);
 | 
					                ogs_fatal("[%s] Cannot increment SQN", supi);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					                        OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
                        recvmsg, "Cannot increment SQN", supi);
 | 
					                        recvmsg, "Cannot increment SQN", supi);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
@@ -171,13 +171,13 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
            response = ogs_sbi_build_response(
 | 
					            response = ogs_sbi_build_response(
 | 
				
			||||||
                    &sendmsg, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					                    &sendmsg, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
            ogs_assert(response);
 | 
					            ogs_assert(response);
 | 
				
			||||||
            ogs_sbi_server_send_response(session, response);
 | 
					            ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("Invalid HTTP method [%s]", recvmsg->h.method);
 | 
					            ogs_error("Invalid HTTP method [%s]", recvmsg->h.method);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED,
 | 
					                    OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED,
 | 
				
			||||||
                    recvmsg, "Invalid HTTP method", recvmsg->h.method);
 | 
					                    recvmsg, "Invalid HTTP method", recvmsg->h.method);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
@@ -190,7 +190,7 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
            if (!AuthEvent) {
 | 
					            if (!AuthEvent) {
 | 
				
			||||||
                ogs_error("[%s] No AuthEvent", supi);
 | 
					                ogs_error("[%s] No AuthEvent", supi);
 | 
				
			||||||
                ogs_sbi_server_send_error(
 | 
					                ogs_sbi_server_send_error(
 | 
				
			||||||
                        session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					                        stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                        recvmsg, "No AuthEvent", supi);
 | 
					                        recvmsg, "No AuthEvent", supi);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -199,7 +199,7 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
            rv = ogs_dbi_increment_sqn(supi);
 | 
					            rv = ogs_dbi_increment_sqn(supi);
 | 
				
			||||||
            if (rv != OGS_OK) {
 | 
					            if (rv != OGS_OK) {
 | 
				
			||||||
                ogs_fatal("[%s] Cannot increment SQN", supi);
 | 
					                ogs_fatal("[%s] Cannot increment SQN", supi);
 | 
				
			||||||
                ogs_sbi_server_send_error(session,
 | 
					                ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                        OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
					                        OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
 | 
				
			||||||
                        recvmsg, "Cannot increment SQN", supi);
 | 
					                        recvmsg, "Cannot increment SQN", supi);
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
@@ -208,13 +208,13 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
            response = ogs_sbi_build_response(
 | 
					            response = ogs_sbi_build_response(
 | 
				
			||||||
                    &sendmsg, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					                    &sendmsg, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
            ogs_assert(response);
 | 
					            ogs_assert(response);
 | 
				
			||||||
            ogs_sbi_server_send_response(session, response);
 | 
					            ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("Invalid HTTP method [%s]", recvmsg->h.method);
 | 
					            ogs_error("Invalid HTTP method [%s]", recvmsg->h.method);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED,
 | 
					                    OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED,
 | 
				
			||||||
                    recvmsg, "Invalid HTTP method", recvmsg->h.method);
 | 
					                    recvmsg, "Invalid HTTP method", recvmsg->h.method);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
@@ -223,7 +223,7 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
    DEFAULT
 | 
					    DEFAULT
 | 
				
			||||||
        ogs_error("Invalid resource name [%s]",
 | 
					        ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                recvmsg->h.resource.component[3]);
 | 
					                recvmsg->h.resource.component[3]);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED,
 | 
					                OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED,
 | 
				
			||||||
                recvmsg, "Unknown resource name",
 | 
					                recvmsg, "Unknown resource name",
 | 
				
			||||||
                recvmsg->h.resource.component[3]);
 | 
					                recvmsg->h.resource.component[3]);
 | 
				
			||||||
@@ -233,20 +233,20 @@ bool udr_nudr_dr_handle_subscription_authentication(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udr_nudr_dr_handle_subscription_context(
 | 
					bool udr_nudr_dr_handle_subscription_context(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ogs_sbi_message_t sendmsg;
 | 
					    ogs_sbi_message_t sendmsg;
 | 
				
			||||||
    ogs_sbi_response_t *response = NULL;
 | 
					    ogs_sbi_response_t *response = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    char *supi = NULL;
 | 
					    char *supi = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    supi = recvmsg->h.resource.component[1];
 | 
					    supi = recvmsg->h.resource.component[1];
 | 
				
			||||||
    if (!supi) {
 | 
					    if (!supi) {
 | 
				
			||||||
        ogs_error("No SUPI");
 | 
					        ogs_error("No SUPI");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "No SUPI", NULL);
 | 
					                recvmsg, "No SUPI", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -254,7 +254,7 @@ bool udr_nudr_dr_handle_subscription_context(
 | 
				
			|||||||
    if (strncmp(supi,
 | 
					    if (strncmp(supi,
 | 
				
			||||||
            OGS_ID_SUPI_TYPE_IMSI, strlen(OGS_ID_SUPI_TYPE_IMSI)) != 0) {
 | 
					            OGS_ID_SUPI_TYPE_IMSI, strlen(OGS_ID_SUPI_TYPE_IMSI)) != 0) {
 | 
				
			||||||
        ogs_error("[%s] Unknown SUPI Type", supi);
 | 
					        ogs_error("[%s] Unknown SUPI Type", supi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
                recvmsg, "Unknwon SUPI Type", supi);
 | 
					                recvmsg, "Unknwon SUPI Type", supi);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -268,13 +268,13 @@ bool udr_nudr_dr_handle_subscription_context(
 | 
				
			|||||||
            response = ogs_sbi_build_response(
 | 
					            response = ogs_sbi_build_response(
 | 
				
			||||||
                    &sendmsg, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
					                    &sendmsg, OGS_SBI_HTTP_STATUS_NO_CONTENT);
 | 
				
			||||||
            ogs_assert(response);
 | 
					            ogs_assert(response);
 | 
				
			||||||
            ogs_sbi_server_send_response(session, response);
 | 
					            ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        DEFAULT
 | 
					        DEFAULT
 | 
				
			||||||
            ogs_error("Invalid HTTP method [%s]", recvmsg->h.method);
 | 
					            ogs_error("Invalid HTTP method [%s]", recvmsg->h.method);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED,
 | 
					                    OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED,
 | 
				
			||||||
                    recvmsg, "Invalid HTTP method", recvmsg->h.method);
 | 
					                    recvmsg, "Invalid HTTP method", recvmsg->h.method);
 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
@@ -283,7 +283,7 @@ bool udr_nudr_dr_handle_subscription_context(
 | 
				
			|||||||
    DEFAULT
 | 
					    DEFAULT
 | 
				
			||||||
        ogs_error("Invalid resource name [%s]",
 | 
					        ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                recvmsg->h.resource.component[3]);
 | 
					                recvmsg->h.resource.component[3]);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED,
 | 
					                OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED,
 | 
				
			||||||
                recvmsg, "Unknown resource name",
 | 
					                recvmsg, "Unknown resource name",
 | 
				
			||||||
                recvmsg->h.resource.component[3]);
 | 
					                recvmsg->h.resource.component[3]);
 | 
				
			||||||
@@ -307,7 +307,7 @@ static OpenAPI_pdu_session_type_e pdu_session_type_from_dbi(uint8_t pdn_type)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool udr_nudr_dr_handle_subscription_provisioned(
 | 
					bool udr_nudr_dr_handle_subscription_provisioned(
 | 
				
			||||||
        ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
 | 
					        ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int rv, i;
 | 
					    int rv, i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -317,13 +317,13 @@ bool udr_nudr_dr_handle_subscription_provisioned(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    char *supi = NULL;
 | 
					    char *supi = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ogs_assert(session);
 | 
					    ogs_assert(stream);
 | 
				
			||||||
    ogs_assert(recvmsg);
 | 
					    ogs_assert(recvmsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    supi = recvmsg->h.resource.component[1];
 | 
					    supi = recvmsg->h.resource.component[1];
 | 
				
			||||||
    if (!supi) {
 | 
					    if (!supi) {
 | 
				
			||||||
        ogs_error("No SUPI");
 | 
					        ogs_error("No SUPI");
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
 | 
				
			||||||
                recvmsg, "No SUPI", NULL);
 | 
					                recvmsg, "No SUPI", NULL);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -331,7 +331,7 @@ bool udr_nudr_dr_handle_subscription_provisioned(
 | 
				
			|||||||
    if (strncmp(supi,
 | 
					    if (strncmp(supi,
 | 
				
			||||||
            OGS_ID_SUPI_TYPE_IMSI, strlen(OGS_ID_SUPI_TYPE_IMSI)) != 0) {
 | 
					            OGS_ID_SUPI_TYPE_IMSI, strlen(OGS_ID_SUPI_TYPE_IMSI)) != 0) {
 | 
				
			||||||
        ogs_error("[%s] Unknown SUPI Type", supi);
 | 
					        ogs_error("[%s] Unknown SUPI Type", supi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_FORBIDDEN,
 | 
				
			||||||
                recvmsg, "Unknwon SUPI Type", supi);
 | 
					                recvmsg, "Unknwon SUPI Type", supi);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -339,14 +339,14 @@ bool udr_nudr_dr_handle_subscription_provisioned(
 | 
				
			|||||||
    rv = ogs_dbi_subscription_data(supi, &subscription_data);
 | 
					    rv = ogs_dbi_subscription_data(supi, &subscription_data);
 | 
				
			||||||
    if (rv != OGS_OK) {
 | 
					    if (rv != OGS_OK) {
 | 
				
			||||||
        ogs_error("[%s] Cannot find SUPI in DB", supi);
 | 
					        ogs_error("[%s] Cannot find SUPI in DB", supi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                recvmsg, "Cannot find SUPI Type", supi);
 | 
					                recvmsg, "Cannot find SUPI Type", supi);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!subscription_data.ambr.uplink && !subscription_data.ambr.downlink) {
 | 
					    if (!subscription_data.ambr.uplink && !subscription_data.ambr.downlink) {
 | 
				
			||||||
        ogs_error("[%s] No UE-AMBR", supi);
 | 
					        ogs_error("[%s] No UE-AMBR", supi);
 | 
				
			||||||
        ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					        ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                recvmsg, "No UE-AMBR", supi);
 | 
					                recvmsg, "No UE-AMBR", supi);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -388,7 +388,7 @@ bool udr_nudr_dr_handle_subscription_provisioned(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
					        response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
				
			||||||
        ogs_assert(response);
 | 
					        ogs_assert(response);
 | 
				
			||||||
        ogs_sbi_server_send_response(session, response);
 | 
					        ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ogs_free(subscribed_ue_ambr.uplink);
 | 
					        ogs_free(subscribed_ue_ambr.uplink);
 | 
				
			||||||
        ogs_free(subscribed_ue_ambr.downlink);
 | 
					        ogs_free(subscribed_ue_ambr.downlink);
 | 
				
			||||||
@@ -404,7 +404,7 @@ bool udr_nudr_dr_handle_subscription_provisioned(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
					        response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
				
			||||||
        ogs_assert(response);
 | 
					        ogs_assert(response);
 | 
				
			||||||
        ogs_sbi_server_send_response(session, response);
 | 
					        ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -425,7 +425,7 @@ bool udr_nudr_dr_handle_subscription_provisioned(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (!recvmsg->param.s_nssai_presence) {
 | 
					        if (!recvmsg->param.s_nssai_presence) {
 | 
				
			||||||
            ogs_error("[%s] Cannot find S_NSSAI", supi);
 | 
					            ogs_error("[%s] Cannot find S_NSSAI", supi);
 | 
				
			||||||
            ogs_sbi_server_send_error(session,
 | 
					            ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                    OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
					                    OGS_SBI_HTTP_STATUS_NOT_FOUND,
 | 
				
			||||||
                    recvmsg, "Cannot find S_NSSAI", supi);
 | 
					                    recvmsg, "Cannot find S_NSSAI", supi);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -594,7 +594,7 @@ bool udr_nudr_dr_handle_subscription_provisioned(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
					        response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
 | 
				
			||||||
        ogs_assert(response);
 | 
					        ogs_assert(response);
 | 
				
			||||||
        ogs_sbi_server_send_response(session, response);
 | 
					        ogs_sbi_server_send_response(stream, response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (singleNSSAI.sd)
 | 
					        if (singleNSSAI.sd)
 | 
				
			||||||
            ogs_free(singleNSSAI.sd);
 | 
					            ogs_free(singleNSSAI.sd);
 | 
				
			||||||
@@ -662,7 +662,7 @@ bool udr_nudr_dr_handle_subscription_provisioned(
 | 
				
			|||||||
    DEFAULT
 | 
					    DEFAULT
 | 
				
			||||||
        ogs_error("Invalid resource name [%s]",
 | 
					        ogs_error("Invalid resource name [%s]",
 | 
				
			||||||
                recvmsg->h.resource.component[3]);
 | 
					                recvmsg->h.resource.component[3]);
 | 
				
			||||||
        ogs_sbi_server_send_error(session,
 | 
					        ogs_sbi_server_send_error(stream,
 | 
				
			||||||
                OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED,
 | 
					                OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED,
 | 
				
			||||||
                recvmsg, "Unknown resource name",
 | 
					                recvmsg, "Unknown resource name",
 | 
				
			||||||
                recvmsg->h.resource.component[3]);
 | 
					                recvmsg->h.resource.component[3]);
 | 
				
			||||||
 
 | 
				
			|||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user