Commit d6ac3148 authored by Pekka Pessi's avatar Pekka Pessi

nua: Added NUA_ERROR_AT() macro

Made internally generated 900 (and 904) response phrases unique as suggested
by Jerry Richards.

darcs-hash:20080118160610-65a35-585aad7ef4702a832f8d1c34bfa179e81014bc2e.gz
parent 58be1509
......@@ -262,7 +262,7 @@ void nua_stack_authorize(nua_t *nua,
nua_stack_event(nua, nh, NULL, e, SIP_200_OK, NULL);
}
else {
nua_stack_event(nua, nh, NULL, e, NUA_INTERNAL_ERROR, NULL);
nua_stack_event(nua, nh, NULL, e, NUA_ERROR_AT(__FILE__, __LINE__), NULL);
}
}
......
......@@ -775,7 +775,7 @@ static void nua_notify_usage_refresh(nua_handle_t *nh,
return;
}
nua_stack_tevent(nh->nh_nua, nh, NULL, e, NUA_INTERNAL_ERROR,
nua_stack_tevent(nh->nh_nua, nh, NULL, e, NUA_ERROR_AT(__FILE__, __LINE__),
NUTAG_SUBSTATE(nua_substate_terminated),
TAG_END());
......
......@@ -405,7 +405,7 @@ static int nua_publish_client_response(nua_client_request_t *cr,
if (!ex || ex->ex_delta == 0)
SET_STATUS(900, "Received Invalid Expiration Time");
else
SET_STATUS1(NUA_INTERNAL_ERROR);
SET_STATUS1(NUA_ERROR_AT(__FILE__, __LINE__));
}
else
nua_dialog_usage_set_refresh(du, ex->ex_delta);
......@@ -428,7 +428,7 @@ static void nua_publish_usage_refresh(nua_handle_t *nh,
}
nua_stack_event(nh->nh_nua, nh, NULL,
nua_r_publish, NUA_INTERNAL_ERROR,
nua_r_publish, NUA_ERROR_AT(__FILE__, __LINE__),
NULL);
nua_dialog_usage_remove(nh, ds, du);
......
......@@ -1046,7 +1046,7 @@ static void nua_register_usage_refresh(nua_handle_t *nh,
}
/* Report that we have de-registered */
nua_stack_event(nua, nh, NULL, nua_r_register, NUA_INTERNAL_ERROR, NULL);
nua_stack_event(nua, nh, NULL, nua_r_register, NUA_ERROR_AT(__FILE__, __LINE__), NULL);
nua_dialog_usage_remove(nh, ds, du);
}
......
......@@ -650,7 +650,7 @@ void nua_stack_signal(nua_t *nua, su_msg_r msg, nua_ee_data_t *ee)
}
if (error < 0) {
nua_stack_event(nh->nh_nua, nh, NULL, event, NUA_INTERNAL_ERROR, NULL);
nua_stack_event(nh->nh_nua, nh, NULL, event, NUA_ERROR_AT(__FILE__, __LINE__), NULL);
}
su_msg_destroy(nua->nua_signal);
......@@ -1214,9 +1214,9 @@ nua_stack_authenticate(nua_t *nua, nua_handle_t *nh, nua_event_t e,
cr->cr_waiting = cr->cr_wait_for_cred = 0;
if (status < 0)
nua_client_response(cr, 900, "Cannot add credentials", NULL);
nua_client_response(cr, 900, "Operation cannot add credentials", NULL);
else
nua_client_response(cr, 904, "No matching challenge", NULL);
nua_client_response(cr, 904, "Operation has no matching challenge ", NULL);
}
else if (status < 0) {
nua_stack_event(nua, nh, NULL, e, 900, "Cannot add credentials", NULL);
......@@ -1984,7 +1984,7 @@ int nua_client_create(nua_handle_t *nh,
return nua_stack_event(nh->nh_nua, nh,
NULL,
event,
NUA_INTERNAL_ERROR,
NUA_ERROR_AT(__FILE__, __LINE__),
NULL);
}
......@@ -2161,7 +2161,7 @@ int nua_client_init_request(nua_client_request_t *cr)
int error = 0;
if (!cr->cr_method_name)
return nua_client_return(cr, NUA_INTERNAL_ERROR, NULL);
return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), NULL);
if (cr->cr_msg)
return nua_client_request_try(cr);
......@@ -2191,7 +2191,7 @@ int nua_client_init_request(nua_client_request_t *cr)
sip = sip_object(msg);
if (!sip)
return nua_client_return(cr, NUA_INTERNAL_ERROR, msg);
return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
if (nh->nh_tags) {
for (t = nh->nh_tags; t; t = t_next(t)) {
......@@ -2312,7 +2312,7 @@ int nua_client_init_request(nua_client_request_t *cr)
return nua_client_request_try(cr);
error:
return nua_client_return(cr, NUA_INTERNAL_ERROR, msg);
return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
}
msg_t *nua_client_request_template(nua_client_request_t *cr)
......@@ -2429,7 +2429,7 @@ int nua_client_request_try(nua_client_request_t *cr)
}
if (error < 0)
error = nua_client_response(cr, NUA_INTERNAL_ERROR, NULL);
error = nua_client_response(cr, NUA_ERROR_AT(__FILE__, __LINE__), NULL);
assert(error > 0);
return error;
......
......@@ -207,6 +207,7 @@ typedef struct nua_event_frame_s nua_event_frame_t;
extern char const nua_internal_error[];
#define NUA_INTERNAL_ERROR 900, nua_internal_error
#define NUA_ERROR_AT(file, line) 900, "Internal error at " file ":" #line
struct nua_s {
su_home_t nua_home[1];
......
......@@ -451,7 +451,7 @@ static void nua_subscribe_usage_refresh(nua_handle_t *nh,
if (!eu->eu_unsolicited)
nua_stack_tevent(nh->nh_nua, nh, NULL,
nua_i_notify, NUA_INTERNAL_ERROR,
nua_i_notify, NUA_ERROR_AT(__FILE__, __LINE__),
NUTAG_SUBSTATE(nua_substate_terminated),
SIPTAG_EVENT(du->du_event),
TAG_END());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment