SIP Witch 1.9.15
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-2015 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 
21 #ifndef _SDP_H_
22 #define _SDP_H_
23 
24 #ifdef ENABLE_MPATROL
25 #include <mpatrol.h>
26 #endif
27 
28 #include <osipparser2/osip_list.h>
29 
30 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
53 
58  struct sdp_bandwidth {
59  char *b_bwtype;
60  char *b_bandwidth;
61  };
62 
67  int sdp_bandwidth_init (sdp_bandwidth_t ** elem);
72  void sdp_bandwidth_free (sdp_bandwidth_t * elem);
73 
79 
84  struct sdp_time_descr {
85  char *t_start_time;
86  char *t_stop_time;
88  };
89 
100 
105  typedef struct sdp_key sdp_key_t;
106 
111  struct sdp_key {
112  char *k_keytype;
113  char *k_keydata;
114  };
115 
120  int sdp_key_init (sdp_key_t ** elem);
125  void sdp_key_free (sdp_key_t * elem);
126 
132 
137  struct sdp_attribute {
138  char *a_att_field;
139  char *a_att_value;
140  };
141 
146  int sdp_attribute_init (sdp_attribute_t ** elem);
151  void sdp_attribute_free (sdp_attribute_t * elem);
152 
153 
159 
164  struct sdp_connection {
165  char *c_nettype;
166  char *c_addrtype;
167  char *c_addr;
172  };
173 
184 
189  typedef struct sdp_media sdp_media_t;
190 
195  struct sdp_media {
196  char *m_media;
197  char *m_port;
199  char *m_proto;
202  char *i_info;
210  };
211 
216  int sdp_media_init (sdp_media_t ** elem);
221  void sdp_media_free (sdp_media_t * elem);
222 
227  typedef struct sdp_message sdp_message_t;
228 
233  struct sdp_message {
234  char *v_version;
235  char *o_username;
236  char *o_sess_id;
238  char *o_nettype;
239  char *o_addrtype;
240  char *o_addr;
241  char *s_name;
242  char *i_info;
243  char *u_uri;
256  };
257 
258 
259 
264  int sdp_message_init (sdp_message_t ** sdp);
270  int sdp_message_parse (sdp_message_t * sdp, const char *buf);
276  int sdp_message_to_str (sdp_message_t * sdp, char **dest);
281  void sdp_message_free (sdp_message_t * sdp);
287  int sdp_message_clone (sdp_message_t * sdp, sdp_message_t ** dest);
288 
294  int sdp_message_v_version_set (sdp_message_t * sdp, char *value);
310  int sdp_message_o_origin_set (sdp_message_t * sdp, char *username, char *sess_id, char *sess_version, char *nettype, char *addrtype, char *addr);
346  int sdp_message_s_name_set (sdp_message_t * sdp, char *value);
358  int sdp_message_i_info_set (sdp_message_t * sdp, int pos_media, char *value);
364  char *sdp_message_i_info_get (sdp_message_t * sdp, int pos_media);
370  int sdp_message_u_uri_set (sdp_message_t * sdp, char *value);
375  char *sdp_message_u_uri_get (sdp_message_t * sdp);
381  int sdp_message_e_email_add (sdp_message_t * sdp, char *value);
386 #define sdp_e_email_get sdp_message_e_email_get
387 
392  char *sdp_message_e_email_get (sdp_message_t * sdp, int pos);
398  int sdp_message_p_phone_add (sdp_message_t * sdp, char *value);
404  char *sdp_message_p_phone_get (sdp_message_t * sdp, int pos);
415  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);
416 #ifndef DOXYGEN
417 /* this method should be internal only... */
418  sdp_connection_t *sdp_message_connection_get (sdp_message_t * sdp, int pos_media, int pos);
419 #endif
420 
426  char *sdp_message_c_nettype_get (sdp_message_t * sdp, int pos_media, int pos);
433  char *sdp_message_c_addrtype_get (sdp_message_t * sdp, int pos_media, int pos);
440  char *sdp_message_c_addr_get (sdp_message_t * sdp, int pos_media, int pos);
447  char *sdp_message_c_addr_multicast_ttl_get (sdp_message_t * sdp, int pos_media, int pos);
454  char *sdp_message_c_addr_multicast_int_get (sdp_message_t * sdp, int pos_media, int pos);
462  int sdp_message_b_bandwidth_add (sdp_message_t * sdp, int pos_media, char *bwtype, char *bandwidth);
469  sdp_bandwidth_t *sdp_message_bandwidth_get (sdp_message_t * sdp, int pos_media, int pos);
476  char *sdp_message_b_bwtype_get (sdp_message_t * sdp, int pos_media, int pos);
483  char *sdp_message_b_bandwidth_get (sdp_message_t * sdp, int pos_media, int pos);
490  int sdp_message_t_time_descr_add (sdp_message_t * sdp, char *start, char *stop);
496  char *sdp_message_t_start_time_get (sdp_message_t * sdp, int pos_td);
502  char *sdp_message_t_stop_time_get (sdp_message_t * sdp, int pos_td);
509  int sdp_message_r_repeat_add (sdp_message_t * sdp, int pos_time_descr, char *value);
516  char *sdp_message_r_repeat_get (sdp_message_t * sdp, int pos_time_descr, int pos_repeat);
535  int sdp_message_k_key_set (sdp_message_t * sdp, int pos_media, char *keytype, char *keydata);
541  char *sdp_message_k_keytype_get (sdp_message_t * sdp, int pos_media);
547  char *sdp_message_k_keydata_get (sdp_message_t * sdp, int pos_media);
555  int sdp_message_a_attribute_add (sdp_message_t * sdp, int pos_media, char *att_field, char *att_value);
562  int sdp_message_a_attribute_del (sdp_message_t * sdp, int pos_media, char *att_field);
570  int sdp_message_a_attribute_del_at_index (sdp_message_t * sdp, int pos_media, char *att_field, int pos_attr);
577  sdp_attribute_t *sdp_message_attribute_get (sdp_message_t * sdp, int pos_media, int pos);
584  char *sdp_message_a_att_field_get (sdp_message_t * sdp, int pos_media, int pos);
591  char *sdp_message_a_att_value_get (sdp_message_t * sdp, int pos_media, int pos);
597  int sdp_message_endof_media (sdp_message_t * sdp, int pos);
606  int sdp_message_m_media_add (sdp_message_t * sdp, char *media, char *port, char *number_of_port, char *proto);
612  char *sdp_message_m_media_get (sdp_message_t * sdp, int pos_media);
618  char *sdp_message_m_port_get (sdp_message_t * sdp, int pos_media);
625  int sdp_message_m_port_set (sdp_message_t * sdp, int pos_media, char *port);
631  char *sdp_message_m_number_of_port_get (sdp_message_t * sdp, int pos_media);
637  char *sdp_message_m_proto_get (sdp_message_t * sdp, int pos_media);
644  int sdp_message_m_payload_add (sdp_message_t * sdp, int pos_media, char *payload);
651  char *sdp_message_m_payload_get (sdp_message_t * sdp, int pos_media, int pos);
658  int sdp_message_m_payload_del (sdp_message_t * sdp, int pos_media, int pos);
659 
660 
664 #ifdef __cplusplus
665 }
666 #endif
667 #endif
Structure for referencing a list of elements.
Definition: osip_list.h:82
char * k_keydata
key data
Definition: sdp_message.h:113
char * sdp_message_m_port_get(sdp_message_t *sdp, int pos_media)
Get the port number ('m' field) of a SDP packet.
int sdp_message_k_key_set(sdp_message_t *sdp, int pos_media, char *keytype, char *keydata)
Add a key in a SDP packet.
sdp_key_t * k_key
key informations
Definition: sdp_message.h:209
int sdp_message_r_repeat_add(sdp_message_t *sdp, int pos_time_descr, char *value)
Set the repeat information ('r' field) in a SDP packet.
int sdp_message_m_payload_add(sdp_message_t *sdp, int pos_media, char *payload)
Set the payload in a SDP packet.
void sdp_message_free(sdp_message_t *sdp)
Free a SDP packet.
int sdp_message_b_bandwidth_add(sdp_message_t *sdp, int pos_media, char *bwtype, char *bandwidth)
Set the version in a SDP packet.
char * sdp_message_c_addr_multicast_ttl_get(sdp_message_t *sdp, int pos_media, int pos)
Get the multicast ttl ('c' field) of a SDP packet.
int sdp_message_v_version_set(sdp_message_t *sdp, char *value)
Set the version in a SDP packet.
char * c_nettype
Network Type.
Definition: sdp_message.h:165
char * o_username
Username.
Definition: sdp_message.h:235
SDP key definition.
Definition: sdp_message.h:111
char * sdp_message_z_adjustments_get(sdp_message_t *sdp)
Get the adjustments ('z' field) of a SDP packet.
char * m_port
port number
Definition: sdp_message.h:197
int sdp_message_m_payload_del(sdp_message_t *sdp, int pos_media, int pos)
Remove a payload in a SDP packet.
char * sdp_message_m_payload_get(sdp_message_t *sdp, int pos_media, int pos)
Get one of the payload number ('m' field) of a SDP packet.
osip_list_t c_connections
list of sdp_connection_t *
Definition: sdp_message.h:203
void sdp_connection_free(sdp_connection_t *elem)
Free a connection element.
char * b_bandwidth
bandwidth value
Definition: sdp_message.h:60
char * a_att_field
attribute field
Definition: sdp_message.h:138
char * z_adjustments
Time adjustment header.
Definition: sdp_message.h:251
int sdp_message_a_attribute_del(sdp_message_t *sdp, int pos_media, char *att_field)
delete all attribute fields specified by att_field.
int sdp_connection_init(sdp_connection_t **elem)
Allocate a connection element.
int sdp_message_endof_media(sdp_message_t *sdp, int pos)
Check if there is more media lines a SDP packet.
int sdp_message_i_info_set(sdp_message_t *sdp, int pos_media, char *value)
Set the version in a SDP packet.
char * t_stop_time
stop time
Definition: sdp_message.h:86
int sdp_message_a_attribute_del_at_index(sdp_message_t *sdp, int pos_media, char *att_field, int pos_attr)
delete one specific attribute fields specified by att_field.
SDP bandwidth definition.
Definition: sdp_message.h:58
char * i_info
Information header.
Definition: sdp_message.h:242
void sdp_attribute_free(sdp_attribute_t *elem)
Free a attribute element.
char * sdp_message_a_att_value_get(sdp_message_t *sdp, int pos_media, int pos)
Get the attribute value ('a' field) of a SDP packet.
char * sdp_message_o_sess_version_get(sdp_message_t *sdp)
Get the session version ('o' field) of a SDP packet.
osip_list_t b_bandwidths
list of bandwidth info (sdp_bandwidth_t)
Definition: sdp_message.h:248
sdp_key_t * k_key
Key information header.
Definition: sdp_message.h:252
char * sdp_message_o_username_get(sdp_message_t *sdp)
Get the username ('o' field) of a SDP packet.
char * sdp_message_c_addr_multicast_int_get(sdp_message_t *sdp, int pos_media, int pos)
Get the multicast int info ('c' field) of a SDP packet.
char * sdp_message_u_uri_get(sdp_message_t *sdp)
Get the uri ('u' field) of a SDP packet.
char * sdp_message_m_media_get(sdp_message_t *sdp, int pos_media)
Get the media type ('m' field) of a SDP packet.
char * sdp_message_b_bwtype_get(sdp_message_t *sdp, int pos_media, int pos)
Get the bandwidth type ('b' field) of a SDP packet.
char * u_uri
Uri header.
Definition: sdp_message.h:243
int sdp_message_parse(sdp_message_t *sdp, const char *buf)
Parse a SDP packet.
char * b_bwtype
bandwidth type
Definition: sdp_message.h:59
int sdp_key_init(sdp_key_t **elem)
Allocate a key element.
void sdp_key_free(sdp_key_t *elem)
Free a key element.
char * m_media
media type
Definition: sdp_message.h:196
char * c_addrtype
Network Address Type.
Definition: sdp_message.h:166
osip_list_t e_emails
list of mail address
Definition: sdp_message.h:244
oSIP list Routines
char * sdp_message_m_number_of_port_get(sdp_message_t *sdp, int pos_media)
Get the number of port ('m' field) of a SDP packet.
sdp_connection_t * c_connection
Connection information.
Definition: sdp_message.h:246
SDP connection definition.
Definition: sdp_message.h:164
int sdp_message_z_adjustments_set(sdp_message_t *sdp, char *value)
Set the adjustments ('z' field) of a SDP packet.
osip_list_t t_descrs
list of time description (sdp_time_descr_t)
Definition: sdp_message.h:250
char * sdp_message_b_bandwidth_get(sdp_message_t *sdp, int pos_media, int pos)
Get the bandwidth value ('b' field) of a SDP packet.
int sdp_message_t_time_descr_add(sdp_message_t *sdp, char *start, char *stop)
Set the version in a SDP packet.
int sdp_message_u_uri_set(sdp_message_t *sdp, char *value)
Set the session info in a SDP packet.
void sdp_media_free(sdp_media_t *elem)
Free a media element.
char * i_info
information header
Definition: sdp_message.h:202
char * sdp_message_m_proto_get(sdp_message_t *sdp, int pos_media)
Get the protocol ('m' field) of a SDP packet.
char * sdp_message_o_sess_id_get(sdp_message_t *sdp)
Get the session id ('o' field) of a SDP packet.
char * c_addr_multicast_int
Number of multicast address.
Definition: sdp_message.h:170
char * t_start_time
start time
Definition: sdp_message.h:85
char * m_number_of_port
number of port
Definition: sdp_message.h:198
char * m_proto
protocol to be used
Definition: sdp_message.h:199
char * o_nettype
Network type.
Definition: sdp_message.h:238
osip_list_t p_phones
list of phone numbers *
Definition: sdp_message.h:245
char * c_addr
Address.
Definition: sdp_message.h:167
char * sdp_message_e_email_get(sdp_message_t *sdp, int pos)
Get one of the email ('e' field) of a SDP packet.
int sdp_message_m_port_set(sdp_message_t *sdp, int pos_media, char *port)
Set the port number ('m' field) of a SDP packet.
char * o_addr
Address.
Definition: sdp_message.h:240
osip_list_t r_repeats
repeat headers
Definition: sdp_message.h:87
osip_list_t b_bandwidths
list of sdp_bandwidth_t *
Definition: sdp_message.h:205
int sdp_bandwidth_init(sdp_bandwidth_t **elem)
Allocate a bandwidth element.
int sdp_message_clone(sdp_message_t *sdp, sdp_message_t **dest)
Clone a SDP packet.
osip_list_t a_attributes
list of global attributes (sdp_attribute_t)
Definition: sdp_message.h:253
int sdp_message_s_name_set(sdp_message_t *sdp, char *value)
Set the session name in a SDP packet.
osip_list_t m_medias
list of supported media (sdp_media_t)
Definition: sdp_message.h:255
char * sdp_message_t_start_time_get(sdp_message_t *sdp, int pos_td)
Get the start time value ('t' field) of a SDP packet.
char * sdp_message_o_addr_get(sdp_message_t *sdp)
Get the addr ('o' field) of a SDP packet.
int sdp_message_p_phone_add(sdp_message_t *sdp, char *value)
Set the version in a SDP packet.
SDP media definition.
Definition: sdp_message.h:195
SDP attribute definition.
Definition: sdp_message.h:137
char * sdp_message_v_version_get(sdp_message_t *sdp)
Get the version ('v' field) of a SDP packet.
char * o_sess_version
Version of session.
Definition: sdp_message.h:237
sdp_bandwidth_t * sdp_message_bandwidth_get(sdp_message_t *sdp, int pos_media, int pos)
Get the bandwidth ('b' field) of a SDP packet.
char * value[96]
Definition: cgiserver.cpp:90
void sdp_bandwidth_free(sdp_bandwidth_t *elem)
Free a bandwidth element.
char * sdp_message_k_keydata_get(sdp_message_t *sdp, int pos_media)
Get the key value ('k' field) of a SDP packet.
char * sdp_message_k_keytype_get(sdp_message_t *sdp, int pos_media)
Get the key type ('k' field) of a SDP packet.
SDP Time description definition.
Definition: sdp_message.h:84
int sdp_time_descr_init(sdp_time_descr_t **elem)
Allocate a time description element.
char * o_sess_id
Identifier for session.
Definition: sdp_message.h:236
SDP message definition.
Definition: sdp_message.h:233
char * sdp_message_o_nettype_get(sdp_message_t *sdp)
Get the nettype ('o' field) of a SDP packet.
int sdp_message_init(sdp_message_t **sdp)
Allocate a SDP packet.
char * c_addr_multicast_ttl
TTL value for multicast address.
Definition: sdp_message.h:168
char * sdp_message_r_repeat_get(sdp_message_t *sdp, int pos_time_descr, int pos_repeat)
Get the repeat information ('r' field) in a SDP packet.
char * k_keytype
Key Type (prompt, clear, base64, uri)
Definition: sdp_message.h:112
int sdp_message_a_attribute_add(sdp_message_t *sdp, int pos_media, char *att_field, char *att_value)
Set the version in a SDP packet.
int sdp_message_m_media_add(sdp_message_t *sdp, char *media, char *port, char *number_of_port, char *proto)
Add a media line in a SDP packet.
int sdp_message_e_email_add(sdp_message_t *sdp, char *value)
Set the version in a SDP packet.
char * sdp_message_i_info_get(sdp_message_t *sdp, int pos_media)
Get the session info ('i' field) of a SDP packet.
int sdp_message_to_str(sdp_message_t *sdp, char **dest)
Get a string representation of a SDP packet.
char * sdp_message_s_name_get(sdp_message_t *sdp)
Get the session name ('s' field) of a SDP packet.
char * v_version
version header
Definition: sdp_message.h:234
char * a_att_value
attribute value (optional)
Definition: sdp_message.h:139
char * sdp_message_p_phone_get(sdp_message_t *sdp, int pos)
Get one of the phone ('p' field) of a SDP packet.
sdp_attribute_t * sdp_message_attribute_get(sdp_message_t *sdp, int pos_media, int pos)
Get one of the attribute ('a' field) of a SDP packet.
char * sdp_message_a_att_field_get(sdp_message_t *sdp, int pos_media, int pos)
Get the attribute name ('a' field) of a SDP packet.
void sdp_time_descr_free(sdp_time_descr_t *elem)
Free a time description element.
sdp_connection_t * sdp_message_connection_get(sdp_message_t *sdp, int pos_media, int pos)
char * sdp_message_t_stop_time_get(sdp_message_t *sdp, int pos_td)
Get the stop time value ('t' field) of a SDP packet.
osip_list_t m_payloads
list of payloads (as strings)
Definition: sdp_message.h:200
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)
Set the version in a SDP packet.
char * sdp_message_c_nettype_get(sdp_message_t *sdp, int pos_media, int pos)
Get the network type ('c' field) of a SDP packet.
osip_list_t a_attributes
list of sdp_attribute_t *
Definition: sdp_message.h:207
char * sdp_message_o_addrtype_get(sdp_message_t *sdp)
Get the addrtype ('o' field) of a SDP packet.
char * o_addrtype
Address type.
Definition: sdp_message.h:239
int sdp_message_o_origin_set(sdp_message_t *sdp, char *username, char *sess_id, char *sess_version, char *nettype, char *addrtype, char *addr)
Set the origin field in a SDP packet.
char * sdp_message_c_addrtype_get(sdp_message_t *sdp, int pos_media, int pos)
Get the address type ('c' field) of a SDP packet.
char * s_name
Subject header.
Definition: sdp_message.h:241
int sdp_attribute_init(sdp_attribute_t **elem)
Allocate an attribute element.
int sdp_media_init(sdp_media_t **elem)
Allocate a media element.
char * sdp_message_c_addr_get(sdp_message_t *sdp, int pos_media, int pos)
Get the address ('c' field) of a SDP packet.