📄 osip_parser.h
字号:
/* The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-) Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Aymeric MOIZARD jack@atosc.org This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/#ifndef _OSIP_PARSER_H_#define _OSIP_PARSER_H_#include <osipparser2/osip_message.h>/** * @file osip_parser.h * @brief oSIP SIP Parser additionnal Routines * *//** * @defgroup oSIP_PARSER oSIP parser Handling * @ingroup osip2_parser * @{ */#ifdef __cplusplusextern "C"{#endif/** * Initialise the oSIP parser. */ int parser_init (void);/** * Fix the via header for INCOMING requests only. * a copy of ip_addr is done. */ int osip_message_fix_last_via_header (osip_message_t * request, const char *ip_addr, int port);/** * define this macro to avoid building several times * the message on retransmissions. If you have changed * the osip_message_t element since last call of osip_message_to_str() you * can call osip_message_force_update() to force a rebuild.*//** * Check if the element is already built. (so osip_message_to_str won't build it again) * @param sip The element to check.*/ int osip_message_get__property (const osip_message_t * sip);/** * Force a osip_message_t element to be rebuild on next osip_message_to_str() call. * @param sip The element to work on. */ int osip_message_force_update (osip_message_t * sip);/** * Get the usual reason phrase as defined in SIP for a specific status code. * @param status_code A status code. */ const char *osip_message_get_reason (int status_code);/** * Set the Accept header. * @param sip The element to work on. * @param hvalue The string describing the element. */#ifndef MINISIZE int osip_message_set_accept (osip_message_t * sip, const char *hvalue);#else#define osip_message_set_accept(sip,value) osip_message_set_header((osip_message_t *)sip,(const char *)"Accept",value)#endif/** * Get one Accept header. * @param sip The element to work on. * @param pos The index of the element to get. * @param dest A pointer on the header found. */#ifndef MINISIZE int osip_message_get_accept (const osip_message_t * sip, int pos, osip_accept_t ** dest);#else#define osip_message_get_accept(sip,pos,dest) osip_message_header_get_byname(( osip_message_t *)sip,(const char *)"accept",pos,(osip_header_t **)dest)#endif/** * Set the Accept-encoding header. * @param sip The element to work on. * @param hvalue The string describing the element. */#ifndef MINISIZE int osip_message_set_accept_encoding (osip_message_t * sip, const char *hvalue);#else#define osip_message_set_accept_encoding(sip,value) osip_message_set_header((osip_message_t *)sip,(const char *)"Accept-Encoding",value)#endif/** * Get one Accept-encoding header. * @param sip The element to work on. * @param pos The index of the element to get. * @param dest A pointer on the header found. */#ifndef MINISIZE int osip_message_get_accept_encoding (const osip_message_t * sip, int pos, osip_accept_encoding_t ** dest);#else#define osip_message_get_accept_encoding(sip,pos,dest) osip_message_header_get_byname(( osip_message_t *)sip,(const char *)"accept-encoding",pos,(osip_header_t **)dest)#endif/** * Set the Accept-language header. * @param sip The element to work on. * @param hvalue The string describing the element. */#ifndef MINISIZE int osip_message_set_accept_language (osip_message_t * sip, const char *hvalue);#else#define osip_message_set_accept_language(sip,value) osip_message_set_header((osip_message_t *)sip,(const char *)"Accept-Language",value)#endif/** * Get one Accept-Language header. * @param sip The element to work on. * @param pos The index of the element to get. * @param dest A pointer on the header found. */#ifndef MINISIZE int osip_message_get_accept_language (const osip_message_t * sip, int pos, osip_accept_language_t ** dest);#else#define osip_message_get_accept_language(sip,pos,dest) osip_message_header_get_byname(( osip_message_t *)sip,(const char *)"accept-language",pos,(osip_header_t **)dest)#endif/** * Set the Alert-info header. * @param sip The element to work on. * @param hvalue The string describing the element. */#ifndef MINISIZE int osip_message_set_alert_info (osip_message_t * sip, const char *hvalue);#else#define osip_message_set_alert_info(sip,value) osip_message_set_header((osip_message_t *)sip,(const char *)"Alert-Info",value)#endif/** * Get one Alert-info header. * @param sip The element to work on. * @param pos The index of the element to get. * @param dest A pointer on the header found. */#ifndef MINISIZE int osip_message_get_alert_info (const osip_message_t * sip, int pos, osip_alert_info_t ** dest);#else#define osip_message_get_alert_info(sip,pos,dest) osip_message_header_get_byname(( osip_message_t *)sip,(const char *)"alert-info",pos,(osip_header_t **)dest)#endif/** * Set the Allow header. * @param sip The element to work on. * @param hvalue The string describing the element. */#ifndef MINISIZE int osip_message_set_allow (osip_message_t * sip, const char *hvalue);#else#define osip_message_set_allow(sip,value) osip_message_set_header((osip_message_t *)sip,(const char *)"Allow",value)#endif/** * Get one Allow header. * @param sip The element to work on. * @param pos The index of the element to get. * @param dest A pointer on the header found. */#ifndef MINISIZE int osip_message_get_allow (const osip_message_t * sip, int pos, osip_allow_t ** dest);#else#define osip_message_get_allow(sip,pos,dest) osip_message_header_get_byname(( osip_message_t *)sip,(const char *)"allow",pos,(osip_header_t **)dest)#endif/** * Set the Authentication-info header. * @param sip The element to work on. * @param hvalue The string describing the element. */#ifndef MINISIZE int osip_message_set_authentication_info (osip_message_t * sip, const char *hvalue);#else#define osip_message_set_authentication_info(sip,value) osip_message_set_header((osip_message_t *)sip,(const char *)"Authentication-Info",value)#endif/** * Get one Authentication-info header. * @param sip The element to work on. * @param pos The index of the element to get. * @param dest A pointer on the header found. */#ifndef MINISIZE int osip_message_get_authentication_info (const osip_message_t * sip, int pos, osip_authentication_info_t ** dest);#else#define osip_message_get_authentication_info(sip,pos,dest) osip_message_header_get_byname(( osip_message_t *)sip,(const char *)"authentication-info",pos,(osip_header_t **)dest)#endif/** * Set the Authorization header. * @param sip The element to work on. * @param hvalue The string describing the element. */ int osip_message_set_authorization (osip_message_t * sip, const char *hvalue);/** * Get one Authorization header. * @param sip The element to work on. * @param pos The index of the element to get. * @param dest A pointer on the header found. */#ifndef MINISIZE int osip_message_get_authorization (const osip_message_t * sip, int pos, osip_authorization_t ** dest);#else#define osip_message_get_authorization(sip, pos, dest) osip_message_get_knownheaderlist((&(sip)->authorizations), pos, (void **)(dest))#endif/** * Set the Call-id header. * @param sip The element to work on. * @param hvalue The string describing the element. */ int osip_message_set_call_id (osip_message_t * sip, const char *hvalue);/** * Get one Call-id header. * @param sip The element to work on. */#ifndef MINISIZE osip_call_id_t *osip_message_get_call_id (const osip_message_t * sip);#else#define osip_message_get_call_id(sip) ((sip)->call_id)#endif/** * Set the Call-info header. * @param sip The element to work on. * @param hvalue The string describing the element. */#ifndef MINISIZE int osip_message_set_call_info (osip_message_t * sip, const char *hvalue);#else#define osip_message_set_call_info(sip,value) osip_message_set_header((osip_message_t *)sip,(const char *)"Call-Info",value)#endif/** * Get one Call-info header. * @param sip The element to work on. * @param pos The index of the element to get. * @param dest A pointer on the header found. */#ifndef MINISIZE int osip_message_get_call_info (const osip_message_t * sip, int pos, osip_call_info_t ** dest);#else#define osip_message_get_call_info(sip,pos,dest) osip_message_header_get_byname(( osip_message_t *)sip,(const char *)"call-info",pos,(osip_header_t **)dest)#endif/** * Set the Contact header. * @param sip The element to work on. * @param hvalue The string describing the element. */ int osip_message_set_contact (osip_message_t * sip, const char *hvalue);/** * Get one Contact header. * @param sip The element to work on. * @param pos The index of the element to get. * @param dest A pointer on the header found. */#ifndef MINISIZE int osip_message_get_contact (const osip_message_t * sip, int pos, osip_contact_t ** dest);#else#define osip_message_get_contact(sip, pos, dest) osip_message_get_knownheaderlist((&(sip)->contacts), pos, (void **)(dest)) #endif/** * Set the Content-encoding header. * @param sip The element to work on. * @param hvalue The string describing the element. */#ifndef MINISIZE int osip_message_set_content_encoding (osip_message_t * sip, const char *hvalue);#else#define osip_message_set_content_encoding(sip,value) osip_message_set_header((osip_message_t *)sip,(const char *)"Content-Encoding",value)#endif/** * Get one Content-encoding header. * @param sip The element to work on. * @param pos The index of the element to get. * @param dest A pointer on the header found. */#ifndef MINISIZE int osip_message_get_content_encoding (const osip_message_t * sip, int pos, osip_content_encoding_t ** dest);#else#define osip_message_get_content_encoding(sip,pos,dest) osip_message_header_get_byname(( osip_message_t *)sip,(const char *)"content-encoding",pos,(osip_header_t **)dest)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -