Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sdp_find_media_rtpmap(3commput) [opensolaris man page]

sdp_find_media_rtpmap(3COMMPUTIL)	     Communication Protocol Parser Utilities Library Functions		 sdp_find_media_rtpmap(3COMMPUTIL)

NAME
sdp_find_media_rtpmap - find the rtpmap attribute in the specified media SYNOPSIS
cc [ flag...] file... -lcommputil [ library...] #include <sdp.h> sdp_attr_t *sdp_find_media_rtpmap(sdp_media_t *media, const char *format); DESCRIPTION
The sdp_find_media_rtpmap() function searches the attribute list of the specified media structure, media, for the specified format. If the search is successful a pointer to that rtpmap attribute is returned. Otherwise it returns NULL. RETURN VALUES
The sdp_find_media_rtpmap() function returns the attribute (sdp_attr_t *) on success and NULL when the search fails or the mandatory input parameters are NULL. EXAMPLES
Example 1 An (incomplete) SDP description that contains two media sections: audio and video. m=audio 49170 RTP/AVP 0 8 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 m=video 51372 RTP/AVP 31 32 a=rtpmap:31 H261/90000 a=rtpmap:32 MPV/90000 /* * Assuming that above description is parsed using sdp_parse() and that * the parsed structure is in "session" sdp_session_t structure. */ sdp_media_t *video; sdp_attr_t *mpv; video = sdp_find_media(session->s_media, "video); mpv = sdp_find_media_rtpmap(video, "32"); /* * Now the attribute structure sdp_attr_t, mpv will be having * values from the attribute field "a=rtpmap:32 MPV/90000" */ ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
libcommputil(3LIB), sdp_parse(3COMMPUTIL), attributes(5) SunOS 5.11 12 Oct 2007 sdp_find_media_rtpmap(3COMMPUTIL)

Check Out this Related Man Page

sdp_add_origin(3COMMPUTIL)		     Communication Protocol Parser Utilities Library Functions			sdp_add_origin(3COMMPUTIL)

NAME
sdp_add_origin, sdp_add_name, sdp_add_information, sdp_add_uri, sdp_add_email, sdp_add_phone, sdp_add_connection, sdp_add_bandwidth, sdp_add_repeat, sdp_add_time, sdp_add_zone, sdp_add_key, sdp_add_attribute, sdp_add_media - add specific SDP fields to the SDP session structure SYNOPSIS
cc [ flag...] file... -lcommputil [ library...] #include <sdp.h> int sdp_add_origin(sdp_session_t *session, const char *name, uint64_t id, uint64_t ver, const char *nettype, const char *addrtype, const char *address); int sdp_add_name(sdp_session_t *session, const char *name); int sdp_add_information(char **information, const char *value); int sdp_add_uri(sdp_session_t *session, const char *uri); int sdp_add_email(sdp_session_t *session, const char *email); int sdp_add_phone(sdp_session_t *session, const char *phone); int sdp_add_connection(sdp_conn_t **conn, const char *nettype, const char *addrtype, const char *address, uint8_t ttl, int addrcount); int sdp_add_bandwidth(sdp_bandwidth_t **bw, const char *type, uint64_t value); int sdp_add_repeat(sdp_time_t *time, uint64_t interval, uint64_t duration, const char *offset); int sdp_add_time(sdp_session_t *session, uint64_t starttime, uint64_t stoptime, sdp_time_t **time); int sdp_add_zone(sdp_session_t *session, uint64_t time, const char *offset); int sdp_add_key(sdp_key_t **key, const char *method, const char *enckey); int sdp_add_attribute(sdp_attr_t **attr, const char *name, const char *value); int sdp_add_media(sdp_session_t *session, const char *name, uint_t port, int portcount, const char *protocol, const char *format, sdp_media_t **media); DESCRIPTION
The caller has to first call sdp_new_session(3COMMPUTIL) and get pointer to a session structure. Then that pointer is used as argument in the following functions and the session structure is constructed. Once the structure is built the caller converts it to a string represen- tation using sdp_session_to_str(3COMMPUTIL). The sdp_add_origin() function adds ORIGIN (o=) SDP field to the session structure (sdp_session_t) using name, id, ver, nettype, addrtype, and address. The sdp_add_name() function adds NAME (s=) SDP field to the session structure (sdp_session_t) using name. The sdp_add_information() function adds INFO (i=) SDP field to the session structure (sdp_session_t) or media structure (sdp_media_t) using value. Since this field can be either in the media section or the session section of an SDP description the caller has to pass &ses- sion->s_info or &media->m_info as the first argument. The sdp_add_uri() function adds URI (u=) SDP field to the session structure (sdp_session_t) using uri. The sdp_add_email() function adds EMAIL (e=) SDP field to the session structure (sdp_session_t) using email. The sdp_add_phone() function adds PHONE (p=) SDP field to the session structure (sdp_session_t) using phone. The sdp_add_connection() function adds CONNECTION (c=) SDP field to the session structure (sdp_session_t) or the media structure (sdp_media_t) using nettype, addrtype, address, ttl, and addrcount. While adding an IP4 or IP6 unicast address the ttl and addrcount should be set to 0. For multicast address the ttl should be set a reasonable value (0 - 255) and addrcount cannot be 0. Also since this field can be either in the media section or the session section of an SDP description, the caller has to pass &session->s_conn or &media->m_conn as the first argument. The sdp_add_bandwidth() function adds BANDWIDTH (b=) SDP field to the session structure (sdp_session_t) or the media structure (sdp_media_t) using type and value. Since this field can be either in the media section or the session section of an SDP description, the caller has to pass &session->s_bw or &media->m_bw as the first argument. The sdp_add_time() function adds the TIME (t=) SDP field to the session structure using startime and stoptime. The pointer to the newly created time structure is returned in time. This pointer is then used in sdp_add_repeat() function. The sdp_add_repeat() function adds the REPEAT (r=) SDP field to the session structure using interval, duration and offset. Here, offset is a string holding one or more offset values, for example "60" or "60 1d 3h". The sdp_add_zone() function adds the ZONE (z=) SDP field to the session structure using time and offset. To add multiple time and offset values in a single zone field, call this function once for each pair. See the example below. The sdp_add_key() function adds the KEY (k=) SDP field to the session structure (sdp_session_t) or media structure (sdp_media_t) using method and enckey. Since this field can be either in the media section or the session section of an SDP description, the caller has to pass &session->s_key or &media->m_key as the first argument. The sdp_add_attribute() function adds the ATTRIBUTE (a=) SDP field to the session structure (sdp_session_t) or media structure (sdp_media_t) using name and value. Since this field can be either in the media section or the session section of an SDP description, the caller has to pass &session->s_attr or &media->m_attr as the first argument. The sdp_add_media() function adds the MEDIA (m=) SDP field to the session structure (sdp_session_t) using name, port, portcount, protocol, and format. Here, format is a string holding possibly more than one value, for example, "0 31 32 97". The pointer to the newly created media structure is returned in media. This pointer is then used to add SDP fields specific to that media section. RETURN VALUES
These functions return 0 on success and the appropriate error value on failure. The value of errno is not changed by these calls in the event of an error. ERRORS
These functions will fail if: EINVAL Mandatory parameters are not provided (they are null). ENOMEM The allocation of memory failed. EXAMPLES
Example 1 Build an SDP session structure In the following example we see how to build an SDP session structure using the functions described on this manual page. We first get a pointer to sdp_session_t structure by calling sdp_new_session(). Then to this newly created structure we add various SDP fields. Once the structure is built we obtain a string representation of the structure using sdp_session_to_str() function. Since its caller responsibility to free the session we call sdp_free_session() towards the end. /* SDP Message we will be building "v=0 o=Alice 2890844526 2890842807 IN IP4 10.47.16.5 s=- i=A Seminar on the session description protocol u=http://www.example.com/seminars/sdp.pdf e=alice@example.com (Alice Smith) p=+1 911-345-1160 c=IN IP4 10.47.16.5 b=CT:1024 t=2854678930 2854679000 r=604800 3600 0 90000 z=2882844526 -1h 2898848070 0h a=recvonly m=audio 49170 RTP/AVP 0 i=audio media b=CT:1000 k=prompt m=video 51372 RTP/AVP 99 90 i=video media a=rtpmap:99 h232-199/90000 a=rtpmap:90 h263-1998/90000 " */ #include stdio.h> #include string.h> #include errno.h> #include sdp.h> int main () { sdp_session_t *my_sess; sdp_media_t *my_media; sdp_time_t *my_time; char *b_sdp; my_sess = sdp_new_session(); if (my_sess == NULL) { return (ENOMEM); } my_sess->version = 0; if (sdp_add_name(my_sess, "-") != 0) goto err_ret; if (sdp_add_origin(my_sess, "Alice", 2890844526ULL, 2890842807ULL, "IN", "IP4", "10.47.16.5") != 0) goto err_ret; if (sdp_add_information(&my_sess->s_info, "A Seminar on the session" "description protocol") != 0) goto err_ret; if (sdp_add_uri (my_sess, "http://www.example.com/seminars/sdp.pdf") != 0) goto err_ret; if (sdp_add_email(my_sess, "alice@example.com (Alice smith)") != 0) goto err_ret; if (sdp_add_phone(my_sess, "+1 911-345-1160") != 0) goto err_ret; if (sdp_add_connection(&my_sess->s_conn, "IN", "IP4", "10.47.16.5", 0, 0) != 0) goto err_ret; if (sdp_add_bandwidth(&my_sess->s_bw, "CT", 1024) != 0) goto err_ret; if (sdp_add_time(my_sess, 2854678930ULL, 2854679000ULL, &my_time) != 0) goto err_ret; if (sdp_add_repeat(my_time, 604800ULL, 3600ULL, "0 90000") != 0) goto err_ret; if (sdp_add_zone(my_sess, 2882844526ULL, "-1h") != 0) goto err_ret; if (sdp_add_zone(my_sess, 2898848070ULL, "0h") != 0) goto err_ret; if (sdp_add_attribute(&my_sess->s_attr, "sendrecv", NULL) != 0) goto err_ret; if (sdp_add_media(my_sess, "audio", 49170, 1, "RTP/AVP", "0", &my_media) != 0) goto err_ret; if (sdp_add_information(&my_media->m_info, "audio media") != 0) goto err_ret; if (sdp_add_bandwidth(&my_media->m_bw, "CT", 1000) != 0) goto err_ret; if (sdp_add_key(&my_media->m_key, "prompt", NULL) != 0) goto err_ret; if (sdp_add_media(my_sess, "video", 51732, 1, "RTP/AVP", "99 90", &my_media) != 0) goto err_ret; if (sdp_add_information(&my_media->m_info, "video media") != 0) goto err_ret; if (sdp_add_attribute(&my_media->m_attr, "rtpmap", "99 h232-199/90000") != 0) goto err_ret; if (sdp_add_attribute(&my_media->m_attr, "rtpmap", "90 h263-1998/90000") != 0) goto err_ret; b_sdp = sdp_session_to_str(my_sess, &error); /* * b_sdp is the string representation of my_sess structure */ free(b_sdp); sdp_free_session(my_sess); return(0); err_ret: free(b_sdp); sdp_free_session(my_sess); return(1); } ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
libcommputil(3LIB), sdp_new_session(3COMMPUTIL), sdp_parse(3COMMPUTIL), sdp_session_to_str(3COMMPUTIL), attributes(5) SunOS 5.11 12 Oct 2007 sdp_add_origin(3COMMPUTIL)
Man Page