Commit 300a5e4d authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Add belle_sip_body_handler_remove_header_from_ptr() and...

Add belle_sip_body_handler_remove_header_from_ptr() and belle_sip_memory_handler_set_buffer() functions.
parent e5d0435d
......@@ -31,6 +31,7 @@ BELLE_SIP_BEGIN_DECLS
typedef void (*belle_sip_body_handler_progress_callback_t)(belle_sip_body_handler_t *obj, belle_sip_message_t *msg, void *user_data, size_t transfered, size_t expected_total);
BELLESIP_EXPORT void belle_sip_body_handler_add_header(belle_sip_body_handler_t *obj, belle_sip_header_t *header);
BELLESIP_EXPORT void belle_sip_body_handler_remove_header_from_ptr(belle_sip_body_handler_t *obj, belle_sip_header_t *header);
BELLESIP_EXPORT const belle_sip_list_t* belle_sip_body_handler_get_headers(const belle_sip_body_handler_t *obj);
BELLESIP_EXPORT size_t belle_sip_body_handler_get_size(const belle_sip_body_handler_t *obj);
BELLESIP_EXPORT void belle_sip_body_handler_set_size(belle_sip_body_handler_t *obj, size_t size);
......@@ -49,7 +50,8 @@ BELLESIP_EXPORT belle_sip_memory_body_handler_t *belle_sip_memory_body_handler_n
BELLESIP_EXPORT belle_sip_memory_body_handler_t *belle_sip_memory_body_handler_new_from_buffer(void *buffer, size_t bufsize,
belle_sip_body_handler_progress_callback_t cb, void *user_data);
BELLESIP_EXPORT const void *belle_sip_memory_body_handler_get_buffer(const belle_sip_memory_body_handler_t *obj);
BELLESIP_EXPORT void *belle_sip_memory_body_handler_get_buffer(const belle_sip_memory_body_handler_t *obj);
BELLESIP_EXPORT void belle_sip_memory_body_handler_set_buffer(belle_sip_memory_body_handler_t *obj, void *buffer);
/*
* body handler that get/puts data from application.
......
......@@ -32,14 +32,6 @@ struct belle_sip_body_handler{
void *user_data;
};
void belle_sip_body_handler_add_header(belle_sip_body_handler_t *obj, belle_sip_header_t *header) {
if (header != NULL) {
obj->headers=belle_sip_list_append(obj->headers,belle_sip_object_ref(header));
}
}
const belle_sip_list_t* belle_sip_body_handler_get_headers(const belle_sip_body_handler_t *obj) {
return obj->headers;
}
static void belle_sip_body_handler_clone(belle_sip_body_handler_t *obj, const belle_sip_body_handler_t *orig){
obj->progress_cb=orig->progress_cb;
obj->user_data=orig->user_data;
......@@ -76,6 +68,24 @@ void belle_sip_body_handler_init(belle_sip_body_handler_t *obj, belle_sip_body_h
obj->headerStringBuffer = NULL; /* header string buffer is set when adding a body handler to a multipart body handler */
}
void belle_sip_body_handler_add_header(belle_sip_body_handler_t *obj, belle_sip_header_t *header) {
if (header != NULL) {
obj->headers=belle_sip_list_append(obj->headers,belle_sip_object_ref(header));
}
}
void belle_sip_body_handler_remove_header_from_ptr(belle_sip_body_handler_t *obj, belle_sip_header_t* header) {
belle_sip_list_t* it = belle_sip_list_find(obj->headers, header);
if (it) {
belle_sip_object_unref(header);
obj->headers = belle_sip_list_delete_link(obj->headers, it);
}
}
const belle_sip_list_t* belle_sip_body_handler_get_headers(const belle_sip_body_handler_t *obj) {
return obj->headers;
}
size_t belle_sip_body_handler_get_size(const belle_sip_body_handler_t *obj){
return obj->expected_size;
}
......@@ -177,10 +187,14 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_memory_body_handler_t)
}
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
const void *belle_sip_memory_body_handler_get_buffer(const belle_sip_memory_body_handler_t *obj){
void *belle_sip_memory_body_handler_get_buffer(const belle_sip_memory_body_handler_t *obj){
return obj->buffer;
}
void belle_sip_memory_body_handler_set_buffer(belle_sip_memory_body_handler_t *obj, void *buffer) {
obj->buffer = (uint8_t *)buffer;
}
belle_sip_memory_body_handler_t *belle_sip_memory_body_handler_new(belle_sip_body_handler_progress_callback_t cb, void *user_data){
belle_sip_memory_body_handler_t *obj=belle_sip_object_new(belle_sip_memory_body_handler_t);
belle_sip_body_handler_init((belle_sip_body_handler_t*)obj,cb,user_data);
......
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