Navigation


Changeset 1113:eb4ce68b6e5c in freeDiameter for libfdproto


Ignore:
Timestamp:
May 13, 2013, 8:17:13 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Added calls to remaining hooks

Location:
libfdproto
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/dispatch.c

    r1078 r1113  
    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)
     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)
    7172{
    7273        struct fd_list * senti, *li;
     
    9798                CHECK_FCT_DO( (r = (*hdl->cb)(msg, avp, sess, hdl->opaque, action)),
    9899                        {
    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);
     100                                *drop_reason = "Internal error: a DISPATCH callback returned an error";
     101                                *drop_msg = *msg;
    101102                                *msg = NULL;
    102103                        }
  • libfdproto/fdproto-internal.h

    r1088 r1113  
    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);
     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);
    5859extern pthread_rwlock_t fd_disp_lock;
    5960
  • libfdproto/messages.c

    r1103 r1113  
    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)
     2672int fd_msg_dispatch ( struct msg ** msg, struct session * session, enum disp_action *action, char ** error_code, char ** drop_reason, struct msg ** drop_msg)
    26732673{
    26742674        struct dictionary  * dict;
     
    26842684        if (error_code)
    26852685                *error_code = NULL;
     2686        if (drop_reason)
     2687                *drop_reason = NULL;
    26862688        *action = DISP_ACT_CONT;
    26872689       
     
    26912693       
    26922694        /* First, call the DISP_HOW_ANY callbacks */
    2693         CHECK_FCT_DO( ret = fd_disp_call_cb_int( NULL, msg, NULL, session, action, NULL, NULL, NULL, NULL ), goto out );
     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 );
    26942696
    26952697        TEST_ACTION_STOP();
     
    27082710                        *action = DISP_ACT_ERROR;
    27092711                } else {
    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);
     2712                        *drop_reason = "Internal error: Received this answer to a local query with an unsupported application";
     2713                        *drop_msg = *msg;
    27122714                        *msg = NULL;
    27132715                }
     
    27402742                       
    27412743                        /* Call the callbacks */
    2742                         CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, avp, session, action, app, cmd, avp->avp_model, enumval ), goto out );
     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 );
    27432745                        TEST_ACTION_STOP();
    27442746                }
     
    27492751        /* Now call command and application callbacks */
    27502752        CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_COMMAND, cmd, &cb_list), goto out );
    2751         CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), 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 );
    27522754        TEST_ACTION_STOP();
    27532755       
    27542756        if (app) {
    27552757                CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_APPLICATION, app, &cb_list), goto out );
    2756                 CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), 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 );
    27572759                TEST_ACTION_STOP();
    27582760        }
Note: See TracChangeset for help on using the changeset viewer.