📄 smsg.h
字号:
from_t *msg_getfrom (sip_t * sip);/** * Set the mime-version header. * @param sip The element to work on. * @param hvalue The string describing the element. */ int msg_setmime_version (sip_t * sip, char *hvalue);/** * Get the Mime-version header. * @param sip The element to work on. */ mime_version_t *msg_getmime_version (sip_t * sip);/** * Set the Proxy-authenticate header. * @param sip The element to work on. * @param hvalue The string describing the element. */ int msg_setproxy_authenticate (sip_t * sip, char *hvalue);/** * Get the Proxy-authenticate 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. */ int msg_getproxy_authenticate (sip_t * sip, int pos, proxy_authenticate_t ** dest);/** * Set the Proxy-authorization header. * @param sip The element to work on. * @param hvalue The string describing the element. */ int msg_setproxy_authorization (sip_t * sip, char *hvalue);/** * Get one Proxy-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. */ int msg_getproxy_authorization (sip_t * sip, int pos, proxy_authorization_t ** dest);/** * Set the Record-Route header. * @param sip The element to work on. * @param hvalue The string describing the element. */ int msg_setrecord_route (sip_t * sip, char *hvalue);/** * Get one Record-route 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. */ int msg_getrecord_route (sip_t * sip, int pos, record_route_t ** dest);/** * Set the Route header. * @param sip The element to work on. * @param hvalue The string describing the element. */ int msg_setroute (sip_t * sip, char *hvalue);/** * Get one Route 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. */ int msg_getroute (sip_t * sip, int pos, route_t ** dest);/** * Set the To header. * @param sip The element to work on. * @param hvalue The string describing the element. */ int msg_setto (sip_t * sip, char *hvalue);/** * Get the To header. * @param sip The element to work on. */ to_t *msg_getto (sip_t * sip);/** * Set the Via header. * @param sip The element to work on. * @param hvalue The string describing the element. */ int msg_setvia (sip_t * sip, char *hvalue);/** * Get one Via 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. */ int msg_getvia (sip_t * sip, int pos, via_t ** dest);/** * Set the Www-authenticate header. * @param sip The element to work on. * @param hvalue The string describing the element. */ int msg_setwww_authenticate (sip_t * sip, char *hvalue);/** * Get one Www-authenticate 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. */ int msg_getwww_authenticate (sip_t * sip, int pos, www_authenticate_t ** dest);/** * Allocate and Add an "unknown" header (not defined in oSIP). * @param sip The element to work on. * @param hname The token name. * @param hvalue The token value. */ int msg_setheader (sip_t * sip, char *hname, char *hvalue);/** * Allocate and Add an "unknown" header (not defined in oSIP). * The element is add on the top of the unknown header list. * @param sip The element to work on. * @param hname The token name. * @param hvalue The token value. */ int msg_settopheader (sip_t * sip, char *hname, char *hvalue);/** * Find an "unknown" header. (not defined in oSIP) * @param sip The element to work on. * @param hname The name of the header to find. * @param pos The index where to start searching for the header. * @param dest A pointer to the header found. */ int msg_header_getbyname (sip_t * sip, char *hname, int pos, header_t ** dest);/** * Get one "unknown" 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. */ int msg_getheader (sip_t * sip, int pos, header_t ** dest);/** * Set the Body of the SIP message. * @param sip The element to work on. * @param buf The string containing the body. */ int msg_setbody (sip_t * sip, char *buf);/** * Set a type for a body. (NOT TESTED! use with care) * @param sip The element to work on. * @param buf the mime type of body. */ int msg_setbody_mime (sip_t * sip, char *buf);/** * Get one body header. * @param sip The element to work on. * @param pos The index of the element to get. * @param dest A pointer on the body found. */ int msg_getbody (sip_t * sip, int pos, body_t ** dest);/* * These are helpfull MACROs to test messages type. *//** * Test if the message is a SIP RESPONSE * @param msg the SIP message. */#define MSG_IS_RESPONSE(msg) ((msg)->strtline->statuscode!=NULL)/** * Test if the message is a SIP REQUEST * @param msg the SIP message. */#define MSG_IS_REQUEST(msg) ((msg)->strtline->statuscode==NULL)/** * Test if the message is an INVITE REQUEST * @param msg the SIP message. */#define MSG_IS_INVITE(msg) (MSG_IS_REQUEST(msg) && \ 0==strncmp((msg)->strtline->sipmethod,"INVITE",6))/** * Test if the message is an ACK REQUEST * @param msg the SIP message. */#define MSG_IS_ACK(msg) (MSG_IS_REQUEST(msg) && \ 0==strncmp((msg)->strtline->sipmethod,"ACK",3))/** * Test if the message is a REGISTER REQUEST * @param msg the SIP message. */#define MSG_IS_REGISTER(msg) (MSG_IS_REQUEST(msg) && \ 0==strncmp((msg)->strtline->sipmethod,"REGISTER",8))/** * Test if the message is a BYE REQUEST * @param msg the SIP message. */#define MSG_IS_BYE(msg) (MSG_IS_REQUEST(msg) && \ 0==strncmp((msg)->strtline->sipmethod,"BYE",3))/** * Test if the message is an OPTIONS REQUEST * @param msg the SIP message. */#define MSG_IS_OPTIONS(msg) (MSG_IS_REQUEST(msg) && \ 0==strncmp((msg)->strtline->sipmethod,"OPTIONS",7))/** * Test if the message is an INFO REQUEST * @param msg the SIP message. */#define MSG_IS_INFO(msg) (MSG_IS_REQUEST(msg) && \ 0==strncmp((msg)->strtline->sipmethod,"INFO",4))/** * Test if the message is a CANCEL REQUEST * @param msg the SIP message. */#define MSG_IS_CANCEL(msg) (MSG_IS_REQUEST(msg) && \ 0==strncmp((msg)->strtline->sipmethod,"CANCEL",6))/** * Test if the message is a REFER REQUEST * @param msg the SIP message. */#define MSG_IS_REFER(msg) (MSG_IS_REQUEST(msg) && \ 0==strncmp((msg)->strtline->sipmethod,"REFER",5))/** * Test if the message is a NOTIFY REQUEST * @param msg the SIP message. */#define MSG_IS_NOTIFY(msg) (MSG_IS_REQUEST(msg) && \ 0==strncmp((msg)->strtline->sipmethod,"NOTIFY",6))/** * Test if the message is a SUBSCRIBE REQUEST * @param msg the SIP message. */#define MSG_IS_SUBSCRIBE(msg) (MSG_IS_REQUEST(msg) && \ 0==strncmp((msg)->strtline->sipmethod,"SUBSCRIBE",9))/** * Test if the message is a MESSAGE REQUEST * @param msg the SIP message. */#define MSG_IS_MESSAGE(msg) (MSG_IS_REQUEST(msg) && \ 0==strncmp((msg)->strtline->sipmethod,"MESSAGE",7))/** * Test if the message is a PRACK REQUEST (!! PRACK IS NOT SUPPORTED by the fsm!!) * @param msg the SIP message. */#define MSG_IS_PRACK(msg) (MSG_IS_REQUEST(msg) && \ 0==strncmp((msg)->strtline->sipmethod,"PRACK",5))/** * Test if the message is a response with status between 100 and 199 * @param msg the SIP message. */#define MSG_IS_STATUS_1XX(msg) (MSG_IS_RESPONSE(msg) && \ 0==strncmp((msg)->strtline->statuscode,"1",1))/** * Test if the message is a response with status between 200 and 299 * @param msg the SIP message. */#define MSG_IS_STATUS_2XX(msg) (MSG_IS_RESPONSE(msg) && \ 0==strncmp((msg)->strtline->statuscode,"2",1))/** * Test if the message is a response with status between 300 and 399 * @param msg the SIP message. */#define MSG_IS_STATUS_3XX(msg) (MSG_IS_RESPONSE(msg) && \ 0==strncmp((msg)->strtline->statuscode,"3",1))/** * Test if the message is a response with status between 400 and 499 * @param msg the SIP message. */#define MSG_IS_STATUS_4XX(msg) (MSG_IS_RESPONSE(msg) && \ 0==strncmp((msg)->strtline->statuscode,"4",1))/** * Test if the message is a response with status between 500 and 599 * @param msg the SIP message. */#define MSG_IS_STATUS_5XX(msg) (MSG_IS_RESPONSE(msg) && \ 0==strncmp((msg)->strtline->statuscode,"5",1))/** * Test if the message is a response with status between 600 and 699 * @param msg the SIP message. */#define MSG_IS_STATUS_6XX(msg) (MSG_IS_RESPONSE(msg) && \ 0==strncmp((msg)->strtline->statuscode,"6",1))/** * Test if the message is a response with a status set to the code value. * @param msg the SIP message. * @param code the status code. */#define MSG_TEST_CODE(msg,code) (MSG_IS_RESPONSE(msg) && \ code==(int)satoi((msg)->strtline->statuscode))/** * Test if the message is a response for a REQUEST of certain type * @param msg the SIP message. * @param requestname the method name to match. */#define MSG_IS_RESPONSEFOR(msg,requestname) (MSG_IS_RESPONSE(msg) && \ 0==strcmp((msg)->cseq->method,requestname))/** * Allocate a body_t element. * @param body The element to work on. */ int body_init (body_t ** body);/** * Free a body_t element. * @param body The element to work on. */ void body_free (body_t * body);/** * Parse a body_t element. * @param body The element to work on. * @param buf The buffer to parse. */ int body_parse (body_t * body, char *buf);/** * Parse a body_t element. (for mime message format) (NOT TESTED, use with care) * @param body The element to work on. * @param buf The buffer to parse. */ int body_parse_mime (body_t * body, char *buf);/** * Get a string representation of a body_t element. * @param body The element to work on. * @param dest The resulting buffer. */ int body_2char (body_t * body, char **dest);/** * Allocate a generic parameter element. * @param GP The element to work on. */#define generic_param_init(GP) url_param_init(GP)/** * Free a generic parameter element. * @param GP The element to work on. */#define generic_param_free(GP) url_param_free(GP)/** * Set values of a generic parameter element. * @param GP The element to work on. * @param NAME The token name. * @param VALUE The token value. */#define generic_param_set(GP, NAME, VALUE) url_param_set(GP, NAME, VALUE)/** * Clone a generic parameter element. * @param GP The element to work on. * @param DEST The resulting new allocated buffer. */#define generic_param_clone(GP,DEST) url_param_clone(GP,DEST)#ifndef DOXYGEN/* * Free a list of a generic parameter element. * @param LIST The list of generic parameter element to free. */#define generic_param_freelist(LIST) url_param_freelist(LIST)#endif/** * Allocate and add a generic parameter element in a list. * @param LIST The list of generic parameter element to work on. * @param NAME The token name. * @param VALUE The token value. */#define generic_param_add(LIST,NAME,VALUE) url_param_add(LIST,NAME,VALUE)/** * Find in a generic parameter element in a list. * @param LIST The list of generic parameter element to work on. * @param NAME The name of the parameter element to find. * @param DEST A pointer on the element found. */#define generic_param_getbyname(LIST,NAME,DEST) url_param_getbyname(LIST,NAME,DEST)/** * Set the name of a generic parameter element. * @param generic_param The element to work on. * @param name the token name to set. */ void generic_param_setname (generic_param_t * generic_param, char *name);/** * Get the name of a generic parameter element. * @param generic_param The element to work on. */ char *generic_param_getname (generic_param_t * generic_param);/** * Set the value of a generic parameter element. * @param generic_param The element to work on. * @param value the token name to set. */ void generic_param_setvalue (generic_param_t * generic_param, char *value);/** * Get the value of a generic parameter element. * @param generic_param The element to work on. */ char *generic_param_getvalue (generic_param_t * generic_param);/** * Allocate a header element. * @param header The element to work on.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -