Commit d4f8dbde authored by jehan's avatar jehan

add belle_sip_header_route_create

parent e5ae98ea
......@@ -263,8 +263,10 @@ belle_sip_header_expires_t* belle_sip_header_expires_create(int expires);
belle_sip_header_route_t* belle_sip_header_route_new();
belle_sip_header_route_t* belle_sip_header_route_parse (const char* route) ;
belle_sip_header_route_t* belle_sip_header_route_create(const belle_sip_header_address_t* route);
#define BELLE_SIP_HEADER_ROUTE(t) BELLE_SIP_CAST(t,belle_sip_header_route_t)
#define BELLE_SIP_ROUTE "Route"
/******************************
* Record route header object inherent from header_address
*
......
......@@ -546,8 +546,13 @@ static void belle_sip_header_route_clone(belle_sip_header_route_t* route, const
int belle_sip_header_route_marshal(belle_sip_header_route_t* route, char* buff,unsigned int offset,unsigned int buff_size) {
BELLE_SIP_FROM_LIKE_MARSHAL(route)
}
BELLE_SIP_NEW_HEADER(header_route,header_address,"Route")
BELLE_SIP_NEW_HEADER(header_route,header_address,BELLE_SIP_ROUTE)
BELLE_SIP_PARSE(header_route)
belle_sip_header_route_t* belle_sip_header_route_create(const belle_sip_header_address_t* route) {
belle_sip_header_route_t* header= belle_sip_header_route_new();
belle_sip_header_address_clone(BELLE_SIP_HEADER_ADDRESS(header),BELLE_SIP_HEADER_ADDRESS(route));
return header;
}
/**************************
* Record route header object inherent from header_address
****************************
......
......@@ -251,8 +251,10 @@ void test_header_record_route(void) {
belle_sip_object_unref(BELLE_SIP_OBJECT(L_record_route));
}
void test_header_route(void) {
belle_sip_header_route_t* L_route = belle_sip_header_route_parse("Route: <sip:212.27.52.5:5060;transport=udp;lr>;charset=ISO-8859-4");
belle_sip_header_address_t* address = belle_sip_header_address_parse("<sip:212.27.52.5:5060;transport=udp;lr>;charset=ISO-8859-4");
CU_ASSERT_PTR_NOT_NULL_FATAL(address);
belle_sip_header_route_t* L_route = belle_sip_header_route_create(address);
CU_ASSERT_PTR_NOT_NULL_FATAL(L_route);
char* l_raw_header = belle_sip_object_to_string(BELLE_SIP_OBJECT(L_route));
belle_sip_object_unref(BELLE_SIP_OBJECT(L_route));
L_route = belle_sip_header_route_parse(l_raw_header);
......
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