Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00027 #include "parse_from.h"
00028 #include "parse_to.h"
00029 #include <stdlib.h>
00030 #include <string.h>
00031 #include "../dprint.h"
00032 #include "msg_parser.h"
00033 #include "../ut.h"
00034 #include "../mem/mem.h"
00035
00036
00044 int parse_refer_to_header( struct sip_msg *msg )
00045 {
00046 struct to_body* refer_to_b;
00047
00048 if ( !msg->refer_to &&
00049 (parse_headers(msg, HDR_REFER_TO_F,0)==-1 || !msg->refer_to)) {
00050 goto error;
00051 }
00052
00053
00054 if (msg->refer_to->parsed)
00055 return 0;
00056
00057
00058
00059 refer_to_b = pkg_malloc(sizeof(struct to_body));
00060 if (refer_to_b == 0) {
00061 LOG(L_ERR, "ERROR:parse_refer_to_header: out of pkg_memory\n");
00062 goto error;
00063 }
00064
00065
00066 memset(refer_to_b, 0, sizeof(struct to_body));
00067 parse_to(msg->refer_to->body.s,
00068 msg->refer_to->body.s + msg->refer_to->body.len+1,
00069 refer_to_b);
00070 if (refer_to_b->error == PARSE_ERROR) {
00071 LOG(L_ERR, "ERROR:parse_refer_to_header: bad Refer-To header\n");
00072 free_to(refer_to_b);
00073 goto error;
00074 }
00075 msg->refer_to->parsed = refer_to_b;
00076
00077 return 0;
00078 error:
00079 return -1;
00080 }