Navigation


Changeset 639:95a784729cac in freeDiameter for include


Ignore:
Timestamp:
Dec 20, 2010, 1:07:06 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Added new opaque pointer to fd_sess_handler_create and fd_disp_register for usability. Bumped API version number.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/libfreeDiameter.h

    r638 r639  
    15591559 *  handler     : location where the new handler must be stored.
    15601560 *  cleanup     : a callback function that must be called when the session with associated data is destroyed.
     1561 *  opaque      : A pointer that is passed to the cleanup callback -- the content is never examined by the framework.
    15611562 *
    15621563 * DESCRIPTION:
     
    15701571 *  ENOMEM      : Not enough memory to complete the operation
    15711572 */
    1572 int fd_sess_handler_create_internal ( struct session_handler ** handler, void (*cleanup)(session_state * state, char * sid) );
     1573int fd_sess_handler_create_internal ( struct session_handler ** handler, void (*cleanup)(session_state * state, char * sid, void * opaque), void * opaque );
    15731574/* Macro to avoid casting everywhere */
    1574 #define fd_sess_handler_create( _handler, _cleanup ) \
    1575         fd_sess_handler_create_internal( (_handler), (void (*)(session_state *, char *))(_cleanup) )
     1575#define fd_sess_handler_create( _handler, _cleanup, _opaque ) \
     1576        fd_sess_handler_create_internal( (_handler), (void (*)(session_state *, char *, void *))(_cleanup), (void *)(_opaque) )
    15761577
    15771578       
     
    15811582 * PARAMETERS:
    15821583 *  handler     : location of an handler created by fd_sess_handler_create.
     1584 *  opaque      : the opaque pointer registered with the callback is restored here (if ! NULL).
    15831585 *
    15841586 * DESCRIPTION:
     
    15911593 *  ENOMEM      : Not enough memory to complete the operation
    15921594 */
    1593 int fd_sess_handler_destroy ( struct session_handler ** handler );
     1595int fd_sess_handler_destroy ( struct session_handler ** handler, void **opaque );
    15941596
    15951597
     
    25262528 *  avp         : for callbacks registered with DISP_HOW_AVP or DISP_HOW_AVP_ENUMVAL, direct link to the triggering AVP.
    25272529 *  session     : if the message contains a Session-Id AVP, the corresponding session object, NULL otherwise.
     2530 *  opaque      : An opaque pointer that is registered along the session handler.
    25282531 *  action      : upon return, this tells the daemon what to do next.
    25292532 *
     
    25572560 *  how           : How the callback must be registered.
    25582561 *  when          : Values that must match, depending on the how argument.
     2562 *  opaque        : A pointer that is passed back to the handler. The content is not interpreted by the framework.
    25592563 *  handle        : On success, a handler to the registered callback is stored here if not NULL.
    25602564 *                 This handler can be used to unregister the cb.
     
    25682572 *  ENOMEM      : Not enough memory to complete the operation
    25692573 */
    2570 int fd_disp_register ( int (*cb)( struct msg **, struct avp *, struct session *, enum disp_action *),
    2571                         enum disp_how how, struct disp_when * when, struct disp_hdl ** handle );
     2574int fd_disp_register ( int (*cb)( struct msg **, struct avp *, struct session *, void *, enum disp_action *),
     2575                        enum disp_how how, struct disp_when * when, void * opaque, struct disp_hdl ** handle );
    25722576
    25732577/*
     
    25762580 * PARAMETERS:
    25772581 *  handle       : Location of the handle of the callback that must be unregistered.
     2582 *  opaque       : If not NULL, the opaque data that was registered is restored here.
    25782583 *
    25792584 * DESCRIPTION:
     
    25842589 *  EINVAL      : A parameter is invalid.
    25852590 */
    2586 int fd_disp_unregister ( struct disp_hdl ** handle );
     2591int fd_disp_unregister ( struct disp_hdl ** handle, void ** opaque );
    25872592
    25882593/* Destroy all handlers */
Note: See TracChangeset for help on using the changeset viewer.