forked from acouzens/open5gs
freediameter extension load
This commit is contained in:
parent
2cceb1d9ce
commit
4058df8f43
|
@ -13,14 +13,14 @@ cellwired_LDADD = \
|
|||
$(top_srcdir)/src/libcellwire.la \
|
||||
$(top_srcdir)/lib/core/src/libcore.la \
|
||||
$(top_srcdir)/lib/logger/liblogger.la \
|
||||
$(top_srcdir)/lib/message/s1ap/libmessages1ap.la
|
||||
$(top_srcdir)/lib/message/s1ap/libmessages1ap.la \
|
||||
$(top_srcdir)/lib/message/nas/libmessagenas.la \
|
||||
$(top_srcdir)/lib/message/s6a/libmessages6a.la
|
||||
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/lib/core/include \
|
||||
-I$(top_srcdir)/lib/logger \
|
||||
-I$(top_srcdir)/lib/message/s1ap/asn1c \
|
||||
-I$(top_srcdir)/lib/emssage/s1ap \
|
||||
-I$(top_srcdir)/src
|
||||
|
||||
CLEANFILES = symtbl.c
|
||||
|
|
|
@ -256,6 +256,7 @@ AC_CONFIG_FILES([lib/logger/Makefile])
|
|||
AC_CONFIG_FILES([lib/message/s1ap/asn1c/Makefile])
|
||||
AC_CONFIG_FILES([lib/message/s1ap/Makefile])
|
||||
AC_CONFIG_FILES([lib/message/nas/Makefile])
|
||||
AC_CONFIG_FILES([lib/message/s6a/Makefile])
|
||||
AC_CONFIG_FILES([lib/message/Makefile])
|
||||
AC_CONFIG_FILES([lib/Makefile])
|
||||
AC_CONFIG_FILES([src/Makefile])
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
noinst_LTLIBRARIES = libmessages6a.la
|
||||
|
||||
libmessages6a_la_SOURCES = \
|
||||
freeDiameter/extension.h
|
||||
|
||||
nodist_libmessages6a_la_SOURCES = \
|
||||
dict_nasreq.c dict_dcca.c dict_dcca_3gpp.c
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/lib/core/include
|
||||
|
||||
AM_CFLAGS = \
|
||||
-Wall -Werror
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MOSTLYCLEANFILES = *.stackdump
|
||||
|
||||
EXTRA_DIST = .libs $(noinst_LTLIBRARIES)
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,72 @@
|
|||
/*********************************************************************************************************
|
||||
* Software License Agreement (BSD License) *
|
||||
* Author: Sebastien Decugis <sdecugis@freediameter.net> *
|
||||
* *
|
||||
* Copyright (c) 2013, WIDE Project and NICT *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Redistribution and use of this software in source and binary forms, with or without modification, are *
|
||||
* permitted provided that the following conditions are met: *
|
||||
* *
|
||||
* * Redistributions of source code must retain the above *
|
||||
* copyright notice, this list of conditions and the *
|
||||
* following disclaimer. *
|
||||
* *
|
||||
* * Redistributions in binary form must reproduce the above *
|
||||
* copyright notice, this list of conditions and the *
|
||||
* following disclaimer in the documentation and/or other *
|
||||
* materials provided with the distribution. *
|
||||
* *
|
||||
* * Neither the name of the WIDE Project or NICT nor the *
|
||||
* names of its contributors may be used to endorse or *
|
||||
* promote products derived from this software without *
|
||||
* specific prior written permission of WIDE Project and *
|
||||
* NICT. *
|
||||
* *
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
||||
*********************************************************************************************************/
|
||||
|
||||
#ifndef _EXTENSION_H
|
||||
#define _EXTENSION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Include definition of freeDiameter API */
|
||||
#include <freeDiameter/freeDiameter-host.h>
|
||||
#include <freeDiameter/libfdcore.h>
|
||||
|
||||
/* Macro that define the entry point of the extension */
|
||||
#define EXTENSION_ENTRY(_name, _function, _depends...) \
|
||||
const char *fd_ext_depends_ ## _function[] = { _name , ## _depends , NULL }; \
|
||||
static int extension_loaded_ ## _function = 0; \
|
||||
int fd_ext_init_ ## _function(int major, int minor, char * conffile) { \
|
||||
if ((major != FD_PROJECT_VERSION_MAJOR) \
|
||||
|| (minor != FD_PROJECT_VERSION_MINOR)) { \
|
||||
TRACE_ERROR("This extension (" _name ") was compiled for a different version of freeDiameter."); \
|
||||
TRACE_DEBUG(INFO, "daemon %d.%d != ext %d.%d", \
|
||||
major, minor, \
|
||||
FD_PROJECT_VERSION_MAJOR, FD_PROJECT_VERSION_MINOR); \
|
||||
return EINVAL; \
|
||||
} \
|
||||
if (extension_loaded_ ## _function) { \
|
||||
TRACE_ERROR("Extension (" _name ") cannot be loaded twice!"); \
|
||||
return ENOTSUP; \
|
||||
} \
|
||||
extension_loaded_ ## _function++; \
|
||||
return (_function)(conffile); \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _EXTENSION_H */
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "freeDiameter/freeDiameter-host.h"
|
||||
#include "freeDiameter/libfdcore.h"
|
||||
#include "freeDiameter/extension.h"
|
||||
|
||||
#include "s6a_path.h"
|
||||
|
||||
|
@ -54,6 +55,10 @@ static void s6a_fd_logger(int printlevel, const char *format, va_list ap)
|
|||
}
|
||||
}
|
||||
|
||||
int fd_ext_init_dnr_entry(int major, int minor, char * conffile);
|
||||
int fd_ext_init_dict_dcca_entry(int major, int minor, char * conffile);
|
||||
int fd_ext_init_dict_dcca_3gpp_entry(int major, int minor, char * conffile);
|
||||
|
||||
status_t s6a_open()
|
||||
{
|
||||
int ret;
|
||||
|
@ -77,6 +82,25 @@ status_t s6a_open()
|
|||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
ret = fd_ext_init_dnr_entry(1, 2, NULL);
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("fd_ext_init_dnr_entry() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
ret = fd_ext_init_dict_dcca_entry(1, 2, NULL);
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("fd_ext_init_dict_dcca_entry() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
ret = fd_ext_init_dict_dcca_3gpp_entry(1, 2, NULL);
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("fd_ext_init_dict_dcca_entry() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
ret = fd_core_start();
|
||||
if (ret != 0)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ testcellwire_LDADD = \
|
|||
$(top_srcdir)/lib/core/src/libcore.la \
|
||||
$(top_srcdir)/lib/message/s1ap/libmessages1ap.la \
|
||||
$(top_srcdir)/lib/message/nas/libmessagenas.la \
|
||||
$(top_srcdir)/lib/message/s6a/libmessages6a.la \
|
||||
$(top_srcdir)/src/libcellwire.la
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
|
@ -20,6 +21,7 @@ AM_CPPFLAGS = \
|
|||
-I$(top_srcdir)/lib/message/s1ap/asn1c \
|
||||
-I$(top_srcdir)/lib/message/s1ap \
|
||||
-I$(top_srcdir)/lib/message/nas \
|
||||
-I$(top_srcdir)/lib/message/s6a \
|
||||
-I$(top_srcdir)/src
|
||||
|
||||
AM_CFLAGS = \
|
||||
|
|
Loading…
Reference in New Issue