libosip  5.3.0
sdp_message.h
Go to the documentation of this file.
1 /*
2  The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
3  Copyright (C) 2001-2020 Aymeric MOIZARD amoizard@antisip.com
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 #ifndef _SDP_H_
21 #define _SDP_H_
22 
23 #ifdef ENABLE_MPATROL
24 #include <mpatrol.h>
25 #endif
26 
27 #include <osipparser2/osip_list.h>
28 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
50 typedef struct sdp_bandwidth sdp_bandwidth_t;
51 
56 struct sdp_bandwidth {
57  char *b_bwtype;
58  char *b_bandwidth;
59 };
60 
71 
76 typedef struct sdp_time_descr sdp_time_descr_t;
77 
83  char *t_start_time;
84  char *t_stop_time;
86 };
87 
98 
103 typedef struct sdp_key sdp_key_t;
104 
109 struct sdp_key {
110  char *k_keytype;
111  char *k_keydata;
112 };
113 
118 int sdp_key_init(sdp_key_t **elem);
124 
129 typedef struct sdp_attribute sdp_attribute_t;
130 
136  char *a_att_field;
137  char *a_att_value;
138 };
139 
150 
155 typedef struct sdp_connection sdp_connection_t;
156 
162  char *c_nettype;
163  char *c_addrtype;
164  char *c_addr;
169 };
170 
181 
186 typedef struct sdp_media sdp_media_t;
187 
192 struct sdp_media {
193  char *m_media;
194  char *m_port;
196  char *m_proto;
199  char *i_info;
207 };
208 
213 int sdp_media_init(sdp_media_t **elem);
219 
224 typedef struct sdp_message sdp_message_t;
225 
230 struct sdp_message {
231  char *v_version;
232  char *o_username;
233  char *o_sess_id;
235  char *o_nettype;
236  char *o_addrtype;
237  char *o_addr;
238  char *s_name;
239  char *i_info;
240  char *u_uri;
253 };
254 
265 int sdp_message_parse(sdp_message_t *sdp, const char *buf);
271 int sdp_message_to_str(sdp_message_t *sdp, char **dest);
283 
289 int sdp_message_v_version_set(sdp_message_t *sdp, char *value);
305 int sdp_message_o_origin_set(sdp_message_t *sdp, char *username, char *sess_id, char *sess_version, char *nettype, char *addrtype, char *addr);
341 int sdp_message_s_name_set(sdp_message_t *sdp, char *value);
353 int sdp_message_i_info_set(sdp_message_t *sdp, int pos_media, char *value);
359 char *sdp_message_i_info_get(sdp_message_t *sdp, int pos_media);
365 int sdp_message_u_uri_set(sdp_message_t *sdp, char *value);
376 int sdp_message_e_email_add(sdp_message_t *sdp, char *value);
381 #define sdp_e_email_get sdp_message_e_email_get
387 char *sdp_message_e_email_get(sdp_message_t *sdp, int pos);
393 int sdp_message_p_phone_add(sdp_message_t *sdp, char *value);
399 char *sdp_message_p_phone_get(sdp_message_t *sdp, int pos);
410 int sdp_message_c_connection_add(sdp_message_t *sdp, int pos_media, char *nettype, char *addrtype, char *addr, char *addr_multicast_ttl, char *addr_multicast_int);
411 #ifndef DOXYGEN
412 /* this method should be internal only... */
413 sdp_connection_t *sdp_message_connection_get(sdp_message_t *sdp, int pos_media, int pos);
414 #endif
421 char *sdp_message_c_nettype_get(sdp_message_t *sdp, int pos_media, int pos);
428 char *sdp_message_c_addrtype_get(sdp_message_t *sdp, int pos_media, int pos);
435 char *sdp_message_c_addr_get(sdp_message_t *sdp, int pos_media, int pos);
442 char *sdp_message_c_addr_multicast_ttl_get(sdp_message_t *sdp, int pos_media, int pos);
449 char *sdp_message_c_addr_multicast_int_get(sdp_message_t *sdp, int pos_media, int pos);
457 int sdp_message_b_bandwidth_add(sdp_message_t *sdp, int pos_media, char *bwtype, char *bandwidth);
464 sdp_bandwidth_t *sdp_message_bandwidth_get(sdp_message_t *sdp, int pos_media, int pos);
471 char *sdp_message_b_bwtype_get(sdp_message_t *sdp, int pos_media, int pos);
478 char *sdp_message_b_bandwidth_get(sdp_message_t *sdp, int pos_media, int pos);
485 int sdp_message_t_time_descr_add(sdp_message_t *sdp, char *start, char *stop);
491 char *sdp_message_t_start_time_get(sdp_message_t *sdp, int pos_td);
497 char *sdp_message_t_stop_time_get(sdp_message_t *sdp, int pos_td);
504 int sdp_message_r_repeat_add(sdp_message_t *sdp, int pos_time_descr, char *value);
511 char *sdp_message_r_repeat_get(sdp_message_t *sdp, int pos_time_descr, int pos_repeat);
517 int sdp_message_z_adjustments_set(sdp_message_t *sdp, char *value);
530 int sdp_message_k_key_set(sdp_message_t *sdp, int pos_media, char *keytype, char *keydata);
536 char *sdp_message_k_keytype_get(sdp_message_t *sdp, int pos_media);
542 char *sdp_message_k_keydata_get(sdp_message_t *sdp, int pos_media);
550 int sdp_message_a_attribute_add(sdp_message_t *sdp, int pos_media, char *att_field, char *att_value);
557 int sdp_message_a_attribute_del(sdp_message_t *sdp, int pos_media, char *att_field);
565 int sdp_message_a_attribute_del_at_index(sdp_message_t *sdp, int pos_media, char *att_field, int pos_attr);
572 sdp_attribute_t *sdp_message_attribute_get(sdp_message_t *sdp, int pos_media, int pos);
579 char *sdp_message_a_att_field_get(sdp_message_t *sdp, int pos_media, int pos);
586 char *sdp_message_a_att_value_get(sdp_message_t *sdp, int pos_media, int pos);
592 int sdp_message_endof_media(sdp_message_t *sdp, int pos);
601 int sdp_message_m_media_add(sdp_message_t *sdp, char *media, char *port, char *number_of_port, char *proto);
607 char *sdp_message_m_media_get(sdp_message_t *sdp, int pos_media);
613 char *sdp_message_m_port_get(sdp_message_t *sdp, int pos_media);
620 int sdp_message_m_port_set(sdp_message_t *sdp, int pos_media, char *port);
626 char *sdp_message_m_number_of_port_get(sdp_message_t *sdp, int pos_media);
632 char *sdp_message_m_proto_get(sdp_message_t *sdp, int pos_media);
639 int sdp_message_m_payload_add(sdp_message_t *sdp, int pos_media, char *payload);
646 char *sdp_message_m_payload_get(sdp_message_t *sdp, int pos_media, int pos);
653 int sdp_message_m_payload_del(sdp_message_t *sdp, int pos_media, int pos);
654 
657 #ifdef __cplusplus
658 }
659 #endif
660 #endif
int sdp_message_endof_media(sdp_message_t *sdp, int pos)
Definition: sdp_accessor.c:676
sdp_attribute_t * sdp_message_attribute_get(sdp_message_t *sdp, int pos_media, int pos)
Definition: sdp_accessor.c:641
char * sdp_message_e_email_get(sdp_message_t *sdp, int pos)
Definition: sdp_accessor.c:172
void sdp_attribute_free(sdp_attribute_t *elem)
Definition: sdp_message.c:129
char * sdp_message_i_info_get(sdp_message_t *sdp, int pos_media)
Definition: sdp_accessor.c:131
char * sdp_message_p_phone_get(sdp_message_t *sdp, int pos)
Definition: sdp_accessor.c:190
char * sdp_message_r_repeat_get(sdp_message_t *sdp, int pos_time_descr, int pos_repeat)
Definition: sdp_accessor.c:420
int sdp_message_k_key_set(sdp_message_t *sdp, int pos_media, char *keytype, char *keydata)
Definition: sdp_accessor.c:449
void sdp_time_descr_free(sdp_time_descr_t *elem)
Definition: sdp_message.c:88
char * sdp_message_b_bandwidth_get(sdp_message_t *sdp, int pos_media, int pos)
Definition: sdp_accessor.c:350
int sdp_message_init(sdp_message_t **sdp)
Definition: sdp_message.c:237
int sdp_message_clone(sdp_message_t *sdp, sdp_message_t **dest)
Definition: sdp_message.c:2367
int sdp_message_m_media_add(sdp_message_t *sdp, char *media, char *port, char *number_of_port, char *proto)
Definition: sdp_accessor.c:689
char * sdp_message_k_keytype_get(sdp_message_t *sdp, int pos_media)
Definition: sdp_accessor.c:478
int sdp_connection_init(sdp_connection_t **elem)
Definition: sdp_message.c:138
char * sdp_message_m_proto_get(sdp_message_t *sdp, int pos_media)
Definition: sdp_accessor.c:746
int sdp_message_m_payload_add(sdp_message_t *sdp, int pos_media, char *payload)
Definition: sdp_accessor.c:755
int sdp_media_init(sdp_media_t **elem)
Definition: sdp_message.c:164
int sdp_message_b_bandwidth_add(sdp_message_t *sdp, int pos_media, char *bwtype, char *bandwidth)
Definition: sdp_accessor.c:295
char * sdp_message_t_stop_time_get(sdp_message_t *sdp, int pos_td)
Definition: sdp_accessor.c:391
int sdp_attribute_init(sdp_attribute_t **elem)
Definition: sdp_message.c:118
char * sdp_message_o_addrtype_get(sdp_message_t *sdp)
Definition: sdp_accessor.c:82
char * sdp_message_o_addr_get(sdp_message_t *sdp)
Definition: sdp_accessor.c:89
char * sdp_message_a_att_field_get(sdp_message_t *sdp, int pos_media, int pos)
Definition: sdp_accessor.c:658
char * sdp_message_c_addr_get(sdp_message_t *sdp, int pos_media, int pos)
Definition: sdp_accessor.c:268
char * sdp_message_c_nettype_get(sdp_message_t *sdp, int pos_media, int pos)
Definition: sdp_accessor.c:250
char * sdp_message_o_username_get(sdp_message_t *sdp)
Definition: sdp_accessor.c:54
int sdp_message_parse(sdp_message_t *sdp, const char *buf)
Definition: sdp_message.c:1595
char * sdp_message_c_addr_multicast_ttl_get(sdp_message_t *sdp, int pos_media, int pos)
Definition: sdp_accessor.c:277
sdp_bandwidth_t * sdp_message_bandwidth_get(sdp_message_t *sdp, int pos_media, int pos)
Definition: sdp_accessor.c:324
int sdp_key_init(sdp_key_t **elem)
Definition: sdp_message.c:98
int sdp_message_m_port_set(sdp_message_t *sdp, int pos_media, char *port)
Definition: sdp_accessor.c:733
void sdp_key_free(sdp_key_t *elem)
Definition: sdp_message.c:109
int sdp_message_s_name_set(sdp_message_t *sdp, char *value)
Definition: sdp_accessor.c:96
char * sdp_message_m_port_get(sdp_message_t *sdp, int pos_media)
Definition: sdp_accessor.c:715
char * sdp_message_c_addr_multicast_int_get(sdp_message_t *sdp, int pos_media, int pos)
Definition: sdp_accessor.c:286
void sdp_message_free(sdp_message_t *sdp)
Definition: sdp_message.c:2332
void sdp_connection_free(sdp_connection_t *elem)
Definition: sdp_message.c:152
char * sdp_message_a_att_value_get(sdp_message_t *sdp, int pos_media, int pos)
Definition: sdp_accessor.c:667
int sdp_message_a_attribute_del(sdp_message_t *sdp, int pos_media, char *att_field)
Definition: sdp_accessor.c:555
char * sdp_message_u_uri_get(sdp_message_t *sdp)
Definition: sdp_accessor.c:157
int sdp_message_a_attribute_add(sdp_message_t *sdp, int pos_media, char *att_field, char *att_value)
Definition: sdp_accessor.c:526
int sdp_message_r_repeat_add(sdp_message_t *sdp, int pos_time_descr, char *value)
Definition: sdp_accessor.c:405
char * sdp_message_k_keydata_get(sdp_message_t *sdp, int pos_media)
Definition: sdp_accessor.c:502
int sdp_message_v_version_set(sdp_message_t *sdp, char *value)
Definition: sdp_accessor.c:26
char * sdp_message_m_payload_get(sdp_message_t *sdp, int pos_media, int pos)
Definition: sdp_accessor.c:765
char * sdp_message_t_start_time_get(sdp_message_t *sdp, int pos_td)
Definition: sdp_accessor.c:377
int sdp_message_m_payload_del(sdp_message_t *sdp, int pos_media, int pos)
Definition: sdp_accessor.c:774
char * sdp_message_b_bwtype_get(sdp_message_t *sdp, int pos_media, int pos)
Definition: sdp_accessor.c:341
char * sdp_message_o_nettype_get(sdp_message_t *sdp)
Definition: sdp_accessor.c:75
char * sdp_message_m_number_of_port_get(sdp_message_t *sdp, int pos_media)
Definition: sdp_accessor.c:724
char * sdp_message_s_name_get(sdp_message_t *sdp)
Definition: sdp_accessor.c:104
int sdp_bandwidth_init(sdp_bandwidth_t **elem)
Definition: sdp_message.c:56
char * sdp_message_c_addrtype_get(sdp_message_t *sdp, int pos_media, int pos)
Definition: sdp_accessor.c:259
char * sdp_message_o_sess_version_get(sdp_message_t *sdp)
Definition: sdp_accessor.c:68
char * sdp_message_z_adjustments_get(sdp_message_t *sdp)
Definition: sdp_accessor.c:442
int sdp_message_e_email_add(sdp_message_t *sdp, char *value)
Definition: sdp_accessor.c:164
int sdp_message_u_uri_set(sdp_message_t *sdp, char *value)
Definition: sdp_accessor.c:149
char * sdp_message_m_media_get(sdp_message_t *sdp, int pos_media)
Definition: sdp_accessor.c:706
int sdp_message_t_time_descr_add(sdp_message_t *sdp, char *start, char *stop)
Definition: sdp_accessor.c:359
char * sdp_message_v_version_get(sdp_message_t *sdp)
Definition: sdp_accessor.c:34
int sdp_message_c_connection_add(sdp_message_t *sdp, int pos_media, char *nettype, char *addrtype, char *addr, char *addr_multicast_ttl, char *addr_multicast_int)
Definition: sdp_accessor.c:200
int sdp_message_i_info_set(sdp_message_t *sdp, int pos_media, char *value)
Definition: sdp_accessor.c:111
int sdp_message_to_str(sdp_message_t *sdp, char **dest)
Definition: sdp_message.c:2136
char * sdp_message_o_sess_id_get(sdp_message_t *sdp)
Definition: sdp_accessor.c:61
void sdp_bandwidth_free(sdp_bandwidth_t *elem)
Definition: sdp_message.c:67
int sdp_message_o_origin_set(sdp_message_t *sdp, char *username, char *sess_id, char *sess_version, char *nettype, char *addrtype, char *addr)
Definition: sdp_accessor.c:41
int sdp_time_descr_init(sdp_time_descr_t **elem)
Definition: sdp_message.c:76
int sdp_message_z_adjustments_set(sdp_message_t *sdp, char *value)
Definition: sdp_accessor.c:434
int sdp_message_p_phone_add(sdp_message_t *sdp, char *value)
Definition: sdp_accessor.c:182
int sdp_message_a_attribute_del_at_index(sdp_message_t *sdp, int pos_media, char *att_field, int pos_attr)
Definition: sdp_accessor.c:600
void sdp_media_free(sdp_media_t *elem)
Definition: sdp_message.c:219
oSIP list Routines
Definition: osip_list.h:87
Definition: sdp_message.h:135
char * a_att_field
Definition: sdp_message.h:136
char * a_att_value
Definition: sdp_message.h:137
Definition: sdp_message.h:56
char * b_bwtype
Definition: sdp_message.h:57
char * b_bandwidth
Definition: sdp_message.h:58
Definition: sdp_message.h:161
char * c_addrtype
Definition: sdp_message.h:163
char * c_addr
Definition: sdp_message.h:164
char * c_nettype
Definition: sdp_message.h:162
char * c_addr_multicast_int
Definition: sdp_message.h:167
char * c_addr_multicast_ttl
Definition: sdp_message.h:165
Definition: sdp_message.h:109
char * k_keydata
Definition: sdp_message.h:111
char * k_keytype
Definition: sdp_message.h:110
Definition: sdp_message.h:192
char * m_number_of_port
Definition: sdp_message.h:195
sdp_key_t * k_key
Definition: sdp_message.h:206
char * m_media
Definition: sdp_message.h:193
osip_list_t c_connections
Definition: sdp_message.h:200
osip_list_t b_bandwidths
Definition: sdp_message.h:202
char * m_port
Definition: sdp_message.h:194
char * m_proto
Definition: sdp_message.h:196
char * i_info
Definition: sdp_message.h:199
osip_list_t m_payloads
Definition: sdp_message.h:197
osip_list_t a_attributes
Definition: sdp_message.h:204
Definition: sdp_message.h:230
char * o_sess_version
Definition: sdp_message.h:234
char * u_uri
Definition: sdp_message.h:240
char * v_version
Definition: sdp_message.h:231
osip_list_t a_attributes
Definition: sdp_message.h:250
char * o_addrtype
Definition: sdp_message.h:236
char * i_info
Definition: sdp_message.h:239
osip_list_t e_emails
Definition: sdp_message.h:241
char * o_username
Definition: sdp_message.h:232
char * s_name
Definition: sdp_message.h:238
sdp_key_t * k_key
Definition: sdp_message.h:249
sdp_connection_t * c_connection
Definition: sdp_message.h:243
osip_list_t b_bandwidths
Definition: sdp_message.h:245
osip_list_t t_descrs
Definition: sdp_message.h:247
char * o_nettype
Definition: sdp_message.h:235
osip_list_t p_phones
Definition: sdp_message.h:242
char * o_sess_id
Definition: sdp_message.h:233
char * z_adjustments
Definition: sdp_message.h:248
char * o_addr
Definition: sdp_message.h:237
osip_list_t m_medias
Definition: sdp_message.h:252
Definition: sdp_message.h:82
osip_list_t r_repeats
Definition: sdp_message.h:85
char * t_stop_time
Definition: sdp_message.h:84
char * t_start_time
Definition: sdp_message.h:83