Navigation


Changeset 1299:035f489b845b in freeDiameter


Ignore:
Timestamp:
Jul 5, 2015, 12:06:37 AM (9 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Added a new hook HOOK_MESSAGE_SENDING

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • contrib/debian/changelog

    r1297 r1299  
    44  * New contrib: Gx extension.
    55  * rt_redirect.fdx and rt_load_balance.fdx improvement: use a hash table. Thanks Thomas.
     6  * New hook HOOK_MESSAGE_SENDING to give a last chance to edit messages before they are sent.
     7    This will be mostly used for enforcing interoperability constraints on non-compliant peers.
    68  * Simplified log output. Old output can be recovered with DEBUG_WITH_META build option.
    79  * Updated the internal counters for finer control on the load.
  • extensions/dbg_msg_dumps/dbg_msg_dumps.c

    r1247 r1299  
    119119                LOG_SPLIT(FD_LOG_NOTICE, "     ", buf, NULL);
    120120                break;
     121        case HOOK_MESSAGE_SENDING:
     122                LOG_N("SNDING to '%s':", peer_name);
     123                LOG_SPLIT(FD_LOG_NOTICE, "     ", buf, NULL);
     124                break;
    121125        case HOOK_MESSAGE_SENT:
    122126                LOG_N("SND to '%s':", peer_name);
     
    205209                LOG_N("RCV from '%s': %s", peer_name, buf);
    206210                break;
     211        case HOOK_MESSAGE_SENDING:
     212                LOG_N("SNDING to '%s': %s", peer_name, buf);
     213                break;
    207214        case HOOK_MESSAGE_SENT:
    208215                LOG_N("SND to '%s': %s", peer_name, buf);
     
    284291                LOG_N("RCV from '%s': %s", peer_name, buf);
    285292                break;
     293        case HOOK_MESSAGE_SENDING:
     294                LOG_N("SNDING to '%s': %s", peer_name, buf);
     295                break;
    286296        case HOOK_MESSAGE_SENT:
    287297                LOG_N("SND to '%s': %s", peer_name, buf);
     
    342352       
    343353        mask_errors = HOOK_MASK( HOOK_MESSAGE_FAILOVER, HOOK_MESSAGE_PARSING_ERROR, HOOK_MESSAGE_ROUTING_ERROR, HOOK_MESSAGE_DROPPED  );
    344         mask_sndrcv = HOOK_MASK( HOOK_MESSAGE_RECEIVED, HOOK_MESSAGE_SENT );
     354        mask_sndrcv = HOOK_MASK( HOOK_MESSAGE_RECEIVED, HOOK_MESSAGE_SENT ); /* We don t access SENDING hook here */
    345355        mask_routing= HOOK_MASK( HOOK_MESSAGE_LOCAL, HOOK_MESSAGE_ROUTING_FORWARD, HOOK_MESSAGE_ROUTING_LOCAL );
    346356        mask_peers  = HOOK_MASK( HOOK_PEER_CONNECT_FAILED, HOOK_PEER_CONNECT_SUCCESS );
  • extensions/test_app/ta_cli.c

    r1214 r1299  
    7171               
    7272                CHECK_FCT_DO( fd_sess_state_retrieve( ta_cli_reg, sess, &mi ), return );
    73                 TRACE_DEBUG( INFO, "%p %p", mi, data);
    7473                ASSERT( (void *)mi == data );
    7574        }
  • include/freeDiameter/libfdcore.h

    r1220 r1299  
    965965                 */
    966966       
     967        HOOK_MESSAGE_SENDING,
     968                /* Hook called when a message is about to be sent to a peer. The message pointer cannot be modified here, but the content of the message
     969                  could still be changed (for example add or remove some AVP. This is the last chance.
     970                 - {msg} points to the message. Some objects may not have been dictionary resolved. If you
     971                   try to call fd_msg_parse_dict, it will slow down the operation of the instance.
     972                 - {peer} is the one the message is being sent to.
     973                 - {other} is NULL.
     974                 - {permsgdata} points to existing structure if any, or a new structure otherwise.
     975                 */
     976       
    967977        HOOK_MESSAGE_SENT,
    968978                /* Hook called when a message has been sent to a peer. The message might be freed as soon as the hook function returns,
  • libfdcore/hooks.c

    r1245 r1299  
    345345                        }
    346346                       
     347                        case HOOK_MESSAGE_SENDING: {
     348                                LOG_A("SENDING message to '%s'", peer ? peer->p_hdr.info.pi_diamid : "<unknown>");
     349                                break;
     350                        }
     351                       
    347352                        case HOOK_MESSAGE_SENT: {
    348353                                CHECK_MALLOC_DO(fd_msg_dump_summary(&hook_default_buf, &hook_default_len, NULL, msg, NULL, 0, 1), break);
  • libfdcore/p_out.c

    r1238 r1299  
    166166        TRACE_ENTRY("%p %p %p", msg, cnx, peer);
    167167        CHECK_PARAMS( msg && *msg && (cnx || (peer && peer->p_cnxctx)));
     168
     169        fd_hook_call(HOOK_MESSAGE_SENDING, *msg, peer, NULL, fd_msg_pmdl_get(*msg));
    168170       
    169171        if (update_reqin_cnt && peer) {
Note: See TracChangeset for help on using the changeset viewer.