use my own extension for freeDiameter

This commit is contained in:
Sukchan Lee 2017-08-17 15:13:03 +09:00
parent 7118f5b352
commit 8c5d884402
14 changed files with 4015 additions and 17 deletions

View File

@ -315,7 +315,11 @@ AC_CONFIG_FILES([lib/base/Makefile])
AC_CONFIG_FILES([lib/s1ap/asn1c/Makefile])
AC_CONFIG_FILES([lib/s1ap/Makefile])
AC_CONFIG_FILES([lib/nas/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dbg_msg_dumps/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_rfc5777/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_mip6i/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_nasreq/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_nas_mipv6/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_dcca/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_dcca_3gpp/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_s6a/Makefile])

View File

@ -1,6 +1,9 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = dict_nasreq dict_dcca dict_dcca_3gpp dict_s6a
SUBDIRS = \
dbg_msg_dumps dict_rfc5777 dict_mip6i \
dict_nasreq dict_nas_mipv6 \
dict_dcca dict_dcca_3gpp dict_s6a
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

View File

@ -0,0 +1,15 @@
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = dbg_msg_dumps.la
dbg_msg_dumps_la_SOURCES = \
dbg_msg_dumps.c
AM_LDFLAGS = \
-module -avoid-version -shared
AM_CFLAGS = \
-Wall -Werror
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

View File

@ -0,0 +1,395 @@
/*********************************************************************************************************
* 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. *
*********************************************************************************************************/
/* This extension uses the hooks mechanism to display the full content of received and sent messages, for
learning & debugging purpose.
Do NOT use this extension in production environment because it will slow down all operation. */
/* You can add a configuration parameter on the LoadExtension line, e.g.
LoadExtension="dbg_msg_dump.fdx":"0x149";
The value is an hexadecimal value with the following bits meaning: */
#define HK_ERRORS_QUIET 0x0001 /* errors are not dumped -- removes the default handling as well */
#define HK_ERRORS_COMPACT 0x0002 /* errors in compact mode */
#define HK_ERRORS_FULL 0x0004 /* errors in full mode (1 line with all the data) */
#define HK_ERRORS_TREE 0x0008 /* errors in treeview mode (message split over multiple lines) */
#define HK_SNDRCV_QUIET 0x0010 /* send+rcv are not dumped -- removes the default handling as well */
#define HK_SNDRCV_COMPACT 0x0020 /* send+rcv in compact mode */
#define HK_SNDRCV_FULL 0x0040 /* send+rcv in full mode */
#define HK_SNDRCV_TREE 0x0080 /* send+rcv in tree mode */
#define HK_ROUTING_QUIET 0x0100 /* routing decisions are not dumped -- removes the default handling as well */
#define HK_ROUTING_COMPACT 0x0200 /* routing decisions in compact mode */
#define HK_ROUTING_FULL 0x0400 /* routing decisions in full mode */
#define HK_ROUTING_TREE 0x0800 /* routing decisions in tree mode */
#define HK_PEERS_QUIET 0x1000 /* peers connections events are not dumped -- removes the default handling as well */
#define HK_PEERS_COMPACT 0x2000 /* peers connections events in compact mode */
#define HK_PEERS_FULL 0x4000 /* peers connections events in full mode */
#define HK_PEERS_TREE 0x8000 /* peers connections events in tree mode */
/*
Default value is HK_ERRORS_TREE + HK_SNDRCV_TREE + HK_PEERS_TREE
*/
#include <freeDiameter/extension.h>
static struct fd_hook_hdl *md_hdl[4] = {NULL,NULL,NULL,NULL};
static uint32_t dump_level = HK_ERRORS_TREE | HK_SNDRCV_TREE | HK_PEERS_TREE; /* default */
static char * buf = NULL;
static size_t len;
static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
/* The callback called when messages are received and sent */
static void md_hook_cb_tree(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata)
{
char * peer_name = peer ? peer->info.pi_diamid : "<unknown peer>";
CHECK_POSIX_DO( pthread_mutex_lock(&mtx), );
if (msg) {
CHECK_MALLOC_DO( fd_msg_dump_treeview(&buf, &len, NULL, msg, fd_g_config->cnf_dict, (type == HOOK_MESSAGE_PARSING_ERROR) ? 0 : 1, 1),
{ LOG_E("Error while dumping a message"); pthread_mutex_unlock(&mtx); return; } );
}
switch (type) {
/* errors */
case HOOK_MESSAGE_FAILOVER:
LOG_E("FAILOVER from '%s':", peer_name);
LOG_SPLIT(FD_LOG_ERROR, " ", buf, NULL);
break;
case HOOK_MESSAGE_PARSING_ERROR:
if (msg) {
DiamId_t id = NULL;
if (!fd_msg_source_get( msg, &id, NULL ))
id = (DiamId_t)"<error getting source>";
if (!id)
id = (DiamId_t)"<local>";
LOG_E("PARSING ERROR: '%s' from '%s': ", (char *)other, (char *)id);
LOG_SPLIT(FD_LOG_ERROR, " ", buf, NULL);
} else {
struct fd_cnx_rcvdata *rcv_data = other;
CHECK_MALLOC_DO(fd_dump_extend_hexdump(&buf, &len, NULL, rcv_data->buffer, rcv_data->length, 0, 0), break);
LOG_E("PARSING ERROR: %zdB msg from '%s': %s", rcv_data->length, peer_name, buf);
}
break;
case HOOK_MESSAGE_ROUTING_ERROR:
LOG_E("ROUTING ERROR '%s' for: ", (char *)other);
LOG_SPLIT(FD_LOG_ERROR, " ", buf, NULL);
break;
case HOOK_MESSAGE_DROPPED:
LOG_E("DROPPED '%s'", (char *)other);
LOG_SPLIT(FD_LOG_ERROR, " ", buf, NULL);
break;
/* send receive */
case HOOK_MESSAGE_RECEIVED:
LOG_N("RCV from '%s':", peer_name);
LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
break;
case HOOK_MESSAGE_SENT:
LOG_N("SND to '%s':", peer_name);
LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
break;
/* routing */
case HOOK_MESSAGE_LOCAL:
LOG_N("ISSUED:");
LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
break;
case HOOK_MESSAGE_ROUTING_FORWARD:
LOG_N("FORWARDING: %s", buf);
LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
break;
case HOOK_MESSAGE_ROUTING_LOCAL:
LOG_N("DISPATCHING: %s", buf);
LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
break;
/* peers */
case HOOK_PEER_CONNECT_FAILED:
LOG_N("CONNECT FAILED to %s: %s", peer_name, (char *)other);
break;
case HOOK_PEER_CONNECT_SUCCESS:
{
char protobuf[40];
if (peer) {
CHECK_FCT_DO(fd_peer_cnx_proto_info(peer, protobuf, sizeof(protobuf)), break );
} else {
protobuf[0] = '-';
protobuf[1] = '\0';
}
LOG_N("CONNECTED TO '%s' (%s):", peer_name, protobuf);
LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
}
break;
/* Not handled */
case HOOK_DATA_RECEIVED:
break;
}
CHECK_POSIX_DO( pthread_mutex_unlock(&mtx), );
}
static void md_hook_cb_full(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata)
{
char * peer_name = peer ? peer->info.pi_diamid : "<unknown peer>";
CHECK_POSIX_DO( pthread_mutex_lock(&mtx), );
if (msg) {
CHECK_MALLOC_DO( fd_msg_dump_full(&buf, &len, NULL, msg, fd_g_config->cnf_dict, (type == HOOK_MESSAGE_PARSING_ERROR) ? 0 : 1, 1),
{ LOG_E("Error while dumping a message"); pthread_mutex_unlock(&mtx); return; } );
}
switch (type) {
/* errors */
case HOOK_MESSAGE_FAILOVER:
LOG_E("FAILOVER from '%s': %s", peer_name, buf);
break;
case HOOK_MESSAGE_PARSING_ERROR:
if (msg) {
DiamId_t id = NULL;
if (!fd_msg_source_get( msg, &id, NULL ))
id = (DiamId_t)"<error getting source>";
if (!id)
id = (DiamId_t)"<local>";
LOG_E("PARSING ERROR: '%s' from '%s': %s", (char *)other, (char *)id, buf);
} else {
struct fd_cnx_rcvdata *rcv_data = other;
CHECK_MALLOC_DO(fd_dump_extend_hexdump(&buf, &len, NULL, rcv_data->buffer, rcv_data->length, 0, 0), break);
LOG_E("PARSING ERROR: %zdB msg from '%s': %s", rcv_data->length, peer_name, buf);
}
break;
case HOOK_MESSAGE_ROUTING_ERROR:
LOG_E("ROUTING ERROR '%s' for: %s", (char *)other, buf);
break;
case HOOK_MESSAGE_DROPPED:
LOG_E("DROPPED '%s' %s", (char *)other, buf);
break;
/* send receive */
case HOOK_MESSAGE_RECEIVED:
LOG_N("RCV from '%s': %s", peer_name, buf);
break;
case HOOK_MESSAGE_SENT:
LOG_N("SND to '%s': %s", peer_name, buf);
break;
/* routing */
case HOOK_MESSAGE_LOCAL:
LOG_N("ISSUED: %s", buf);
break;
case HOOK_MESSAGE_ROUTING_FORWARD:
LOG_N("FORWARDING: %s", buf);
break;
case HOOK_MESSAGE_ROUTING_LOCAL:
LOG_N("DISPATCHING: %s", buf);
break;
/* peers */
case HOOK_PEER_CONNECT_FAILED:
LOG_N("CONNECT FAILED to %s: %s", peer_name, (char *)other);
break;
case HOOK_PEER_CONNECT_SUCCESS: {
char protobuf[40];
if (peer) {
CHECK_FCT_DO(fd_peer_cnx_proto_info(peer, protobuf, sizeof(protobuf)), break );
} else {
protobuf[0] = '-';
protobuf[1] = '\0';
}
LOG_N("CONNECTED TO '%s' (%s): %s", peer_name, protobuf, buf);
}
break;
/* Not handled */
case HOOK_DATA_RECEIVED:
break;
}
CHECK_POSIX_DO( pthread_mutex_unlock(&mtx), );
}
static void md_hook_cb_compact(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata)
{
char * peer_name = peer ? peer->info.pi_diamid : "<unknown peer>";
CHECK_POSIX_DO( pthread_mutex_lock(&mtx), );
if (msg) {
CHECK_MALLOC_DO( fd_msg_dump_summary(&buf, &len, NULL, msg, fd_g_config->cnf_dict, 0, 0),
{ LOG_E("Error while dumping a message"); pthread_mutex_unlock(&mtx); return; } );
}
switch (type) {
/* errors */
case HOOK_MESSAGE_FAILOVER:
LOG_E("FAILOVER from '%s': %s", peer_name, buf);
break;
case HOOK_MESSAGE_PARSING_ERROR:
if (msg) {
DiamId_t id = NULL;
if (!fd_msg_source_get( msg, &id, NULL ))
id = (DiamId_t)"<error getting source>";
if (!id)
id = (DiamId_t)"<local>";
LOG_E("PARSING ERROR: '%s' from '%s': %s", (char *)other, (char *)id, buf);
} else {
struct fd_cnx_rcvdata *rcv_data = other;
CHECK_MALLOC_DO(fd_dump_extend_hexdump(&buf, &len, NULL, rcv_data->buffer, rcv_data->length, 0, 0), break);
LOG_E("PARSING ERROR: %zdB msg from '%s': %s", rcv_data->length, peer_name, buf);
}
break;
case HOOK_MESSAGE_ROUTING_ERROR:
LOG_E("ROUTING ERROR '%s' for: %s", (char *)other, buf);
break;
case HOOK_MESSAGE_DROPPED:
LOG_E("DROPPED '%s' %s", (char *)other, buf);
break;
/* send receive */
case HOOK_MESSAGE_RECEIVED:
LOG_N("RCV from '%s': %s", peer_name, buf);
break;
case HOOK_MESSAGE_SENT:
LOG_N("SND to '%s': %s", peer_name, buf);
break;
/* routing */
case HOOK_MESSAGE_LOCAL:
LOG_N("ISSUED: %s", buf);
break;
case HOOK_MESSAGE_ROUTING_FORWARD:
LOG_N("FORWARDING: %s", buf);
break;
case HOOK_MESSAGE_ROUTING_LOCAL:
LOG_N("DISPATCHING: %s", buf);
break;
/* peers */
case HOOK_PEER_CONNECT_FAILED:
LOG_N("CONNECT FAILED to %s: %s", peer_name, (char *)other);
break;
case HOOK_PEER_CONNECT_SUCCESS: {
char protobuf[40];
if (peer) {
CHECK_FCT_DO(fd_peer_cnx_proto_info(peer, protobuf, sizeof(protobuf)), break );
} else {
protobuf[0] = '-';
protobuf[1] = '\0';
}
LOG_N("CONNECTED TO '%s' (%s)", peer_name, protobuf);
}
break;
/* Not handled */
case HOOK_DATA_RECEIVED:
break;
}
CHECK_POSIX_DO( pthread_mutex_unlock(&mtx), );
}
static void md_hook_cb_quiet(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata)
{
}
/* Entry point */
static int md_main(char * conffile)
{
uint32_t mask_errors, mask_sndrcv, mask_routing, mask_peers;
uint32_t mask_quiet, mask_compact, mask_full, mask_tree;
TRACE_ENTRY("%p", conffile);
if (conffile != NULL) {
char * endp;
dump_level = (uint32_t)strtoul(conffile, &endp, 16);
CHECK_PARAMS_DO( *endp == '\0', {
LOG_E("Configuration parameter must be in the form \"0xNNNN\"");
return EINVAL; });
}
mask_errors = HOOK_MASK( HOOK_MESSAGE_FAILOVER, HOOK_MESSAGE_PARSING_ERROR, HOOK_MESSAGE_ROUTING_ERROR, HOOK_MESSAGE_DROPPED );
mask_sndrcv = HOOK_MASK( HOOK_MESSAGE_RECEIVED, HOOK_MESSAGE_SENT );
mask_routing= HOOK_MASK( HOOK_MESSAGE_LOCAL, HOOK_MESSAGE_ROUTING_FORWARD, HOOK_MESSAGE_ROUTING_LOCAL );
mask_peers = HOOK_MASK( HOOK_PEER_CONNECT_FAILED, HOOK_PEER_CONNECT_SUCCESS );
mask_quiet = (dump_level & HK_ERRORS_QUIET) ? mask_errors : 0;
mask_quiet |= (dump_level & HK_SNDRCV_QUIET) ? mask_sndrcv : 0;
mask_quiet |= (dump_level & HK_ROUTING_QUIET) ? mask_routing : 0;
mask_quiet |= (dump_level & HK_PEERS_QUIET) ? mask_peers : 0;
mask_compact = (dump_level & HK_ERRORS_COMPACT) ? mask_errors : 0;
mask_compact |= (dump_level & HK_SNDRCV_COMPACT) ? mask_sndrcv : 0;
mask_compact |= (dump_level & HK_ROUTING_COMPACT) ? mask_routing : 0;
mask_compact |= (dump_level & HK_PEERS_COMPACT) ? mask_peers : 0;
mask_full = (dump_level & HK_ERRORS_FULL) ? mask_errors : 0;
mask_full |= (dump_level & HK_SNDRCV_FULL) ? mask_sndrcv : 0;
mask_full |= (dump_level & HK_ROUTING_FULL) ? mask_routing : 0;
mask_full |= (dump_level & HK_PEERS_FULL) ? mask_peers : 0;
mask_tree = (dump_level & HK_ERRORS_TREE) ? mask_errors : 0;
mask_tree |= (dump_level & HK_SNDRCV_TREE) ? mask_sndrcv : 0;
mask_tree |= (dump_level & HK_ROUTING_TREE) ? mask_routing : 0;
mask_tree |= (dump_level & HK_PEERS_TREE) ? mask_peers : 0;
if (mask_quiet) {
CHECK_FCT( fd_hook_register( mask_quiet, md_hook_cb_quiet, NULL, NULL, &md_hdl[0]) );
}
if (mask_compact) {
CHECK_FCT( fd_hook_register( mask_compact, md_hook_cb_compact, NULL, NULL, &md_hdl[1]) );
}
if (mask_full) {
CHECK_FCT( fd_hook_register( mask_full, md_hook_cb_full, NULL, NULL, &md_hdl[2]) );
}
if (mask_tree) {
CHECK_FCT( fd_hook_register( mask_tree, md_hook_cb_tree, NULL, NULL, &md_hdl[3]) );
}
return 0;
}
/* Cleanup */
void fd_ext_fini(void)
{
TRACE_ENTRY();
if (md_hdl[0]) { CHECK_FCT_DO( fd_hook_unregister( md_hdl[0] ), ); }
if (md_hdl[1]) { CHECK_FCT_DO( fd_hook_unregister( md_hdl[1] ), ); }
if (md_hdl[2]) { CHECK_FCT_DO( fd_hook_unregister( md_hdl[2] ), ); }
if (md_hdl[2]) { CHECK_FCT_DO( fd_hook_unregister( md_hdl[3] ), ); }
return ;
}
EXTENSION_ENTRY("dbg_msg_dumps", md_main);

View File

@ -0,0 +1,15 @@
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = dict_mip6i.la
dict_mip6i_la_SOURCES = \
dict_mip6i.c
AM_LDFLAGS = \
-module -avoid-version -shared
AM_CFLAGS = \
-Wall -Werror
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = dict_nas_mipv6.la
dict_nas_mipv6_la_SOURCES = \
dict_nas_mipv6.c
AM_LDFLAGS = \
-module -avoid-version -shared
AM_CFLAGS = \
-Wall -Werror
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

View File

@ -0,0 +1,258 @@
/*********************************************************************************************************
* 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);

View File

@ -0,0 +1,15 @@
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = dict_rfc5777.la
dict_rfc5777_la_SOURCES = \
dict_rfc5777.c
AM_LDFLAGS = \
-module -avoid-version -shared
AM_CFLAGS = \
-Wall -Werror
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

File diff suppressed because it is too large Load Diff

View File

@ -223,11 +223,11 @@ TLS_CA = "@prefix@/etc/freeDiameter/cacert.pem";
# 4 - full - display the complete information on a single long line
# 8 - tree - display the complete information in an easier to read format spanning several lines.
LoadExtension = "dbg_msg_dumps.fdx" : "0x8888";
LoadExtension = "dict_rfc5777.fdx";
LoadExtension = "dict_mip6i.fdx";
LoadExtension = "dict_nas_mipv6.fdx";
LoadExtension = "@prefix@/lib/nextepc/dbg_msg_dumps.so" : "0x8888";
LoadExtension = "@prefix@/lib/nextepc/dict_rfc5777.so";
LoadExtension = "@prefix@/lib/nextepc/dict_mip6i.so";
LoadExtension = "@prefix@/lib/nextepc/dict_nasreq.so";
LoadExtension = "@prefix@/lib/nextepc/dict_nas_mipv6.so";
LoadExtension = "@prefix@/lib/nextepc/dict_dcca.so";
LoadExtension = "@prefix@/lib/nextepc/dict_dcca_3gpp.so";
LoadExtension = "@prefix@/lib/nextepc/dict_s6a.so";

View File

@ -223,11 +223,11 @@ TLS_CA = "@prefix@/etc/freeDiameter/cacert.pem";
# 4 - full - display the complete information on a single long line
# 8 - tree - display the complete information in an easier to read format spanning several lines.
LoadExtension = "dbg_msg_dumps.fdx" : "0x8888";
LoadExtension = "dict_rfc5777.fdx";
LoadExtension = "dict_mip6i.fdx";
LoadExtension = "dict_nas_mipv6.fdx";
LoadExtension = "@prefix@/lib/nextepc/dbg_msg_dumps.so" : "0x8888";
LoadExtension = "@prefix@/lib/nextepc/dict_rfc5777.so";
LoadExtension = "@prefix@/lib/nextepc/dict_mip6i.so";
LoadExtension = "@prefix@/lib/nextepc/dict_nasreq.so";
LoadExtension = "@prefix@/lib/nextepc/dict_nas_mipv6.so";
LoadExtension = "@prefix@/lib/nextepc/dict_dcca.so";
LoadExtension = "@prefix@/lib/nextepc/dict_dcca_3gpp.so";
LoadExtension = "@prefix@/lib/nextepc/dict_s6a.so";

View File

@ -223,11 +223,11 @@ TLS_CA = "@prefix@/etc/freeDiameter/cacert.pem";
# 4 - full - display the complete information on a single long line
# 8 - tree - display the complete information in an easier to read format spanning several lines.
LoadExtension = "dbg_msg_dumps.fdx" : "0x8888";
LoadExtension = "dict_rfc5777.fdx";
LoadExtension = "dict_mip6i.fdx";
LoadExtension = "dict_nas_mipv6.fdx";
LoadExtension = "@prefix@/lib/nextepc/dbg_msg_dumps.so" : "0x8888";
LoadExtension = "@prefix@/lib/nextepc/dict_rfc5777.so";
LoadExtension = "@prefix@/lib/nextepc/dict_mip6i.so";
LoadExtension = "@prefix@/lib/nextepc/dict_nasreq.so";
LoadExtension = "@prefix@/lib/nextepc/dict_nas_mipv6.so";
LoadExtension = "@prefix@/lib/nextepc/dict_dcca.so";
LoadExtension = "@prefix@/lib/nextepc/dict_dcca_3gpp.so";
#LoadExtension = "@prefix@/lib/nextepc/dict_legacy_xml.so" : "@prefix@/etc/freeDiameter/dict_legacy_xml.conf";

View File

@ -223,11 +223,11 @@ TLS_CA = "@prefix@/etc/freeDiameter/cacert.pem";
# 4 - full - display the complete information on a single long line
# 8 - tree - display the complete information in an easier to read format spanning several lines.
LoadExtension = "dbg_msg_dumps.fdx" : "0x8888";
LoadExtension = "dict_rfc5777.fdx";
LoadExtension = "dict_mip6i.fdx";
LoadExtension = "dict_nas_mipv6.fdx";
LoadExtension = "@prefix@/lib/nextepc/dbg_msg_dumps.so" : "0x8888";
LoadExtension = "@prefix@/lib/nextepc/dict_rfc5777.so";
LoadExtension = "@prefix@/lib/nextepc/dict_mip6i.so";
LoadExtension = "@prefix@/lib/nextepc/dict_nasreq.so";
LoadExtension = "@prefix@/lib/nextepc/dict_nas_mipv6.so";
LoadExtension = "@prefix@/lib/nextepc/dict_dcca.so";
LoadExtension = "@prefix@/lib/nextepc/dict_dcca_3gpp.so";
#LoadExtension = "@prefix@/lib/nextepc/dict_legacy_xml.so" : "@prefix@/etc/freeDiameter/dict_legacy_xml.conf";