Changeset 690:a29e4201d511 in freeDiameter
- Timestamp:
- Jan 20, 2011, 3:38:12 PM (13 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdproto/messages.c
r689 r690 2222 2222 #define TEST_ACTION_STOP() \ 2223 2223 if ((*msg == NULL) || (*action != DISP_ACT_CONT)) \ 2224 goto no_error;2224 goto out; 2225 2225 2226 2226 /* Call all dispatch callbacks for a given message */ … … 2232 2232 struct avp * avp; 2233 2233 struct fd_list * cb_list; 2234 int ret = 0 ;2234 int ret = 0, r2; 2235 2235 2236 2236 TRACE_ENTRY("%p %p %p %p", msg, session, action, error_code); … … 2246 2246 2247 2247 /* First, call the DISP_HOW_ANY callbacks */ 2248 CHECK_FCT_DO( ret = fd_disp_call_cb_int( NULL, msg, NULL, session, action, NULL, NULL, NULL, NULL ), goto error);2248 CHECK_FCT_DO( ret = fd_disp_call_cb_int( NULL, msg, NULL, session, action, NULL, NULL, NULL, NULL ), goto out ); 2249 2249 2250 2250 TEST_ACTION_STOP(); 2251 2251 2252 2252 /* If we don't know the model at this point, we stop cause we cannot get the dictionary. It's invalid: an error should already have been trigged by ANY callbacks */ 2253 CHECK_PARAMS_DO(cmd = (*msg)->msg_model, { ret = EINVAL; goto error; } );2253 CHECK_PARAMS_DO(cmd = (*msg)->msg_model, { ret = EINVAL; goto out; } ); 2254 2254 2255 2255 /* Now resolve message application */ 2256 CHECK_FCT_DO( ret = fd_dict_getdict( cmd, &dict ), goto error);2257 CHECK_FCT_DO( ret = fd_dict_search( dict, DICT_APPLICATION, APPLICATION_BY_ID, &(*msg)->msg_public.msg_appl, &app, 0 ), goto error);2256 CHECK_FCT_DO( ret = fd_dict_getdict( cmd, &dict ), goto out ); 2257 CHECK_FCT_DO( ret = fd_dict_search( dict, DICT_APPLICATION, APPLICATION_BY_ID, &(*msg)->msg_public.msg_appl, &app, 0 ), goto out ); 2258 2258 2259 2259 if (app == NULL) { … … 2267 2267 *msg = NULL; 2268 2268 } 2269 goto no_error;2269 goto out; 2270 2270 } 2271 2271 2272 2272 /* So start browsing the message */ 2273 CHECK_FCT_DO( ret = fd_msg_browse( *msg, MSG_BRW_FIRST_CHILD, &avp, NULL ), goto error);2273 CHECK_FCT_DO( ret = fd_msg_browse( *msg, MSG_BRW_FIRST_CHILD, &avp, NULL ), goto out ); 2274 2274 while (avp != NULL) { 2275 2275 /* For unknown AVP, we don't have a callback registered, so just skip */ … … 2278 2278 2279 2279 /* Get the list of callback for this AVP */ 2280 CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_AVP, avp->avp_model, &cb_list), goto error);2280 CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_AVP, avp->avp_model, &cb_list), goto out ); 2281 2281 2282 2282 /* We search enumerated values only in case of non-grouped AVP */ … … 2284 2284 struct dict_object * type; 2285 2285 /* Check if the AVP has a constant value */ 2286 CHECK_FCT_DO( ret = fd_dict_search(dict, DICT_TYPE, TYPE_OF_AVP, avp->avp_model, &type, 0), goto error);2286 CHECK_FCT_DO( ret = fd_dict_search(dict, DICT_TYPE, TYPE_OF_AVP, avp->avp_model, &type, 0), goto out ); 2287 2287 if (type) { 2288 2288 struct dict_enumval_request req; … … 2290 2290 req.type_obj = type; 2291 2291 memcpy( &req.search.enum_value, avp->avp_public.avp_value, sizeof(union avp_value) ); 2292 CHECK_FCT_DO( ret = fd_dict_search(dict, DICT_ENUMVAL, ENUMVAL_BY_STRUCT, &req, &enumval, 0), goto error);2292 CHECK_FCT_DO( ret = fd_dict_search(dict, DICT_ENUMVAL, ENUMVAL_BY_STRUCT, &req, &enumval, 0), goto out ); 2293 2293 } 2294 2294 } 2295 2295 2296 2296 /* Call the callbacks */ 2297 CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, avp, session, action, app, cmd, avp->avp_model, enumval ), goto error);2297 CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, avp, session, action, app, cmd, avp->avp_model, enumval ), goto out ); 2298 2298 TEST_ACTION_STOP(); 2299 2299 } 2300 2300 /* Go to next AVP */ 2301 CHECK_FCT_DO( ret = fd_msg_browse( avp, MSG_BRW_WALK, &avp, NULL ), goto error);2301 CHECK_FCT_DO( ret = fd_msg_browse( avp, MSG_BRW_WALK, &avp, NULL ), goto out ); 2302 2302 } 2303 2303 2304 2304 /* Now call command and application callbacks */ 2305 CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_COMMAND, cmd, &cb_list), goto error);2306 CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), goto error);2305 CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_COMMAND, cmd, &cb_list), goto out ); 2306 CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), goto out ); 2307 2307 TEST_ACTION_STOP(); 2308 2308 2309 2309 if (app) { 2310 CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_APPLICATION, app, &cb_list), goto error);2311 CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), goto error);2310 CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_APPLICATION, app, &cb_list), goto out ); 2311 CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), goto out ); 2312 2312 TEST_ACTION_STOP(); 2313 2313 } 2314 2314 out: 2315 ; /* some systems would complain without this */ 2315 2316 pthread_cleanup_pop(0); 2316 2317 2317 no_error: 2318 CHECK_POSIX(pthread_rwlock_unlock(&fd_disp_lock) ); 2319 return 0; 2320 2321 error: 2322 CHECK_POSIX_DO(pthread_rwlock_unlock(&fd_disp_lock), /* ignore */ ); 2323 return ret; 2324 } 2325 2326 2318 CHECK_POSIX_DO(r2 = pthread_rwlock_unlock(&fd_disp_lock), /* ignore */ ); 2319 return ret ?: r2; 2320 } 2321 2322 -
tests/testappacct.c
r662 r690 260 260 /* That's all for the tests yet */ 261 261 free(sess_bkp); 262 fd_ext_fini();263 262 264 263 PASSTEST();
Note: See TracChangeset
for help on using the changeset viewer.