source: verona/phapi/sdphandler.h @ 150:5e24ab07af1f

Last change on this file since 150:5e24ab07af1f was 150:5e24ab07af1f, checked in by Nikita Kozlov <nikita@…>, 2 years ago

fix some memleaks in phapi

File size: 3.9 KB
Line 
1 /*
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.
7  *
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.
12  *
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
16  */
17
18#ifndef SDP_HANDLER_H
19#define SDP_HANDLER_H
20
21#include <osipparser2/sdp_message.h>
22
23typedef struct _sdp_payload
24{
25        int line;       /* the index of the m= line */
26        int pt;         /*payload type */
27        int localport;
28        int localrtcpport;
29        int remoteport;
30        int remotertcpport;
31        int b_as_bandwidth;     /* application specific bandwidth */
32        char *proto;
33        char *c_nettype;
34        char *c_addrtype;
35        char *c_addr;
36        char *c_addr_multicast_ttl;
37        char *c_addr_multicast_int;
38        char *a_rtpmap;
39        char *a_fmtp;
40        char *relay_host;
41        int relay_port;
42        char *relay_session_id;
43        int a_ptime;
44} sdp_payload_t;
45
46typedef struct _sdp_context sdp_context_t;
47
48typedef int (*sdp_handler_read_codec_func_t) (struct _sdp_context *, sdp_payload_t *);
49typedef int (*sdp_handler_write_codec_func_t) (struct _sdp_context *);
50
51typedef struct _sdp_handler
52{
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  */
59} sdp_handler_t;
60
61
62typedef enum _sdp_context_state
63{
64        SDP_CONTEXT_STATE_INIT,
65        SDP_CONTEXT_STATE_NEGOCIATION_OPENED,
66        SDP_CONTEXT_STATE_NEGOCIATION_CLOSED
67} sdp_context_state_t;
68
69struct _sdp_context
70{
71        sdp_handler_t *handler;
72        char *localip;
73        char *username;
74        void *reference;
75        sdp_message_t *offer;           /* the local sdp to be used for outgoing request */
76        char *offerstr;
77        sdp_message_t *answer;          /* the local sdp generated from an inc request */
78        char *answerstr;
79        char *relay;
80        char *relay_session_id;
81        int negoc_status;       /* in sip code */
82        int incb;
83        sdp_context_state_t state;
84};
85
86/* create a context for a sdp negociation: localip is the ip address to be used in the sdp message, can
87be a firewall address.
88It can be null when negociating for an incoming offer; In that case it will be guessed. */
89sdp_context_t *sdp_handler_create_context(sdp_handler_t *handler, const char *localip, const char *username, const char *relay);
90void sdp_context_set_user_pointer(sdp_context_t * ctx, void* up);
91void *sdp_context_get_user_pointer(sdp_context_t * ctx);
92void sdp_context_add_audio_payload(sdp_context_t * ctx, sdp_payload_t * payload, int ptime);
93void sdp_context_add_video_payload(sdp_context_t * ctx, sdp_payload_t * payload);
94char * sdp_context_build_offer(sdp_context_t *ctx);
95char * sdp_context_build_answer(sdp_context_t* ctx, sdp_message_t *remote_offer, int ptime);
96int sdp_context_get_status(sdp_context_t* ctx);
97void sdp_context_process_answer(sdp_context_t *ctx, sdp_message_t *remote_answer);
98void sdp_context_free(sdp_context_t *ctx);
99int sdp_message_m_attr_has_type(sdp_message_t *sdp, const char *type);
100
101int sdp_payload_init (sdp_payload_t * payload);
102void sdp_payload_free(void *data);
103int sdp_payload_clone(void *src, void **dst);
104int sdp_equal_payload(const sdp_payload_t *cur_payload, const sdp_payload_t *payload);
105int sdp_payload_list_add(struct osip_list* list, int pt, char *rtpmap, int line);
106#endif
Note: See TracBrowser for help on using the repository browser.