sdp.h

来自「基于sip协议的网络电话源码」· C头文件 代码 · 共 626 行 · 第 1/2 页

H
626
字号
 * * @return		PJ_SUCCESS on success. */PJ_DECL(pj_status_t) pjmedia_sdp_attr_get_rtcp(const pjmedia_sdp_attr *attr,					       pjmedia_sdp_rtcp_attr *rtcp);/* ************************************************************************** * SDP CONNECTION INFO **************************************************************************** *//** * This structure describes SDP connection info ("c=" line).  */struct pjmedia_sdp_conn{    pj_str_t	net_type;	/**< Network type ("IN").		*/    pj_str_t	addr_type;	/**< Address type ("IP4", "IP6").	*/    pj_str_t	addr;		/**< The address.			*/};/** * @see pjmedia_sdp_conn */typedef struct pjmedia_sdp_conn pjmedia_sdp_conn;/**  * Clone connection info.  *  * @param pool	    Pool to allocate memory for the new connection info. * @param rhs	    The connection into to clone. * * @return	    The new connection info. */PJ_DECL(pjmedia_sdp_conn*) pjmedia_sdp_conn_clone(pj_pool_t *pool, 						  const pjmedia_sdp_conn *rhs);/* ************************************************************************** * SDP MEDIA INFO/LINE **************************************************************************** *//** * This structure describes SDP media descriptor. A SDP media descriptor * starts with "m=" line and contains the media attributes and optional * connection line. */struct pjmedia_sdp_media{    /** Media descriptor line ("m=" line) */    struct    {	pj_str_t    media;		/**< Media type ("audio", "video")  */	pj_uint16_t port;		/**< Port number.		    */	unsigned    port_count;		/**< Port count, used only when >2  */	pj_str_t    transport;		/**< Transport ("RTP/AVP")	    */	unsigned    fmt_count;		/**< Number of formats.		    */	pj_str_t    fmt[PJMEDIA_MAX_SDP_FMT];	/**< Media formats.	    */    } desc;    pjmedia_sdp_conn *conn;		/**< Optional connection info.	    */    unsigned	     attr_count;	/**< Number of attributes.	    */    pjmedia_sdp_attr*attr[PJMEDIA_MAX_SDP_ATTR];  /**< Attributes.	    */};/** * @see pjmedia_sdp_media */typedef struct pjmedia_sdp_media pjmedia_sdp_media;/**  * Clone SDP media description.  * * @param pool	    Pool to allocate memory for the new media description. * @param rhs	    The media descriptin to clone. * * @return	    New media description. */PJ_DECL(pjmedia_sdp_media*) pjmedia_sdp_media_clone( pj_pool_t *pool, 			 const pjmedia_sdp_media *rhs);/** * Find the first occurence of the specified attribute name in the media  * descriptor. Optionally the format may be specified. * * @param m		The SDP media description. * @param name		Attribute name to find. * @param fmt		Optional payload type to match in the *			attribute list, when the attribute is \a rtpmap *			or \a fmtp. For other types of SDP attributes, this *			value should be NULL. * * @return		The first instance of the specified attribute or NULL. */PJ_DECL(pjmedia_sdp_attr*) pjmedia_sdp_media_find_attr(const pjmedia_sdp_media *m,			    const pj_str_t *name, const pj_str_t *fmt);/** * Find the first occurence of the specified attribute name in the SDP media  * descriptor. Optionally the format may be specified. * * @param m		The SDP media description. * @param name		Attribute name to find. * @param fmt		Optional payload type to match in the *			attribute list, when the attribute is \a rtpmap *			or \a fmtp. For other types of SDP attributes, this *			value should be NULL. * * @return		The first instance of the specified attribute or NULL. */PJ_DECL(pjmedia_sdp_attr*) pjmedia_sdp_media_find_attr2(const pjmedia_sdp_media *m,			     const char *name, const pj_str_t *fmt);/** * Add new attribute to the media descriptor. * * @param m		The SDP media description. * @param attr		Attribute to add. * * @return		PJ_SUCCESS or the appropriate error code. */PJ_DECL(pj_status_t) pjmedia_sdp_media_add_attr(pjmedia_sdp_media *m,						pjmedia_sdp_attr *attr);/** * Remove all attributes with the specified name from the SDP media * descriptor. * * @param m		The SDP media description. * @param name		Attribute name to remove. * * @return		The number of attributes removed. */PJ_DECL(unsigned) pjmedia_sdp_media_remove_all_attr(pjmedia_sdp_media *m,				  const char *name);/** * Remove the occurence of the specified attribute from the SDP media * descriptor. * * @param m		The SDP media descriptor. * @param attr		The attribute to find and remove. * * @return		PJ_SUCCESS if the attribute can be found and has *			been removed from the array. */PJ_DECL(pj_status_t)pjmedia_sdp_media_remove_attr(pjmedia_sdp_media *m,			      pjmedia_sdp_attr *attr);/** * Compare two SDP media for equality. * * @param sd1	    The first SDP media to compare. * @param sd2	    The second SDP media to compare. * @param option    Comparison option, which should be zero for now. * * @return	    PJ_SUCCESS when both SDP medias are equal, or the *		    appropriate status code describing which part of *		    the descriptors that are not equal. */PJ_DECL(pj_status_t) pjmedia_sdp_media_cmp(const pjmedia_sdp_media *sd1,					   const pjmedia_sdp_media *sd2,					   unsigned option);/* ************************************************************************** * SDP SESSION DESCRIPTION **************************************************************************** *//** * This structure describes SDP session description. A SDP session descriptor * contains complete information about a session, and normally is exchanged * with remote media peer using signaling protocol such as SIP. */struct pjmedia_sdp_session{    /** Session origin (o= line) */    struct    {	pj_str_t    user;	    /**< User 				*/	pj_uint32_t id;		    /**< Session ID			*/	pj_uint32_t version;	    /**< Session version		*/	pj_str_t    net_type;	    /**< Network type ("IN")		*/	pj_str_t    addr_type;	    /**< Address type ("IP4", "IP6")	*/	pj_str_t    addr;	    /**< The address.			*/    } origin;    pj_str_t	     name;	    /**< Subject line (s=)		*/    pjmedia_sdp_conn *conn;	    /**< Connection line (c=)		*/        /** Session time (t= line)	*/    struct    {	pj_uint32_t start;	    /**< Start time.			*/	pj_uint32_t stop;	    /**< Stop time.			*/    } time;    unsigned	       attr_count;		/**< Number of attributes.  */    pjmedia_sdp_attr  *attr[PJMEDIA_MAX_SDP_ATTR]; /**< Attributes array.   */    unsigned	       media_count;		/**< Number of media.	    */    pjmedia_sdp_media *media[PJMEDIA_MAX_SDP_MEDIA];	/**< Media array.   */};/** * @see pjmedia_sdp_session */typedef struct pjmedia_sdp_session pjmedia_sdp_session;/** * Parse SDP message. * * @param pool	    The pool to allocate SDP session description. * @param buf	    The message buffer. * @param len	    The length of the message. * @param p_sdp	    Pointer to receive the SDP session descriptor. * * @return	    PJ_SUCCESS if message was successfully parsed into *		    SDP session descriptor. */PJ_DECL(pj_status_t) pjmedia_sdp_parse( pj_pool_t *pool,				        char *buf, pj_size_t len, 					pjmedia_sdp_session **p_sdp );/** * Print SDP description to a buffer. * * @param sdp	    The SDP session description. * @param buf	    The buffer. * @param size	    The buffer length. * * @return	    the length printed, or -1 if the buffer is too *		    short. */PJ_DECL(int) pjmedia_sdp_print( const pjmedia_sdp_session *sdp, 				char *buf, pj_size_t size);/** * Perform semantic validation for the specified SDP session descriptor. * This function perform validation beyond just syntactic verification, * such as to verify the value of network type and address type, check * the connection line, and verify that \a rtpmap attribute is present * when dynamic payload type is used. * * @param sdp	    The SDP session descriptor to validate. * * @return	    PJ_SUCCESS on success. */PJ_DECL(pj_status_t) pjmedia_sdp_validate(const pjmedia_sdp_session *sdp);/** * Clone SDP session descriptor. * * @param pool	    The pool used to clone the session. * @param sdp	    The SDP session to clone. * * @return	    New SDP session. */PJ_DECL(pjmedia_sdp_session*) pjmedia_sdp_session_clone( pj_pool_t *pool,			   const pjmedia_sdp_session *sdp);/** * Compare two SDP session for equality. * * @param sd1	    The first SDP session to compare. * @param sd2	    The second SDP session to compare. * @param option    Must be zero for now. * * @return	    PJ_SUCCESS when both SDPs are equal, or otherwise *		    the status code indicates which part of the session *		    descriptors are not equal. */PJ_DECL(pj_status_t) pjmedia_sdp_session_cmp(const pjmedia_sdp_session *sd1,					     const pjmedia_sdp_session *sd2,					     unsigned option);PJ_END_DECL/** * @} */#endif	/* __PJMEDIA_SDP_H__ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?