Changeset 639:95a784729cac in freeDiameter
- Timestamp:
- Dec 20, 2010, 1:07:06 PM (13 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
CMakeLists.txt
r633 r639 15 15 16 16 # Version of the API with the library 17 SET(FD_PROJECT_VERSION_API 1)17 SET(FD_PROJECT_VERSION_API 2) 18 18 19 19 # The test framework, using CTest and CDash. -
contrib/debian/changelog
r629 r639 1 1 freediameter (1.0.3) UNRELEASED; urgency=low 2 2 3 * Added parameters to fd_disp_register and fd_sess_handler_create, 4 Bumped API version number accordingly. 3 5 * Fixed a couple of issues for portability (#21, #22, #23) 4 6 * Fixed issue with ListenOn bit ordering (#20) -
doc/dbg_interactive.py.sample
r638 r639 622 622 np.add() 623 623 624 # It is possible to specify a callback for when the connection completes or fails tothis peer.624 # It is possible to specify a callback for when the connection completes or fails with this peer. 625 625 # The prototype is as follow: 626 626 def add_cb(peer): -
extensions/app_acct/app_acct.c
r403 r639 46 46 47 47 /* Callback for incoming Base Accounting Accounting-Request messages */ 48 static int acct_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)48 static int acct_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act) 49 49 { 50 50 struct msg * m; … … 135 135 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_APPLICATION, APPLICATION_BY_NAME, "Diameter Base Accounting", &data.app, ENOENT) ); 136 136 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Accounting-Request", &data.command, ENOENT) ); 137 CHECK_FCT( fd_disp_register( acct_cb, DISP_HOW_CC, &data, NULL ) );137 CHECK_FCT( fd_disp_register( acct_cb, DISP_HOW_CC, &data, NULL, NULL ) ); 138 138 139 139 /* Advertise the support for the Diameter Base Accounting application in the peer */ -
extensions/app_diameap/diameap_server.c
r610 r639 85 85 86 86 87 void diameap_cli_sess_cleanup(void * arg, char * sid )87 void diameap_cli_sess_cleanup(void * arg, char * sid, void * opaque) 88 88 { 89 89 … … 3060 3060 3061 3061 static int diameap_server_callback(struct msg ** rmsg, struct avp * ravp, 3062 struct session * sess, enum disp_action * action)3062 struct session * sess, void * opaque, enum disp_action * action) 3063 3063 { 3064 3064 TRACE_ENTRY("%p %p %p %p", rmsg, ravp, sess, action); … … 3389 3389 3390 3390 /*create handler for sessions */ 3391 CHECK_FCT(fd_sess_handler_create(&diameap_server_reg, diameap_cli_sess_cleanup ));3391 CHECK_FCT(fd_sess_handler_create(&diameap_server_reg, diameap_cli_sess_cleanup, NULL)); 3392 3392 3393 3393 /* Register the callback */ … … 3397 3397 3398 3398 /* Register the callback for EAP Application */ 3399 CHECK_FCT(fd_disp_register(diameap_server_callback, DISP_HOW_CC, &when, 3399 CHECK_FCT(fd_disp_register(diameap_server_callback, DISP_HOW_CC, &when, NULL, 3400 3400 &handle)); 3401 3401 … … 3410 3410 int diameap_stop_server(void) 3411 3411 { 3412 CHECK_FCT(fd_sess_handler_destroy(&diameap_server_reg ));3413 CHECK_FCT(fd_disp_unregister(&handle ));3412 CHECK_FCT(fd_sess_handler_destroy(&diameap_server_reg, NULL)); 3413 CHECK_FCT(fd_disp_unregister(&handle, NULL)); 3414 3414 3415 3415 return 0; -
extensions/app_radgw/rgwx_acct.c
r564 r639 173 173 memset(new, 0, sizeof(struct rgwp_config)); 174 174 175 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free ) );175 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free, NULL ) ); 176 176 new->confstr = conffile; 177 177 … … 284 284 TRACE_ENTRY("%p", state); 285 285 CHECK_PARAMS_DO( state, return ); 286 CHECK_FCT_DO( fd_sess_handler_destroy( &state->sess_hdl ), );286 CHECK_FCT_DO( fd_sess_handler_destroy( &state->sess_hdl, NULL ), ); 287 287 free(state); 288 288 return; -
extensions/app_radgw/rgwx_auth.c
r532 r639 139 139 memset(new, 0, sizeof(struct rgwp_config)); 140 140 141 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free ) );141 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free, NULL ) ); 142 142 new->confstr = confstr; 143 143 … … 225 225 TRACE_ENTRY("%p", state); 226 226 CHECK_PARAMS_DO( state, return ); 227 CHECK_FCT_DO( fd_sess_handler_destroy( &state->sess_hdl ), );227 CHECK_FCT_DO( fd_sess_handler_destroy( &state->sess_hdl, NULL ), ); 228 228 free(state); 229 229 return; -
extensions/app_radgw/rgwx_echodrop.c
r403 r639 39 39 40 40 /* If a session is destroyed, empty the list of ed_saved_attribute */ 41 static void state_delete(void * arg, char * sid ) {41 static void state_delete(void * arg, char * sid, void * opaque) { 42 42 struct fd_list * list = (struct fd_list *)arg; 43 43 … … 69 69 70 70 /* Create the session handler */ 71 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, state_delete ) );71 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, state_delete, NULL ) ); 72 72 73 73 /* Parse the configuration file */ … … 107 107 TRACE_ENTRY("%p", state); 108 108 CHECK_PARAMS_DO( state, return ); 109 CHECK_FCT_DO( fd_sess_handler_destroy( &state->sess_hdl ), );109 CHECK_FCT_DO( fd_sess_handler_destroy( &state->sess_hdl, NULL ), ); 110 110 while (! FD_IS_LIST_EMPTY(&state->attributes) ) { 111 111 struct fd_list * li = state->attributes.next; -
extensions/app_radgw/rgwx_sip.c
r584 r639 262 262 memset(new, 0, sizeof(struct rgwp_config)); 263 263 264 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free ) );264 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free, NULL ) ); 265 265 new->confstr = conffile; 266 266 … … 316 316 CHECK_PARAMS_DO( state, return ); 317 317 318 CHECK_FCT_DO( fd_sess_handler_destroy( &state->sess_hdl ), );318 CHECK_FCT_DO( fd_sess_handler_destroy( &state->sess_hdl, NULL ), ); 319 319 320 320 nonce_deletelistnonce(state); -
extensions/app_sip/app_sip.c
r433 r639 59 59 struct app_sip_dict sip_dict; 60 60 61 int app_sip_default_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)62 { 63 TRACE_ENTRY("%p %p %p %p ", msg, avp, sess, act);61 int app_sip_default_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act) 62 { 63 TRACE_ENTRY("%p %p %p %p %p", msg, avp, sess, opaque, act); 64 64 65 65 return 0; … … 179 179 if(as_conf->mode==1) 180 180 { 181 // **Command Codes181 // **Command Codes 182 182 //MAR 183 183 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Multimedia-Auth-Request", &data.command, ENOENT) ); 184 CHECK_FCT( fd_disp_register( app_sip_MAR_cb, DISP_HOW_CC, &data, &app_sip_MAR_hdl ) );184 CHECK_FCT( fd_disp_register( app_sip_MAR_cb, DISP_HOW_CC, &data, NULL, &app_sip_MAR_hdl ) ); 185 185 //RTA 186 186 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Registration-Termination-Answer", &data.command, ENOENT) ); 187 CHECK_FCT( fd_disp_register( app_sip_RTA_cb, DISP_HOW_CC, &data, &app_sip_RTA_hdl ) );187 CHECK_FCT( fd_disp_register( app_sip_RTA_cb, DISP_HOW_CC, &data, NULL, &app_sip_RTA_hdl ) ); 188 188 //PPA 189 189 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Push-Profile-Answer", &data.command, ENOENT) ); 190 CHECK_FCT( fd_disp_register( app_sip_PPA_cb, DISP_HOW_CC, &data, &app_sip_PPA_hdl ) );190 CHECK_FCT( fd_disp_register( app_sip_PPA_cb, DISP_HOW_CC, &data, NULL, &app_sip_PPA_hdl ) ); 191 191 //LIR 192 192 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Location-Info-Request", &data.command, ENOENT) ); 193 CHECK_FCT( fd_disp_register( app_sip_LIR_cb, DISP_HOW_CC, &data, &app_sip_LIR_hdl ) );193 CHECK_FCT( fd_disp_register( app_sip_LIR_cb, DISP_HOW_CC, &data, NULL, &app_sip_LIR_hdl ) ); 194 194 //UAR 195 195 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "User-Authorization-Request", &data.command, ENOENT) ); 196 CHECK_FCT( fd_disp_register( app_sip_UAR_cb, DISP_HOW_CC, &data, &app_sip_UAR_hdl ) );196 CHECK_FCT( fd_disp_register( app_sip_UAR_cb, DISP_HOW_CC, &data, NULL, &app_sip_UAR_hdl ) ); 197 197 //SAR 198 198 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Server-Assignment-Request", &data.command, ENOENT) ); 199 CHECK_FCT( fd_disp_register( app_sip_SAR_cb, DISP_HOW_CC, &data, &app_sip_SAR_hdl ) );199 CHECK_FCT( fd_disp_register( app_sip_SAR_cb, DISP_HOW_CC, &data, NULL, &app_sip_SAR_hdl ) ); 200 200 } 201 201 if(as_conf->mode==2) … … 203 203 //LIR 204 204 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Location-Info-Request", &data.command, ENOENT) ); 205 CHECK_FCT( fd_disp_register( app_sip_SL_LIR_cb, DISP_HOW_CC, &data, &app_sip_SL_LIR_hdl ) );205 CHECK_FCT( fd_disp_register( app_sip_SL_LIR_cb, DISP_HOW_CC, &data, NULL, &app_sip_SL_LIR_hdl ) ); 206 206 } 207 207 //Callback for unexpected messages 208 CHECK_FCT( fd_disp_register( app_sip_default_cb, DISP_HOW_APPID, &data, &app_sip_default_hdl ) );208 CHECK_FCT( fd_disp_register( app_sip_default_cb, DISP_HOW_APPID, &data, NULL, &app_sip_default_hdl ) ); 209 209 210 210 … … 213 213 return EINVAL; 214 214 215 CHECK_FCT(fd_sess_handler_create(&ds_sess_hdl, free ));215 CHECK_FCT(fd_sess_handler_create(&ds_sess_hdl, free, NULL)); 216 216 217 217 //Creation of thread for Registration Termination … … 237 237 //TODO:unregister other callbacks 238 238 239 (void) fd_disp_unregister(&app_sip_MAR_hdl );240 CHECK_FCT_DO( fd_sess_handler_destroy(&ds_sess_hdl ),return);239 (void) fd_disp_unregister(&app_sip_MAR_hdl, NULL); 240 CHECK_FCT_DO( fd_sess_handler_destroy(&ds_sess_hdl, NULL),return); 241 241 242 242 -
extensions/app_sip/app_sip.h
r468 r639 140 140 int ds_entry(); 141 141 void fd_ext_fini(void); 142 int app_sip_default_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);143 int app_sip_MAR_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);144 int app_sip_RTA_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);145 int app_sip_PPA_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);146 int app_sip_LIR_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);147 int app_sip_UAR_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);148 int app_sip_SAR_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);142 int app_sip_default_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); 143 int app_sip_MAR_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); 144 int app_sip_RTA_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); 145 int app_sip_PPA_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); 146 int app_sip_LIR_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); 147 int app_sip_UAR_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); 148 int app_sip_SAR_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); 149 149 150 150 //Suscriber Locator 151 int app_sip_SL_LIR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act);152 //int app_sip_SL_SAR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act);151 int app_sip_SL_LIR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act); 152 //int app_sip_SL_SAR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act); 153 153 154 154 #define SQL_GETPASSWORD "SELECT `password` FROM ds_users WHERE `username` ='%s'" -
extensions/app_sip/locationinfo.c
r433 r639 37 37 38 38 39 int app_sip_LIR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)39 int app_sip_LIR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act) 40 40 { 41 41 TRACE_ENTRY("%p %p %p %p", msg, paramavp, sess, act); -
extensions/app_sip/locationinfosl.c
r433 r639 37 37 38 38 //This callback is specific to SUSCRIBER LOCATOR. We must look for the "serving" SIP server 39 int app_sip_SL_LIR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)39 int app_sip_SL_LIR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act) 40 40 { 41 41 TRACE_ENTRY("%p %p %p %p", msg, paramavp, sess, act); -
extensions/app_sip/multimediaauth.c
r433 r639 37 37 38 38 39 int app_sip_MAR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)39 int app_sip_MAR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act) 40 40 { 41 41 struct msg *ans, *qry; -
extensions/app_sip/pushprofile.c
r440 r639 255 255 256 256 //Called when an PPA arrive 257 int app_sip_PPA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)257 int app_sip_PPA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act) 258 258 { 259 259 //TODO: PPA reception -
extensions/app_sip/registrationtermination.c
r440 r639 258 258 259 259 //Called when an RTA arrive 260 int app_sip_RTA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)260 int app_sip_RTA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act) 261 261 { 262 262 //TODO: RTA reception -
extensions/app_sip/serverassignment.c
r433 r639 37 37 38 38 39 int app_sip_SAR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)39 int app_sip_SAR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act) 40 40 { 41 41 TRACE_ENTRY("%p %p %p %p", msg, paramavp, sess, act); -
extensions/app_sip/userauthorization.c
r433 r639 37 37 38 38 39 int app_sip_UAR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)39 int app_sip_UAR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act) 40 40 { 41 41 TRACE_ENTRY("%p %p %p %p", msg, paramavp, sess, act); -
extensions/dbg_interactive/dbg_interactive.c
r625 r639 67 67 68 68 end: 69 /* Upon exit, issue the order of terminating to fD */ 70 CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL), ); 69 /* Upon exit, issue the order of terminating to fD, if the interpreter was started without a file */ 70 if (!arg) { 71 CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL), ); 72 } 71 73 72 74 return NULL; -
extensions/dbg_interactive/dispatch.i
r638 r639 40 40 41 41 %{ 42 /* store the python callback function here */43 static PyObject * py_dispatch_cb = NULL;44 static int py_dispatch_cb_n = 0;45 42 /* call it (will be called from a different thread than the interpreter, when message arrives) */ 46 static int call_the_python_dispatch_callback(struct msg **msg, struct avp *avp, struct session *session, enum disp_action *action) {43 static int call_the_python_dispatch_callback(struct msg **msg, struct avp *avp, struct session *session, void * pycb, enum disp_action *action) { 47 44 PyObject *PyMsg, *PyAvp, *PySess; 48 PyObject * result = NULL;45 PyObject *cb, *result = NULL; 49 46 int ret = 0; 50 47 51 if (!py_dispatch_cb) 48 if (!pycb) { 49 fd_log_debug("Internal error: missing the callback!\n"); 52 50 return ENOTSUP; 51 } 52 cb = pycb; 53 53 54 54 SWIG_PYTHON_THREAD_BEGIN_BLOCK; … … 59 59 60 60 /* Call the function */ 61 result = PyEval_CallFunction( py_dispatch_cb, "(OOO)", PyMsg, PyAvp, PySess);61 result = PyEval_CallFunction(cb, "(OOO)", PyMsg, PyAvp, PySess); 62 62 63 63 /* The result is supposedly composed of: [ ret, *msg, *action ] */ … … 108 108 struct disp_hdl * hdl = NULL; 109 109 int ret; 110 if (py_dispatch_cb && (py_dispatch_cb != PyCb)) {111 DI_ERROR(EINVAL, PyExc_SyntaxError, "Only one dispatch callback is supported at the moment in this extension\n.");112 return NULL;113 }114 py_dispatch_cb = PyCb;115 py_dispatch_cb_n += 1;116 Py_XINCREF(py_dispatch_cb);117 110 118 ret = fd_disp_register ( call_the_python_dispatch_callback, how, when, &hdl ); 111 Py_XINCREF(PyCb); 112 113 ret = fd_disp_register ( call_the_python_dispatch_callback, how, when, PyCb, &hdl ); 119 114 if (ret != 0) { 120 115 DI_ERROR(ret, NULL, NULL); … … 125 120 ~disp_hdl() { 126 121 struct disp_hdl * hdl = self; 127 int ret = fd_disp_unregister(&hdl); 122 PyObject * cb = NULL; 123 int ret = fd_disp_unregister(&hdl, (void *)&cb); 128 124 if (ret != 0) { 129 125 DI_ERROR(ret, NULL, NULL); 130 126 } 131 /* Now free the callback */ 132 Py_XDECREF(py_dispatch_cb); 133 py_dispatch_cb_n -= 1; 134 if (!py_dispatch_cb_n) 135 py_dispatch_cb = NULL; 127 Py_XDECREF(cb); 136 128 return; 137 129 } -
extensions/dbg_interactive/sessions.i
r638 r639 39 39 40 40 %{ 41 /* store the python callback function here */42 static PyObject * py_cleanup_cb = NULL;43 41 /* call it (might be called from a different thread than the interpreter, when session times out) */ 44 static void call_the_python_cleanup_callback(session_state * state, char * sid ) {42 static void call_the_python_cleanup_callback(session_state * state, char * sid, void * cb) { 45 43 PyObject *result; 46 if (!py_cleanup_cb) 44 if (!cb) { 45 fd_log_debug("Internal error: missing callback object!\n"); 47 46 return; 47 } 48 48 49 49 /* Call the function */ 50 50 SWIG_PYTHON_THREAD_BEGIN_BLOCK; 51 result = PyEval_CallFunction( py_cleanup_cb, "(Os)", state, sid);51 result = PyEval_CallFunction((PyObject *)cb, "(Os)", state, sid); 52 52 Py_XDECREF(result); 53 53 SWIG_PYTHON_THREAD_END_BLOCK; … … 64 64 struct session_handler * hdl = NULL; 65 65 int ret; 66 if (py_cleanup_cb) {67 DI_ERROR(EINVAL, PyExc_SyntaxError, "Only one session handler at a time is supported at the moment in this extension\n.");68 return NULL;69 }70 py_cleanup_cb = PyCb;71 Py_XINCREF(py_cleanup_cb);72 66 73 ret = fd_sess_handler_create_internal ( &hdl, call_the_python_cleanup_callback ); 67 Py_XINCREF(PyCb); 68 69 ret = fd_sess_handler_create_internal ( &hdl, call_the_python_cleanup_callback, PyCb ); 74 70 if (ret != 0) { 75 71 DI_ERROR(ret, NULL, NULL); … … 80 76 ~session_handler() { 81 77 struct session_handler * hdl = self; 82 int ret = fd_sess_handler_destroy(&hdl); 78 PyObject * cb = NULL; 79 80 int ret = fd_sess_handler_destroy(&hdl, (void *)&cb); 83 81 if (ret != 0) { 84 82 DI_ERROR(ret, NULL, NULL); 85 83 } 86 84 /* Now free the callback */ 87 Py_XDECREF(py_cleanup_cb); 88 py_cleanup_cb = NULL; 85 Py_XDECREF(cb); 89 86 return; 90 87 } -
extensions/test_app/ta_cli.c
r406 r639 234 234 int ta_cli_init(void) 235 235 { 236 CHECK_FCT( fd_sess_handler_create(&ta_cli_reg, free ) );236 CHECK_FCT( fd_sess_handler_create(&ta_cli_reg, free, NULL) ); 237 237 238 238 CHECK_FCT( fd_sig_register(ta_conf->signal, "test_app.cli", ta_cli_test_message ) ); … … 245 245 CHECK_FCT_DO( fd_sig_unregister(ta_conf->signal), /* continue */ ); 246 246 247 CHECK_FCT_DO( fd_sess_handler_destroy(&ta_cli_reg ), /* continue */ );247 CHECK_FCT_DO( fd_sess_handler_destroy(&ta_cli_reg, NULL), /* continue */ ); 248 248 249 249 return; -
extensions/test_app/ta_serv.c
r575 r639 42 42 43 43 /* Default callback for the application. */ 44 static int ta_fb_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)44 static int ta_fb_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act) 45 45 { 46 46 /* This CB should never be called */ … … 53 53 54 54 /* Callback for incoming Test-Request messages */ 55 static int ta_tr_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)55 static int ta_tr_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act) 56 56 { 57 57 struct msg *ans, *qry; … … 120 120 121 121 /* fallback CB if command != Test-Request received */ 122 CHECK_FCT( fd_disp_register( ta_fb_cb, DISP_HOW_APPID, &data, &ta_hdl_fb ) );122 CHECK_FCT( fd_disp_register( ta_fb_cb, DISP_HOW_APPID, &data, NULL, &ta_hdl_fb ) ); 123 123 124 124 /* Now specific handler for Test-Request */ 125 CHECK_FCT( fd_disp_register( ta_tr_cb, DISP_HOW_CC, &data, &ta_hdl_tr ) );125 CHECK_FCT( fd_disp_register( ta_tr_cb, DISP_HOW_CC, &data, NULL, &ta_hdl_tr ) ); 126 126 127 127 return 0; … … 131 131 { 132 132 if (ta_hdl_fb) { 133 (void) fd_disp_unregister(&ta_hdl_fb );133 (void) fd_disp_unregister(&ta_hdl_fb, NULL); 134 134 } 135 135 if (ta_hdl_tr) { 136 (void) fd_disp_unregister(&ta_hdl_tr );136 (void) fd_disp_unregister(&ta_hdl_tr, NULL); 137 137 } 138 138 -
extensions/test_sip/locationinfo.c
r430 r639 125 125 } 126 126 127 int test_sip_LIA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)127 int test_sip_LIA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act) 128 128 { 129 129 -
extensions/test_sip/locationinfosl.c
r430 r639 127 127 } 128 128 129 int test_sipSL_LIA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)129 int test_sipSL_LIA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act) 130 130 { 131 131 -
extensions/test_sip/multimediaauth.c
r409 r639 37 37 38 38 39 int test_sip_MAA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)39 int test_sip_MAA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act) 40 40 { 41 41 /* -
extensions/test_sip/registrationtermination.c
r409 r639 37 37 38 38 39 int test_sip_RTR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)39 int test_sip_RTR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act) 40 40 { 41 41 -
extensions/test_sip/serverassignment.c
r432 r639 168 168 } 169 169 170 int test_sip_SAA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)170 int test_sip_SAA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act) 171 171 { 172 172 -
extensions/test_sip/test_sip.c
r448 r639 64 64 struct sip_dict sip_dict; 65 65 66 int test_sip_default_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)66 int test_sip_default_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act) 67 67 { 68 68 TRACE_ENTRY("%p %p %p %p", msg, avp, sess, act); … … 187 187 //MAA 188 188 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Multimedia-Auth-Answer", &data.command, ENOENT) ); 189 CHECK_FCT( fd_disp_register( test_sip_MAA_cb, DISP_HOW_CC, &data, &test_sip_MAA_hdl ) );189 CHECK_FCT( fd_disp_register( test_sip_MAA_cb, DISP_HOW_CC, &data, NULL, &test_sip_MAA_hdl ) ); 190 190 191 191 //UAA 192 192 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "User-Authorization-Answer", &data.command, ENOENT) ); 193 CHECK_FCT( fd_disp_register( test_sip_UAA_cb, DISP_HOW_CC, &data, &test_sip_UAA_hdl ) );193 CHECK_FCT( fd_disp_register( test_sip_UAA_cb, DISP_HOW_CC, &data, NULL, &test_sip_UAA_hdl ) ); 194 194 195 195 //RTR 196 196 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Registration-Termination-Request", &data.command, ENOENT) ); 197 CHECK_FCT( fd_disp_register( test_sip_RTR_cb, DISP_HOW_CC, &data, &test_sip_RTR_hdl ) );197 CHECK_FCT( fd_disp_register( test_sip_RTR_cb, DISP_HOW_CC, &data, NULL, &test_sip_RTR_hdl ) ); 198 198 199 199 //LIA 200 200 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Location-Info-Answer", &data.command, ENOENT) ); 201 CHECK_FCT( fd_disp_register( test_sip_LIA_cb, DISP_HOW_CC, &data, &test_sip_LIA_hdl ) );201 CHECK_FCT( fd_disp_register( test_sip_LIA_cb, DISP_HOW_CC, &data, NULL, &test_sip_LIA_hdl ) ); 202 202 203 203 //LIA 204 204 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Server-Assignment-Answer", &data.command, ENOENT) ); 205 CHECK_FCT( fd_disp_register( test_sip_SAA_cb, DISP_HOW_CC, &data, &test_sip_SAA_hdl ) );205 CHECK_FCT( fd_disp_register( test_sip_SAA_cb, DISP_HOW_CC, &data, NULL, &test_sip_SAA_hdl ) ); 206 206 207 207 //Callback for unexpected messages 208 CHECK_FCT( fd_disp_register( test_sip_default_cb, DISP_HOW_APPID, &data, &test_sip_default_hdl ) );208 CHECK_FCT( fd_disp_register( test_sip_default_cb, DISP_HOW_APPID, &data, NULL, &test_sip_default_hdl ) ); 209 209 210 210 /* … … 214 214 */ 215 215 216 CHECK_FCT(fd_sess_handler_create(&ts_sess_hdl, free ));216 CHECK_FCT(fd_sess_handler_create(&ts_sess_hdl, free, NULL)); 217 217 //CHECK_FCT( fd_sig_register(30, "test_sip", (void *)test_sipSL_LIR_cb ) ); 218 218 CHECK_FCT( fd_sig_register(30, "test_sip", (void *)test_sip_SAR_cb ) ); -
extensions/test_sip/test_sip.h
r427 r639 115 115 int test_sipSL_LIR_cb(); 116 116 117 int test_sip_default_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);118 int test_sip_MAA_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);119 int test_sip_RTR_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);120 int test_sip_UAA_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);121 int test_sip_LIA_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);122 int test_sip_SAA_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);123 int test_sipSL_LIA_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act);117 int test_sip_default_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); 118 int test_sip_MAA_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); 119 int test_sip_RTR_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); 120 int test_sip_UAA_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); 121 int test_sip_LIA_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); 122 int test_sip_SAA_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); 123 int test_sipSL_LIA_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act); -
extensions/test_sip/userauthorization.c
r430 r639 159 159 } 160 160 161 int test_sip_UAA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)161 int test_sip_UAA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act) 162 162 { 163 163 -
freeDiameter/tests/testdisp.c
r90 r639 36 36 #include "tests.h" 37 37 38 #define Define_cb( __int, __extra ) \ 39 int cb_##__int( struct msg ** msg, struct avp * avp, struct session * session, enum disp_action * action ) \ 40 { \ 41 CHECK( 1, msg ? 1 : 0 ); \ 42 CHECK( 1, action ? 1 : 0 ); \ 43 CHECK( sess, session ); \ 44 *action = DISP_ACT_CONT; \ 45 cbcalled[__int] += 1; \ 46 do { \ 47 __extra ; \ 48 } while (0); \ 49 return 0; \ 38 #define Define_cb( __int, __extra ) \ 39 int cb_##__int( struct msg ** msg, struct avp * avp, struct session * session, void * opaque, enum disp_action * action ) \ 40 { \ 41 CHECK( 1, msg ? 1 : 0 ); \ 42 CHECK( 1, action ? 1 : 0 ); \ 43 CHECK( sess, session ); \ 44 if (opaque) { \ 45 CHECK( 1, opaque == g_opaque ? 1 : 0 ); \ 46 } \ 47 *action = DISP_ACT_CONT; \ 48 cbcalled[__int] += 1; \ 49 do { \ 50 __extra ; \ 51 } while (0); \ 52 return 0; \ 50 53 } 51 54 … … 53 56 char cbcalled[NB_CB]; 54 57 struct session * sess; 58 void * g_opaque = (void *)"test"; 55 59 56 60 /* cb_0 */ Define_cb( 0, ); … … 142 146 /* Register first handler, very simple test */ 143 147 { 144 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, NULL, &hdl[0] ) );148 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, NULL, NULL, &hdl[0] ) ); 145 149 CHECK( 1, hdl[0] ? 1 : 0 ); 146 CHECK( 0, fd_disp_unregister( &hdl[0] ) );150 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); 147 151 CHECK( NULL, hdl[0] ); 148 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, NULL, &hdl[0] ) );152 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, NULL, NULL, &hdl[0] ) ); 149 153 150 154 /* Check this handler is called for a message */ … … 157 161 /* Delete the message */ 158 162 CHECK( 0, fd_msg_free( msg ) ); 159 CHECK( 0, fd_disp_unregister( &hdl[0] ) );163 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); 160 164 } 161 165 162 166 /* Handlers for applications */ 163 167 { 164 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, &hdl[0] ) );168 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); 165 169 when.app = app1; 166 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_APPID, &when, &hdl[1] ) );170 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_APPID, &when, NULL, &hdl[1] ) ); 167 171 when.app = app2; 168 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_APPID, &when, &hdl[2] ) );172 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_APPID, &when, NULL, &hdl[2] ) ); 169 173 when.avp = avp2; 170 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_APPID, &when, &hdl[3] ) );174 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_APPID, &when, NULL, &hdl[3] ) ); 171 175 when.avp = avp1; 172 CHECK( 0, fd_disp_register( cb_4, DISP_HOW_APPID, &when, &hdl[4] ) );176 CHECK( 0, fd_disp_register( cb_4, DISP_HOW_APPID, &when, NULL, &hdl[4] ) ); 173 177 174 178 /* Check the callbacks are called as appropriate */ … … 206 210 CHECK( 0, fd_msg_free( msg ) ); 207 211 208 CHECK( 0, fd_disp_unregister( &hdl[0] ) );209 CHECK( 0, fd_disp_unregister( &hdl[1] ) );210 CHECK( 0, fd_disp_unregister( &hdl[2] ) );211 CHECK( 0, fd_disp_unregister( &hdl[3] ) );212 CHECK( 0, fd_disp_unregister( &hdl[4] ) );212 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); 213 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); 214 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); 215 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); 216 CHECK( 0, fd_disp_unregister( &hdl[4], NULL ) ); 213 217 } 214 218 … … 217 221 when.app = NULL; 218 222 when.command = NULL; 219 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, &hdl[0] ) );220 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_CC, &when, &hdl[1] ) );223 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); 224 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_CC, &when, NULL, &hdl[1] ) ); 221 225 when.command = cmd1; 222 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_CC, &when, &hdl[1] ) ); /* cmd1 */226 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_CC, &when, NULL, &hdl[1] ) ); /* cmd1 */ 223 227 when.app = app2; 224 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_CC, &when, &hdl[2] ) ); /* app2 + cmd1 */228 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_CC, &when, NULL, &hdl[2] ) ); /* app2 + cmd1 */ 225 229 when.command = cmd2; 226 230 when.app = NULL; 227 231 when.avp = avp1; 228 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_CC, &when, &hdl[3] ) ); /* cmd2 (avp1 ignored) */232 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_CC, &when, NULL, &hdl[3] ) ); /* cmd2 (avp1 ignored) */ 229 233 230 234 /* Check the callbacks are called as appropriate */ … … 269 273 CHECK( 0, fd_msg_free( msg ) ); 270 274 271 CHECK( 0, fd_disp_unregister( &hdl[0] ) );272 CHECK( 0, fd_disp_unregister( &hdl[1] ) );273 CHECK( 0, fd_disp_unregister( &hdl[2] ) );274 CHECK( 0, fd_disp_unregister( &hdl[3] ) );275 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); 276 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); 277 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); 278 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); 275 279 } 276 280 … … 281 285 when.avp = NULL; 282 286 283 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, &hdl[0] ) ); /* all */284 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_AVP, &when, &hdl[1] ) );287 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); /* all */ 288 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_AVP, &when, NULL, &hdl[1] ) ); 285 289 286 290 when.avp = avp1; 287 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_AVP, &when, &hdl[1] ) ); /* avp1 */291 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_AVP, &when, NULL, &hdl[1] ) ); /* avp1 */ 288 292 289 293 when.command = cmd1; 290 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_AVP, &when, &hdl[2] ) ); /* avp1 + cmd1 */294 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_AVP, &when, NULL, &hdl[2] ) ); /* avp1 + cmd1 */ 291 295 292 296 when.command = NULL; 293 297 when.app = app1; 294 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_AVP, &when, &hdl[3] ) ); /* avp1 + app1 */298 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_AVP, &when, NULL, &hdl[3] ) ); /* avp1 + app1 */ 295 299 296 300 when.command = cmd1; 297 CHECK( 0, fd_disp_register( cb_4, DISP_HOW_AVP, &when, &hdl[4] ) ); /* avp1 + cmd1 + app1 */301 CHECK( 0, fd_disp_register( cb_4, DISP_HOW_AVP, &when, NULL, &hdl[4] ) ); /* avp1 + cmd1 + app1 */ 298 302 299 303 when.app = NULL; … … 301 305 when.avp = avp2; 302 306 when.value = enu1; 303 CHECK( 0, fd_disp_register( cb_5, DISP_HOW_AVP, &when, &hdl[5] ) ); /* avp2 */307 CHECK( 0, fd_disp_register( cb_5, DISP_HOW_AVP, &when, NULL, &hdl[5] ) ); /* avp2 */ 304 308 305 309 when.value = enu2; 306 CHECK( 0, fd_disp_register( cb_7, DISP_HOW_AVP, &when, &hdl[6] ) ); /* avp2 */310 CHECK( 0, fd_disp_register( cb_7, DISP_HOW_AVP, &when, NULL, &hdl[6] ) ); /* avp2 */ 307 311 308 312 … … 396 400 CHECK( 0, fd_msg_free( msg ) ); 397 401 398 CHECK( 0, fd_disp_unregister( &hdl[0] ) );399 CHECK( 0, fd_disp_unregister( &hdl[1] ) );400 CHECK( 0, fd_disp_unregister( &hdl[2] ) );401 CHECK( 0, fd_disp_unregister( &hdl[3] ) );402 CHECK( 0, fd_disp_unregister( &hdl[4] ) );403 CHECK( 0, fd_disp_unregister( &hdl[5] ) );404 CHECK( 0, fd_disp_unregister( &hdl[6] ) );402 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); 403 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); 404 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); 405 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); 406 CHECK( 0, fd_disp_unregister( &hdl[4], NULL ) ); 407 CHECK( 0, fd_disp_unregister( &hdl[5], NULL ) ); 408 CHECK( 0, fd_disp_unregister( &hdl[6], NULL ) ); 405 409 } 406 410 … … 412 416 when.value = NULL; 413 417 414 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, &hdl[0] ) ); /* all */415 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, &hdl[1] ) );418 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); /* all */ 419 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[1] ) ); 416 420 when.value = enu1; 417 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, &hdl[1] ) );421 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[1] ) ); 418 422 when.avp = avp1; 419 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, &hdl[1] ) );423 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[1] ) ); 420 424 when.avp = avp2; 421 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, &hdl[1] ) ); /* avp2, enu1 */425 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[1] ) ); /* avp2, enu1 */ 422 426 423 427 when.command = cmd1; 424 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_AVP_ENUMVAL, &when, &hdl[2] ) ); /* avp2, enu1 + cmd1 */428 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[2] ) ); /* avp2, enu1 + cmd1 */ 425 429 426 430 when.command = NULL; 427 431 when.app = app1; 428 432 when.value = enu2; 429 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_AVP_ENUMVAL, &when, &hdl[3] ) ); /* avp2, enu2 + app1 */433 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[3] ) ); /* avp2, enu2 + app1 */ 430 434 431 435 /* Check the callbacks are called as appropriate */ … … 498 502 CHECK( 0, fd_msg_free( msg ) ); 499 503 500 CHECK( 0, fd_disp_unregister( &hdl[0] ) );501 CHECK( 0, fd_disp_unregister( &hdl[1] ) );502 CHECK( 0, fd_disp_unregister( &hdl[2] ) );503 CHECK( 0, fd_disp_unregister( &hdl[3] ) );504 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); 505 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); 506 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); 507 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); 504 508 } 505 509 506 510 /* Test behavior of handlers */ 507 511 { 508 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, &hdl[0] ) );509 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_ANY, &when, &hdl[1] ) );510 CHECK( 0, fd_disp_register( cb_6, DISP_HOW_ANY, &when, &hdl[2] ) );511 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_ANY, &when, &hdl[3] ) );512 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_ANY, &when, &hdl[4] ) );512 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); 513 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_ANY, &when, NULL, &hdl[1] ) ); 514 CHECK( 0, fd_disp_register( cb_6, DISP_HOW_ANY, &when, NULL, &hdl[2] ) ); 515 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_ANY, &when, NULL, &hdl[3] ) ); 516 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_ANY, &when, NULL, &hdl[4] ) ); 513 517 514 518 memset(cbcalled, 0, sizeof(cbcalled)); … … 522 526 CHECK( 0, fd_msg_free( msg ) ); 523 527 524 CHECK( 0, fd_disp_unregister( &hdl[0] ) );525 CHECK( 0, fd_disp_unregister( &hdl[1] ) );526 CHECK( 0, fd_disp_unregister( &hdl[2] ) );527 CHECK( 0, fd_disp_unregister( &hdl[3] ) );528 CHECK( 0, fd_disp_unregister( &hdl[4] ) );529 530 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, &hdl[0] ) );531 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_ANY, &when, &hdl[1] ) );532 CHECK( 0, fd_disp_register( cb_8, DISP_HOW_ANY, &when, &hdl[2] ) );533 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_ANY, &when, &hdl[3] ) );534 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_ANY, &when, &hdl[4] ) );528 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); 529 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); 530 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); 531 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); 532 CHECK( 0, fd_disp_unregister( &hdl[4], NULL ) ); 533 534 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); 535 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_ANY, &when, NULL, &hdl[1] ) ); 536 CHECK( 0, fd_disp_register( cb_8, DISP_HOW_ANY, &when, NULL, &hdl[2] ) ); 537 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_ANY, &when, NULL, &hdl[3] ) ); 538 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_ANY, &when, NULL, &hdl[4] ) ); 535 539 536 540 memset(cbcalled, 0, sizeof(cbcalled)); … … 544 548 CHECK( NULL, msg ); 545 549 546 CHECK( 0, fd_disp_unregister( &hdl[0] ) );547 CHECK( 0, fd_disp_unregister( &hdl[1] ) );548 CHECK( 0, fd_disp_unregister( &hdl[2] ) );549 CHECK( 0, fd_disp_unregister( &hdl[3] ) );550 CHECK( 0, fd_disp_unregister( &hdl[4] ) );551 552 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, &hdl[0] ) );553 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_ANY, &when, &hdl[1] ) );554 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_ANY, &when, &hdl[2] ) );555 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_ANY, &when, &hdl[3] ) );556 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_ANY, &when, &hdl[4] ) );550 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); 551 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); 552 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); 553 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); 554 CHECK( 0, fd_disp_unregister( &hdl[4], NULL ) ); 555 556 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); 557 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_ANY, &when, NULL, &hdl[1] ) ); 558 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_ANY, &when, NULL, &hdl[2] ) ); 559 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_ANY, &when, NULL, &hdl[3] ) ); 560 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_ANY, &when, NULL, &hdl[4] ) ); 557 561 558 562 memset(cbcalled, 0, sizeof(cbcalled)); … … 567 571 CHECK( 0, fd_msg_free( msg ) ); 568 572 569 CHECK( 0, fd_disp_unregister( &hdl[0] ) );570 CHECK( 0, fd_disp_unregister( &hdl[1] ) );571 CHECK( 0, fd_disp_unregister( &hdl[2] ) );572 CHECK( 0, fd_disp_unregister( &hdl[3] ) );573 CHECK( 0, fd_disp_unregister( &hdl[4] ) );573 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); 574 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); 575 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); 576 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); 577 CHECK( 0, fd_disp_unregister( &hdl[4], NULL ) ); 574 578 } 575 579 … … 581 585 when.value = enu2; 582 586 583 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, &hdl[0] ) );584 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, &hdl[1] ) );585 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_AVP, &when, &hdl[2] ) );586 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_CC, &when, &hdl[3] ) );587 CHECK( 0, fd_disp_register( cb_4, DISP_HOW_APPID, &when, &hdl[4] ) );587 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); 588 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[1] ) ); 589 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_AVP, &when, NULL, &hdl[2] ) ); 590 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_CC, &when, NULL, &hdl[3] ) ); 591 CHECK( 0, fd_disp_register( cb_4, DISP_HOW_APPID, &when, NULL, &hdl[4] ) ); 588 592 589 593 memset(cbcalled, 0, sizeof(cbcalled)); … … 598 602 CHECK( 0, fd_msg_free( msg ) ); 599 603 600 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_ANY, &when, &hdl[5] ) );604 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_ANY, &when, NULL, &hdl[5] ) ); 601 605 memset(cbcalled, 0, sizeof(cbcalled)); 602 606 msg = new_msg( 2, cmd2, avp1, avp2, 2 ); … … 609 613 CHECK( 1, cbcalled[9] ); 610 614 CHECK( 0, fd_msg_free( msg ) ); 611 CHECK( 0, fd_disp_unregister( &hdl[5] ) );612 613 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_AVP_ENUMVAL, &when, &hdl[5] ) );615 CHECK( 0, fd_disp_unregister( &hdl[5], NULL ) ); 616 617 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[5] ) ); 614 618 memset(cbcalled, 0, sizeof(cbcalled)); 615 619 msg = new_msg( 2, cmd2, avp1, avp2, 2 ); … … 622 626 CHECK( 1, cbcalled[9] ); 623 627 CHECK( 0, fd_msg_free( msg ) ); 624 CHECK( 0, fd_disp_unregister( &hdl[5] ) );625 626 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_AVP, &when, &hdl[5] ) );628 CHECK( 0, fd_disp_unregister( &hdl[5], NULL ) ); 629 630 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_AVP, &when, NULL, &hdl[5] ) ); 627 631 memset(cbcalled, 0, sizeof(cbcalled)); 628 632 msg = new_msg( 2, cmd2, avp1, avp2, 2 ); … … 635 639 CHECK( 1, cbcalled[9] ); 636 640 CHECK( 0, fd_msg_free( msg ) ); 637 CHECK( 0, fd_disp_unregister( &hdl[5] ) );638 639 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_CC, &when, &hdl[5] ) );641 CHECK( 0, fd_disp_unregister( &hdl[5], NULL ) ); 642 643 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_CC, &when, NULL, &hdl[5] ) ); 640 644 memset(cbcalled, 0, sizeof(cbcalled)); 641 645 msg = new_msg( 2, cmd2, avp1, avp2, 2 ); … … 648 652 CHECK( 1, cbcalled[9] ); 649 653 CHECK( 0, fd_msg_free( msg ) ); 650 CHECK( 0, fd_disp_unregister( &hdl[5] ) );651 652 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_APPID, &when, &hdl[5] ) );654 CHECK( 0, fd_disp_unregister( &hdl[5], NULL ) ); 655 656 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_APPID, &when, NULL, &hdl[5] ) ); 653 657 memset(cbcalled, 0, sizeof(cbcalled)); 654 658 msg = new_msg( 2, cmd2, avp1, avp2, 2 ); … … 661 665 CHECK( 1, cbcalled[9] ); 662 666 CHECK( 0, fd_msg_free( msg ) ); 663 CHECK( 0, fd_disp_unregister( &hdl[5] ) );664 665 CHECK( 0, fd_disp_unregister( &hdl[0] ) );666 CHECK( 0, fd_disp_unregister( &hdl[1] ) );667 CHECK( 0, fd_disp_unregister( &hdl[2] ) );668 CHECK( 0, fd_disp_unregister( &hdl[3] ) );669 CHECK( 0, fd_disp_unregister( &hdl[4] ) );667 CHECK( 0, fd_disp_unregister( &hdl[5], NULL ) ); 668 669 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); 670 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); 671 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); 672 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); 673 CHECK( 0, fd_disp_unregister( &hdl[4], NULL ) ); 670 674 } 671 675 … … 698 702 } 699 703 704 /* Test opaque pointer management */ 705 { 706 void * ptr; 707 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, NULL, g_opaque, &hdl[0] ) ); 708 709 /* Check this handler is called for a message */ 710 msg = new_msg( 0, cmd1, avp1, NULL, 0 ); 711 memset(cbcalled, 0, sizeof(cbcalled)); 712 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) ); 713 CHECK( 1, cbcalled[0] ); 714 CHECK( DISP_ACT_CONT, action ); 715 716 /* Delete the message */ 717 CHECK( 0, fd_msg_free( msg ) ); 718 CHECK( 0, fd_disp_unregister( &hdl[0], &ptr ) ); 719 CHECK( 1, ptr == g_opaque ? 1 : 0 ); 720 } 721 700 722 /* That's all for the tests yet */ 701 723 PASSTEST(); -
freeDiameter/tests/testsess.c
r403 r639 45 45 char * sid; /* the session with which the data was registered */ 46 46 int * freed; /* location where to write the freed status */ 47 void * opaque; /* if opaque was provided, this is the value we expect */ 47 48 }; 48 49 49 static void mycleanup( struct mystate * data, char * sid )50 static void mycleanup( struct mystate * data, char * sid, void * opaque ) 50 51 { 51 52 /* sanity */ … … 56 57 if (data->freed) 57 58 *(data->freed) += 1; 59 if (data->opaque) { 60 CHECK( 1, opaque == data->opaque ? 1 : 0 ); 61 } 58 62 /* Now, free the data */ 59 63 free(data->sid); … … 73 77 return new; 74 78 } 79 80 void * g_opaque = (void *)"test"; 75 81 76 82 … … 88 94 /* Test functions related to handlers (simple situation) */ 89 95 { 90 CHECK( 0, fd_sess_handler_create ( &hdl1, mycleanup ) ); 91 CHECK( 0, fd_sess_handler_create ( &hdl2, mycleanup ) ); 92 CHECK( 0, fd_sess_handler_destroy( &hdl2 ) ); 93 CHECK( 0, fd_sess_handler_create ( &hdl2, mycleanup ) ); 96 void * testptr = NULL; 97 CHECK( 0, fd_sess_handler_create ( &hdl1, mycleanup, NULL ) ); 98 CHECK( 0, fd_sess_handler_create ( &hdl2, mycleanup, NULL ) ); 99 CHECK( 0, fd_sess_handler_destroy( &hdl2, &testptr ) ); 100 CHECK( 1, testptr == NULL ? 1 : 0 ); 101 CHECK( 0, fd_sess_handler_create ( &hdl2, mycleanup, g_opaque ) ); 94 102 #if 0 95 103 fd_sess_dump_hdl(0, hdl1); … … 237 245 int freed[6]; 238 246 struct timespec timeout; 247 void * testptr = NULL; 239 248 240 249 /* Create three sessions */ … … 267 276 CHECK( NULL, tms ); 268 277 269 mycleanup(ms[0], str1 );270 mycleanup(ms[1], str1 );278 mycleanup(ms[0], str1, NULL); 279 mycleanup(ms[1], str1, NULL); 271 280 272 281 /* Now create 6 states */ … … 281 290 ms[4] = new_state(str1, &freed[4]); 282 291 ms[5] = new_state(str1, &freed[5]); 292 ms[5]->opaque = g_opaque; 283 293 str2 = strdup(str1); 284 294 CHECK( 1, str2 ? 1 : 0 ); … … 308 318 309 319 /* Destroy handler 2 */ 310 CHECK( 0, fd_sess_handler_destroy( &hdl2 ) );320 CHECK( 0, fd_sess_handler_destroy( &hdl2, &testptr ) ); 311 321 CHECK( 0, freed[0] ); 312 322 CHECK( 1, freed[1] ); … … 315 325 CHECK( 1, freed[4] ); 316 326 CHECK( 1, freed[5] ); 327 CHECK( 1, testptr == g_opaque ? 1 : 0 ); 317 328 318 329 #if 1 … … 349 360 CHECK( 0, fd_sess_state_retrieve( hdl1, sess1, &tms ) ); 350 361 CHECK( 0, fd_sess_getsid(sess1, &str1) ); 351 mycleanup(tms, str1 );362 mycleanup(tms, str1, NULL); 352 363 } 353 364 -
include/freeDiameter/libfreeDiameter.h
r638 r639 1559 1559 * handler : location where the new handler must be stored. 1560 1560 * 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. 1561 1562 * 1562 1563 * DESCRIPTION: … … 1570 1571 * ENOMEM : Not enough memory to complete the operation 1571 1572 */ 1572 int fd_sess_handler_create_internal ( struct session_handler ** handler, void (*cleanup)(session_state * state, char * sid ));1573 int fd_sess_handler_create_internal ( struct session_handler ** handler, void (*cleanup)(session_state * state, char * sid, void * opaque), void * opaque ); 1573 1574 /* 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) ) 1576 1577 1577 1578 … … 1581 1582 * PARAMETERS: 1582 1583 * 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). 1583 1585 * 1584 1586 * DESCRIPTION: … … 1591 1593 * ENOMEM : Not enough memory to complete the operation 1592 1594 */ 1593 int fd_sess_handler_destroy ( struct session_handler ** handler );1595 int fd_sess_handler_destroy ( struct session_handler ** handler, void **opaque ); 1594 1596 1595 1597 … … 2526 2528 * avp : for callbacks registered with DISP_HOW_AVP or DISP_HOW_AVP_ENUMVAL, direct link to the triggering AVP. 2527 2529 * 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. 2528 2531 * action : upon return, this tells the daemon what to do next. 2529 2532 * … … 2557 2560 * how : How the callback must be registered. 2558 2561 * 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. 2559 2563 * handle : On success, a handler to the registered callback is stored here if not NULL. 2560 2564 * This handler can be used to unregister the cb. … … 2568 2572 * ENOMEM : Not enough memory to complete the operation 2569 2573 */ 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 );2574 int 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 ); 2572 2576 2573 2577 /* … … 2576 2580 * PARAMETERS: 2577 2581 * 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. 2578 2583 * 2579 2584 * DESCRIPTION: … … 2584 2589 * EINVAL : A parameter is invalid. 2585 2590 */ 2586 int fd_disp_unregister ( struct disp_hdl ** handle );2591 int fd_disp_unregister ( struct disp_hdl ** handle, void ** opaque ); 2587 2592 2588 2593 /* Destroy all handlers */ -
libfreeDiameter/dispatch.c
r398 r639 56 56 enum disp_how how; /* Copy of registration parameter */ 57 57 struct disp_when when; /* Copy of registration parameter */ 58 int (*cb)( struct msg **, struct avp *, struct session *, enum disp_action *); /* The callback itself */ 58 int (*cb)( struct msg **, struct avp *, struct session *, void *, enum disp_action *); /* The callback itself */ 59 void *opaque; /* opaque data passed back to the callback */ 59 60 }; 60 61 … … 93 94 94 95 /* We have a match, the cb must be called. */ 95 CHECK_FCT( (*hdl->cb)(msg, avp, sess, action) );96 CHECK_FCT( (*hdl->cb)(msg, avp, sess, hdl->opaque, action) ); 96 97 97 98 if (*action != DISP_ACT_CONT) … … 109 110 110 111 /* Create a new handler and link it */ 111 int fd_disp_register ( int (*cb)( struct msg **, struct avp *, struct session *, enum disp_action *),112 enum disp_how how, struct disp_when * when, struct disp_hdl ** handle )112 int fd_disp_register ( int (*cb)( struct msg **, struct avp *, struct session *, void *, enum disp_action *), 113 enum disp_how how, struct disp_when * when, void * opaque, struct disp_hdl ** handle ) 113 114 { 114 115 struct fd_list * cb_list = NULL; … … 171 172 } 172 173 new->cb = cb; 174 new->opaque = opaque; 173 175 174 176 /* Now, link this new element in the appropriate lists */ … … 186 188 187 189 /* Delete a handler */ 188 int fd_disp_unregister ( struct disp_hdl ** handle )190 int fd_disp_unregister ( struct disp_hdl ** handle, void ** opaque ) 189 191 { 190 192 struct disp_hdl * del; … … 199 201 CHECK_POSIX( pthread_rwlock_unlock(&fd_disp_lock) ); 200 202 203 if (opaque) 204 *opaque = del->opaque; 205 201 206 free(del); 202 207 return 0; … … 208 213 TRACE_ENTRY(""); 209 214 while (!FD_IS_LIST_EMPTY(&all_handlers)) { 210 CHECK_FCT_DO( fd_disp_unregister((void *)&(all_handlers.next->o) ), /* continue */ );215 CHECK_FCT_DO( fd_disp_unregister((void *)&(all_handlers.next->o), NULL), /* continue */ ); 211 216 } 212 217 return; -
libfreeDiameter/sessions.c
r557 r639 69 69 int eyec; /* An eye catcher also used to ensure the object is valid, must be SH_EYEC */ 70 70 int id; /* A unique integer to identify this handler */ 71 void (*cleanup)(session_state *, char *); /* The cleanup function to be called for cleaning a state */ 71 void (*cleanup)(session_state *, char *, void *); /* The cleanup function to be called for cleaning a state */ 72 void *opaque; /* a value that is passed as is to the cleanup callback */ 72 73 }; 73 74 … … 253 254 254 255 /* Create a new handler */ 255 int fd_sess_handler_create_internal ( struct session_handler ** handler, void (*cleanup)(session_state * state, char * sid ))256 int fd_sess_handler_create_internal ( struct session_handler ** handler, void (*cleanup)(session_state * state, char * sid, void * opaque), void * opaque ) 256 257 { 257 258 struct session_handler *new; … … 270 271 new->eyec = SH_EYEC; 271 272 new->cleanup = cleanup; 273 new->opaque = opaque; 272 274 273 275 *handler = new; … … 277 279 /* Destroy a handler, and all states attached to this handler. This operation is very slow but we don't care since it's rarely used. 278 280 * Note that it's better to call this function after all sessions have been deleted... */ 279 int fd_sess_handler_destroy ( struct session_handler ** handler )281 int fd_sess_handler_destroy ( struct session_handler ** handler, void ** opaque ) 280 282 { 281 283 struct session_handler * del; … … 323 325 struct state * st = (struct state *)(deleted_states.next->o); 324 326 TRACE_DEBUG(FULL, "Calling cleanup handler for session '%s' and data %p", st->sid, st->state); 325 (*del->cleanup)(st->state, st->sid );327 (*del->cleanup)(st->state, st->sid, del->opaque); 326 328 free(st->sid); 327 329 fd_list_unlink(&st->chain); 328 330 free(st); 329 331 } 332 333 if (opaque) 334 *opaque = del->opaque; 330 335 331 336 /* Free the handler */ … … 583 588 fd_list_unlink(&st->chain); 584 589 TRACE_DEBUG(FULL, "Calling handler %p cleanup for state registered with session '%s'", st->hdl, sess->sid); 585 (*st->hdl->cleanup)(st->state, sess->sid );590 (*st->hdl->cleanup)(st->state, sess->sid, st->hdl->opaque); 586 591 free(st); 587 592 } … … 805 810 fd_log_debug("\t %*s Invalid session handler object\n", level, ""); 806 811 } else { 807 fd_log_debug("\t %*s id %d, cleanup %p \n", level, "", handler->id, handler->cleanup);812 fd_log_debug("\t %*s id %d, cleanup %p, opaque %p\n", level, "", handler->id, handler->cleanup, handler->opaque); 808 813 } 809 814 fd_log_debug("\t %*s -- end of handler @%p --\n", level, "", handler);
Note: See TracChangeset
for help on using the changeset viewer.