sdp_accessor.c

Go to the documentation of this file.
00001 
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025 
00026 #include "osip_const.h"
00027 #include "osip_port.h"
00028 #include "sdp_message.h"
00029 
00030 int
00031 sdp_message_v_version_set (sdp_message_t * sdp, char *v_version)
00032 {
00033   if (sdp == NULL)
00034     return -1;
00035   sdp->v_version = v_version;
00036   return 0;
00037 }
00038 
00039 char *
00040 sdp_message_v_version_get (sdp_message_t * sdp)
00041 {
00042   if (sdp == NULL)
00043     return NULL;
00044   return sdp->v_version;
00045 }
00046 
00047 int
00048 sdp_message_o_origin_set (sdp_message_t * sdp, char *username, char *sess_id,
00049                           char *sess_version, char *nettype, char *addrtype,
00050                           char *addr)
00051 {
00052   if (sdp == NULL)
00053     return -1;
00054   sdp->o_username = username;
00055   sdp->o_sess_id = sess_id;
00056   sdp->o_sess_version = sess_version;
00057   sdp->o_nettype = nettype;
00058   sdp->o_addrtype = addrtype;
00059   sdp->o_addr = addr;
00060   return 0;
00061 }
00062 
00063 char *
00064 sdp_message_o_username_get (sdp_message_t * sdp)
00065 {
00066   if (sdp == NULL)
00067     return NULL;
00068   return sdp->o_username;
00069 }
00070 
00071 char *
00072 sdp_message_o_sess_id_get (sdp_message_t * sdp)
00073 {
00074   if (sdp == NULL)
00075     return NULL;
00076   return sdp->o_sess_id;
00077 }
00078 
00079 char *
00080 sdp_message_o_sess_version_get (sdp_message_t * sdp)
00081 {
00082   if (sdp == NULL)
00083     return NULL;
00084   return sdp->o_sess_version;
00085 }
00086 
00087 char *
00088 sdp_message_o_nettype_get (sdp_message_t * sdp)
00089 {
00090   if (sdp == NULL)
00091     return NULL;
00092   return sdp->o_nettype;
00093 }
00094 
00095 char *
00096 sdp_message_o_addrtype_get (sdp_message_t * sdp)
00097 {
00098   if (sdp == NULL)
00099     return NULL;
00100   return sdp->o_addrtype;
00101 }
00102 
00103 char *
00104 sdp_message_o_addr_get (sdp_message_t * sdp)
00105 {
00106   if (sdp == NULL)
00107     return NULL;
00108   return sdp->o_addr;
00109 }
00110 
00111 int
00112 sdp_message_s_name_set (sdp_message_t * sdp, char *name)
00113 {
00114   if (sdp == NULL)
00115     return -1;
00116   sdp->s_name = name;
00117   return 0;
00118 }
00119 
00120 char *
00121 sdp_message_s_name_get (sdp_message_t * sdp)
00122 {
00123   if (sdp == NULL)
00124     return NULL;
00125   return sdp->s_name;
00126 }
00127 
00128 int
00129 sdp_message_i_info_set (sdp_message_t * sdp, int pos_media, char *info)
00130 {
00131   sdp_media_t *med;
00132 
00133   if (sdp == NULL)
00134     return -1;
00135   if (pos_media == -1)
00136     {
00137       sdp->i_info = info;
00138       return 0;
00139     }
00140   med = osip_list_get (sdp->m_medias, pos_media);
00141   if (med == NULL)
00142     return -1;
00143   med->i_info = info;
00144   return 0;
00145 }
00146 
00147 char *
00148 sdp_message_i_info_get (sdp_message_t * sdp, int pos_media)
00149 {
00150   sdp_media_t *med;
00151 
00152   if (sdp == NULL)
00153     return NULL;
00154   if (pos_media == -1)
00155     {
00156       return sdp->i_info;
00157     }
00158   med = osip_list_get (sdp->m_medias, pos_media);
00159   if (med == NULL)
00160     return NULL;
00161   return med->i_info;
00162 }
00163 
00164 int
00165 sdp_message_u_uri_set (sdp_message_t * sdp, char *uri)
00166 {
00167   if (sdp == NULL)
00168     return -1;
00169   sdp->u_uri = uri;
00170   return 0;
00171 }
00172 
00173 char *
00174 sdp_message_u_uri_get (sdp_message_t * sdp)
00175 {
00176   if (sdp == NULL)
00177     return NULL;
00178   return sdp->u_uri;
00179 }
00180 
00181 int
00182 sdp_message_e_email_add (sdp_message_t * sdp, char *email)
00183 {
00184   if (sdp == NULL)
00185     return -1;
00186   osip_list_add (sdp->e_emails, email, -1);
00187   return 0;
00188 }
00189 
00190 char *
00191 sdp_message_e_email_get (sdp_message_t * sdp, int pos)
00192 {
00193   if (sdp == NULL)
00194     return NULL;
00195   if (osip_list_size (sdp->e_emails) > pos)
00196     return (char *) osip_list_get (sdp->e_emails, pos);
00197   return NULL;
00198 }
00199 
00200 int
00201 sdp_message_p_phone_add (sdp_message_t * sdp, char *phone)
00202 {
00203   if (sdp == NULL)
00204     return -1;
00205   osip_list_add (sdp->p_phones, phone, -1);
00206   return 0;
00207 }
00208 
00209 char *
00210 sdp_message_p_phone_get (sdp_message_t * sdp, int pos)
00211 {
00212   if (sdp == NULL)
00213     return NULL;
00214   if (osip_list_size (sdp->p_phones) > pos)
00215     return (char *) osip_list_get (sdp->p_phones, pos);
00216   return NULL;
00217 }
00218 
00219 int
00220 sdp_message_c_connection_add (sdp_message_t * sdp, int pos_media,
00221                               char *nettype, char *addrtype,
00222                               char *addr, char *addr_multicast_ttl,
00223                               char *addr_multicast_int)
00224 {
00225   int i;
00226   sdp_media_t *med;
00227   sdp_connection_t *conn;
00228 
00229   if (sdp == NULL)
00230     return -1;
00231   if ((pos_media != -1) && (osip_list_size (sdp->m_medias) < pos_media + 1))
00232     return -1;
00233   i = sdp_connection_init (&conn);
00234   if (i != 0)
00235     return -1;
00236   conn->c_nettype = nettype;
00237   conn->c_addrtype = addrtype;
00238   conn->c_addr = addr;
00239   conn->c_addr_multicast_ttl = addr_multicast_ttl;
00240   conn->c_addr_multicast_int = addr_multicast_int;
00241   if (pos_media == -1)
00242     {
00243       sdp->c_connection = conn;
00244       return 0;
00245     }
00246   med = (sdp_media_t *) osip_list_get (sdp->m_medias, pos_media);
00247   osip_list_add (med->c_connections, conn, -1);
00248   return 0;
00249 }
00250 
00251 /* this method should be internal only... */
00252 sdp_connection_t *
00253 sdp_message_connection_get (sdp_message_t * sdp, int pos_media, int pos)
00254 {
00255   sdp_media_t *med;
00256 
00257   if (sdp == NULL)
00258     return NULL;
00259   if (pos_media == -1)          /* pos is useless in this case: 1 global "c=" is allowed */
00260     return sdp->c_connection;
00261   med = (sdp_media_t *) osip_list_get (sdp->m_medias, pos_media);
00262   if (med == NULL)
00263     return NULL;
00264   return (sdp_connection_t *) osip_list_get (med->c_connections, pos);
00265 }
00266 
00267 char *
00268 sdp_message_c_nettype_get (sdp_message_t * sdp, int pos_media, int pos)
00269 {
00270   sdp_connection_t *conn = sdp_message_connection_get (sdp, pos_media, pos);
00271 
00272   if (conn == NULL)
00273     return NULL;
00274   return conn->c_nettype;
00275 }
00276 
00277 char *
00278 sdp_message_c_addrtype_get (sdp_message_t * sdp, int pos_media, int pos)
00279 {
00280   sdp_connection_t *conn = sdp_message_connection_get (sdp, pos_media, pos);
00281 
00282   if (conn == NULL)
00283     return NULL;
00284   return conn->c_addrtype;
00285 }
00286 
00287 char *
00288 sdp_message_c_addr_get (sdp_message_t * sdp, int pos_media, int pos)
00289 {
00290   sdp_connection_t *conn = sdp_message_connection_get (sdp, pos_media, pos);
00291 
00292   if (conn == NULL)
00293     return NULL;
00294   return conn->c_addr;
00295 }
00296 
00297 char *
00298 sdp_message_c_addr_multicast_ttl_get (sdp_message_t * sdp, int pos_media, int pos)
00299 {
00300   sdp_connection_t *conn = sdp_message_connection_get (sdp, pos_media, pos);
00301 
00302   if (conn == NULL)
00303     return NULL;
00304   return conn->c_addr_multicast_ttl;
00305 }
00306 
00307 char *
00308 sdp_message_c_addr_multicast_int_get (sdp_message_t * sdp, int pos_media, int pos)
00309 {
00310   sdp_connection_t *conn = sdp_message_connection_get (sdp, pos_media, pos);
00311 
00312   if (conn == NULL)
00313     return NULL;
00314   return conn->c_addr_multicast_int;
00315 }
00316 
00317 int
00318 sdp_message_b_bandwidth_add (sdp_message_t * sdp, int pos_media, char *bwtype,
00319                              char *bandwidth)
00320 {
00321   int i;
00322   sdp_media_t *med;
00323   sdp_bandwidth_t *band;
00324 
00325   if (sdp == NULL)
00326     return -1;
00327   if ((pos_media != -1) && (osip_list_size (sdp->m_medias) < pos_media + 1))
00328     return -1;
00329   i = sdp_bandwidth_init (&band);
00330   if (i != 0)
00331     return -1;
00332   band->b_bwtype = bwtype;
00333   band->b_bandwidth = bandwidth;
00334   if (pos_media == -1)
00335     {
00336       osip_list_add (sdp->b_bandwidths, band, -1);
00337       return 0;
00338     }
00339   med = (sdp_media_t *) osip_list_get (sdp->m_medias, pos_media);
00340   osip_list_add (med->b_bandwidths, band, -1);
00341   return 0;
00342 }
00343 
00344 sdp_bandwidth_t *
00345 sdp_message_bandwidth_get (sdp_message_t * sdp, int pos_media, int pos)
00346 {
00347   sdp_media_t *med;
00348 
00349   if (sdp == NULL)
00350     return NULL;
00351   if (pos_media == -1)
00352     return (sdp_bandwidth_t *) osip_list_get (sdp->b_bandwidths, pos);
00353   med = (sdp_media_t *) osip_list_get (sdp->m_medias, pos_media);
00354   if (med == NULL)
00355     return NULL;
00356   return (sdp_bandwidth_t *) osip_list_get (med->b_bandwidths, pos);
00357 }
00358 
00359 char *
00360 sdp_message_b_bwtype_get (sdp_message_t * sdp, int pos_media, int pos)
00361 {
00362   sdp_bandwidth_t *band = sdp_message_bandwidth_get (sdp, pos_media, pos);
00363 
00364   if (band == NULL)
00365     return NULL;
00366   return band->b_bwtype;
00367 }
00368 
00369 char *
00370 sdp_message_b_bandwidth_get (sdp_message_t * sdp, int pos_media, int pos)
00371 {
00372   sdp_bandwidth_t *band = sdp_message_bandwidth_get (sdp, pos_media, pos);
00373 
00374   if (band == NULL)
00375     return NULL;
00376   return band->b_bandwidth;
00377 }
00378 
00379 int
00380 sdp_message_t_time_descr_add (sdp_message_t * sdp, char *start, char *stop)
00381 {
00382   int i;
00383   sdp_time_descr_t *td;
00384 
00385   if (sdp == NULL)
00386     return -1;
00387   i = sdp_time_descr_init (&td);
00388   if (i != 0)
00389     return -1;
00390   td->t_start_time = start;
00391   td->t_stop_time = stop;
00392   osip_list_add (sdp->t_descrs, td, -1);
00393   return 0;
00394 }
00395 
00396 char *
00397 sdp_message_t_start_time_get (sdp_message_t * sdp, int pos_td)
00398 {
00399   sdp_time_descr_t *td;
00400 
00401   if (sdp == NULL)
00402     return NULL;
00403   td = (sdp_time_descr_t *) osip_list_get (sdp->t_descrs, pos_td);
00404   if (td == NULL)
00405     return NULL;
00406   return td->t_start_time;
00407 }
00408 
00409 char *
00410 sdp_message_t_stop_time_get (sdp_message_t * sdp, int pos_td)
00411 {
00412   sdp_time_descr_t *td;
00413 
00414   if (sdp == NULL)
00415     return NULL;
00416   td = (sdp_time_descr_t *) osip_list_get (sdp->t_descrs, pos_td);
00417   if (td == NULL)
00418     return NULL;
00419   return td->t_stop_time;
00420 }
00421 
00422 int
00423 sdp_message_r_repeat_add (sdp_message_t * sdp, int pos_time_descr, char *field)
00424 {
00425   sdp_time_descr_t *td;
00426 
00427   if (sdp == NULL)
00428     return -1;
00429   td = (sdp_time_descr_t *) osip_list_get (sdp->t_descrs, pos_time_descr);
00430   if (td == NULL)
00431     return -1;
00432   osip_list_add (td->r_repeats, field, -1);
00433   return 0;
00434 }
00435 
00436 char *
00437 sdp_message_r_repeat_get (sdp_message_t * sdp, int pos_time_descr, int pos_repeat)
00438 {
00439   sdp_time_descr_t *td;
00440 
00441   if (sdp == NULL)
00442     return NULL;
00443   td = (sdp_time_descr_t *) osip_list_get (sdp->t_descrs, pos_time_descr);
00444   if (td == NULL)
00445     return NULL;
00446   return (char *) osip_list_get (td->r_repeats, pos_repeat);
00447 }
00448 
00449 int
00450 sdp_message_z_adjustments_set (sdp_message_t * sdp, char *field)
00451 {
00452   if (sdp == NULL)
00453     return -1;
00454   sdp->z_adjustments = field;
00455   return 0;
00456 }
00457 
00458 char *
00459 sdp_message_z_adjustments_get (sdp_message_t * sdp)
00460 {
00461   if (sdp == NULL)
00462     return NULL;
00463   return sdp->z_adjustments;
00464 }
00465 
00466 int
00467 sdp_message_k_key_set (sdp_message_t * sdp, int pos_media, char *keytype,
00468                        char *keydata)
00469 {
00470   sdp_key_t *key;
00471   sdp_media_t *med;
00472 
00473   if (sdp == NULL)
00474     return -1;
00475   if ((pos_media != -1) && (osip_list_size (sdp->m_medias) < pos_media + 1))
00476     return -1;
00477   sdp_key_init (&key);
00478   key->k_keytype = keytype;
00479   key->k_keydata = keydata;
00480   if (pos_media == -1)
00481     {
00482       sdp->k_key = key;
00483       return 0;
00484     }
00485   med = (sdp_media_t *) osip_list_get (sdp->m_medias, pos_media);
00486   med->k_key = key;
00487   return 0;
00488 }
00489 
00490 char *
00491 sdp_message_k_keytype_get (sdp_message_t * sdp, int pos_media)
00492 {
00493   sdp_media_t *med;
00494 
00495   if (sdp == NULL)
00496     return NULL;
00497   if (pos_media == -1)
00498     {
00499       if (sdp->k_key == NULL)
00500         return NULL;
00501       return sdp->k_key->k_keytype;
00502     }
00503   if ((pos_media != -1) && (osip_list_size (sdp->m_medias) < pos_media + 1))
00504     return NULL;
00505   med = (sdp_media_t *) osip_list_get (sdp->m_medias, pos_media);
00506   if (med->k_key == NULL)
00507     return NULL;
00508   return med->k_key->k_keytype;
00509 }
00510 
00511 char *
00512 sdp_message_k_keydata_get (sdp_message_t * sdp, int pos_media)
00513 {
00514   sdp_media_t *med;
00515 
00516   if (sdp == NULL)
00517     return NULL;
00518   if (pos_media == -1)
00519     {
00520       if (sdp->k_key == NULL)
00521         return NULL;
00522       return sdp->k_key->k_keydata;
00523     }
00524   if ((pos_media != -1) && (osip_list_size (sdp->m_medias) < pos_media + 1))
00525     return NULL;
00526   med = (sdp_media_t *) osip_list_get (sdp->m_medias, pos_media);
00527   if (med->k_key == NULL)
00528     return NULL;
00529   return med->k_key->k_keydata;
00530 }
00531 
00532 int
00533 sdp_message_a_attribute_add (sdp_message_t * sdp, int pos_media,
00534                              char *att_field, char *att_value)
00535 {
00536   int i;
00537   sdp_media_t *med;
00538   sdp_attribute_t *attr;
00539 
00540   if (sdp == NULL)
00541     return -1;
00542   if ((pos_media != -1) && (osip_list_size (sdp->m_medias) < pos_media + 1))
00543     return -1;
00544   i = sdp_attribute_init (&attr);
00545   if (i != 0)
00546     return -1;
00547   attr->a_att_field = att_field;
00548   attr->a_att_value = att_value;
00549   if (pos_media == -1)
00550     {
00551       osip_list_add (sdp->a_attributes, attr, -1);
00552       return 0;
00553     }
00554   med = (sdp_media_t *) osip_list_get (sdp->m_medias, pos_media);
00555   osip_list_add (med->a_attributes, attr, -1);
00556   return 0;
00557 }
00558 
00559 int
00560 sdp_message_a_attribute_del (sdp_message_t * sdp, int pos_media, char *att_field)
00561 {
00562   int i;
00563   sdp_media_t *med;
00564   sdp_attribute_t *attr;
00565 
00566   if (sdp == NULL)
00567     return -1;
00568   if ((pos_media != -1) && (osip_list_size (sdp->m_medias) < pos_media + 1))
00569     return -1;
00570   if (pos_media == -1)
00571     {
00572       for (i = 0; i < osip_list_size (sdp->a_attributes);)
00573         {
00574           attr = osip_list_get (sdp->a_attributes, i);
00575           if (strcmp (attr->a_att_field, att_field) == 0)
00576             {
00577               osip_list_remove (sdp->a_attributes, i);
00578               sdp_attribute_free (attr);
00579           } else
00580             i++;
00581         }
00582       return 0;
00583     }
00584   med = (sdp_media_t *) osip_list_get (sdp->m_medias, pos_media);
00585   if (med == NULL)
00586     return -1;
00587   for (i = 0; i < osip_list_size (med->a_attributes);)
00588     {
00589       attr = osip_list_get (med->a_attributes, i);
00590       if (strcmp (attr->a_att_field, att_field) == 0)
00591         {
00592           osip_list_remove (med->a_attributes, i);
00593           sdp_attribute_free (attr);
00594       } else
00595         i++;
00596     }
00597   return 0;
00598 }
00599 
00600 int
00601 sdp_message_a_attribute_del_at_index (sdp_message_t * sdp, int pos_media,
00602                                       char *att_field, int pos_attr)
00603 {
00604   int i;
00605   sdp_media_t *med;
00606   sdp_attribute_t *attr;
00607 
00608   if (sdp == NULL)
00609     return -1;
00610   if ((pos_media != -1) && (osip_list_size (sdp->m_medias) < pos_media + 1))
00611     return -1;
00612   if (pos_media == -1)
00613     {
00614       if (pos_attr == -1)
00615         {
00616           for (i = 0; i < osip_list_size (sdp->a_attributes);)
00617             {
00618               attr = osip_list_get (sdp->a_attributes, i);
00619               if (strcmp (attr->a_att_field, att_field) == 0)
00620                 {
00621                   osip_list_remove (sdp->a_attributes, i);
00622                   sdp_attribute_free (attr);
00623               } else
00624                 i++;
00625             }
00626       } else if ((attr = osip_list_get (sdp->a_attributes, pos_attr)) != NULL)
00627         {
00628           osip_list_remove (sdp->a_attributes, pos_attr);
00629           sdp_attribute_free (attr);
00630         }
00631       return 0;
00632     }
00633   med = (sdp_media_t *) osip_list_get (sdp->m_medias, pos_media);
00634   if (med == NULL)
00635     return -1;
00636   for (i = 0; i < osip_list_size (med->a_attributes);)
00637     {
00638       if (pos_attr == -1)
00639         {
00640           attr = osip_list_get (med->a_attributes, i);
00641           if (strcmp (attr->a_att_field, att_field) == 0)
00642             {
00643               osip_list_remove (med->a_attributes, i);
00644               sdp_attribute_free (attr);
00645           } else
00646             i++;
00647       } else if ((attr = osip_list_get (med->a_attributes, pos_attr)) != NULL)
00648         {
00649           osip_list_remove (med->a_attributes, pos_attr);
00650           sdp_attribute_free (attr);
00651         }
00652     }
00653   return 0;
00654 }
00655 
00656 
00657 sdp_attribute_t *
00658 sdp_message_attribute_get (sdp_message_t * sdp, int pos_media, int pos)
00659 {
00660   sdp_media_t *med;
00661 
00662   if (sdp == NULL)
00663     return NULL;
00664   if (pos_media == -1)
00665     return (sdp_attribute_t *) osip_list_get (sdp->a_attributes, pos);
00666   med = (sdp_media_t *) osip_list_get (sdp->m_medias, pos_media);
00667   if (med == NULL)
00668     return NULL;
00669   return (sdp_attribute_t *) osip_list_get (med->a_attributes, pos);
00670 }
00671 
00672 char *
00673 sdp_message_a_att_field_get (sdp_message_t * sdp, int pos_media, int pos)
00674 {
00675   sdp_attribute_t *attr = sdp_message_attribute_get (sdp, pos_media, pos);
00676 
00677   if (attr == NULL)
00678     return NULL;
00679   return attr->a_att_field;
00680 }
00681 
00682 char *
00683 sdp_message_a_att_value_get (sdp_message_t * sdp, int pos_media, int pos)
00684 {
00685   sdp_attribute_t *attr = sdp_message_attribute_get (sdp, pos_media, pos);
00686 
00687   if (attr == NULL)
00688     return NULL;
00689   return attr->a_att_value;
00690 }
00691 
00692 int
00693 sdp_message_endof_media (sdp_message_t * sdp, int i)
00694 {
00695   if (sdp == NULL)
00696     return -1;
00697   if (i == -1)
00698     return 0;
00699   if (!osip_list_eol (sdp->m_medias, i))
00700     return 0;                   /* not end of list */
00701   return -1;                    /* end of list */
00702 }
00703 
00704 int
00705 sdp_message_m_media_add (sdp_message_t * sdp, char *media,
00706                          char *port, char *number_of_port, char *proto)
00707 {
00708   int i;
00709   sdp_media_t *med;
00710 
00711   i = sdp_media_init (&med);
00712   if (i != 0)
00713     return -1;
00714   med->m_media = media;
00715   med->m_port = port;
00716   med->m_number_of_port = number_of_port;
00717   med->m_proto = proto;
00718   osip_list_add (sdp->m_medias, med, -1);
00719   return 0;
00720 }
00721 
00722 char *
00723 sdp_message_m_media_get (sdp_message_t * sdp, int pos_media)
00724 {
00725   sdp_media_t *med = osip_list_get (sdp->m_medias, pos_media);
00726 
00727   if (med == NULL)
00728     return NULL;
00729   return med->m_media;
00730 }
00731 
00732 char *
00733 sdp_message_m_port_get (sdp_message_t * sdp, int pos_media)
00734 {
00735   sdp_media_t *med = osip_list_get (sdp->m_medias, pos_media);
00736 
00737   if (med == NULL)
00738     return NULL;
00739   return med->m_port;
00740 }
00741 
00742 char *
00743 sdp_message_m_number_of_port_get (sdp_message_t * sdp, int pos_media)
00744 {
00745   sdp_media_t *med = osip_list_get (sdp->m_medias, pos_media);
00746 
00747   if (med == NULL)
00748     return NULL;
00749   return med->m_number_of_port;
00750 }
00751 
00752 int
00753 sdp_message_m_port_set (sdp_message_t * sdp, int pos_media, char *port)
00754 {
00755   sdp_media_t *med = osip_list_get (sdp->m_medias, pos_media);
00756 
00757   if (med == NULL)
00758     return -1;
00759   if (med->m_port)
00760     osip_free (med->m_port);
00761   med->m_port = port;
00762   return 0;
00763 }
00764 
00765 char *
00766 sdp_message_m_proto_get (sdp_message_t * sdp, int pos_media)
00767 {
00768   sdp_media_t *med = osip_list_get (sdp->m_medias, pos_media);
00769 
00770   if (med == NULL)
00771     return NULL;
00772   return med->m_proto;
00773 }
00774 
00775 int
00776 sdp_message_m_payload_add (sdp_message_t * sdp, int pos_media, char *payload)
00777 {
00778   sdp_media_t *med = osip_list_get (sdp->m_medias, pos_media);
00779 
00780   if (med == NULL)
00781     return -1;
00782   osip_list_add (med->m_payloads, payload, -1);
00783   return 0;
00784 }
00785 
00786 char *
00787 sdp_message_m_payload_get (sdp_message_t * sdp, int pos_media, int pos)
00788 {
00789   sdp_media_t *med = osip_list_get (sdp->m_medias, pos_media);
00790 
00791   if (med == NULL)
00792     return NULL;
00793   return (char *) osip_list_get (med->m_payloads, pos);
00794 }
00795 
00796 int
00797 sdp_message_m_payload_del (sdp_message_t * sdp, int pos_media, int pos)
00798 {
00799   sdp_media_t *med = osip_list_get (sdp->m_medias, pos_media);
00800   char *payload;
00801 
00802   if (med == NULL)
00803     return -1;
00804   if ((payload = osip_list_get (med->m_payloads, pos)) == NULL)
00805     return -1;
00806   osip_list_remove (med->m_payloads, pos);
00807   osip_free (payload);
00808   return 0;
00809 }

Generated on Fri Mar 9 20:08:53 2007 for MAD-FCL by  doxygen 1.5.0