From 42cd3a38756cc1baef47cd808273435518c56401 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Sun, 1 Aug 2010 09:24:58 +0000 Subject: Re #1070 (support for multipart bodies): modified the param field of pjsip_media_type from a simple string to pjsip_param, to support a more complex use of this field git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3241 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/include/pjsip/sip_msg.h | 49 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'pjsip/include') diff --git a/pjsip/include/pjsip/sip_msg.h b/pjsip/include/pjsip/sip_msg.h index 489fb025..4c112dc9 100644 --- a/pjsip/include/pjsip/sip_msg.h +++ b/pjsip/include/pjsip/sip_msg.h @@ -515,10 +515,44 @@ typedef struct pjsip_media_type { pj_str_t type; /**< Media type. */ pj_str_t subtype; /**< Media subtype. */ - pj_str_t param; /**< Media type parameters (concatenated). */ + pjsip_param param; /**< Media type parameters */ } pjsip_media_type; +/** + * Initialize the media type with the specified type and subtype string. + * + * @param mt The media type. + * @param type Optionally specify the media type. + * @param subtype Optionally specify the media subtype. + */ +PJ_DECL(void) pjsip_media_type_init(pjsip_media_type *mt, + pj_str_t *type, + pj_str_t *subtype); + +/** + * Initialize the media type with the specified type and subtype string. + * + * @param mt The media type. + * @param type Optionally specify the media type. + * @param subtype Optionally specify the media subtype. + */ +PJ_DECL(void) pjsip_media_type_init2(pjsip_media_type *mt, + char *type, + char *subtype); + +/** + * Compare two media types. + * + * @param mt1 The first media type. + * @param mt2 The second media type. + * + * @return Zero if both media types are equal, -1 if mt1 < mt2, + * 1 if mt1 > mt2. + */ +PJ_DECL(int) pjsip_media_type_cmp(const pjsip_media_type *mt1, + const pjsip_media_type *mt2); + /** * Copy SIP media type to another. * @@ -530,6 +564,19 @@ PJ_DECL(void) pjsip_media_type_cp(pj_pool_t *pool, pjsip_media_type *dst, const pjsip_media_type *src); +/** + * Print media type to the specified buffer. + * + * @param buf Destination buffer. + * @param len Length of the buffer. + * @param mt The media type to be printed. + * + * @return The number of characters printed to the buffer, or -1 + * if there's not enough space in the buffer. + */ +PJ_DECL(int) pjsip_media_type_print(char *buf, unsigned len, + const pjsip_media_type *mt); + /** * @} */ -- cgit v1.2.3