Changeset 1120:c473581adff2 in freeDiameter
- Timestamp:
- May 14, 2013, 1:32:28 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/app_diameap/diameap.c
r732 r1120 60 60 CHECK_FCT(fd_disp_app_support(dataobj_diameap_app, dataobj_diameap_ven, 1, 0)); 61 61 62 TRACE_DEBUG(INFO,"%sDiameter EAP Application Extension started successfully.",DIAMEAP_EXTENSION);62 LOG_D("%sDiameter EAP Application Extension started successfully.",DIAMEAP_EXTENSION); 63 63 64 64 return 0; -
extensions/app_diameap/diameap_server.c
r1088 r1120 3284 3284 ; 3285 3285 3286 LOG_N("%s Auth FAIL: %.*s",DIAMEAP_EXTENSION, diameap_sm->eap_sm.user.useridLength, diameap_sm->eap_sm.user.userid); 3287 3286 3288 CHECK_FCT_DO( diameap_send(rmsg), 3287 3289 goto s_end) … … 3323 3325 { TRACE_DEBUG(INFO,"%s Adding accounting AVP failed",DIAMEAP_EXTENSION); goto s_end;}) 3324 3326 ; 3327 3328 LOG_N("%s Auth Success: %.*s",DIAMEAP_EXTENSION, diameap_sm->eap_sm.user.useridLength, diameap_sm->eap_sm.user.userid); 3329 3325 3330 CHECK_FCT_DO( diameap_send(rmsg), 3326 3331 goto s_end) -
extensions/dbg_monitor/dbg_monitor.c
r1113 r1120 143 143 TRACE_DEBUG(INFO, "%s", fd_conf_dump(&buf, &len, NULL)); 144 144 TRACE_DEBUG(INFO, "[dbg_monitor] Dumping extensions information"); 145 TRACE_DEBUG(INFO, "%s", fd_ext_dump(&buf, &len, NULL ));145 TRACE_DEBUG(INFO, "%s", fd_ext_dump(&buf, &len, NULL, 0)); 146 146 TRACE_DEBUG(INFO, "[dbg_monitor] Dumping dictionary information"); 147 147 TRACE_DEBUG(INFO, "%s", fd_dict_dump(&buf, &len, NULL, fd_g_config->cnf_dict)); -
extensions/dict_dcca/dict_dcca.c
r885 r1120 1465 1465 } 1466 1466 } 1467 TRACE_DEBUG(INFO,"Extension 'Dictionary definitions for DCCA (rfc4006)' initialized");1467 LOG_D( "Extension 'Dictionary definitions for DCCA (rfc4006)' initialized"); 1468 1468 return 0; 1469 1469 } -
extensions/dict_dcca_3gpp/dict_dcca_3gpp.c
r1086 r1120 10757 10757 } 10758 10758 10759 TRACE_DEBUG(INFO,"Extension 'Dictionary definitions for DCCA 3GPP' initialized");10759 LOG_D( "Extension 'Dictionary definitions for DCCA 3GPP' initialized"); 10760 10760 return 0; 10761 10761 } -
extensions/dict_dcca_starent/dict_dcca_starent.c
r962 r1120 283 283 284 284 285 TRACE_DEBUG(INFO,"Extension 'Dictionary definitions for DCCA Starent' initialized");285 LOG_D( "Extension 'Dictionary definitions for DCCA Starent' initialized"); 286 286 return 0; 287 287 } -
extensions/dict_eap/dict_eap.c
r879 r1120 513 513 } 514 514 515 TRACE_DEBUG(INFO,"Extension 'Dictionary definitions for EAP' initialized");515 LOG_D( "Extension 'Dictionary definitions for EAP' initialized"); 516 516 return 0; 517 517 } -
extensions/dict_mip6a/dict_mip6a.c
r776 r1120 1089 1089 } 1090 1090 } 1091 TRACE_DEBUG(INFO,"Dictionary Extension 'Diameter Mobile IPv6 Auth (MIP6A)' initialized");1091 LOG_D( "Dictionary Extension 'Diameter Mobile IPv6 Auth (MIP6A)' initialized"); 1092 1092 return 0; 1093 1093 } -
extensions/dict_mip6i/dict_mip6i.c
r777 r1120 1132 1132 } 1133 1133 1134 TRACE_DEBUG(INFO,"Dictionary Extension 'Diameter Mobile IPv6 IKE (MIP6I)' initialized");1134 LOG_D( "Dictionary Extension 'Diameter Mobile IPv6 IKE (MIP6I)' initialized"); 1135 1135 return 0; 1136 1136 } -
extensions/dict_nas_mipv6/dict_nas_mipv6.c
r614 r1120 253 253 } 254 254 255 TRACE_DEBUG(INFO,"Dictionary Extension 'MIPv6 NAS-to-HAAA Interaction' initialized");255 LOG_D( "Dictionary Extension 'MIPv6 NAS-to-HAAA Interaction' initialized"); 256 256 return 0; 257 257 } -
extensions/dict_nasreq/dict_nasreq.c
r750 r1120 3729 3729 } 3730 3730 3731 TRACE_DEBUG(INFO,"Extension 'Dictionary definitions for NASREQ' initialized");3731 LOG_D( "Extension 'Dictionary definitions for NASREQ' initialized"); 3732 3732 return 0; 3733 3733 } -
extensions/dict_rfc5777/dict_rfc5777.c
r774 r1120 2136 2136 } 2137 2137 2138 TRACE_DEBUG(INFO,"Dictionary Extension 'Traffic Classification and Quality of Service (QoS) Attributes for Diameter (RFC 5777)' initialized");2138 LOG_D( "Dictionary Extension 'Traffic Classification and Quality of Service (QoS) Attributes for Diameter (RFC 5777)' initialized"); 2139 2139 return 0; 2140 2140 } -
extensions/dict_sip/dict_sip.c
r614 r1120 2947 2947 } 2948 2948 2949 TRACE_DEBUG(INFO,"Extension 'Dictionary definitions for SIP' initialized");2949 LOG_D( "Extension 'Dictionary definitions for SIP' initialized"); 2950 2950 return 0; 2951 2951 } -
extensions/test_netemul/tne_process.c
r972 r1120 106 106 CHECK_FCT( fd_msg_bufferize(m, &buf, &len) ); 107 107 CHECK_FCT( fd_msg_parse_buffer(&buf, len, &nm) ); 108 CHECK_FCT( fd_msg_source_set(nm, src, srclen , 0, NULL) );108 CHECK_FCT( fd_msg_source_set(nm, src, srclen) ); 109 109 CHECK_FCT( fd_msg_hdr(nm, &nh) ); 110 110 nh->msg_flags |= CMD_FLAG_RETRANSMIT; /* Add the 'T' flag */ -
include/freeDiameter/libfdcore.h
r1113 r1120 813 813 /* The "old" FD_EV_DUMP_* events are replaced with direct calls to the following dump functions */ 814 814 DECLARE_FD_DUMP_PROTOTYPE(fd_conf_dump); 815 DECLARE_FD_DUMP_PROTOTYPE(fd_ext_dump );815 DECLARE_FD_DUMP_PROTOTYPE(fd_ext_dump, int indent_next); 816 816 DECLARE_FD_DUMP_PROTOTYPE(fd_servers_dump, int details); 817 817 #endif /* SWIG */ -
include/freeDiameter/libfdproto.h
r1119 r1120 2500 2500 * msg : A msg object. 2501 2501 * diamid,len : The diameter id of the peer from which this message was received. 2502 * add_rr : if true, a Route-Record AVP is added to the message with content diamid. In that case, dict must be supplied. 2503 * dict : a dictionary with definition of Route-Record AVP (if add_rr is true) 2502 * dict : a dictionary with definition of Route-Record AVP (for fd_msg_source_setrr) 2504 2503 * 2505 2504 * DESCRIPTION: … … 2512 2511 * !0 : an error occurred. 2513 2512 */ 2514 int fd_msg_source_set( struct msg * msg, DiamId_t diamid, size_t diamidlen, int add_rr, struct dictionary * dict ); 2513 int fd_msg_source_set( struct msg * msg, DiamId_t diamid, size_t diamidlen ); 2514 int fd_msg_source_setrr( struct msg * msg, DiamId_t diamid, size_t diamidlen, struct dictionary * dict ); 2515 2515 int fd_msg_source_get( struct msg * msg, DiamId_t *diamid, size_t * diamidlen ); 2516 2516 -
libfdcore/core.c
r1119 r1120 257 257 LOG_N("%s", b ?: "Error during configuration dump..."); 258 258 259 /* Display extensions status */ 260 b = fd_ext_dump(&buf, &len, NULL, 19); 261 LOG_N("Loaded extensions: %s", b ?: "Error during extensions dump..."); 262 259 263 /* Display registered triggers for FDEV_TRIGGER */ 260 264 b = fd_event_trig_dump(&buf, &len, &offset); -
libfdcore/extensions.c
r1113 r1120 78 78 79 79 /* Dump the list */ 80 DECLARE_FD_DUMP_PROTOTYPE(fd_ext_dump )80 DECLARE_FD_DUMP_PROTOTYPE(fd_ext_dump, int indent_next) 81 81 { 82 82 struct fd_list * li; … … 86 86 { 87 87 struct fd_ext_info * ext = (struct fd_ext_info *)li; 88 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{extension}(@%p): '%s'[%s], %sloaded%s", ext, ext->filename, ext->conffile?:"no conf", ext->handler ? "" : "not ", (li->next == &ext_list) ? "":"\n"), return NULL); 88 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "%*s'%s'[%s], %sloaded%s", (li == ext_list.next) ? 0 : indent_next,"", 89 ext->filename, 90 ext->conffile?:"no conf", 91 ext->handler ? "" : "not ", (li->next == &ext_list) ? "":"\n"), return NULL); 89 92 } 90 93 return *buf; -
libfdcore/hooks.c
r1103 r1120 333 333 if (msg) { 334 334 DiamId_t id = NULL; 335 size_t idlen; 336 if (!fd_msg_source_get( msg, &id, &idlen )) 335 if (!fd_msg_source_get( msg, &id, NULL )) 337 336 id = (DiamId_t)"<error getting source>"; 338 337 … … 353 352 case HOOK_MESSAGE_ROUTING_ERROR: { 354 353 DiamId_t id = NULL; 355 size_t idlen; 356 if (!fd_msg_source_get( msg, &id, &idlen )) 354 if (!fd_msg_source_get( msg, &id, NULL )) 357 355 id = (DiamId_t)"<error getting source>"; 358 356 … … 397 395 398 396 case HOOK_PEER_CONNECT_SUCCESS: { 397 DiamId_t id = NULL; 398 if ((!fd_msg_source_get( msg, &id, NULL )) && (id == NULL)) { /* The CEA is locally issued */ 399 fd_msg_answ_getq(msg, &msg); /* We dump the CER in that case */ 400 } 399 401 CHECK_MALLOC_DO(fd_msg_dump_treeview(&buf, &len, NULL, msg, NULL, 0, 1), break); 400 402 LOG_N("Connected to '%s', remote capabilities: %s", peer ? peer->p_hdr.info.pi_diamid : "<unknown>", buf); -
libfdcore/messages.c
r1113 r1120 318 318 struct msg_hdr *hdr; 319 319 DiamId_t diamid; 320 size_t diamidlen;321 320 322 321 /* Save the callback in the message, with the timeout */ … … 326 325 if ( (fd_msg_hdr(*pmsg, &hdr) == 0) 327 326 && (hdr->msg_flags & CMD_FLAG_REQUEST) 328 && (fd_msg_source_get(*pmsg, &diamid, &diamidlen) == 0)327 && (fd_msg_source_get(*pmsg, &diamid, NULL) == 0) 329 328 && (diamid == NULL)) { 330 329 fd_hook_call(HOOK_MESSAGE_LOCAL, *pmsg, NULL, NULL, fd_msg_pmdl_get(*pmsg)); -
libfdcore/p_psm.c
r1118 r1120 282 282 return 0; 283 283 284 TRACE_DEBUG(((old == STATE_OPEN) || (new_state == STATE_OPEN)) ? INFO : FULL, "'%s'\t-> '%s'\t'%s'",284 LOG(((old == STATE_OPEN) || (new_state == STATE_OPEN)) ? FD_LOG_NOTICE : FD_LOG_DEBUG, "'%s'\t-> '%s'\t'%s'", 285 285 STATE_STR(old), 286 286 STATE_STR(new_state), … … 500 500 501 501 fd_hook_associate(msg, pmdl); 502 CHECK_FCT_DO( fd_msg_source_set( msg, peer->p_hdr.info.pi_diamid, peer->p_hdr.info.pi_diamidlen), goto psm_end); 502 503 503 504 /* If the current state does not allow receiving messages, just drop it */ … … 557 558 558 559 /* Set the message source and add the Route-Record */ 559 CHECK_FCT_DO( fd_msg_source_set ( msg, peer->p_hdr.info.pi_diamid, peer->p_hdr.info.pi_diamidlen, 1, fd_g_config->cnf_dict ), goto psm_end);560 CHECK_FCT_DO( fd_msg_source_setrr( msg, peer->p_hdr.info.pi_diamid, peer->p_hdr.info.pi_diamidlen, fd_g_config->cnf_dict ), goto psm_end); 560 561 561 562 /* Requeue to the global incoming queue */ … … 742 743 char * buf = NULL; 743 744 size_t len = 0; 744 LOG_D(" New remote endpoint(s): %s", fd_ep_dump(&buf, &len, NULL, 0, 0, &peer->p_hdr.info.pi_endpoints) ?: "error");745 LOG_D("Got low layer notification (IGNORED): remote endpoint(s) changed: %s", fd_ep_dump(&buf, &len, NULL, 0, 0, &peer->p_hdr.info.pi_endpoints) ?: "error"); 745 746 free(buf); 746 747 } -
libfdcore/routing_dispatch.c
r1119 r1120 551 551 int is_err = 0; 552 552 DiamId_t qry_src = NULL; 553 size_t qry_src_len = 0;554 553 struct msg *msgptr = msg; 555 554 … … 751 750 /* Retrieve the corresponding query and its origin */ 752 751 CHECK_FCT( fd_msg_answ_getq( msgptr, &qry ) ); 753 CHECK_FCT( fd_msg_source_get( qry, &qry_src, &qry_src_len) );752 CHECK_FCT( fd_msg_source_get( qry, &qry_src, NULL ) ); 754 753 755 754 if ((!qry_src) && (!is_err)) { -
libfdproto/messages.c
r1119 r1120 804 804 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, " Command Code: %u\n", msg->msg_public.msg_code), return NULL); 805 805 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, " ApplicationId: %d\n", msg->msg_public.msg_appl), return NULL); 806 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, " Hop-by-Hop Identifier: 0x% 8X\n", msg->msg_public.msg_hbhid), return NULL);807 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, " End-to-End Identifier: 0x% 8X\n", msg->msg_public.msg_eteid), return NULL);806 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, " Hop-by-Hop Identifier: 0x%08X\n", msg->msg_public.msg_hbhid), return NULL); 807 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, " End-to-End Identifier: 0x%08X\n", msg->msg_public.msg_eteid), return NULL); 808 808 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, " {debug data}: src:%s(%zd) rwb:%p rt:%d cb:%p,%p(%p) qry:%p asso:%d sess:%p", msg->msg_src_id?:"(nil)", msg->msg_src_id_len, msg->msg_rawbuffer, msg->msg_routable, msg->msg_cb.anscb, msg->msg_cb.expirecb, msg->msg_cb.data, msg->msg_query, msg->msg_associated, msg->msg_sess), return NULL); 809 809 … … 1071 1071 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, " {"), return NULL); 1072 1072 } else { 1073 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, " +"), return NULL);1073 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, ","), return NULL); 1074 1074 } 1075 1075 } … … 1131 1131 /* For embedded AVPs, we only display (vendor,) code & length */ 1132 1132 if (avp->avp_public.avp_flags & AVP_FLAG_VENDOR) { 1133 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "V =%u,", avp->avp_public.avp_vendor), return NULL);1134 } 1135 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "C =%u,L=%d", avp->avp_public.avp_code, avp->avp_public.avp_len), return NULL);1133 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "V:%u/", avp->avp_public.avp_vendor), return NULL); 1134 } 1135 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "C:%u/l:%d", avp->avp_public.avp_code, avp->avp_public.avp_len), return NULL); 1136 1136 } 1137 1137 … … 1342 1342 1343 1343 /* Associate source peer */ 1344 int fd_msg_source_set( struct msg * msg, DiamId_t diamid, size_t diamidlen , int add_rr, struct dictionary * dict)1345 { 1346 TRACE_ENTRY( "%p %p %zd %d %p", msg, diamid, diamidlen, add_rr, dict);1344 int fd_msg_source_set( struct msg * msg, DiamId_t diamid, size_t diamidlen ) 1345 { 1346 TRACE_ENTRY( "%p %p %zd", msg, diamid, diamidlen); 1347 1347 1348 1348 /* Check we received a valid message */ 1349 CHECK_PARAMS( CHECK_MSG(msg) && ( (! add_rr) || dict ));1349 CHECK_PARAMS( CHECK_MSG(msg) ); 1350 1350 1351 1351 /* Cleanup any previous source */ … … 1360 1360 CHECK_MALLOC( msg->msg_src_id = os0dup(diamid, diamidlen) ); 1361 1361 msg->msg_src_id_len = diamidlen; 1362 1363 1364 if (add_rr) { 1365 struct dict_object *avp_rr_model = NULL; 1366 avp_code_t code = AC_ROUTE_RECORD; 1367 struct avp *avp; 1368 union avp_value val; 1369 1370 /* Lock the cached values */ 1362 /* done */ 1363 return 0; 1364 } 1365 1366 /* Associate source peer */ 1367 int fd_msg_source_setrr( struct msg * msg, DiamId_t diamid, size_t diamidlen, struct dictionary * dict ) 1368 { 1369 struct dict_object *avp_rr_model = NULL; 1370 avp_code_t code = AC_ROUTE_RECORD; 1371 struct avp *avp; 1372 union avp_value val; 1373 1374 TRACE_ENTRY( "%p %p %zd %p", msg, diamid, diamidlen, dict); 1375 1376 /* Check we received a valid message */ 1377 CHECK_PARAMS( CHECK_MSG(msg) && dict ); 1378 1379 /* Lock the cached values */ 1380 CHECK_POSIX( pthread_mutex_lock(&cached_avp_rr_lock) ); 1381 if (cached_avp_rr_dict == dict) { 1382 avp_rr_model = cached_avp_rr_model; 1383 } 1384 CHECK_POSIX( pthread_mutex_unlock(&cached_avp_rr_lock) ); 1385 1386 /* If it was not cached */ 1387 if (!avp_rr_model) { 1388 /* Find the model for Route-Record in the dictionary */ 1389 CHECK_FCT( fd_dict_search ( dict, DICT_AVP, AVP_BY_CODE, &code, &avp_rr_model, ENOENT) ); 1390 1391 /* Now cache this result */ 1371 1392 CHECK_POSIX( pthread_mutex_lock(&cached_avp_rr_lock) ); 1372 if (cached_avp_rr_dict == dict) { 1373 avp_rr_model = cached_avp_rr_model; 1374 } 1393 cached_avp_rr_dict = dict; 1394 cached_avp_rr_model = avp_rr_model; 1375 1395 CHECK_POSIX( pthread_mutex_unlock(&cached_avp_rr_lock) ); 1376 1377 /* If it was not cached */ 1378 if (!avp_rr_model) { 1379 /* Find the model for Route-Record in the dictionary */ 1380 CHECK_FCT( fd_dict_search ( dict, DICT_AVP, AVP_BY_CODE, &code, &avp_rr_model, ENOENT) ); 1381 1382 /* Now cache this result */ 1383 CHECK_POSIX( pthread_mutex_lock(&cached_avp_rr_lock) ); 1384 cached_avp_rr_dict = dict; 1385 cached_avp_rr_model = avp_rr_model; 1386 CHECK_POSIX( pthread_mutex_unlock(&cached_avp_rr_lock) ); 1387 } 1388 1389 /* Create the AVP with this model */ 1390 CHECK_FCT( fd_msg_avp_new ( avp_rr_model, 0, &avp ) ); 1391 1392 /* Set the AVP value with the diameter id */ 1393 memset(&val, 0, sizeof(val)); 1394 val.os.data = (uint8_t *)diamid; 1395 val.os.len = diamidlen; 1396 CHECK_FCT( fd_msg_avp_setvalue( avp, &val ) ); 1397 1398 /* Add the AVP in the message */ 1399 CHECK_FCT( fd_msg_avp_add( msg, MSG_BRW_LAST_CHILD, avp ) ); 1400 } 1396 } 1397 1398 /* Create the AVP with this model */ 1399 CHECK_FCT( fd_msg_avp_new ( avp_rr_model, 0, &avp ) ); 1400 1401 /* Set the AVP value with the diameter id */ 1402 memset(&val, 0, sizeof(val)); 1403 val.os.data = (uint8_t *)diamid; 1404 val.os.len = diamidlen; 1405 CHECK_FCT( fd_msg_avp_setvalue( avp, &val ) ); 1406 1407 /* Add the AVP in the message */ 1408 CHECK_FCT( fd_msg_avp_add( msg, MSG_BRW_LAST_CHILD, avp ) ); 1401 1409 1402 1410 /* done */ -
tests/testappacct.c
r773 r1120 239 239 240 240 /* Source */ 241 CHECK( 0, fd_msg_source_set( msg, "peer3", CONSTSTRLEN("peer3"), 1, fd_g_config->cnf_dict ) ); 241 CHECK( 0, fd_msg_source_set( msg, "peer3", CONSTSTRLEN("peer3") ) ); 242 CHECK( 0, fd_msg_source_setrr( msg, "peer3", CONSTSTRLEN("peer3"), fd_g_config->cnf_dict ) ); 242 243 } 243 244
Note: See TracChangeset
for help on using the changeset viewer.