2 * Linphone is sip (RFC3261) compatible internet phone.
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <osipparser2/sdp_message.h>
22 #include "linphonecore.h"
24 typedef struct _sdp_payload
26 int line; /* the index of the m= line */
27 int pt; /*payload type */
30 int b_as_bandwidth; /* application specific bandwidth */
35 char *c_addr_multicast_ttl;
36 char *c_addr_multicast_int;
41 char *relay_session_id;
45 typedef struct _sdp_context sdp_context_t;
47 typedef int (*sdp_handler_read_codec_func_t) (struct _sdp_context *,
49 typedef int (*sdp_handler_write_codec_func_t) (struct _sdp_context *);
51 typedef struct _sdp_handler
53 sdp_handler_read_codec_func_t accept_audio_codecs; /*from remote sdp */
54 sdp_handler_read_codec_func_t accept_video_codecs; /*from remote sdp */
55 sdp_handler_write_codec_func_t set_audio_codecs; /*to local sdp */
56 sdp_handler_write_codec_func_t set_video_codecs; /*to local sdp */
57 sdp_handler_read_codec_func_t get_audio_codecs; /*from incoming answer */
58 sdp_handler_read_codec_func_t get_video_codecs; /*from incoming answer */
62 typedef enum _sdp_context_state
64 SDP_CONTEXT_STATE_INIT,
65 SDP_CONTEXT_STATE_NEGOCIATION_OPENED,
66 SDP_CONTEXT_STATE_NEGOCIATION_CLOSED
67 } sdp_context_state_t;
71 sdp_handler_t *handler;
75 sdp_message_t *offer; /* the local sdp to be used for outgoing request */
77 sdp_message_t *answer; /* the local sdp generated from an inc request */
80 char *relay_session_id;
81 int negoc_status; /* in sip code */
83 sdp_context_state_t state;
86 /* create a context for a sdp negociation: localip is the ip address to be used in the sdp message, can
87 be a firewall address.
88 It can be null when negociating for an incoming offer; In that case it will be guessed. */
89 sdp_context_t *sdp_handler_create_context(sdp_handler_t *handler, const char *localip, const char *username, const char *relay);
90 void sdp_context_set_user_pointer(sdp_context_t * ctx, void* up);
91 void *sdp_context_get_user_pointer(sdp_context_t * ctx);
92 void sdp_context_add_audio_payload( sdp_context_t * ctx, sdp_payload_t * payload);
93 void sdp_context_add_video_payload( sdp_context_t * ctx, sdp_payload_t * payload);
94 char * sdp_context_get_offer(sdp_context_t *ctx);
95 char * sdp_context_get_answer(sdp_context_t* ctx, sdp_message_t *remote_offer);
96 int sdp_context_get_status(sdp_context_t* ctx);
97 void sdp_context_read_answer(sdp_context_t *ctx, sdp_message_t *remote_answer);
98 void sdp_context_free(sdp_context_t *ctx);
100 int sdp_payload_init (sdp_payload_t * payload);