Navigation


Changes in / [1116:5da2ea1585a1:1115:a325f95de659] in freeDiameter


Ignore:
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • extensions/dbg_interactive/endpoints.i

    r1113 r1088  
    128128                char * buf = NULL;
    129129                size_t len;
    130                 printf("%s", fd_ep_dump_one(&buf, &len, NULL, 1, $self));
     130                printf("%s", fd_ep_dump_one(&buf, &len, NULL, $self));
    131131                free(buf);
    132132        }
  • extensions/dbg_monitor/dbg_monitor.c

    r1113 r1088  
    126126               
    127127                TRACE_DEBUG(INFO, "[dbg_monitor] Dumping servers information");
    128                 TRACE_DEBUG(INFO, "%s", fd_servers_dump(&buf, &len, NULL, 1));
     128                TRACE_DEBUG(INFO, "%s", fd_servers_dump(&buf, &len, NULL));
    129129               
    130130                sleep(1);
  • include/freeDiameter/libfdcore.h

    r1113 r1103  
    814814DECLARE_FD_DUMP_PROTOTYPE(fd_conf_dump);
    815815DECLARE_FD_DUMP_PROTOTYPE(fd_ext_dump);
    816 DECLARE_FD_DUMP_PROTOTYPE(fd_servers_dump, int details);
     816DECLARE_FD_DUMP_PROTOTYPE(fd_servers_dump);
    817817#endif /* SWIG */
    818818DECLARE_FD_DUMP_PROTOTYPE(fd_peer_dump_list, int details);
     
    853853int fd_ep_filter_list( struct fd_list * list, struct fd_list * exclude_list );
    854854int fd_ep_clearflags( struct fd_list * list, uint32_t flags );
    855 DECLARE_FD_DUMP_PROTOTYPE(fd_ep_dump_one, int preamble, struct fd_endpoint * ep );
    856 DECLARE_FD_DUMP_PROTOTYPE(fd_ep_dump, int preamble, int indent, struct fd_list * eps  );
     855DECLARE_FD_DUMP_PROTOTYPE(fd_ep_dump_one, struct fd_endpoint * ep );
     856DECLARE_FD_DUMP_PROTOTYPE(fd_ep_dump, int indent, struct fd_list * eps  );
    857857
    858858
     
    936936       
    937937        HOOK_MESSAGE_LOCAL,
    938                 /* Hook called when a request message has been created locally by an extension and is being sent.
     938                /* Hook called when a request message has been created locally and is being sent.
    939939                 - {msg} points to the message.
    940940                 - {peer} is NULL
  • include/freeDiameter/libfdproto.h

    r1113 r1107  
    29222922 *  action      : Upon return, the action that must be taken on the message
    29232923 *  error_code  : Upon return with action == DISP_ACT_ERROR, contains the error (such as "DIAMETER_UNABLE_TO_COMPLY")
    2924  *  drop_reason : if set on return, the message must be freed for this reason.
    2925  *  drop_msg    : if drop_reason is set, this points to the message to be freed while *msg is NULL.
    29262924 *
    29272925 * DESCRIPTION:
     
    29362934 *  (other errors)
    29372935 */
    2938 int fd_msg_dispatch ( struct msg ** msg, struct session * session, enum disp_action *action, char ** error_code, char ** drop_reason, struct msg ** drop_msg );
     2936int fd_msg_dispatch ( struct msg ** msg, struct session * session, enum disp_action *action, char ** error_code );
    29392937
    29402938
  • libfdcore/config.c

    r1113 r1107  
    8585        FD_DUMP_HANDLE_OFFSET();
    8686       
    87         CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "freeDiameter configuration:\n", fd_g_config), return NULL);       
     87        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{freeDiameter configuration}(@%p): \n", fd_g_config), return NULL);       
    8888        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  Default trace level .... : %+d\n", fd_g_debug_lvl), return NULL);
    8989        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  Configuration file ..... : %s\n", fd_g_config->cnf_file), return NULL);
     
    9999                CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  Local endpoints ........ : Default (use all available)\n"), return NULL);
    100100        } else {
    101                 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  Local endpoints ........ : "), return NULL);
    102                 CHECK_MALLOC_DO( fd_ep_dump( FD_DUMP_STD_PARAMS, 0, 0, &fd_g_config->cnf_endpoints ), return NULL);
     101                CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  Local endpoints ........ : \n"), return NULL);
     102                CHECK_MALLOC_DO( fd_ep_dump( FD_DUMP_STD_PARAMS, 29, &fd_g_config->cnf_endpoints ), return NULL);
    103103        }
    104104        if (FD_IS_LIST_EMPTY(&fd_g_config->cnf_apps)) {
    105                 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  Local applications ..... : (none)"), return NULL);
     105                CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  Local applications ..... : (none)\n"), return NULL);
    106106        } else {
    107107                struct fd_list * li = fd_g_config->cnf_apps.next;
    108                 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  Local applications ..... : "), return NULL);
     108                CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  Local applications ..... : \n"), return NULL);
    109109                while (li != &fd_g_config->cnf_apps) {
    110110                        struct fd_app * app = (struct fd_app *)li;
    111                         CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "App: %u,%s%s,Vnd:%u\t",
     111                        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "                             App: %u\t%s%s\tVnd: %u\n",
    112112                                        app->appid,
    113113                                        app->flags.auth ? "Au" : "--",
     
    118118        }
    119119       
    120         CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "\n  Flags : - IP ........... : %s\n", fd_g_config->cnf_flags.no_ip4 ? "DISABLED" : "Enabled"), return NULL);
     120        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  Flags : - IP ........... : %s\n", fd_g_config->cnf_flags.no_ip4 ? "DISABLED" : "Enabled"), return NULL);
    121121        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "          - IPv6 ......... : %s\n", fd_g_config->cnf_flags.no_ip6 ? "DISABLED" : "Enabled"), return NULL);
    122122        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "          - Relay app .... : %s\n", fd_g_config->cnf_flags.no_fwd ? "DISABLED" : "Enabled"), return NULL);
     
    588588               
    589589        } else {
    590                 LOG_D( "Generating fresh Diffie-Hellman parameters of size %d (this takes some time)... ", fd_g_config->cnf_sec_data.dh_bits ?: GNUTLS_DEFAULT_DHBITS);
     590                TRACE_DEBUG(INFO, "Generating fresh Diffie-Hellman parameters of size %d (this takes some time)... ", fd_g_config->cnf_sec_data.dh_bits ?: GNUTLS_DEFAULT_DHBITS);
    591591                CHECK_GNUTLS_DO( gnutls_dh_params_generate2(
    592592                                        fd_g_config->cnf_sec_data.dh_cache,
  • libfdcore/core.c

    r1112 r1111  
    8484static int core_state_wait(enum core_state waitstate)
    8585{
    86         int ret = 0;
     86        int ret;
    8787        CHECK_POSIX( pthread_mutex_lock( &core_mtx ));
    8888        pthread_cleanup_push( fd_cleanup_mutex, &core_mtx );
    89         while (waitstate > core_state) {
     89        do {
    9090                CHECK_POSIX_DO(ret = pthread_cond_wait(&core_cnd, &core_mtx), break);
    91         }
     91        } while (waitstate > core_state);
    9292        pthread_cleanup_pop( 0 );
    9393        CHECK_POSIX( pthread_mutex_unlock( &core_mtx ));
     
    189189        }
    190190       
    191         LOG_N("libfdproto initialized.");
     191        LOG_D("libfdproto initialized.");
    192192       
    193193        /* Name this thread */
     
    305305        if (cur_state < CORE_RUNNING) {
    306306                core_shutdown();
    307                 core_state_set(CORE_TERM);
    308307        } else if (cur_state == CORE_RUNNING) {
    309308                core_state_set(CORE_SHUTDOWN);
     
    324323        void * th_ret = NULL;
    325324       
    326         CHECK_FCT(core_state_wait(CORE_SHUTDOWN));
    327        
    328325        if (cur_state == CORE_TERM)
    329326                return 0;
    330327       
     328        CHECK_FCT(core_state_wait(CORE_SHUTDOWN));
     329       
    331330        /* Just wait for core_runner_thread to complete and return gracefully */
    332331        CHECK_POSIX(pthread_join(core_runner, &th_ret));
  • libfdcore/endpoints.c

    r1113 r1093  
    285285}
    286286
    287 DECLARE_FD_DUMP_PROTOTYPE(fd_ep_dump_one, int preamble, struct fd_endpoint * ep )
     287DECLARE_FD_DUMP_PROTOTYPE(fd_ep_dump_one, struct fd_endpoint * ep )
    288288{
    289289        FD_DUMP_HANDLE_OFFSET();
    290290       
    291         if (preamble) {
    292                 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{ep}(@%p): ", ep), return NULL);
    293         }
     291        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{ep}(@%p): ", ep), return NULL);
    294292       
    295293        if (!ep) {
     
    299297       
    300298        CHECK_MALLOC_DO( fd_sa_dump_node_serv( FD_DUMP_STD_PARAMS, &ep->sa, NI_NUMERICHOST | NI_NUMERICSERV ), return NULL);
    301         CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{%s%s%s%s%s}",
    302                                 (ep->flags & EP_FL_CONF)        ? "C" : "-",
    303                                 (ep->flags & EP_FL_DISC)        ? "D" : "-",
    304                                 (ep->flags & EP_FL_ADV)         ? "A" : "-",
    305                                 (ep->flags & EP_FL_LL)          ? "L" : "-",
    306                                 (ep->flags & EP_FL_PRIMARY)     ? "P" : "-"), return NULL);
     299        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, " {%s%s%s%s%s}",
     300                        (ep->flags & EP_FL_CONF)        ? "C" : "-",
     301                        (ep->flags & EP_FL_DISC)        ? "D" : "-",
     302                        (ep->flags & EP_FL_ADV)         ? "A" : "-",
     303                        (ep->flags & EP_FL_LL)          ? "L" : "-",
     304                        (ep->flags & EP_FL_PRIMARY)     ? "P" : "-"), return NULL);
    307305        return *buf;
    308306}
    309307
    310 DECLARE_FD_DUMP_PROTOTYPE(fd_ep_dump, int preamble, int indent, struct fd_list * eps  )
     308DECLARE_FD_DUMP_PROTOTYPE(fd_ep_dump, int indent, struct fd_list * eps  )
    311309{
    312310        struct fd_list * li;
     
    314312        FD_DUMP_HANDLE_OFFSET();
    315313       
    316         if (preamble) {
    317                 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "%*s{eps}(@%p):", indent, "", eps), return NULL);
    318         }
     314        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "%*s{eps}(@%p):", indent, "", eps), return NULL);
    319315        if (eps) {
    320316                for (li = eps->next; li != eps; li = li->next) {
    321317                        struct fd_endpoint * ep = (struct fd_endpoint *)li;
    322                         if (preamble) {
    323                                 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "\n%*s", indent+1, ""), return NULL);
    324                         } else if (li->prev != eps) {
    325                                 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "\t"), return NULL);
    326                         }
    327                         CHECK_MALLOC_DO( fd_ep_dump_one( FD_DUMP_STD_PARAMS, preamble, ep ), return NULL);
    328                 }
    329         }
    330 }
    331        
     318                        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "\n%*s", indent+1, ""), return NULL);
     319                        CHECK_MALLOC_DO( fd_ep_dump_one( FD_DUMP_STD_PARAMS, ep ), return NULL);
     320                }
     321        }
     322}
     323       
  • libfdcore/extensions.c

    r1113 r1094  
    151151        {
    152152                struct fd_ext_info * ext = (struct fd_ext_info *)li;
    153                 LOG_D( "Loading : %s", ext->filename);
     153                TRACE_DEBUG (INFO, "Loading : %s", ext->filename);
    154154               
    155155                /* Load the extension */
     
    162162                if (ext->handler == NULL) {
    163163                        /* An error occured */
    164                         LOG_F("Loading of extension %s failed: %s", ext->filename, dlerror());
     164                        TRACE_ERROR("Loading of extension %s failed: %s", ext->filename, dlerror());
    165165                        #ifdef DEBUG
    166166                        ext->handler = dlopen(ext->filename, RTLD_LAZY | RTLD_GLOBAL);
     
    208208        }
    209209
    210         LOG_N("All extensions loaded.");
     210        TRACE_DEBUG (INFO, "All extensions loaded.");
    211211       
    212212        /* We have finished. */
  • libfdcore/messages.c

    r1113 r1103  
    314314}
    315315
    316 static int fd_msg_send_int( struct msg ** pmsg, void (*anscb)(void *, struct msg **), void * data, void (*expirecb)(void *, DiamId_t, size_t, struct msg **), const struct timespec *timeout )
    317 {
    318         struct msg_hdr *hdr;
    319         DiamId_t diamid;
    320         size_t diamidlen;
     316/* Send a message and optionaly register a callback for an answer */
     317int fd_msg_send ( struct msg ** pmsg, void (*anscb)(void *, struct msg **), void * data )
     318{
     319        TRACE_ENTRY("%p %p %p", pmsg, anscb, data);
     320        CHECK_PARAMS( pmsg );
     321       
     322        /* Save the callback in the message */
     323        CHECK_FCT(  fd_msg_anscb_associate( *pmsg, anscb, data, NULL, NULL /* we should maybe use a safeguard here like 1 hour or so? */ )  );
     324       
     325        /* Post the message in the outgoing queue */
     326        CHECK_FCT( fd_fifo_post(fd_g_outgoing, pmsg) );
     327       
     328        return 0;
     329}
     330
     331/* The variation of the same function with a timeout callback */
     332int fd_msg_send_timeout ( struct msg ** pmsg, void (*anscb)(void *, struct msg **), void * data, void (*expirecb)(void *, DiamId_t, size_t, struct msg **), const struct timespec *timeout )
     333{
     334        TRACE_ENTRY("%p %p %p %p %p", pmsg, anscb, data, expirecb, timeout);
     335        CHECK_PARAMS( pmsg && expirecb && timeout );
    321336       
    322337        /* Save the callback in the message, with the timeout */
    323338        CHECK_FCT(  fd_msg_anscb_associate( *pmsg, anscb, data, expirecb, timeout )  );
    324339       
    325         /* If this is a new request, call the HOOK_MESSAGE_LOCAL hook */
    326         if ( (fd_msg_hdr(*pmsg, &hdr) == 0)
    327          &&  (hdr->msg_flags & CMD_FLAG_REQUEST)
    328          &&  (fd_msg_source_get(*pmsg, &diamid, &diamidlen) == 0)
    329          &&  (diamid == NULL)) {
    330                 fd_hook_call(HOOK_MESSAGE_LOCAL, *pmsg, NULL, NULL, fd_msg_pmdl_get(*pmsg));
    331         }
    332                
    333340        /* Post the message in the outgoing queue */
    334341        CHECK_FCT( fd_fifo_post(fd_g_outgoing, pmsg) );
    335342       
    336343        return 0;
    337 }
    338 
    339 /* Send a message and optionaly register a callback for an answer */
    340 int fd_msg_send ( struct msg ** pmsg, void (*anscb)(void *, struct msg **), void * data )
    341 {
    342         TRACE_ENTRY("%p %p %p", pmsg, anscb, data);
    343         CHECK_PARAMS( pmsg );
    344        
    345         return fd_msg_send_int(pmsg, anscb, data, NULL, NULL);
    346 }
    347 
    348 /* The variation of the same function with a timeout callback */
    349 int fd_msg_send_timeout ( struct msg ** pmsg, void (*anscb)(void *, struct msg **), void * data, void (*expirecb)(void *, DiamId_t, size_t, struct msg **), const struct timespec *timeout )
    350 {
    351         TRACE_ENTRY("%p %p %p %p %p", pmsg, anscb, data, expirecb, timeout);
    352         CHECK_PARAMS( pmsg && expirecb && timeout );
    353        
    354         return fd_msg_send_int(pmsg, anscb, data, expirecb, timeout);
    355344}
    356345
  • libfdcore/p_ce.c

    r1113 r1103  
    650650        *recv_cnx = NULL;
    651651        if (*cer) {
    652                 fd_hook_call(HOOK_MESSAGE_DROPPED, *cer, NULL, "An error occurred while rejecting this CER.", fd_msg_pmdl_get(*cer));
     652                //fd_msg_log(FD_MSG_LOG_DROPPED, *cer, "An error occurred while rejecting a CER.");
    653653                fd_msg_free(*cer);
    654654                *cer = NULL;
  • libfdcore/p_out.c

    r1113 r1103  
    9898        CHECK_FCT_DO(fd_fifo_post(fd_g_outgoing, &msg),
    9999                {
    100                         fd_hook_call(HOOK_MESSAGE_DROPPED, msg, NULL, "An error occurred while attempting to requeue this message during cancellation of the sending function", fd_msg_pmdl_get(msg));
     100                        //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "An error occurred while attempting to requeue this message during cancellation of the sending function");
    101101                        CHECK_FCT_DO(fd_msg_free(msg), /* What can we do more? */);
    102102                } );
     
    131131                        {
    132132                                if (msg) {
    133                                         char buf[256];
    134                                         snprintf(buf, sizeof(buf), "Error while sending this message: s", strerror(ret));
    135                                         fd_hook_call(HOOK_MESSAGE_DROPPED, msg, NULL, buf, fd_msg_pmdl_get(msg));
     133                                        //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Internal error: Problem while sending (%s)", strerror(ret) );
    136134                                        fd_msg_free(msg);
    137135                                }
     
    185183                        {
    186184                                if (msg) {
    187                                         char buf[256];
    188                                         snprintf(buf, sizeof(buf), "Error while sending this message: s", strerror(ret));
    189                                         fd_hook_call(HOOK_MESSAGE_DROPPED, *msg, NULL, buf, fd_msg_pmdl_get(*msg));
     185                                        //fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Internal error: Problem while sending (%s)", strerror(ret) );
    190186                                        fd_msg_free(*msg);
    191187                                        *msg = NULL;
  • libfdcore/p_psm.c

    r1113 r1104  
    241241                        case FDEVP_CNX_INCOMING: {
    242242                                struct cnx_incoming * evd = ev->data;
    243                                 fd_hook_call(HOOK_MESSAGE_DROPPED, evd->cer, NULL, "Message discarded while cleaning peer state machine queue.", fd_msg_pmdl_get(evd->cer));
     243                                //fd_msg_log( FD_MSG_LOG_DROPPED, evd->cer, "Message discarded while cleaning peer state machine queue." );
    244244                                CHECK_FCT_DO( fd_msg_free(evd->cer), /* continue */);
    245245                                fd_cnx_destroy(evd->cnx);
     
    577577                                        char buf[128];
    578578                                        snprintf(buf, sizeof(buf), "Received while peer state machine was in state %s.", STATE_STR(cur_state));
    579                                         LOG_E("%s",buf);
    580579                                        fd_hook_call(HOOK_MESSAGE_DROPPED, msg, peer, buf, fd_msg_pmdl_get(msg));
    581580                                        fd_msg_free(msg);
     
    591590                        if (ret != EBADMSG) {
    592591                                CHECK_FCT_DO( ret,
    593                                         {
    594                                                 char buf[256];
    595                                                 snprintf(buf, sizeof(buf), "%s: An unexpected error occurred while parsing a link-local message", peer->p_hdr.info.pi_diamid);
    596                                                 LOG_E("%s",buf);
    597                                                 fd_hook_call(HOOK_MESSAGE_DROPPED, msg, peer, buf, fd_msg_pmdl_get(msg));
     592                                        {
     593                                                LOG_E("%s: An unexpected error occurred while parsing a link-local message", peer->p_hdr.info.pi_diamid);
    598594                                                fd_msg_free(msg);
    599595                                                goto psm_end;
     
    604600                                        CHECK_FCT_DO( ret = fd_out_send(&error, NULL, peer, FD_CNX_ORDERED),  );
    605601                                        if (error) {
    606                                                 char buf[256];
    607602                                                /* Only if an error occurred & the message was not saved / dumped */
    608                                                 snprintf(buf, sizeof(buf), "%s: error sending a message", peer->p_hdr.info.pi_diamid);
    609                                                 LOG_E("%s",buf);
    610                                                 fd_hook_call(HOOK_MESSAGE_DROPPED, error, peer, buf, fd_msg_pmdl_get(error));
     603                                                LOG_E("%s: error sending a message", peer->p_hdr.info.pi_diamid);
    611604                                                CHECK_FCT_DO( fd_msg_free(error), goto psm_end);
    612605                                        }
    613606                                } else {
    614                                         char buf[256];
    615607                                        /* We received an invalid answer, let's disconnect */
    616                                         snprintf(buf, sizeof(buf), "%s: Received invalid answer to Base protocol message, disconnecting...", peer->p_hdr.info.pi_diamid);
    617                                         LOG_E("%s",buf);
     608                                        LOG_E("%s: Received invalid answer to Base protocol message, disconnecting...", peer->p_hdr.info.pi_diamid);
    618609                                        CHECK_FCT_DO( fd_msg_free(msg), goto psm_end);
    619610                                        CHECK_FCT_DO( fd_event_send(peer->p_events, FDEVP_CNX_ERROR, 0, NULL), goto psm_reset );
     
    666657                                /* Cleanup the message if not done */
    667658                                if (msg) {
    668                                         char buf[256];
    669                                         snprintf(buf, sizeof(buf), "Received un-handled non-routable command from peer '%s'.", peer->p_hdr.info.pi_diamid);
    670                                         LOG_E("%s",buf);
    671                                         fd_hook_call(HOOK_MESSAGE_DROPPED, msg, NULL, buf, fd_msg_pmdl_get(msg));
     659                                        //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Received un-handled non-routable command from peer '%s'.", peer->p_hdr.info.pi_diamid );
    672660                                        CHECK_FCT_DO( fd_msg_free(msg), /* continue */);
    673661                                        msg = NULL;
     
    677665                /* At this point the message must have been fully handled already */
    678666                if (msg) {
    679                         char buf[256];
    680                         snprintf(buf, sizeof(buf), "Internal error ('%s'): unhandled message.", peer->p_hdr.info.pi_diamid);
    681                         LOG_E("%s",buf);
    682                         fd_hook_call(HOOK_MESSAGE_DROPPED, msg, NULL, buf, fd_msg_pmdl_get(msg));
     667                        //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Internal error ('%s'): unhandled message.", peer->p_hdr.info.pi_diamid );
    683668                        fd_msg_free(msg);
    684669                }
     
    747732                        char * buf = NULL;
    748733                        size_t len = 0;
    749                         LOG_D("New remote endpoint(s): %s",  fd_ep_dump(&buf, &len, NULL, 0, 0, &peer->p_hdr.info.pi_endpoints) ?: "error");
     734                        LOG_D("New remote endpoint(s): %s",  fd_ep_dump(&buf, &len, NULL, 6, &peer->p_hdr.info.pi_endpoints) ?: "error");
    750735                        free(buf);
    751736                }
  • libfdcore/p_sr.c

    r1113 r1110  
    119119        /* If the callback did not dispose of the message, do it now */
    120120        if (ed->request) {
    121                 fd_hook_call(HOOK_MESSAGE_DROPPED, ed->request, NULL, "Expiration period completed without an answer, and the expiry callback did not dispose of the message.", fd_msg_pmdl_get(ed->request));
     121                //fd_msg_log(FD_MSG_LOG_DROPPED, ed->request, "Expiration period completed without an answer, and the expiry callback did not dispose of the message.");
    122122                CHECK_FCT_DO( fd_msg_free(ed->request), /* ignore */ );
    123123        }
     
    323323                                hdr->msg_flags |= CMD_FLAG_RETRANSMIT;
    324324                       
    325                         fd_hook_call(HOOK_MESSAGE_FAILOVER, sr->req, (struct fd_peer *)srlist->srs.o, NULL, fd_msg_pmdl_get(sr->req));
    326                        
    327325                        /* Requeue for sending to another peer */
    328326                        CHECK_FCT_DO( ret = fd_fifo_post(fd_g_outgoing, &sr->req),
    329327                                {
    330                                         char buf[256];
    331                                         snprintf(buf, sizeof(buf), "Internal error: error while requeuing during failover: %s", strerror(ret));
    332                                         fd_hook_call(HOOK_MESSAGE_DROPPED, sr->req, NULL, buf, fd_msg_pmdl_get(sr->req));
     328                                        //fd_msg_log( FD_MSG_LOG_DROPPED, sr->req, "Internal error: error while requeuing during failover: %s", strerror(ret) );
    333329                                        CHECK_FCT_DO(fd_msg_free(sr->req), /* What can we do more? */)
    334330                                });
    335331                } else {
    336332                        /* Just free the request. */
    337                         /* fd_hook_call(HOOK_MESSAGE_DROPPED, sr->req, NULL, "Sent & unanswered local message discarded during failover.", fd_msg_pmdl_get(sr->req)); */
     333                        //fd_msg_log( FD_MSG_LOG_DROPPED, sr->req, "Sent & unanswered local message discarded during failover." );
    338334                        CHECK_FCT_DO(fd_msg_free(sr->req), /* Ignore */);
    339335                }
  • libfdcore/peers.c

    r1113 r1103  
    242242        /* Requeue all messages in the "out" queue */
    243243        while ( fd_fifo_tryget(peer->p_tosend, &m) == 0 ) {
    244                 fd_hook_call(HOOK_MESSAGE_FAILOVER, m, peer, NULL, fd_msg_pmdl_get(m));
    245244                CHECK_FCT_DO(fd_fifo_post(fd_g_outgoing, &m),
    246245                        {
    247246                                /* fallback: destroy the message */
    248                                 fd_hook_call(HOOK_MESSAGE_DROPPED, m, NULL, "Internal error: unable to requeue this message during failover process", fd_msg_pmdl_get(m));
     247                                //fd_msg_log(FD_MSG_LOG_DROPPED, m, "Internal error: unable to requeue this message during failover process");
    249248                                CHECK_FCT_DO(fd_msg_free(m), /* What can we do more? */)
    250249                        } );
  • libfdcore/queues.c

    r1113 r1078  
    7474               
    7575                /* We got one! */
    76                 fd_hook_call(HOOK_MESSAGE_DROPPED, msg, NULL, "Message lost because framework is terminating.", fd_msg_pmdl_get(msg));
     76                //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Message lost because framework is terminating." );
    7777                fd_msg_free(msg);
    7878        }
  • libfdcore/routing_dispatch.c

    r1113 r1103  
    393393
    394394                        if (!peer) {
    395                                 char buf[256];
    396                                 snprintf(buf, sizeof(buf), "Unable to send error '%s' to deleted peer '%s' in reply to this message.", error_code, id);
    397                                 fd_hook_call(HOOK_MESSAGE_DROPPED, *pmsg, NULL, buf, fd_msg_pmdl_get(*pmsg));
     395                                //fd_msg_log(FD_MSG_LOG_DROPPED, *pmsg, "Unable to send error '%s' to deleted peer '%s' in reply to this message.", error_code, id);
    398396                                fd_msg_free(*pmsg);
    399397                                *pmsg = NULL;
     
    498496
    499497        /* Now, call any callback registered for the message */
    500         CHECK_FCT( fd_msg_dispatch ( &msgptr, sess, &action, &ec, &em, &error) );
     498        CHECK_FCT( fd_msg_dispatch ( &msgptr, sess, &action, &ec) );
    501499
    502500        /* Now, act depending on msg and action and ec */
     
    507505                                if (!fd_g_config->cnf_flags.no_fwd) {
    508506                                        /* requeue to fd_g_outgoing */
    509                                         fd_hook_call(HOOK_MESSAGE_ROUTING_FORWARD, msgptr, NULL, NULL, fd_msg_pmdl_get(msgptr));
    510507                                        CHECK_FCT( fd_fifo_post(fd_g_outgoing, &msgptr) );
    511508                                        break;
     
    522519                               
    523520                                if (!is_req) {
    524                                         fd_hook_call(HOOK_MESSAGE_DROPPED, msgptr, NULL, "Internal error: Answer received to locally issued request, but not handled by any handler.", fd_msg_pmdl_get(msgptr));
     521                                        //fd_msg_log( FD_MSG_LOG_DROPPED, msgptr,  "Internal error: Answer received to locally issued request, but not handled by any handler.");
    525522                                        fd_msg_free(msgptr);
    526523                                        break;
     
    535532                                CHECK_FCT( fd_fifo_post(fd_g_outgoing, &msgptr) );
    536533                }
    537         } else if (em) {
    538                 fd_hook_call(HOOK_MESSAGE_DROPPED, error, NULL, em, fd_msg_pmdl_get(error));
    539                 fd_msg_free(error);
    540534        }
    541535       
     
    561555        /* Handle incorrect bits */
    562556        if (is_req && is_err) {
    563                 fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, "R & E bits were set", fd_msg_pmdl_get(msgptr));
    564557                CHECK_FCT( return_error( &msgptr, "DIAMETER_INVALID_HDR_BITS", "R & E bits were set", NULL) );
    565558                return 0;
     
    580573                /* Check if we have local support for the message application */
    581574                if ( (hdr->msg_appl == 0) || (hdr->msg_appl == AI_RELAY) ) {
    582                         fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, "Received a routable message with application id 0 or " _stringize(AI_RELAY) " (relay)", fd_msg_pmdl_get(msgptr));
     575                        TRACE_DEBUG(INFO, "Received a routable message with application id 0 or " _stringize(AI_RELAY) " (relay),"
     576                                          " returning DIAMETER_APPLICATION_UNSUPPORTED");
    583577                        CHECK_FCT( return_error( &msgptr, "DIAMETER_APPLICATION_UNSUPPORTED", "Routable message with application id 0 or relay", NULL) );
    584578                        return 0;
     
    607601                                                        {
    608602                                                                if (error_info.pei_errcode) {
    609                                                                         fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, error_info.pei_message ?: error_info.pei_errcode, fd_msg_pmdl_get(msgptr));
    610603                                                                        CHECK_FCT( return_error( &msgptr, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) );
    611604                                                                        return 0;
    612605                                                                } else {
    613                                                                         fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, "Unspecified error while parsing Destination-Host AVP", fd_msg_pmdl_get(msgptr));
    614606                                                                        return ret;
    615607                                                                }
     
    629621                                                        {
    630622                                                                if (error_info.pei_errcode) {
    631                                                                         fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, error_info.pei_message ?: error_info.pei_errcode, fd_msg_pmdl_get(msgptr));
    632623                                                                        CHECK_FCT( return_error( &msgptr, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) );
    633624                                                                        return 0;
    634625                                                                } else {
    635                                                                         fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, "Unspecified error while parsing Destination-Realm AVP", fd_msg_pmdl_get(msgptr));
    636626                                                                        return ret;
    637627                                                                }
     
    653643                                                        {
    654644                                                                if (error_info.pei_errcode) {
    655                                                                         fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, error_info.pei_message ?: error_info.pei_errcode, fd_msg_pmdl_get(msgptr));
    656645                                                                        CHECK_FCT( return_error( &msgptr, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) );
    657646                                                                        return 0;
    658647                                                                } else {
    659                                                                         fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, "Unspecified error while parsing User-Name AVP", fd_msg_pmdl_get(msgptr));
    660648                                                                        return ret;
    661649                                                                }
     
    680668                /* Handle the missing routing AVPs first */
    681669                if ( is_dest_realm == UNKNOWN ) {
    682                         fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, "Non-routable message not supported (invalid bit ? missing Destination-Realm ?)", fd_msg_pmdl_get(msgptr));
    683670                        CHECK_FCT( return_error( &msgptr, "DIAMETER_COMMAND_UNSUPPORTED", "Non-routable message not supported (invalid bit ? missing Destination-Realm ?)", NULL) );
    684671                        return 0;
     
    689676                        if (is_local_app == YES) {
    690677                                /* Ok, give the message to the dispatch thread */
    691                                 fd_hook_call(HOOK_MESSAGE_ROUTING_LOCAL, msgptr, NULL, NULL, fd_msg_pmdl_get(msgptr));
    692678                                CHECK_FCT( fd_fifo_post(fd_g_local, &msgptr) );
    693679                        } else {
    694680                                /* We don't support the application, reply an error */
    695                                 fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, "Application unsupported", fd_msg_pmdl_get(msgptr));
    696681                                CHECK_FCT( return_error( &msgptr, "DIAMETER_APPLICATION_UNSUPPORTED", NULL, NULL) );
    697682                        }
     
    702687                if ((is_dest_host == NO) || (is_dest_realm == NO)) {
    703688                        if (fd_g_config->cnf_flags.no_fwd) {
    704                                 fd_hook_call(HOOK_MESSAGE_ROUTING_ERROR, msgptr, NULL, "Message for another realm/host", fd_msg_pmdl_get(msgptr));
    705689                                CHECK_FCT( return_error( &msgptr, "DIAMETER_UNABLE_TO_DELIVER", "I am not a Diameter agent", NULL) );
    706690                                return 0;
     
    716700                                        {
    717701                                                /* If the process failed, we assume it is because of the AVP format */
    718                                                 fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, "Failed to process decorated NAI", fd_msg_pmdl_get(msgptr));
    719702                                                CHECK_FCT( return_error( &msgptr, "DIAMETER_INVALID_AVP_VALUE", "Failed to process decorated NAI", un) );
    720703                                                return 0;
     
    730713                        if (is_local_app == YES) {
    731714                                /* Handle localy since we are able to */
    732                                 fd_hook_call(HOOK_MESSAGE_ROUTING_LOCAL, msgptr, NULL, NULL, fd_msg_pmdl_get(msgptr));
    733715                                CHECK_FCT(fd_fifo_post(fd_g_local, &msgptr) );
    734716                                return 0;
     
    737719                        if (fd_g_config->cnf_flags.no_fwd) {
    738720                                /* We return an error */
    739                                 fd_hook_call(HOOK_MESSAGE_ROUTING_ERROR, msgptr, NULL, "Application unsupported", fd_msg_pmdl_get(msgptr));
    740721                                CHECK_FCT( return_error( &msgptr, "DIAMETER_APPLICATION_UNSUPPORTED", NULL, NULL) );
    741722                                return 0;
     
    755736                if ((!qry_src) && (!is_err)) {
    756737                        /* The message is a normal answer to a request issued localy, we do not call the callbacks chain on it. */
    757                         fd_hook_call(HOOK_MESSAGE_ROUTING_LOCAL, msgptr, NULL, NULL, fd_msg_pmdl_get(msgptr));
    758738                        CHECK_FCT(fd_fifo_post(fd_g_local, &msgptr) );
    759739                        return 0;
     
    784764                        CHECK_FCT_DO( ret = (*rh->rt_fwd_cb)(rh->cbdata, &msgptr),
    785765                                {
    786                                         char buf[256];
    787                                         snprintf(buf, sizeof(buf), "A FWD routing callback returned an error: %s", strerror(ret));
    788                                         fd_hook_call(HOOK_MESSAGE_ROUTING_ERROR, msgptr, NULL, buf, fd_msg_pmdl_get(msgptr));
    789                                         fd_hook_call(HOOK_MESSAGE_DROPPED, msgptr, NULL, buf, fd_msg_pmdl_get(msgptr));
     766                                        //fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "Internal error: a FWD routing callback returned an error (%s)", strerror(ret));
    790767                                        fd_msg_free(msgptr);
    791768                                        msgptr = NULL;
    792                                         break;
    793769                                } );
    794770                }
     
    804780        /* Now pass the message to the next step: either forward to another peer, or dispatch to local extensions */
    805781        if (is_req || qry_src) {
    806                 fd_hook_call(HOOK_MESSAGE_ROUTING_FORWARD, msgptr, NULL, NULL, fd_msg_pmdl_get(msgptr));
    807782                CHECK_FCT(fd_fifo_post(fd_g_outgoing, &msgptr) );
    808783        } else {
    809                 fd_hook_call(HOOK_MESSAGE_ROUTING_LOCAL, msgptr, NULL, NULL, fd_msg_pmdl_get(msgptr));
    810784                CHECK_FCT(fd_fifo_post(fd_g_local, &msgptr) );
    811785        }
     
    849823                CHECK_FCT( fd_peer_getbyid( qry_src, qry_src_len, 0, (void *) &peer ) );
    850824                if (fd_peer_getstate(peer) != STATE_OPEN) {
    851                         char buf[128];
    852                         snprintf(buf, sizeof(buf), "Unable to forward answer to deleted / closed peer '%s'.", qry_src);
    853                         fd_hook_call(HOOK_MESSAGE_ROUTING_ERROR, msgptr, NULL, buf, fd_msg_pmdl_get(msgptr));
    854                         fd_hook_call(HOOK_MESSAGE_DROPPED, msgptr, NULL, buf, fd_msg_pmdl_get(msgptr));
     825                        //fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "Unable to forward answer to deleted / closed peer '%s'.", qry_src);
    855826                        fd_msg_free(msgptr);
    856827                        return 0;
     
    937908                        CHECK_FCT_DO( ret = (*rh->rt_out_cb)(rh->cbdata, msgptr, candidates),
    938909                                {
    939                                         char buf[256];
    940                                         snprintf(buf, sizeof(buf), "An OUT routing callback returned an error: %s", strerror(ret));
    941                                         fd_hook_call(HOOK_MESSAGE_ROUTING_ERROR, msgptr, NULL, buf, fd_msg_pmdl_get(msgptr));
    942                                         fd_hook_call(HOOK_MESSAGE_DROPPED, msgptr, NULL, buf, fd_msg_pmdl_get(msgptr));
     910                                        //fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "Internal error: an OUT routing callback returned an error (%s)", strerror(ret));
    943911                                        fd_msg_free(msgptr);
    944912                                        msgptr = NULL;
     
    988956        /* If the message has not been sent, return an error */
    989957        if (msgptr) {
    990                 fd_hook_call(HOOK_MESSAGE_ROUTING_ERROR, msgptr, NULL, "No remaining suitable candidate to route the message to", fd_msg_pmdl_get(msgptr));
     958                //fd_msg_log( FD_MSG_LOG_NODELIVER, msgptr, "No suitable candidate to route the message to." );
    991959                return_error( &msgptr, "DIAMETER_UNABLE_TO_DELIVER", "No suitable candidate to route the message to", NULL);
    992960        }
  • libfdcore/server.c

    r1113 r1103  
    9494
    9595/* Dump all servers information */
    96 DECLARE_FD_DUMP_PROTOTYPE(fd_servers_dump, int details)
     96DECLARE_FD_DUMP_PROTOTYPE(fd_servers_dump)
    9797{
    9898        struct fd_list * li, *cli;
     
    104104                enum s_state st = get_status(s);
    105105               
    106                 if (details) {
    107                         CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{server}(@%p)'%s': %s, %s, %s", s, fd_cnx_getid(s->conn),
    108                                         IPPROTO_NAME( s->proto ),
    109                                         s->secur ? "Secur" : "NotSecur",
    110                                         (st == NOT_CREATED) ? "Thread not created" :
    111                                         ((st == RUNNING) ? "Thread running" :
    112                                         ((st == TERMINATED) ? "Thread terminated" :
    113                                                                   "Thread status unknown"))), return NULL);
    114                         /* Dump the client list of this server */
    115                         CHECK_POSIX_DO( pthread_mutex_lock(&s->clients_mtx), );
    116                         for (cli = s->clients.next; cli != &s->clients; cli = cli->next) {
    117                                 struct client * c = (struct client *)cli;
    118                                 char bufts[128];
    119                                 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "\n  {client}(@%p)'%s': to:%s", c, fd_cnx_getid(c->conn), fd_log_time(&c->ts, bufts, sizeof(bufts))), break);
    120                         }
    121                         CHECK_POSIX_DO( pthread_mutex_unlock(&s->clients_mtx), );
    122 
    123                         if (li->next != &FD_SERVERS) {
    124                                 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "\n"), return NULL);
    125                         }
    126                 } else {
    127                         CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "'%s'(%s,%s)  ", fd_cnx_getid(s->conn),
    128                                         IPPROTO_NAME( s->proto ), s->secur ? "Secur" : "NotSecur"), return NULL);
     106                CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{server}(@%p)'%s': %s, %s, %s", s, fd_cnx_getid(s->conn),
     107                                IPPROTO_NAME( s->proto ),
     108                                s->secur ? "Secur" : "NotSecur",
     109                                (st == NOT_CREATED) ? "Thread not created" :
     110                                ((st == RUNNING) ? "Thread running" :
     111                                ((st == TERMINATED) ? "Thread terminated" :
     112                                                          "Thread status unknown"))), return NULL);
     113                /* Dump the client list of this server */
     114                CHECK_POSIX_DO( pthread_mutex_lock(&s->clients_mtx), );
     115                for (cli = s->clients.next; cli != &s->clients; cli = cli->next) {
     116                        struct client * c = (struct client *)cli;
     117                        char bufts[128];
     118                        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "\n  {client}(@%p)'%s': to:%s", c, fd_cnx_getid(c->conn), fd_log_time(&c->ts, bufts, sizeof(bufts))), break);
     119                }
     120                CHECK_POSIX_DO( pthread_mutex_unlock(&s->clients_mtx), );
     121               
     122                if (li->next != &FD_SERVERS) {
     123                        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "\n"), return NULL);
    129124                }
    130125        }
     
    451446                size_t len = 0, offset = 0;
    452447                CHECK_MALLOC_DO( fd_dump_extend( &buf, &len, &offset , "Local server address(es): "), );
    453                 CHECK_MALLOC_DO( fd_ep_dump(  &buf, &len, &offset, 0, 0, &fd_g_config->cnf_endpoints ), );
     448                CHECK_MALLOC_DO( fd_ep_dump(  &buf, &len, &offset, 5, &fd_g_config->cnf_endpoints ), );
    454449                LOG_N("%s", buf ?: "Error dumping addresses");
    455450                free(buf);
  • libfdproto/dispatch.c

    r1113 r1078  
    6868/* Call CBs from a given list (any_handlers if cb_list is NULL) -- must have locked fd_disp_lock before */
    6969int fd_disp_call_cb_int( struct fd_list * cb_list, struct msg ** msg, struct avp *avp, struct session *sess, enum disp_action *action,
    70                         struct dict_object * obj_app, struct dict_object * obj_cmd, struct dict_object * obj_avp, struct dict_object * obj_enu,
    71                         char ** drop_reason, struct msg ** drop_msg)
     70                        struct dict_object * obj_app, struct dict_object * obj_cmd, struct dict_object * obj_avp, struct dict_object * obj_enu)
    7271{
    7372        struct fd_list * senti, *li;
     
    9897                CHECK_FCT_DO( (r = (*hdl->cb)(msg, avp, sess, hdl->opaque, action)),
    9998                        {
    100                                 *drop_reason = "Internal error: a DISPATCH callback returned an error";
    101                                 *drop_msg = *msg;
     99                                //fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Internal error: a DISPATCH callback returned an error (%s)", strerror(r));
     100                                fd_msg_free(*msg);
    102101                                *msg = NULL;
    103102                        }
  • libfdproto/fdproto-internal.h

    r1113 r1088  
    5555DECLARE_FD_DUMP_PROTOTYPE(fd_dict_dump_avp_value, union avp_value *avp_value, struct dict_object * model, int indent, int header);
    5656int fd_disp_call_cb_int( struct fd_list * cb_list, struct msg ** msg, struct avp *avp, struct session *sess, enum disp_action *action,
    57                         struct dict_object * obj_app, struct dict_object * obj_cmd, struct dict_object * obj_avp, struct dict_object * obj_enu,
    58                         char ** drop_reason, struct msg ** drop_msg);
     57                        struct dict_object * obj_app, struct dict_object * obj_cmd, struct dict_object * obj_avp, struct dict_object * obj_enu);
    5958extern pthread_rwlock_t fd_disp_lock;
    6059
  • libfdproto/messages.c

    r1113 r1103  
    26702670
    26712671/* Call all dispatch callbacks for a given message */
    2672 int fd_msg_dispatch ( struct msg ** msg, struct session * session, enum disp_action *action, char ** error_code, char ** drop_reason, struct msg ** drop_msg)
     2672int fd_msg_dispatch ( struct msg ** msg, struct session * session, enum disp_action *action, char ** error_code)
    26732673{
    26742674        struct dictionary  * dict;
     
    26842684        if (error_code)
    26852685                *error_code = NULL;
    2686         if (drop_reason)
    2687                 *drop_reason = NULL;
    26882686        *action = DISP_ACT_CONT;
    26892687       
     
    26932691       
    26942692        /* First, call the DISP_HOW_ANY callbacks */
    2695         CHECK_FCT_DO( ret = fd_disp_call_cb_int( NULL, msg, NULL, session, action, NULL, NULL, NULL, NULL, drop_reason, drop_msg ), goto out );
     2693        CHECK_FCT_DO( ret = fd_disp_call_cb_int( NULL, msg, NULL, session, action, NULL, NULL, NULL, NULL ), goto out );
    26962694
    26972695        TEST_ACTION_STOP();
     
    27102708                        *action = DISP_ACT_ERROR;
    27112709                } else {
    2712                         *drop_reason = "Internal error: Received this answer to a local query with an unsupported application";
    2713                         *drop_msg = *msg;
     2710                        //fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Internal error: Received this answer to a local query with an unsupported application %d", (*msg)->msg_public.msg_appl);
     2711                        fd_msg_free(*msg);
    27142712                        *msg = NULL;
    27152713                }
     
    27422740                       
    27432741                        /* Call the callbacks */
    2744                         CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, avp, session, action, app, cmd, avp->avp_model, enumval, drop_reason, drop_msg ), goto out );
     2742                        CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, avp, session, action, app, cmd, avp->avp_model, enumval ), goto out );
    27452743                        TEST_ACTION_STOP();
    27462744                }
     
    27512749        /* Now call command and application callbacks */
    27522750        CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_COMMAND, cmd, &cb_list), goto out );
    2753         CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL, drop_reason, drop_msg ), goto out );
     2751        CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), goto out );
    27542752        TEST_ACTION_STOP();
    27552753       
    27562754        if (app) {
    27572755                CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_APPLICATION, app, &cb_list), goto out );
    2758                 CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL, drop_reason, drop_msg ), goto out );
     2756                CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), goto out );
    27592757                TEST_ACTION_STOP();
    27602758        }
  • tests/testdisp.c

    r1113 r1088  
    106106        struct dict_object * avp1, * avp2; /* avp2 is enumerated; they are both unsigned32 types */
    107107        struct dict_object * enu1, * enu2;
    108         struct msg * msg = NULL, *error;
     108        struct msg * msg = NULL;
    109109        enum disp_action action;
    110110        struct disp_hdl * hdl[NB_CB];
    111111        struct disp_when when;
    112         char * ec, *em;
     112        char * ec;
    113113       
    114114        /* First, initialize the daemon modules */
     
    156156                msg = new_msg( 0, cmd1, avp1, NULL, 0 );
    157157                memset(cbcalled, 0, sizeof(cbcalled));
    158                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     158                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    159159                CHECK( 1, cbcalled[0] );
    160160                CHECK( DISP_ACT_CONT, action );
     
    180180                memset(cbcalled, 0, sizeof(cbcalled));
    181181                msg = new_msg( 0, cmd1, avp1, NULL, 0 );
    182                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     182                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    183183                CHECK( 1, cbcalled[0] );
    184184                CHECK( 0, cbcalled[1] );
     
    191191                memset(cbcalled, 0, sizeof(cbcalled));
    192192                msg = new_msg( 1, cmd1, avp1, NULL, 0 );
    193                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     193                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    194194                CHECK( 1, cbcalled[0] );
    195195                CHECK( 1, cbcalled[1] );
     
    202202                memset(cbcalled, 0, sizeof(cbcalled));
    203203                msg = new_msg( 2, cmd1, avp1, NULL, 0 );
    204                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     204                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    205205                CHECK( 1, cbcalled[0] );
    206206                CHECK( 0, cbcalled[1] );
     
    236236                memset(cbcalled, 0, sizeof(cbcalled));
    237237                msg = new_msg( 0, cmd1, avp1, NULL, 0 );
    238                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     238                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    239239                CHECK( 1, cbcalled[0] );
    240240                CHECK( 1, cbcalled[1] );
     
    246246                memset(cbcalled, 0, sizeof(cbcalled));
    247247                msg = new_msg( 2, cmd1, avp1, NULL, 0 );
    248                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     248                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    249249                CHECK( 1, cbcalled[0] );
    250250                CHECK( 1, cbcalled[1] );
     
    256256                memset(cbcalled, 0, sizeof(cbcalled));
    257257                msg = new_msg( 2, cmd2, avp1, NULL, 0 );
    258                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     258                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    259259                CHECK( 1, cbcalled[0] );
    260260                CHECK( 0, cbcalled[1] );
     
    266266                memset(cbcalled, 0, sizeof(cbcalled));
    267267                msg = new_msg( 1, cmd2, NULL, avp2, 0 );
    268                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     268                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    269269                CHECK( 1, cbcalled[0] );
    270270                CHECK( 0, cbcalled[1] );
     
    316316                memset(cbcalled, 0, sizeof(cbcalled));
    317317                msg = new_msg( 0, cmd1, NULL, NULL, 0 );
    318                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     318                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    319319                CHECK( 1, cbcalled[0] );
    320320                CHECK( 0, cbcalled[1] );
     
    328328                memset(cbcalled, 0, sizeof(cbcalled));
    329329                msg = new_msg( 0, cmd1, avp1, NULL, 0 );
    330                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     330                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    331331                CHECK( 1, cbcalled[0] );
    332332                CHECK( 1, cbcalled[1] );
     
    340340                memset(cbcalled, 0, sizeof(cbcalled));
    341341                msg = new_msg( 1, cmd2, avp1, NULL, 0 );
    342                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     342                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    343343                CHECK( 1, cbcalled[0] );
    344344                CHECK( 1, cbcalled[1] );
     
    352352                memset(cbcalled, 0, sizeof(cbcalled));
    353353                msg = new_msg( 1, cmd1, avp1, NULL, 0 );
    354                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     354                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    355355                CHECK( 1, cbcalled[0] );
    356356                CHECK( 1, cbcalled[1] );
     
    364364                memset(cbcalled, 0, sizeof(cbcalled));
    365365                msg = new_msg( 1, cmd1, avp1, avp2, 0 );
    366                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     366                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    367367                CHECK( 1, cbcalled[0] );
    368368                CHECK( 1, cbcalled[1] );
     
    377377                memset(cbcalled, 0, sizeof(cbcalled));
    378378                msg = new_msg( 1, cmd1, NULL, avp2, 1 );
    379                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     379                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    380380                CHECK( 1, cbcalled[0] );
    381381                CHECK( 0, cbcalled[1] );
     
    390390                memset(cbcalled, 0, sizeof(cbcalled));
    391391                msg = new_msg( 1, cmd1, NULL, avp2, 2 );
    392                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     392                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    393393                CHECK( 1, cbcalled[0] );
    394394                CHECK( 0, cbcalled[1] );
     
    437437                memset(cbcalled, 0, sizeof(cbcalled));
    438438                msg = new_msg( 0, cmd1, avp1, NULL, 0 );
    439                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     439                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    440440                CHECK( 1, cbcalled[0] );
    441441                CHECK( 0, cbcalled[1] );
     
    447447                memset(cbcalled, 0, sizeof(cbcalled));
    448448                msg = new_msg( 1, cmd2, avp1, avp2, 0 );
    449                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     449                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    450450                CHECK( 1, cbcalled[0] );
    451451                CHECK( 0, cbcalled[1] );
     
    457457                memset(cbcalled, 0, sizeof(cbcalled));
    458458                msg = new_msg( 1, cmd2, avp1, avp2, 1 );
    459                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     459                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    460460                CHECK( 1, cbcalled[0] );
    461461                CHECK( 1, cbcalled[1] );
     
    467467                memset(cbcalled, 0, sizeof(cbcalled));
    468468                msg = new_msg( 1, cmd2, avp1, avp2, 2 );
    469                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     469                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    470470                CHECK( 1, cbcalled[0] );
    471471                CHECK( 0, cbcalled[1] );
     
    477477                memset(cbcalled, 0, sizeof(cbcalled));
    478478                msg = new_msg( 1, cmd1, avp1, avp2, 1 );
    479                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     479                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    480480                CHECK( 1, cbcalled[0] );
    481481                CHECK( 1, cbcalled[1] );
     
    495495                        CHECK( 0, fd_msg_avp_add ( msg, MSG_BRW_LAST_CHILD, avp ) );
    496496                }
    497                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     497                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    498498                CHECK( 1, cbcalled[0] );
    499499                CHECK( 1, cbcalled[1] );
     
    519519                memset(cbcalled, 0, sizeof(cbcalled));
    520520                msg = new_msg( 1, cmd1, avp1, avp2, 1 );
    521                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     521                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    522522                CHECK( 1, cbcalled[0] );
    523523                CHECK( 1, cbcalled[1] );
     
    526526                CHECK( 0, cbcalled[3] );
    527527                CHECK( 0, msg ? 1 : 0);
    528                 CHECK( 1, ec ? 1 : 0);
    529                 CHECK( 0, fd_msg_free( error ) );
    530528               
    531529                CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) );
     
    543541                memset(cbcalled, 0, sizeof(cbcalled));
    544542                msg = new_msg( 1, cmd1, avp1, avp2, 1 );
    545                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     543                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    546544                CHECK( 1, cbcalled[0] );
    547545                CHECK( 1, cbcalled[1] );
     
    550548                CHECK( 0, cbcalled[3] );
    551549                CHECK( NULL, msg );
    552                 CHECK( NULL, ec );
    553550               
    554551                CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) );
     
    566563                memset(cbcalled, 0, sizeof(cbcalled));
    567564                msg = new_msg( 1, cmd1, avp1, avp2, 1 );
    568                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     565                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    569566                CHECK( 1, cbcalled[0] );
    570567                CHECK( 1, cbcalled[1] );
     
    597594                memset(cbcalled, 0, sizeof(cbcalled));
    598595                msg = new_msg( 2, cmd2, avp1, avp2, 2 );
    599                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     596                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    600597                CHECK( 1, cbcalled[0] );
    601598                CHECK( 1, cbcalled[1] );
     
    609606                memset(cbcalled, 0, sizeof(cbcalled));
    610607                msg = new_msg( 2, cmd2, avp1, avp2, 2 );
    611                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     608                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    612609                CHECK( 1, cbcalled[0] );
    613610                CHECK( 0, cbcalled[1] );
     
    622619                memset(cbcalled, 0, sizeof(cbcalled));
    623620                msg = new_msg( 2, cmd2, avp1, avp2, 2 );
    624                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     621                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    625622                CHECK( 1, cbcalled[0] );
    626623                CHECK( 1, cbcalled[1] );
     
    635632                memset(cbcalled, 0, sizeof(cbcalled));
    636633                msg = new_msg( 2, cmd2, avp1, avp2, 2 );
    637                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     634                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    638635                CHECK( 1, cbcalled[0] );
    639636                CHECK( 1, cbcalled[1] );
     
    648645                memset(cbcalled, 0, sizeof(cbcalled));
    649646                msg = new_msg( 2, cmd2, avp1, avp2, 2 );
    650                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     647                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    651648                CHECK( 1, cbcalled[0] );
    652649                CHECK( 1, cbcalled[1] );
     
    661658                memset(cbcalled, 0, sizeof(cbcalled));
    662659                msg = new_msg( 2, cmd2, avp1, avp2, 2 );
    663                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     660                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    664661                CHECK( 1, cbcalled[0] );
    665662                CHECK( 1, cbcalled[1] );
     
    714711                msg = new_msg( 0, cmd1, avp1, NULL, 0 );
    715712                memset(cbcalled, 0, sizeof(cbcalled));
    716                 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
     713                CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
    717714                CHECK( 1, cbcalled[0] );
    718715                CHECK( DISP_ACT_CONT, action );
Note: See TracChangeset for help on using the changeset viewer.