Commit b3ed7ad2 authored by Simon Morlat's avatar Simon Morlat

add new method to create dialog-queued requests from another request

parent 491ba6f2
......@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT([belle-sip], [1.2.0], [jehan.monnier@linphone.org])
AC_INIT([belle-sip], [1.2.1], [jehan.monnier@linphone.org])
AC_CONFIG_SRCDIR([src/belle_sip_utils.c])
AC_CONFIG_HEADERS([config.h])
......
......@@ -35,6 +35,10 @@ BELLESIP_EXPORT const char* belle_sip_dialog_state_to_string(const belle_sip_dia
BELLESIP_EXPORT belle_sip_request_t *belle_sip_dialog_create_ack(belle_sip_dialog_t *dialog, unsigned int cseq);
/**
* Create a request part of this dialog.
**/
BELLESIP_EXPORT belle_sip_request_t *belle_sip_dialog_create_request(belle_sip_dialog_t *dialog, const char *method);
/**
* Create a request within a dialog keeping non system header from an initial request. This function is very useful to resend request after expiration or chalenge.
......@@ -44,8 +48,20 @@ BELLESIP_EXPORT belle_sip_request_t *belle_sip_dialog_create_request(belle_sip_d
*/
BELLESIP_EXPORT belle_sip_request_t * belle_sip_dialog_create_request_from(belle_sip_dialog_t *obj, const belle_sip_request_t *initial_req);
/**
* Create a new request part of this dialog. If dialog is busy (pending transaction), the request can be created anyway and will be sent by the transaction
* when the dialog becomes available.
**/
BELLESIP_EXPORT belle_sip_request_t * belle_sip_dialog_create_queued_request(belle_sip_dialog_t *obj, const char *method);
/**
* Create a new request part of this dialog keeping non system header from an initial request. If dialog is busy (pending transaction), the request can be created anyway and will be sent by the transaction
* when the dialog becomes available.
* @param obj dialog associated to the request
* @param initial_req, all headers + body are re-used from this request except: Via,From, To, Allows, CSeq, Call-ID, Max-Forwards
**/
BELLESIP_EXPORT belle_sip_request_t *belle_sip_dialog_create_queued_request_from(belle_sip_dialog_t *obj, const belle_sip_request_t *initial_req);
BELLESIP_EXPORT void belle_sip_dialog_delete(belle_sip_dialog_t *dialog);
BELLESIP_EXPORT void *belle_sip_dialog_get_application_data(const belle_sip_dialog_t *dialog);
......
......@@ -581,11 +581,20 @@ static void copy_non_system_headers(belle_sip_header_t* header,belle_sip_request
}
}
belle_sip_request_t *belle_sip_dialog_create_request_from(belle_sip_dialog_t *obj, const belle_sip_request_t *initial_req){
belle_sip_request_t* req = belle_sip_dialog_create_request(obj, belle_sip_request_get_method(initial_req));
belle_sip_header_content_length_t* content_lenth = belle_sip_message_get_header_by_type(initial_req,belle_sip_header_content_length_t);
static belle_sip_request_t *_belle_sip_dialog_create_request_from(belle_sip_dialog_t *obj, const belle_sip_request_t *initial_req, int queued){
belle_sip_request_t* req;
const char *method=belle_sip_request_get_method(initial_req);
belle_sip_header_content_length_t* content_lenth;
belle_sip_list_t* headers;
if (queued) req=belle_sip_dialog_create_queued_request(obj,method);
else req=belle_sip_dialog_create_request(obj,method);
if (req==NULL) return NULL;
content_lenth = belle_sip_message_get_header_by_type(initial_req,belle_sip_header_content_length_t);
/*first copy non system headers*/
belle_sip_list_t* headers = belle_sip_message_get_all_headers(BELLE_SIP_MESSAGE(initial_req));
headers = belle_sip_message_get_all_headers(BELLE_SIP_MESSAGE(initial_req));
belle_sip_list_for_each2(headers,(void (*)(void *, void *))copy_non_system_headers,req);
belle_sip_list_free(headers);
......@@ -603,6 +612,14 @@ belle_sip_request_t *belle_sip_dialog_create_request_from(belle_sip_dialog_t *ob
return req;
}
belle_sip_request_t *belle_sip_dialog_create_request_from(belle_sip_dialog_t *obj, const belle_sip_request_t *initial_req){
return _belle_sip_dialog_create_request_from(obj,initial_req,FALSE);
}
belle_sip_request_t *belle_sip_dialog_create_queued_request_from(belle_sip_dialog_t *obj, const belle_sip_request_t *initial_req){
return _belle_sip_dialog_create_request_from(obj,initial_req,TRUE);
}
void belle_sip_dialog_delete(belle_sip_dialog_t *obj){
int dropped_transactions;
......
......@@ -268,7 +268,7 @@ static void belle_sip_request_destroy(belle_sip_request_t* request) {
if (request->dialog) belle_sip_object_unref(request->dialog);
}
static void belle_sip_request_init(belle_sip_request_t *message){
static void belle_sip_request_init(belle_sip_request_t *message){
}
static void belle_sip_request_clone(belle_sip_request_t *request, const belle_sip_request_t *orig){
......
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