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_rpid_header( struct sip_msg *msg )
00045 {
00046 struct to_body* rpid_b;
00047
00048 if ( !msg->rpid && (parse_headers(msg, HDR_RPID_F, 0)==-1 || !msg->rpid)) {
00049 goto error;
00050 }
00051
00052
00053 if (msg->rpid->parsed)
00054 return 0;
00055
00056
00057
00058 rpid_b = pkg_malloc(sizeof(struct to_body));
00059 if (rpid_b == 0) {
00060 LOG(L_ERR, "ERROR:parse_rpid_header: out of pkg_memory\n");
00061 goto error;
00062 }
00063
00064
00065 memset(rpid_b, 0, sizeof(struct to_body));
00066 parse_to(msg->rpid->body.s,msg->rpid->body.s+msg->rpid->body.len+1,rpid_b);
00067 if (rpid_b->error == PARSE_ERROR) {
00068 LOG(L_ERR, "ERROR:parse_rpid_header: bad rpid header\n");
00069 free_to(rpid_b);
00070 goto error;
00071 }
00072 msg->rpid->parsed = rpid_b;
00073
00074 return 0;
00075 error:
00076 return -1;
00077 }