3 Copyright (C) 2010 Simon MORLAT (simon.morlat@free.fr)
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program 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
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 This header files defines the Signaling Abstraction Layer.
22 The purpose of this layer is too allow experiment different call signaling
23 protocols and implementations under linphone, for example SIP, JINGLE...
28 SalMediaDescription *sal_media_description_new(){
29 SalMediaDescription *md=ms_new0(SalMediaDescription,1);
34 static void sal_media_description_destroy(SalMediaDescription *md){
36 for(i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;i++){
37 ms_list_for_each(md->streams[i].payloads,(void (*)(void *))payload_type_destroy);
38 ms_list_free(md->streams[i].payloads);
39 md->streams[i].payloads=NULL;
44 void sal_media_description_ref(SalMediaDescription *md){
48 void sal_media_description_unref(SalMediaDescription *md){
51 sal_media_description_destroy (md);
55 const SalStreamDescription *sal_media_description_find_stream(const SalMediaDescription *md,
56 SalMediaProto proto, SalStreamType type){
58 for(i=0;i<md->nstreams;++i){
59 const SalStreamDescription *ss=&md->streams[i];
60 if (ss->proto==proto && ss->type==type) return ss;
65 bool_t sal_media_description_empty(const SalMediaDescription *md){
67 for(i=0;i<md->nstreams;++i){
68 const SalStreamDescription *ss=&md->streams[i];
69 if (ss->port!=0) return FALSE;
74 void sal_media_description_set_dir(SalMediaDescription *md, SalStreamDir stream_dir){
76 for(i=0;i<md->nstreams;++i){
77 SalStreamDescription *ss=&md->streams[i];
82 bool_t sal_media_description_has_dir(const SalMediaDescription *md, SalStreamDir stream_dir){
84 for(i=0;i<md->nstreams;++i){
85 const SalStreamDescription *ss=&md->streams[i];
86 if (ss->dir==stream_dir) return TRUE;
91 static void assign_string(char **str, const char *arg){
100 void sal_op_set_contact(SalOp *op, const char *contact){
101 assign_string(&((SalOpBase*)op)->contact,contact);
104 void sal_op_set_route(SalOp *op, const char *route){
105 assign_string(&((SalOpBase*)op)->route,route);
108 void sal_op_set_from(SalOp *op, const char *from){
109 assign_string(&((SalOpBase*)op)->from,from);
112 void sal_op_set_to(SalOp *op, const char *to){
113 assign_string(&((SalOpBase*)op)->to,to);
116 void sal_op_set_user_pointer(SalOp *op, void *up){
117 ((SalOpBase*)op)->user_pointer=up;
120 Sal *sal_op_get_sal(const SalOp *op){
121 return ((SalOpBase*)op)->root;
124 const char *sal_op_get_from(const SalOp *op){
125 return ((SalOpBase*)op)->from;
128 const char *sal_op_get_to(const SalOp *op){
129 return ((SalOpBase*)op)->to;
132 const char *sal_op_get_contact(const SalOp *op){
133 return ((SalOpBase*)op)->contact;
136 const char *sal_op_get_route(const SalOp *op){
137 return ((SalOpBase*)op)->route;
140 void *sal_op_get_user_pointer(const SalOp *op){
141 return ((SalOpBase*)op)->user_pointer;
144 const char *sal_op_get_proxy(const SalOp *op){
145 return ((SalOpBase*)op)->route;
148 const char *sal_op_get_network_origin(const SalOp *op){
149 return ((SalOpBase*)op)->origin;
152 void __sal_op_init(SalOp *b, Sal *sal){
153 memset(b,0,sizeof(SalOpBase));
154 ((SalOpBase*)b)->root=sal;
157 void __sal_op_set_network_origin(SalOp *op, const char *origin){
158 assign_string(&((SalOpBase*)op)->origin,origin);
162 void __sal_op_free(SalOp *op){
163 SalOpBase *b=(SalOpBase *)op;
185 sal_media_description_unref(b->local_media);
187 sal_media_description_unref(b->remote_media);