1 /* 2 The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-) 3 Copyright (C) 2001-2020 Aymeric MOIZARD amoizard@antisip.com 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with this library; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 20 #ifndef _OSIP_RECORD_ROUTE_H_ 21 #define _OSIP_RECORD_ROUTE_H_ 22 23 #include <osipparser2/headers/osip_from.h> 24 25 /** 26 * @file osip_record_route.h 27 * @brief oSIP osip_record_route header definition. 28 */ 29 30 /** 31 * @defgroup oSIP_RECORD_ROUTE oSIP record-route header definition. 32 * @ingroup oSIP_HEADERS 33 * @{ 34 */ 35 36 /** 37 * Structure for Record-Route headers. 38 * @var osip_record_route_t 39 */ 40 typedef osip_from_t osip_record_route_t; 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 #ifndef MINISIZE 47 /** 48 * Allocate a Record-Route element. 49 * @param header The element to work on. 50 */ 51 int osip_record_route_init(osip_record_route_t **header); 52 /** 53 * Free a Record-Route element. 54 * @param header The element to work on. 55 */ 56 void osip_record_route_free(osip_record_route_t *header); 57 /** 58 * Parse a Record-Route element. 59 * @param header The element to work on. 60 * @param hvalue The string to parse. 61 */ 62 int osip_record_route_parse(osip_record_route_t *header, const char *hvalue); 63 /** 64 * Get a string representation of a Record-Route element. 65 * @param header The element to work on. 66 * @param dest A pointer on the new allocated string. 67 */ 68 int osip_record_route_to_str(const osip_record_route_t *header, char **dest); 69 /** 70 * Clone a Record-Route element. 71 * @param header The element to work on. 72 * @param dest A pointer on the copy of the element. 73 */ 74 #define osip_record_route_clone osip_from_clone 75 #else 76 #define osip_record_route_init osip_from_init 77 #define osip_record_route_free osip_from_free 78 #define osip_record_route_parse osip_from_parse 79 #define osip_record_route_to_str osip_from_to_str 80 #define osip_record_route_clone osip_from_clone 81 #endif 82 /** 83 * Set the url in the Record-Route element. 84 * @param header The element to work on. 85 * @param url The value of the element. 86 */ 87 #define osip_record_route_set_url(header, url) osip_from_set_url((osip_from_t *) header, url) 88 /** 89 * Get the url from a Record-Route header. 90 * @param header The element to work on. 91 */ 92 #define osip_record_route_get_url(header) osip_from_get_url((osip_from_t *) header) 93 /** 94 * Get a header parameter from a Record-Route element. 95 * @param header The element to work on. 96 * @param pos The index of the element to get. 97 * @param dest A pointer on the element found. 98 */ 99 #define osip_record_route_param_get(header, pos, dest) osip_from_param_get((osip_from_t *) header, pos, dest) 100 /** 101 * Allocate and add a generic parameter element in a list. 102 * @param header The element to work on. 103 * @param name The token name. 104 * @param value The token value. 105 */ 106 #define osip_record_route_param_add(header, name, value) osip_generic_param_add((&(header)->gen_params), name, value) 107 /** 108 * Find a header parameter in a Record-Route element. 109 * @param header The element to work on. 110 * @param name The token name to search. 111 * @param dest A pointer on the element found. 112 */ 113 #define osip_record_route_param_get_byname(header, name, dest) osip_generic_param_get_byname((&(header)->gen_params), name, dest) 114 115 #ifdef __cplusplus 116 } 117 #endif 118 119 /** @} */ 120 121 #endif 122