forked from acouzens/open5gs
move directory
This commit is contained in:
parent
0d97c5d633
commit
b93867f9cd
|
@ -1,6 +0,0 @@
|
||||||
## Process this file with automake to produce Makefile.in
|
|
||||||
|
|
||||||
SUBDIRS = s1ap nas
|
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
||||||
MOSTLYCLEANFILES = *.stackdump
|
|
|
@ -1,28 +0,0 @@
|
||||||
## Process this file with automake to produce Makefile.in
|
|
||||||
|
|
||||||
SUBDIRS = freeDiameter
|
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libmessages6a.la
|
|
||||||
|
|
||||||
libmessages6a_la_SOURCES = \
|
|
||||||
s6a_message.h
|
|
||||||
|
|
||||||
nodist_libmessages6a_la_SOURCES = \
|
|
||||||
s6a_init.c s6a_dict.c s6a_server.c s6a_client.c
|
|
||||||
|
|
||||||
libmessages6a_la_DEPENDENCIES = \
|
|
||||||
$(top_srcdir)/lib/message/s6a/freeDiameter/libmessages6afd.la
|
|
||||||
|
|
||||||
libmessages6a_la_LIBADD = \
|
|
||||||
$(top_srcdir)/lib/message/s6a/freeDiameter/libmessages6afd.la
|
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
|
||||||
-I$(top_srcdir)/lib/core/include
|
|
||||||
|
|
||||||
AM_CFLAGS = \
|
|
||||||
-Wall -Werror -Wno-unused
|
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
||||||
MOSTLYCLEANFILES = *.stackdump
|
|
||||||
|
|
||||||
EXTRA_DIST = .libs $(noinst_LTLIBRARIES)
|
|
|
@ -1,20 +0,0 @@
|
||||||
## Process this file with automake to produce Makefile.in
|
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libmessages6afd.la
|
|
||||||
|
|
||||||
libmessages6afd_la_SOURCES = \
|
|
||||||
extension.h
|
|
||||||
|
|
||||||
nodist_libmessages6afd_la_SOURCES = \
|
|
||||||
dict_nas_mipv6.c dict_s6a.c
|
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
|
||||||
-I$(top_srcdir)/lib/message/s6a
|
|
||||||
|
|
||||||
AM_CFLAGS = \
|
|
||||||
-Wall -Werror
|
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
||||||
MOSTLYCLEANFILES = *.stackdump
|
|
||||||
|
|
||||||
EXTRA_DIST = .libs $(noinst_LTLIBRARIES)
|
|
|
@ -1,258 +0,0 @@
|
||||||
/*********************************************************************************************************
|
|
||||||
* Software License Agreement (BSD License) *
|
|
||||||
* Author: Francois Bard <francois@tera.ics.keio.ac.jp> *
|
|
||||||
* *
|
|
||||||
* Copyright (c) 2010, Teraoka Laboratory, Keio University *
|
|
||||||
* 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 Teraoka Laboratory nor the *
|
|
||||||
* names of its contributors may be used to endorse or *
|
|
||||||
* promote products derived from this software without *
|
|
||||||
* specific prior written permission of Teraoka Laboratory *
|
|
||||||
* *
|
|
||||||
* *
|
|
||||||
* 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. *
|
|
||||||
*********************************************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
The following table lists the AVPs needed for the NAS to HAAA server interaction.
|
|
||||||
We try to keep the structure of the grouped AVP by declaring the contained AVPs just before the grouped AVP they depend on.
|
|
||||||
The number of '+' indicates the depth of the contained AVP.
|
|
||||||
|
|
||||||
DEPTH NAME AVP CODE RFC TYPE IMPLEMENTED NOTES
|
|
||||||
|
|
||||||
MIP6-Feature-Vector 124 5447 Unsigned64 yes
|
|
||||||
+ MIP-Home-Agent-Address 334 4004 Address not yet
|
|
||||||
++ Destination-Host 293 3588 DiameterIdentity no (Base)
|
|
||||||
++ Destination-Realm 283 3588 DiameterIdentity no (Base)
|
|
||||||
+ MIP-Home-Agent-Host 348 4004 Grouped not yet
|
|
||||||
+ MIP6-Home-Link-Prefix 125 5447 OctetString yes
|
|
||||||
MIP6-Agent-Info 486 5447 Grouped yes
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <freeDiameter/extension.h>
|
|
||||||
|
|
||||||
/* The content of this file follows the same structure as dict_base_proto.c */
|
|
||||||
|
|
||||||
#define CHECK_dict_new( _type, _data, _parent, _ref ) \
|
|
||||||
CHECK_FCT( fd_dict_new( fd_g_config->cnf_dict, (_type), (_data), (_parent), (_ref)) );
|
|
||||||
|
|
||||||
#define CHECK_dict_search( _type, _criteria, _what, _result ) \
|
|
||||||
CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
|
|
||||||
|
|
||||||
struct local_rules_definition {
|
|
||||||
char *avp_name;
|
|
||||||
enum rule_position position;
|
|
||||||
int min;
|
|
||||||
int max;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define RULE_ORDER( _position ) ((((_position) == RULE_FIXED_HEAD) || ((_position) == RULE_FIXED_TAIL)) ? 1 : 0 )
|
|
||||||
|
|
||||||
#define PARSE_loc_rules( _rulearray, _parent) { \
|
|
||||||
int __ar; \
|
|
||||||
for (__ar=0; __ar < sizeof(_rulearray) / sizeof((_rulearray)[0]); __ar++) { \
|
|
||||||
struct dict_rule_data __data = { NULL, \
|
|
||||||
(_rulearray)[__ar].position, \
|
|
||||||
0, \
|
|
||||||
(_rulearray)[__ar].min, \
|
|
||||||
(_rulearray)[__ar].max}; \
|
|
||||||
__data.rule_order = RULE_ORDER(__data.rule_position); \
|
|
||||||
CHECK_FCT( fd_dict_search( \
|
|
||||||
fd_g_config->cnf_dict, \
|
|
||||||
DICT_AVP, \
|
|
||||||
AVP_BY_NAME, \
|
|
||||||
(_rulearray)[__ar].avp_name, \
|
|
||||||
&__data.rule_avp, 0 ) ); \
|
|
||||||
if ( !__data.rule_avp ) { \
|
|
||||||
TRACE_DEBUG(INFO, "AVP Not found: '%s'", (_rulearray)[__ar].avp_name ); \
|
|
||||||
return ENOENT; \
|
|
||||||
} \
|
|
||||||
CHECK_FCT_DO( fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &__data, _parent, NULL), \
|
|
||||||
{ \
|
|
||||||
TRACE_DEBUG(INFO, "Error on rule with AVP '%s'", \
|
|
||||||
(_rulearray)[__ar].avp_name ); \
|
|
||||||
return EINVAL; \
|
|
||||||
} ); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define enumval_def_u32( _val_, _str_ ) \
|
|
||||||
{ _str_, { .u32 = _val_ }}
|
|
||||||
|
|
||||||
#define enumval_def_os( _len_, _val_, _str_ ) \
|
|
||||||
{ _str_, { .os = { .data = (unsigned char *)_val_, .len = _len_ }}}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Defines if there are any */
|
|
||||||
|
|
||||||
/* Define Flags for MIP6-Feature-Vector*/
|
|
||||||
|
|
||||||
#define MIP6_INTEGRATED 0x0000000000000001
|
|
||||||
#define LOCAL_HOME_AGENT_ASSIGNMENT 0x0000000000000002
|
|
||||||
|
|
||||||
/* Dictionary */
|
|
||||||
|
|
||||||
int dict_nas_mipv6_init(char * conffile)
|
|
||||||
{
|
|
||||||
struct dict_object * nas_mipv6;
|
|
||||||
{
|
|
||||||
struct dict_application_data data = { 5447, "MIPv6 NAS-to-HAAA Interaction" };
|
|
||||||
CHECK_dict_new( DICT_APPLICATION, &data , NULL, &nas_mipv6);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* AVP section */
|
|
||||||
{
|
|
||||||
/* Loading the derived data formats */
|
|
||||||
|
|
||||||
struct dict_object * Address_type;
|
|
||||||
CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Address", &Address_type);
|
|
||||||
|
|
||||||
/* MIP6-Feature-Vector */
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct dict_avp_data data = {
|
|
||||||
124, /* Code */
|
|
||||||
0, /* Vendor */
|
|
||||||
"MIP6-Feature-Vector", /* Name */
|
|
||||||
AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
|
|
||||||
AVP_FLAG_MANDATORY, /* Fixed flag values */
|
|
||||||
AVP_TYPE_UNSIGNED64 /* base type of data */
|
|
||||||
};
|
|
||||||
|
|
||||||
CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MIP-Home-Agent-Address - RFC 4004 */
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct dict_avp_data data = {
|
|
||||||
334, /* Code */
|
|
||||||
0, /* Vendor */
|
|
||||||
"MIP-Home-Agent-Address", /* Name */
|
|
||||||
AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
|
|
||||||
AVP_FLAG_MANDATORY, /* Fixed flag values */
|
|
||||||
AVP_TYPE_OCTETSTRING /* base type of data */
|
|
||||||
};
|
|
||||||
|
|
||||||
CHECK_dict_new( DICT_AVP, &data , Address_type, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Destination-Host - Base Protocol */
|
|
||||||
|
|
||||||
/* Destination-Realm - Base Protocol */
|
|
||||||
|
|
||||||
/* MIP-Home-Agent-Host - RFC 4004 */
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
The MIP-Home-Agent-Host AVP (AVP Code 348) is of type Grouped and
|
|
||||||
contains the identity of the assigned Home Agent. If the MIP-Home-
|
|
||||||
Agent-Host AVP is present in the AMR, the AAAH MUST copy it into the
|
|
||||||
HAR.
|
|
||||||
|
|
||||||
MIP-Home-Agent-Host ::= < AVP Header: 348 >
|
|
||||||
{ Destination-Realm }
|
|
||||||
{ Destination-Host }
|
|
||||||
* [ AVP ]
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct dict_object * avp;
|
|
||||||
struct dict_avp_data data = {
|
|
||||||
348, /* Code */
|
|
||||||
0, /* Vendor */
|
|
||||||
"MIP-Home-Agent-Host", /* Name */
|
|
||||||
AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
|
|
||||||
AVP_FLAG_MANDATORY, /* Fixed flag values */
|
|
||||||
AVP_TYPE_GROUPED /* base type of data */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct local_rules_definition rules[] =
|
|
||||||
{ { "Destination-Realm", RULE_REQUIRED, -1, 1 }
|
|
||||||
,{ "Destination-Host", RULE_REQUIRED, -1, 1 }
|
|
||||||
};
|
|
||||||
|
|
||||||
CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
|
|
||||||
PARSE_loc_rules( rules, avp );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MIP6-Home-Link-Prefix */
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct dict_avp_data data = {
|
|
||||||
125, /* Code */
|
|
||||||
0, /* Vendor */
|
|
||||||
"MIP6-Home-Link-Prefix", /* Name */
|
|
||||||
AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
|
|
||||||
AVP_FLAG_MANDATORY, /* Fixed flag values */
|
|
||||||
AVP_TYPE_OCTETSTRING /* base type of data */
|
|
||||||
};
|
|
||||||
|
|
||||||
CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MIP6-Agent-Info */
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
|
|
||||||
*/
|
|
||||||
struct dict_object * avp;
|
|
||||||
struct dict_avp_data data = {
|
|
||||||
486, /* Code */
|
|
||||||
0, /* Vendor */
|
|
||||||
"MIP6-Agent-Info", /* Name */
|
|
||||||
AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
|
|
||||||
AVP_FLAG_MANDATORY, /* Fixed flag values */
|
|
||||||
AVP_TYPE_GROUPED /* base type of data */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct local_rules_definition rules[] =
|
|
||||||
{ { "MIP-Home-Agent-Address", RULE_OPTIONAL, -1, 2 }
|
|
||||||
,{ "MIP-Home-Agent-Host", RULE_OPTIONAL, -1, 1 }
|
|
||||||
,{ "MIP6-Home-Link-Prefix", RULE_OPTIONAL, -1, 1 }
|
|
||||||
};
|
|
||||||
|
|
||||||
CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
|
|
||||||
PARSE_loc_rules( rules, avp );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_D( "Dictionary Extension 'MIPv6 NAS-to-HAAA Interaction' initialized");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXTENSION_ENTRY("dict_nas_mipv6", dict_nas_mipv6_init);
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,72 +0,0 @@
|
||||||
/*********************************************************************************************************
|
|
||||||
* 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_ ## _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 */
|
|
|
@ -1,123 +0,0 @@
|
||||||
#define TRACE_MODULE _s6a_client
|
|
||||||
|
|
||||||
#include "core_debug.h"
|
|
||||||
|
|
||||||
#include "freeDiameter/freeDiameter-host.h"
|
|
||||||
#include "freeDiameter/libfdcore.h"
|
|
||||||
#include "freeDiameter/extension.h"
|
|
||||||
|
|
||||||
#include "s6a_message.h"
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static struct session_handler *s6a_cli_reg = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct sess_state {
|
|
||||||
c_int32_t randval; /* a random value to store in Test-AVP */
|
|
||||||
struct timespec ts; /* Time of sending the message */
|
|
||||||
} ;
|
|
||||||
|
|
||||||
/* Cb called when an Authentication-Information-Answe is received */
|
|
||||||
static void s6a_aia_cb(void *data, struct msg **msg)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
struct sess_state *mi = NULL;
|
|
||||||
struct timespec ts;
|
|
||||||
struct session *sess;
|
|
||||||
struct avp *avp;
|
|
||||||
struct avp_hdr *hdr;
|
|
||||||
unsigned long dur;
|
|
||||||
int error = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Now log content of the answer */
|
|
||||||
d_info("Authentication-Information-Answer received!");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a test message */
|
|
||||||
void s6a_build_auth_info_req()
|
|
||||||
{
|
|
||||||
struct msg *req = NULL;
|
|
||||||
struct avp *avp;
|
|
||||||
union avp_value val;
|
|
||||||
#if 0
|
|
||||||
struct sess_state *mi = NULL, *svg;
|
|
||||||
#endif
|
|
||||||
struct session *sess = NULL;
|
|
||||||
|
|
||||||
/* Create the request */
|
|
||||||
CHECK_FCT_DO(fd_msg_new(s6a_air, MSGFL_ALLOC_ETEID, &req), goto out);
|
|
||||||
|
|
||||||
/* Create a new session */
|
|
||||||
#define S6A_APP_SID_OPT "app_s6a"
|
|
||||||
CHECK_FCT_DO(fd_msg_new_session(req, (os0_t)S6A_APP_SID_OPT,
|
|
||||||
CONSTSTRLEN(S6A_APP_SID_OPT)), goto out);
|
|
||||||
CHECK_FCT_DO(fd_msg_sess_get(
|
|
||||||
fd_g_config->cnf_dict, req, &sess, NULL), goto out);
|
|
||||||
|
|
||||||
/* Now set all AVPs values */
|
|
||||||
|
|
||||||
/* Set the Destination-Realm AVP */
|
|
||||||
{
|
|
||||||
CHECK_FCT_DO(fd_msg_avp_new(
|
|
||||||
s6a_destination_realm, 0, &avp), goto out);
|
|
||||||
val.os.data = (unsigned char *)(fd_g_config->cnf_diamrlm);
|
|
||||||
val.os.len = strlen(fd_g_config->cnf_diamrlm);
|
|
||||||
CHECK_FCT_DO(fd_msg_avp_setvalue(avp, &val), goto out);
|
|
||||||
CHECK_FCT_DO(fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp), goto out);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the Destination-Host AVP if needed*/
|
|
||||||
#if 0
|
|
||||||
if (ta_conf->dest_host) {
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
CHECK_FCT_DO(fd_msg_avp_new(
|
|
||||||
s6a_destination_host, 0, &avp), goto out);
|
|
||||||
val.os.data = (unsigned char *)(fd_g_config->cnf_diamid);
|
|
||||||
val.os.len = strlen(fd_g_config->cnf_diamid);
|
|
||||||
CHECK_FCT_DO(fd_msg_avp_setvalue(avp, &val), goto out);
|
|
||||||
CHECK_FCT_DO(fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp), goto out);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set Origin-Host & Origin-Realm */
|
|
||||||
CHECK_FCT_DO(fd_msg_add_origin (req, 0), goto out);
|
|
||||||
|
|
||||||
/* Set the User-Name AVP if needed*/
|
|
||||||
#if 0
|
|
||||||
if (ta_conf->user_name) {
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
CHECK_FCT_DO(fd_msg_avp_new(s6a_user_name, 0, &avp), goto out);
|
|
||||||
#define S6A_IMSI "01045238277"
|
|
||||||
val.os.data = (unsigned char *)(S6A_IMSI);
|
|
||||||
val.os.len = strlen(S6A_IMSI);
|
|
||||||
CHECK_FCT_DO(fd_msg_avp_setvalue(avp, &val), goto out);
|
|
||||||
CHECK_FCT_DO(fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp), goto out);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Send the request */
|
|
||||||
CHECK_FCT_DO(fd_msg_send(&req, s6a_aia_cb, NULL), goto out);
|
|
||||||
|
|
||||||
out:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
status_t s6a_client_start()
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
CHECK_FCT(fd_sess_handler_create(&s6a_cli_reg, (void *)free, NULL, NULL));
|
|
||||||
#endif
|
|
||||||
s6a_build_auth_info_req();
|
|
||||||
|
|
||||||
return CORE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void s6a_client_stop()
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
CHECK_FCT_DO(fd_sess_handler_destroy(&s6a_cli_reg, NULL), /* continue */ );
|
|
||||||
#endif
|
|
||||||
}
|
|
|
@ -1,343 +0,0 @@
|
||||||
#define TRACE_MODULE _s6a_dict
|
|
||||||
|
|
||||||
#include "core_debug.h"
|
|
||||||
#include "core_lib.h"
|
|
||||||
|
|
||||||
#include "freeDiameter/freeDiameter-host.h"
|
|
||||||
#include "freeDiameter/libfdcore.h"
|
|
||||||
#include "freeDiameter/extension.h"
|
|
||||||
|
|
||||||
#include "s6a_message.h"
|
|
||||||
|
|
||||||
#define VENDOR_3GPP (10415)
|
|
||||||
#define APP_S6A (16777251)
|
|
||||||
|
|
||||||
struct dict_object *s6a_vendor;
|
|
||||||
struct dict_object *s6a_appli;
|
|
||||||
|
|
||||||
struct dict_object *s6a_air;
|
|
||||||
struct dict_object *s6a_aia;
|
|
||||||
struct dict_object *s6a_ulr;
|
|
||||||
struct dict_object *s6a_ula;
|
|
||||||
struct dict_object *s6a_pur;
|
|
||||||
struct dict_object *s6a_pua;
|
|
||||||
struct dict_object *s6a_clr;
|
|
||||||
struct dict_object *s6a_cla;
|
|
||||||
|
|
||||||
struct dict_object *s6a_origin_host;
|
|
||||||
struct dict_object *s6a_origin_realm;
|
|
||||||
struct dict_object *s6a_destination_host;
|
|
||||||
struct dict_object *s6a_destination_realm;
|
|
||||||
struct dict_object *s6a_user_name;
|
|
||||||
struct dict_object *s6a_session_id;
|
|
||||||
struct dict_object *s6a_auth_session_state;
|
|
||||||
struct dict_object *s6a_result_code;
|
|
||||||
struct dict_object *s6a_experimental_result;
|
|
||||||
struct dict_object *s6a_vendor_id;
|
|
||||||
struct dict_object *s6a_experimental_result_code;
|
|
||||||
|
|
||||||
struct dict_object *s6a_visited_plmn_id;
|
|
||||||
struct dict_object *s6a_rat_type;
|
|
||||||
struct dict_object *s6a_ulr_flags;
|
|
||||||
struct dict_object *s6a_ula_flags;
|
|
||||||
struct dict_object *s6a_subscription_data;
|
|
||||||
struct dict_object *s6a_req_eutran_auth_info;
|
|
||||||
struct dict_object *s6a_number_of_requested_vectors;
|
|
||||||
struct dict_object *s6a_immediate_response_pref;
|
|
||||||
struct dict_object *s6a_authentication_info;
|
|
||||||
struct dict_object *s6a_re_synchronization_info;
|
|
||||||
struct dict_object *s6a_service_selection;
|
|
||||||
struct dict_object *s6a_ue_srvcc_cap;
|
|
||||||
struct dict_object *s6a_imsi;
|
|
||||||
struct dict_object *s6a_imei;
|
|
||||||
struct dict_object *s6a_software_version;
|
|
||||||
struct dict_object *s6a_supported_features;
|
|
||||||
struct dict_object *s6a_req_e_utran_auth_info;
|
|
||||||
struct dict_object *s6a_req_resync_info;
|
|
||||||
struct dict_object *s6a_req_nb_of_req_vectors;
|
|
||||||
struct dict_object *s6a_req_geran_auth_info;
|
|
||||||
struct dict_object *s6a_immediate_response_pref;
|
|
||||||
struct dict_object *s6a_visited_plmn_id;
|
|
||||||
struct dict_object *s6a_auth_session_state;
|
|
||||||
struct dict_object *s6a_authentication_info;
|
|
||||||
struct dict_object *s6a_e_utran_vector;
|
|
||||||
struct dict_object *s6a_rand;
|
|
||||||
struct dict_object *s6a_xres;
|
|
||||||
struct dict_object *s6a_autn;
|
|
||||||
struct dict_object *s6a_kasme;
|
|
||||||
struct dict_object *s6a_ulr_flags;
|
|
||||||
struct dict_object *s6a_ula_flags;
|
|
||||||
struct dict_object *s6a_pur_flags;
|
|
||||||
struct dict_object *s6a_pua_flags;
|
|
||||||
struct dict_object *s6a_rat_type;
|
|
||||||
struct dict_object *s6a_terminal_info;
|
|
||||||
struct dict_object *s6a_ue_srvcc_cap;
|
|
||||||
struct dict_object *s6a_gmlc_addr;
|
|
||||||
struct dict_object *s6a_subscription_data;
|
|
||||||
struct dict_object *s6a_subscriber_status;
|
|
||||||
struct dict_object *s6a_msisdn;
|
|
||||||
struct dict_object *s6a_ambr;
|
|
||||||
struct dict_object *s6a_network_access_mode;
|
|
||||||
struct dict_object *s6a_access_restriction_data;
|
|
||||||
struct dict_object *s6a_apn_configuration_profile;
|
|
||||||
struct dict_object *s6a_subscribed_rau_tau_timer;
|
|
||||||
struct dict_object *s6a_context_identifier;
|
|
||||||
struct dict_object *s6a_all_apn_conf_inc_ind;
|
|
||||||
struct dict_object *s6a_apn_configuration;
|
|
||||||
struct dict_object *s6a_max_bandwidth_ul;
|
|
||||||
struct dict_object *s6a_max_bandwidth_dl;
|
|
||||||
struct dict_object *s6a_pdn_type;
|
|
||||||
struct dict_object *s6a_service_selection;
|
|
||||||
struct dict_object *s6a_eps_subscribed_qos_profile;
|
|
||||||
struct dict_object *s6a_qos_class_identifier;
|
|
||||||
struct dict_object *s6a_allocation_retention_priority;
|
|
||||||
struct dict_object *s6a_priority_level;
|
|
||||||
struct dict_object *s6a_pre_emption_capability;
|
|
||||||
struct dict_object *s6a_pre_emption_vulnerability;
|
|
||||||
struct dict_object *s6a_served_party_ip_addr;
|
|
||||||
|
|
||||||
status_t s6a_ext_load()
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
int fd_ext_dict_nas_mipv6_init(int major, int minor, char *conffile);
|
|
||||||
int fd_ext_dict_s6a_init(int major, int minor, char *conffile);
|
|
||||||
|
|
||||||
ret = fd_ext_dict_nas_mipv6_init(
|
|
||||||
FD_PROJECT_VERSION_MAJOR, FD_PROJECT_VERSION_MINOR, NULL);
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
d_error("fd_ext_init_nas_mipv6() failed");
|
|
||||||
return CORE_ERROR;
|
|
||||||
}
|
|
||||||
ret = fd_ext_dict_s6a_init(
|
|
||||||
FD_PROJECT_VERSION_MAJOR, FD_PROJECT_VERSION_MINOR, NULL);
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
d_error("fd_ext_init_dict_s6a() failed");
|
|
||||||
return CORE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CORE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
status_t s6a_dict_init()
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
vendor_id_t vendor_3gpp = VENDOR_3GPP;
|
|
||||||
application_id_t app_s6a = APP_S6A;
|
|
||||||
|
|
||||||
ret = s6a_ext_load();
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
return CORE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_VENDOR, VENDOR_BY_ID,
|
|
||||||
(void *)&vendor_3gpp, &s6a_vendor, ENOENT));
|
|
||||||
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_APPLICATION,
|
|
||||||
APPLICATION_BY_ID, (void *)&app_s6a, &s6a_appli, ENOENT));
|
|
||||||
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME,
|
|
||||||
"Authentication-Information-Request", &s6a_air, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME,
|
|
||||||
"Authentication-Information-Answer", &s6a_aia, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME,
|
|
||||||
"Update-Location-Request", &s6a_ulr, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME,
|
|
||||||
"Update-Location-Answer", &s6a_ula, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME,
|
|
||||||
"Purge-UE-Request", &s6a_pur, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME,
|
|
||||||
"Purge-UE-Answer", &s6a_pua, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME,
|
|
||||||
"Cancel-Location-Request", &s6a_clr, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME,
|
|
||||||
"Cancel-Location-Answer", &s6a_cla, ENOENT));
|
|
||||||
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME,
|
|
||||||
"Origin-Host", &s6a_origin_host, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME,
|
|
||||||
"Origin-Realm", &s6a_origin_realm, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME,
|
|
||||||
"Destination-Host", &s6a_destination_host, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME,
|
|
||||||
"Destination-Realm", &s6a_destination_realm, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME,
|
|
||||||
"User-Name", &s6a_user_name, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME,
|
|
||||||
"Session-Id", &s6a_session_id, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME,
|
|
||||||
"Auth-Session-State", &s6a_auth_session_state, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME,
|
|
||||||
"Result-Code", &s6a_result_code, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME,
|
|
||||||
"Experimental-Result", &s6a_experimental_result, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME,
|
|
||||||
"Vendor-Id", &s6a_vendor_id, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME,
|
|
||||||
"Experimental-Result-Code", &s6a_experimental_result_code, ENOENT));
|
|
||||||
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Visited-PLMN-Id",
|
|
||||||
&s6a_visited_plmn_id, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "RAT-Type", &s6a_rat_type, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "ULR-Flags", &s6a_ulr_flags, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "ULA-Flags", &s6a_ula_flags, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Subscription-Data",
|
|
||||||
&s6a_subscription_data, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Requested-EUTRAN-Authentication-Info",
|
|
||||||
&s6a_req_eutran_auth_info, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Number-Of-Requested-Vectors",
|
|
||||||
&s6a_number_of_requested_vectors, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Immediate-Response-Preferred",
|
|
||||||
&s6a_immediate_response_pref, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Authentication-Info",
|
|
||||||
&s6a_authentication_info, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Re-Synchronization-Info",
|
|
||||||
&s6a_re_synchronization_info, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Service-Selection",
|
|
||||||
&s6a_service_selection, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "UE-SRVCC-Capability",
|
|
||||||
&s6a_ue_srvcc_cap, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "User-Name", &s6a_imsi, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "IMEI", &s6a_imei, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Software-Version",
|
|
||||||
&s6a_software_version, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Supported-Features",
|
|
||||||
&s6a_supported_features, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Requested-EUTRAN-Authentication-Info",
|
|
||||||
&s6a_req_e_utran_auth_info, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Number-Of-Requested-Vectors",
|
|
||||||
&s6a_req_nb_of_req_vectors, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Re-Synchronization-Info",
|
|
||||||
&s6a_req_resync_info, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Requested-UTRAN-GERAN-Authentication-Info",
|
|
||||||
&s6a_req_geran_auth_info, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Immediate-Response-Preferred",
|
|
||||||
&s6a_immediate_response_pref, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search (fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Visited-PLMN-Id",
|
|
||||||
&s6a_visited_plmn_id, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Auth-Session-State",
|
|
||||||
&s6a_auth_session_state, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Authentication-Info",
|
|
||||||
&s6a_authentication_info, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "E-UTRAN-Vector",
|
|
||||||
&s6a_e_utran_vector, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "RAND", &s6a_rand, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "XRES", &s6a_xres, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "AUTN", &s6a_autn, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "KASME", &s6a_kasme, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "ULR-Flags", &s6a_ulr_flags, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "ULA-Flags", &s6a_ula_flags, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "PUR-Flags", &s6a_pur_flags, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "PUA-Flags", &s6a_pua_flags, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "RAT-Type", &s6a_rat_type, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Terminal-Information",
|
|
||||||
&s6a_terminal_info, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "UE-SRVCC-Capability",
|
|
||||||
&s6a_ue_srvcc_cap, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "GMLC-Address", &s6a_gmlc_addr, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Subscription-Data",
|
|
||||||
&s6a_subscription_data, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Subscriber-Status",
|
|
||||||
&s6a_subscriber_status, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "MSISDN", &s6a_msisdn, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "AMBR", &s6a_ambr, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Network-Access-Mode",
|
|
||||||
&s6a_network_access_mode, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Access-Restriction-Data",
|
|
||||||
&s6a_access_restriction_data, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "APN-Configuration-Profile",
|
|
||||||
&s6a_apn_configuration_profile, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Subscribed-Periodic-RAU-TAU-Timer",
|
|
||||||
&s6a_subscribed_rau_tau_timer, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Context-Identifier",
|
|
||||||
&s6a_context_identifier, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "All-APN-Configurations-Included-Indicator",
|
|
||||||
&s6a_all_apn_conf_inc_ind, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "APN-Configuration",
|
|
||||||
&s6a_apn_configuration, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Max-Requested-Bandwidth-UL",
|
|
||||||
&s6a_max_bandwidth_ul, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Max-Requested-Bandwidth-DL",
|
|
||||||
&s6a_max_bandwidth_dl, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "PDN-Type", &s6a_pdn_type, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Service-Selection",
|
|
||||||
&s6a_service_selection, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "EPS-Subscribed-QoS-Profile",
|
|
||||||
&s6a_eps_subscribed_qos_profile, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "QoS-Class-Identifier",
|
|
||||||
&s6a_qos_class_identifier, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Allocation-Retention-Priority",
|
|
||||||
&s6a_allocation_retention_priority, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Priority-Level",
|
|
||||||
&s6a_priority_level, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Pre-emption-Capability",
|
|
||||||
&s6a_pre_emption_capability, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Pre-emption-Vulnerability",
|
|
||||||
&s6a_pre_emption_vulnerability, ENOENT));
|
|
||||||
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
|
|
||||||
AVP_BY_NAME_ALL_VENDORS, "Served-Party-IP-Address",
|
|
||||||
&s6a_served_party_ip_addr, ENOENT));
|
|
||||||
|
|
||||||
return CORE_OK;
|
|
||||||
}
|
|
|
@ -1,203 +0,0 @@
|
||||||
#define TRACE_MODULE _s6a_init
|
|
||||||
|
|
||||||
#include "core_debug.h"
|
|
||||||
#include "core_lib.h"
|
|
||||||
|
|
||||||
#include "freeDiameter/freeDiameter-host.h"
|
|
||||||
#include "freeDiameter/libfdcore.h"
|
|
||||||
#include "freeDiameter/extension.h"
|
|
||||||
|
|
||||||
#include "s6a_message.h"
|
|
||||||
|
|
||||||
static void s6a_gnutls_log_func(int level, const char *str);
|
|
||||||
static void s6a_fd_logger(int printlevel, const char *format, va_list ap);
|
|
||||||
|
|
||||||
status_t s6a_initialize()
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
d_trace_level(&_s6a_init, 100);
|
|
||||||
|
|
||||||
gnutls_global_set_log_function(s6a_gnutls_log_func);
|
|
||||||
gnutls_global_set_log_level(TRACE_MODULE);
|
|
||||||
|
|
||||||
ret = fd_log_handler_register(s6a_fd_logger);
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
d_error("fd_log_handler_register() failed");
|
|
||||||
return CORE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = fd_core_initialize();
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
d_error("fd_core_initialize() failed");
|
|
||||||
return CORE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
int fd_msg_init(void);
|
|
||||||
ret = fd_msg_init();
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
d_error("fd_msg_init() failed");
|
|
||||||
return CORE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = s6a_dict_init();
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
d_error("s6a_conf_init() failed");
|
|
||||||
return CORE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CORE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
status_t s6a_conf_handle(s6a_conf_t *conf)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
fd_g_config->cnf_diamid = conf->identity;
|
|
||||||
|
|
||||||
ret = fd_os_validate_DiameterIdentity(&fd_g_config->cnf_diamid,
|
|
||||||
&fd_g_config->cnf_diamid_len, 1);
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
return CORE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
fd_g_config->cnf_diamrlm = conf->realm;
|
|
||||||
|
|
||||||
ret = fd_os_validate_DiameterIdentity(&fd_g_config->cnf_diamrlm,
|
|
||||||
&fd_g_config->cnf_diamrlm_len, 1);
|
|
||||||
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
return CORE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
fd_g_config->cnf_flags.no_fwd = 1;
|
|
||||||
fd_g_config->cnf_flags.no_ip6 = 1;
|
|
||||||
fd_g_config->cnf_flags.no_sctp = 1;
|
|
||||||
fd_g_config->cnf_flags.pr_tcp = 1;
|
|
||||||
|
|
||||||
return CORE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void s6a_conf_show()
|
|
||||||
{
|
|
||||||
char *buf = NULL;
|
|
||||||
size_t len;
|
|
||||||
|
|
||||||
fd_g_debug_lvl = 0;
|
|
||||||
if (g_trace_mask && TRACE_MODULE >= 1)
|
|
||||||
{
|
|
||||||
printf("%s\n", fd_conf_dump(&buf, &len, NULL));
|
|
||||||
free(buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
status_t s6a_thread_start()
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = fd_core_start();
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
d_error("fd_core_start() failed");
|
|
||||||
return CORE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = fd_core_waitstartcomplete();
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
d_error("fd_core_waitstartcomplete() failed");
|
|
||||||
return CORE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = s6a_server_start();
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
d_error("s6a_server_start() failed");
|
|
||||||
return CORE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Advertise the support for the test application in the peer */
|
|
||||||
CHECK_FCT(fd_disp_app_support(s6a_appli, s6a_vendor, 1, 0));
|
|
||||||
|
|
||||||
ret = s6a_client_start();
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
d_error("s6a_client_start() failed");
|
|
||||||
return CORE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CORE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void s6a_thread_stop()
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
s6a_client_stop();
|
|
||||||
s6a_server_stop();
|
|
||||||
|
|
||||||
ret = fd_core_shutdown();
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
d_error("fd_core_shutdown() failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = fd_core_wait_shutdown_complete();
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
d_error("fd_core_wait_shutdown_complete() failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void s6a_gnutls_log_func(int level, const char *str)
|
|
||||||
{
|
|
||||||
d_trace(level, "gnutls[%d]: %s", level, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void s6a_fd_logger(int printlevel, const char *format, va_list ap)
|
|
||||||
{
|
|
||||||
char buffer[HUGE_STRING_LEN];
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
ret = vsnprintf(buffer, HUGE_STRING_LEN, format, ap);
|
|
||||||
if (ret < 0 || ret > HUGE_STRING_LEN)
|
|
||||||
{
|
|
||||||
d_error("vsnprintf() failed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(printlevel)
|
|
||||||
{
|
|
||||||
case FD_LOG_ANNOYING:
|
|
||||||
d_trace(10, "freeDiameter[%d]: %s\n", printlevel, buffer);
|
|
||||||
break;
|
|
||||||
case FD_LOG_DEBUG:
|
|
||||||
d_trace(1, "freeDiameter[%d]: %s\n", printlevel, buffer);
|
|
||||||
break;
|
|
||||||
case FD_LOG_NOTICE:
|
|
||||||
d_info("%s", buffer);
|
|
||||||
break;
|
|
||||||
case FD_LOG_ERROR:
|
|
||||||
d_error("%s", buffer);
|
|
||||||
break;
|
|
||||||
case FD_LOG_FATAL:
|
|
||||||
{
|
|
||||||
char *except = "Initiating freeDiameter shutdown sequence";
|
|
||||||
if (strncmp(buffer, except, strlen(except)) == 0)
|
|
||||||
d_info("%s", buffer);
|
|
||||||
else
|
|
||||||
d_fatal("%s", buffer);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
d_warn("%s", buffer);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,121 +0,0 @@
|
||||||
#ifndef _S6A_MESSAGE_H__
|
|
||||||
#define _S6A_MESSAGE_H__
|
|
||||||
|
|
||||||
#include "core_errno.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#define S6A_SDU_SIZE 2048
|
|
||||||
|
|
||||||
typedef struct _s6a_conf_t {
|
|
||||||
char *identity;
|
|
||||||
char *realm;
|
|
||||||
} s6a_conf_t;
|
|
||||||
|
|
||||||
CORE_DECLARE(status_t) s6a_initialize();
|
|
||||||
|
|
||||||
CORE_DECLARE(status_t) s6a_conf_handle(s6a_conf_t *conf);
|
|
||||||
CORE_DECLARE(void) s6a_conf_show();
|
|
||||||
|
|
||||||
CORE_DECLARE(status_t) s6a_dict_init();
|
|
||||||
|
|
||||||
CORE_DECLARE(status_t) s6a_thread_start();
|
|
||||||
CORE_DECLARE(void) s6a_thread_stop();
|
|
||||||
|
|
||||||
CORE_DECLARE(status_t) s6a_server_start();
|
|
||||||
CORE_DECLARE(void) s6a_server_stop();
|
|
||||||
CORE_DECLARE(status_t) s6a_client_start();
|
|
||||||
CORE_DECLARE(void) s6a_client_stop();
|
|
||||||
|
|
||||||
extern struct dict_object *s6a_vendor;
|
|
||||||
extern struct dict_object *s6a_appli;
|
|
||||||
|
|
||||||
extern struct dict_object *s6a_air;
|
|
||||||
extern struct dict_object *s6a_aia;
|
|
||||||
extern struct dict_object *s6a_ulr;
|
|
||||||
extern struct dict_object *s6a_ula;
|
|
||||||
extern struct dict_object *s6a_pur;
|
|
||||||
extern struct dict_object *s6a_pua;
|
|
||||||
extern struct dict_object *s6a_clr;
|
|
||||||
extern struct dict_object *s6a_cla;
|
|
||||||
|
|
||||||
extern struct dict_object *s6a_origin_host;
|
|
||||||
extern struct dict_object *s6a_origin_realm;
|
|
||||||
extern struct dict_object *s6a_destination_host;
|
|
||||||
extern struct dict_object *s6a_destination_realm;
|
|
||||||
extern struct dict_object *s6a_user_name;
|
|
||||||
extern struct dict_object *s6a_session_id;
|
|
||||||
extern struct dict_object *s6a_auth_session_state;
|
|
||||||
extern struct dict_object *s6a_result_code;
|
|
||||||
extern struct dict_object *s6a_experimental_result;
|
|
||||||
extern struct dict_object *s6a_vendor_id;
|
|
||||||
extern struct dict_object *s6a_experimental_result_code;
|
|
||||||
|
|
||||||
extern struct dict_object *s6a_visited_plmn_id;
|
|
||||||
extern struct dict_object *s6a_rat_type;
|
|
||||||
extern struct dict_object *s6a_ulr_flags;
|
|
||||||
extern struct dict_object *s6a_ula_flags;
|
|
||||||
extern struct dict_object *s6a_subscription_data;
|
|
||||||
extern struct dict_object *s6a_req_eutran_auth_info;
|
|
||||||
extern struct dict_object *s6a_number_of_requested_vectors;
|
|
||||||
extern struct dict_object *s6a_immediate_response_pref;
|
|
||||||
extern struct dict_object *s6a_authentication_info;
|
|
||||||
extern struct dict_object *s6a_re_synchronization_info;
|
|
||||||
extern struct dict_object *s6a_service_selection;
|
|
||||||
extern struct dict_object *s6a_ue_srvcc_cap;
|
|
||||||
extern struct dict_object *s6a_imsi;
|
|
||||||
extern struct dict_object *s6a_imei;
|
|
||||||
extern struct dict_object *s6a_software_version;
|
|
||||||
extern struct dict_object *s6a_supported_features;
|
|
||||||
extern struct dict_object *s6a_req_e_utran_auth_info;
|
|
||||||
extern struct dict_object *s6a_req_resync_info;
|
|
||||||
extern struct dict_object *s6a_req_nb_of_req_vectors;
|
|
||||||
extern struct dict_object *s6a_req_geran_auth_info;
|
|
||||||
extern struct dict_object *s6a_immediate_response_pref;
|
|
||||||
extern struct dict_object *s6a_visited_plmn_id;
|
|
||||||
extern struct dict_object *s6a_auth_session_state;
|
|
||||||
extern struct dict_object *s6a_authentication_info;
|
|
||||||
extern struct dict_object *s6a_e_utran_vector;
|
|
||||||
extern struct dict_object *s6a_rand;
|
|
||||||
extern struct dict_object *s6a_xres;
|
|
||||||
extern struct dict_object *s6a_autn;
|
|
||||||
extern struct dict_object *s6a_kasme;
|
|
||||||
extern struct dict_object *s6a_ulr_flags;
|
|
||||||
extern struct dict_object *s6a_ula_flags;
|
|
||||||
extern struct dict_object *s6a_pur_flags;
|
|
||||||
extern struct dict_object *s6a_pua_flags;
|
|
||||||
extern struct dict_object *s6a_rat_type;
|
|
||||||
extern struct dict_object *s6a_terminal_info;
|
|
||||||
extern struct dict_object *s6a_ue_srvcc_cap;
|
|
||||||
extern struct dict_object *s6a_gmlc_addr;
|
|
||||||
extern struct dict_object *s6a_subscription_data;
|
|
||||||
extern struct dict_object *s6a_subscriber_status;
|
|
||||||
extern struct dict_object *s6a_msisdn;
|
|
||||||
extern struct dict_object *s6a_ambr;
|
|
||||||
extern struct dict_object *s6a_network_access_mode;
|
|
||||||
extern struct dict_object *s6a_access_restriction_data;
|
|
||||||
extern struct dict_object *s6a_apn_configuration_profile;
|
|
||||||
extern struct dict_object *s6a_subscribed_rau_tau_timer;
|
|
||||||
extern struct dict_object *s6a_context_identifier;
|
|
||||||
extern struct dict_object *s6a_all_apn_conf_inc_ind;
|
|
||||||
extern struct dict_object *s6a_apn_configuration;
|
|
||||||
extern struct dict_object *s6a_max_bandwidth_ul;
|
|
||||||
extern struct dict_object *s6a_max_bandwidth_dl;
|
|
||||||
extern struct dict_object *s6a_pdn_type;
|
|
||||||
extern struct dict_object *s6a_service_selection;
|
|
||||||
extern struct dict_object *s6a_eps_subscribed_qos_profile;
|
|
||||||
extern struct dict_object *s6a_qos_class_identifier;
|
|
||||||
extern struct dict_object *s6a_allocation_retention_priority;
|
|
||||||
extern struct dict_object *s6a_priority_level;
|
|
||||||
extern struct dict_object *s6a_pre_emption_capability;
|
|
||||||
extern struct dict_object *s6a_pre_emption_vulnerability;
|
|
||||||
extern struct dict_object *s6a_served_party_ip_addr;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
#define TRACE_MODULE _s6a_serv
|
|
||||||
|
|
||||||
#include "core_debug.h"
|
|
||||||
|
|
||||||
#include "freeDiameter/freeDiameter-host.h"
|
|
||||||
#include "freeDiameter/libfdcore.h"
|
|
||||||
#include "freeDiameter/extension.h"
|
|
||||||
|
|
||||||
#include "s6a_message.h"
|
|
||||||
|
|
||||||
/* handler for fallback cb */
|
|
||||||
static struct disp_hdl *s6a_hdl_fb = NULL;
|
|
||||||
/* handler for Authentication-Information-Request cb */
|
|
||||||
static struct disp_hdl *s6a_hdl_air = NULL;
|
|
||||||
|
|
||||||
/* Default callback for the application. */
|
|
||||||
static int s6a_fb_cb( struct msg ** msg, struct avp * avp,
|
|
||||||
struct session * sess, void * opaque, enum disp_action * act)
|
|
||||||
{
|
|
||||||
/* This CB should never be called */
|
|
||||||
d_warn("Unexpected message received!");
|
|
||||||
|
|
||||||
return ENOTSUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Callback for incoming Authentication-Information-Request messages */
|
|
||||||
static int s6a_air_cb( struct msg ** msg, struct avp * avp,
|
|
||||||
struct session * sess, void * opaque, enum disp_action * act)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
struct msg *ans, *qry;
|
|
||||||
struct avp * a;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
d_info("Authentication-Information-Request received!");
|
|
||||||
|
|
||||||
if (msg == NULL)
|
|
||||||
return EINVAL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
status_t s6a_server_start()
|
|
||||||
{
|
|
||||||
struct disp_when data;
|
|
||||||
|
|
||||||
memset(&data, 0, sizeof(data));
|
|
||||||
data.app = s6a_appli;
|
|
||||||
data.command = s6a_air;
|
|
||||||
|
|
||||||
/* fallback CB if Unexpected message received */
|
|
||||||
CHECK_FCT(fd_disp_register(
|
|
||||||
s6a_fb_cb, DISP_HOW_APPID, &data, NULL, &s6a_hdl_fb));
|
|
||||||
|
|
||||||
/* Now specific handler for Authentication-Information-Request */
|
|
||||||
CHECK_FCT(fd_disp_register(
|
|
||||||
s6a_air_cb, DISP_HOW_CC, &data, NULL, &s6a_hdl_air));
|
|
||||||
|
|
||||||
return CORE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void s6a_server_stop()
|
|
||||||
{
|
|
||||||
if (s6a_hdl_fb)
|
|
||||||
(void)fd_disp_unregister(&s6a_hdl_fb, NULL);
|
|
||||||
|
|
||||||
if (s6a_hdl_air)
|
|
||||||
(void) fd_disp_unregister(&s6a_hdl_air, NULL);
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue