Changeset 639:95a784729cac in freeDiameter for libfreeDiameter/dispatch.c
- Timestamp:
- Dec 20, 2010, 1:07:06 PM (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note: See TracChangeset
for help on using the changeset viewer.