Navigation


Changeset 1113:eb4ce68b6e5c in freeDiameter for libfdcore/messages.c


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/messages.c

    r1103 r1113  
    314314}
    315315
     316static 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;
     321       
     322        /* Save the callback in the message, with the timeout */
     323        CHECK_FCT(  fd_msg_anscb_associate( *pmsg, anscb, data, expirecb, timeout )  );
     324       
     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               
     333        /* Post the message in the outgoing queue */
     334        CHECK_FCT( fd_fifo_post(fd_g_outgoing, pmsg) );
     335       
     336        return 0;
     337}
     338
    316339/* Send a message and optionaly register a callback for an answer */
    317340int fd_msg_send ( struct msg ** pmsg, void (*anscb)(void *, struct msg **), void * data )
     
    320343        CHECK_PARAMS( pmsg );
    321344       
    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;
     345        return fd_msg_send_int(pmsg, anscb, data, NULL, NULL);
    329346}
    330347
     
    335352        CHECK_PARAMS( pmsg && expirecb && timeout );
    336353       
    337         /* Save the callback in the message, with the timeout */
    338         CHECK_FCT(  fd_msg_anscb_associate( *pmsg, anscb, data, expirecb, timeout )  );
    339        
    340         /* Post the message in the outgoing queue */
    341         CHECK_FCT( fd_fifo_post(fd_g_outgoing, pmsg) );
    342        
    343         return 0;
     354        return fd_msg_send_int(pmsg, anscb, data, expirecb, timeout);
    344355}
    345356
Note: See TracChangeset for help on using the changeset viewer.