00001 /* 00002 * $Id: parse_rr.h 4720 2008-08-23 10:56:15Z henningw $ 00003 * 00004 * Copyright (C) 2001-2003 FhG Fokus 00005 * 00006 * This file is part of Kamailio, a free SIP server. 00007 * 00008 * Kamailio is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version 00012 * 00013 * Kamailio is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 00023 /*! 00024 * \file 00025 * \brief Route & Record-Route header field parser 00026 * \ingroup parser 00027 */ 00028 00029 #ifndef PARSE_RR_H 00030 #define PARSE_RR_H 00031 00032 #include <stdio.h> 00033 #include "msg_parser.h" 00034 #include "parse_nameaddr.h" 00035 #include "parse_param.h" 00036 #include "hf.h" 00037 00038 00039 /*! 00040 * Structure representing a Route & Record-Route HF body 00041 */ 00042 typedef struct rr { 00043 name_addr_t nameaddr; /*!< Name-addr part */ 00044 param_t* r2; /*!< Hook to r2 parameter */ 00045 param_t* params; /*!< Linked list of other parameters */ 00046 int len; /*!< Length of the whole route field */ 00047 struct rr* next; /*!< Next RR in the list */ 00048 } rr_t; 00049 00050 00051 /*! 00052 * Parse Route & Record-Route header fields 00053 */ 00054 int parse_rr(struct hdr_field* _r); 00055 00056 /*! 00057 * Parse the body of Route & Record-Route headers 00058 */ 00059 int parse_rr_body(char *buf, int len, rr_t **head); 00060 00061 /*! 00062 * Free list of rr in pkg_mem 00063 * _c is head of the list 00064 */ 00065 void free_rr(rr_t** _r); 00066 00067 00068 /*! 00069 * Free list of rr in shm_mem 00070 * _c is head of the list 00071 */ 00072 void shm_free_rr(rr_t** _r); 00073 00074 00075 /*! 00076 * Print list of rrs, just for debugging 00077 */ 00078 void print_rr(FILE* _o, rr_t* _r); 00079 00080 00081 /*! 00082 * Duplicate a single (first) or the whole list of rr_t structure 00083 * using pkg_malloc 00084 */ 00085 int duplicate_rr(rr_t** _new, rr_t* _r, int _first); 00086 00087 00088 /*! 00089 * Duplicate a single (first) or the whole list of rr_t structure 00090 * using shm_malloc 00091 */ 00092 int shm_duplicate_rr(rr_t** _new, rr_t* _r, int _first); 00093 00094 /*! 00095 * print body for all RR headers in comma separated string 00096 */ 00097 int print_rr_body(struct hdr_field *iroute, str *oroute, int order, 00098 unsigned int * nb_recs); 00099 00100 /*! 00101 * Function returns the first uri 00102 * from Path without any duplication. 00103 */ 00104 int get_path_dst_uri(str *_p, str *_dst); 00105 00106 #endif /* PARSE_RR_H */
1.5.6