]> sjero.net Git - linphone/commitdiff
implement dscp settings from config file and gtk interface
authorSimon Morlat <simon.morlat@linphone.org>
Fri, 14 Sep 2012 15:38:18 +0000 (17:38 +0200)
committerSimon Morlat <simon.morlat@linphone.org>
Fri, 14 Sep 2012 15:39:27 +0000 (17:39 +0200)
12 files changed:
coreapi/linphonecall.c
coreapi/linphonecore.c
coreapi/linphonecore.h
coreapi/lpconfig.c
coreapi/lpconfig.h
coreapi/sal.h
coreapi/sal_eXosip2.c
coreapi/sal_eXosip2.h
gtk/Makefile.am
gtk/dscp_settings.ui [new file with mode: 0644]
gtk/parameters.ui
gtk/propertybox.c

index 41b39cb8b904661620a68605fb2653b5b012eac1..5962badd3a257e2503ca019c4beb3cbe0aa50dce 100644 (file)
@@ -974,7 +974,7 @@ void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, Lin
 void linphone_call_init_audio_stream(LinphoneCall *call){
        LinphoneCore *lc=call->core;
        AudioStream *audiostream;
-       int dscp=lp_config_get_int(lc->config,"rtp","audio_dscp",-1);
+       int dscp=linphone_core_get_audio_dscp(lc);
 
        call->audiostream=audiostream=audio_stream_new(call->audio_port,call->audio_port+1,linphone_core_ipv6_enabled(lc));
        if (dscp!=-1)
@@ -1028,7 +1028,7 @@ void linphone_call_init_video_stream(LinphoneCall *call){
 
        if ((lc->video_conf.display || lc->video_conf.capture) && call->params.has_video){
                int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0);
-               int dscp=lp_config_get_int(lc->config,"rtp","video_dscp",-1);
+               int dscp=linphone_core_get_video_dscp(lc);
                
                call->videostream=video_stream_new(call->video_port,call->video_port+1,linphone_core_ipv6_enabled(lc));
                if (dscp!=-1)
index f8a33de57383b4803ad5e9b5ebe07c73cccaf006..6d81d8b719cca3e57e5e31abff3b5ff18c538c36 100644 (file)
@@ -615,6 +615,7 @@ static void sip_config_read(LinphoneCore *lc)
        sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period);
        sal_use_one_matching_codec_policy(lc->sal,lp_config_get_int(lc->config,"sip","only_one_codec",0));
        sal_use_double_registrations(lc->sal,lp_config_get_int(lc->config,"sip","use_double_registrations",1));
+       sal_set_dscp(lc->sal,linphone_core_get_sip_dscp(lc));
 }
 
 static void rtp_config_read(LinphoneCore *lc)
@@ -5112,3 +5113,74 @@ void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id)
 const char*  linphone_core_get_device_identifier(const LinphoneCore *lc) {
        return lc->device_id;
 }
+
+/**
+ * Set the DSCP field for SIP signaling channel.
+ * 
+ * @ingroup network_parameters
+ * * The DSCP defines the quality of service in IP packets.
+ * 
+**/
+void linphone_core_set_sip_dscp(LinphoneCore *lc, int dscp){
+       sal_set_dscp(lc->sal,dscp);
+       if (linphone_core_ready(lc))
+               lp_config_set_int_hex(lc->config,"sip","dscp",dscp);
+}
+
+/**
+ * Get the DSCP field for SIP signaling channel.
+ * 
+ * @ingroup network_parameters
+ * * The DSCP defines the quality of service in IP packets.
+ * 
+**/
+int linphone_core_get_sip_dscp(const LinphoneCore *lc){
+       return lp_config_get_int(lc->config,"sip","dscp",0x1a);
+}
+
+/**
+ * Set the DSCP field for outgoing audio streams.
+ *
+ * @ingroup network_parameters
+ * The DSCP defines the quality of service in IP packets.
+ * 
+**/
+void linphone_core_set_audio_dscp(LinphoneCore *lc, int dscp){
+       if (linphone_core_ready(lc))
+               lp_config_set_int_hex(lc->config,"rtp","audio_dscp",dscp);
+}
+
+/**
+ * Get the DSCP field for outgoing audio streams.
+ *
+ * @ingroup network_parameters
+ * The DSCP defines the quality of service in IP packets.
+ * 
+**/
+int linphone_core_get_audio_dscp(const LinphoneCore *lc){
+       return lp_config_get_int(lc->config,"rtp","audio_dscp",0x2e);
+}
+
+/**
+ * Set the DSCP field for outgoing video streams.
+ *
+ * @ingroup network_parameters
+ * The DSCP defines the quality of service in IP packets.
+ * 
+**/
+void linphone_core_set_video_dscp(LinphoneCore *lc, int dscp){
+       if (linphone_core_ready(lc))
+               lp_config_set_int_hex(lc->config,"rtp","video_dscp",dscp);
+       
+}
+
+/**
+ * Get the DSCP field for outgoing video streams.
+ *
+ * @ingroup network_parameters
+ * The DSCP defines the quality of service in IP packets.
+ * 
+**/
+int linphone_core_get_video_dscp(const LinphoneCore *lc){
+       return lp_config_get_int(lc->config,"rtp","video_dscp",0x2e);
+}
index 009648be3053bf8db601a32c07d4d02c8d98711a..ef24f2c78cbb3894e3a31637699641c9652fc83c 100644 (file)
@@ -1389,6 +1389,15 @@ LinphoneTunnel *linphone_core_get_tunnel(LinphoneCore *lc);
 
 void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy);
 
+void linphone_core_set_sip_dscp(LinphoneCore *lc, int dscp);
+int linphone_core_get_sip_dscp(const LinphoneCore *lc);
+
+void linphone_core_set_audio_dscp(LinphoneCore *lc, int dscp);
+int linphone_core_get_audio_dscp(const LinphoneCore *lc);
+
+void linphone_core_set_video_dscp(LinphoneCore *lc, int dscp);
+int linphone_core_get_video_dscp(const LinphoneCore *lc);
+
 #ifdef __cplusplus
 }
 #endif
index 4cd7202cc82ea6c1efa426db579bfc0dd3cbdb48..0efdc335e529e77777e369503b95801a1d1e3edc 100644 (file)
@@ -273,7 +273,13 @@ const char *lp_config_get_string(LpConfig *lpconfig, const char *section, const
 
 int lp_config_get_int(LpConfig *lpconfig,const char *section, const char *key, int default_value){
        const char *str=lp_config_get_string(lpconfig,section,key,NULL);
-       if (str!=NULL) return atoi(str);
+       if (str!=NULL) {
+               int ret=0;
+               if (strstr(str,"0x")==str){
+                       sscanf(str,"%x",&ret);
+               }else ret=atoi(str);
+               return ret;
+       }
        else return default_value;
 }
 
@@ -324,6 +330,12 @@ void lp_config_set_int(LpConfig *lpconfig,const char *section, const char *key,
        lp_config_set_string(lpconfig,section,key,tmp);
 }
 
+void lp_config_set_int_hex(LpConfig *lpconfig,const char *section, const char *key, int value){
+       char tmp[30];
+       snprintf(tmp,sizeof(tmp),"0x%x",value);
+       lp_config_set_string(lpconfig,section,key,tmp);
+}
+
 void lp_config_set_int64(LpConfig *lpconfig,const char *section, const char *key, int64_t value){
        char tmp[30];
        snprintf(tmp,sizeof(tmp),"%lli",(long long)value);
index c1821d2aab7fe4b34e1c61c9b22eb74529f7c92d..a27f7e39a28327ed54fd12ea34f6b6b02a26434f 100644 (file)
@@ -96,6 +96,14 @@ void lp_config_set_string(LpConfig *lpconfig,const char *section, const char *ke
  * @ingroup misc
 **/
 void lp_config_set_int(LpConfig *lpconfig,const char *section, const char *key, int value);
+
+/**
+ * Sets an integer config item, but store it as hexadecimal
+ *
+ * @ingroup misc
+**/
+void lp_config_set_int_hex(LpConfig *lpconfig,const char *section, const char *key, int value);
+
 /**
  * Sets a 64 bits integer config item
  *
index 9c3f6d61f2e46bf99631ec819b4c0d344eff24ca..751cc653309df69c99762dc1a0fb9993c4704b6f 100644 (file)
@@ -325,6 +325,7 @@ void sal_auth_info_delete(const SalAuthInfo* auth_info);
 void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs);
 int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure);
 int sal_unlisten_ports(Sal *ctx);
+void sal_set_dscp(Sal *ctx, int dscp);
 int sal_reset_transports(Sal *ctx);
 ortp_socket_t sal_get_socket(Sal *ctx);
 void sal_set_user_agent(Sal *ctx, const char *user_agent);
index 30b0f286dafb59c73ec2b28859793de9f9bebd3f..821e4ab39cb55b143eec14e4a2dac84a973a5239 100644 (file)
@@ -283,6 +283,7 @@ Sal * sal_init(){
        sal->rootCa = 0;
        sal->verify_server_certs=TRUE;
        sal->expire_old_contact=FALSE;
+       sal->dscp=-1;
        return sal;
 }
 
@@ -380,6 +381,12 @@ static void set_tls_options(Sal *ctx){
 #endif
 }
 
+void sal_set_dscp(Sal *ctx, int dscp){
+       ctx->dscp=dscp;
+       if (dscp!=-1)
+               eXosip_set_option(EXOSIP_OPT_SET_DSCP,&ctx->dscp);
+}
+
 int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure){
        int err;
        bool_t ipv6;
@@ -406,6 +413,7 @@ int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int i
        eXosip_set_option(EXOSIP_OPT_USE_RPORT,&use_rports);
        int dont_use_101 = !ctx->use_101; // Copy char to int to avoid bad alignment
        eXosip_set_option(EXOSIP_OPT_DONT_SEND_101,&dont_use_101);
+       sal_set_dscp(ctx,ctx->dscp);
 
        ipv6=strchr(addr,':')!=NULL;
        eXosip_enable_ipv6(ipv6);
index ccc95d56a76f30d758999e2527a57176c030084d..71463854ca301abf1375d79d6947b535b77c2832 100644 (file)
@@ -41,6 +41,7 @@ struct Sal{
        int keepalive_period;
        void *up; /*user pointer*/
        char* rootCa; /* File _or_ folder containing root CA */
+       int dscp;
        bool_t one_matching_codec;
        bool_t double_reg;
        bool_t use_rports;
index a4dceba61008745b1271f1009fc6c639d023d3e9..ede08b900ce2696dca5211d897b85785e846420d 100644 (file)
@@ -9,7 +9,8 @@ UI_FILES=       about.ui \
                log.ui \
                buddylookup.ui \
                tunnel_config.ui \
-               waiting.ui
+               waiting.ui \
+               dscp_settings.ui
 
 PIXMAPS=       \
                stock_people.png 
diff --git a/gtk/dscp_settings.ui b/gtk/dscp_settings.ui
new file mode 100644 (file)
index 0000000..4664768
--- /dev/null
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.24"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkDialog" id="dscp_settings">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Dscp settings</property>
+    <property name="modal">True</property>
+    <property name="type_hint">dialog</property>
+    <signal name="response" handler="linphone_gtk_dscp_edit_response" swapped="no"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button2">
+                <property name="label">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button1">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFrame" id="frame1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkTable" id="table1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="n_rows">3</property>
+                <property name="n_columns">2</property>
+                <property name="homogeneous">True</property>
+                <child>
+                  <object class="GtkEntry" id="sip_dscp">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">•</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="primary_icon_activatable">False</property>
+                    <property name="secondary_icon_activatable">False</property>
+                    <property name="primary_icon_sensitive">True</property>
+                    <property name="secondary_icon_sensitive">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="audio_dscp">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">•</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="primary_icon_activatable">False</property>
+                    <property name="secondary_icon_activatable">False</property>
+                    <property name="primary_icon_sensitive">True</property>
+                    <property name="secondary_icon_sensitive">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="video_dscp">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">•</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="primary_icon_activatable">False</property>
+                    <property name="secondary_icon_activatable">False</property>
+                    <property name="primary_icon_sensitive">True</property>
+                    <property name="secondary_icon_sensitive">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">SIP</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Audio RTP stream</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Video RTP stream</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">&lt;b&gt;Set DSCP values (in hexadecimal)&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button2</action-widget>
+      <action-widget response="-5">button1</action-widget>
+    </action-widgets>
+  </object>
+</interface>
index 9fc8538c0a34710b2885d17344f1d7c1b6d71170..7e76c385fda08145779b8bf937895dce1fec6e71 100644 (file)
                                 <child>
                                   <object class="GtkCheckButton" id="mtu_set">
                                     <property name="label" translatable="yes">Set Maximum Transmission Unit:</property>
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="draw_indicator">True</property>
                                     <signal name="toggled" handler="linphone_gtk_mtu_set" swapped="no"/>
                                   </object>
                             <child>
                               <object class="GtkCheckButton" id="dtmf_sipinfo">
                                 <property name="label" translatable="yes">Send DTMFs as SIP info</property>
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="draw_indicator">True</property>
                                 <signal name="toggled" handler="linphone_gtk_use_sip_info_dtmf_toggled" swapped="no"/>
                               </object>
                             <child>
                               <object class="GtkCheckButton" id="ipv6_enabled">
                                 <property name="label" translatable="yes">Use IPv6 instead of IPv4</property>
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="draw_indicator">True</property>
                                 <signal name="toggled" handler="linphone_gtk_ipv6_toggled" swapped="no"/>
                               </object>
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                            <property name="n_rows">5</property>
+                            <property name="n_rows">6</property>
                             <property name="n_columns">2</property>
                             <child>
                               <object class="GtkComboBox" id="proto_combo">
                                 <property name="label" translatable="yes">Tunnel</property>
                               </object>
                               <packing>
-                                <property name="top_attach">4</property>
-                                <property name="bottom_attach">5</property>
+                                <property name="top_attach">5</property>
+                                <property name="bottom_attach">6</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkButton" id="tunnel_edit_button">
-                                <property name="label" translatable="yes">edit</property>
-                                <property name="use_action_appearance">False</property>
+                                <property name="label">gtk-edit</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="use_stock">True</property>
                                 <signal name="clicked" handler="linphone_gtk_edit_tunnel" swapped="no"/>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
                                 <property name="right_attach">2</property>
-                                <property name="top_attach">4</property>
-                                <property name="bottom_attach">5</property>
+                                <property name="top_attach">5</property>
+                                <property name="bottom_attach">6</property>
                               </packing>
                             </child>
                             <child>
                                 <property name="bottom_attach">3</property>
                               </packing>
                             </child>
+                            <child>
+                              <object class="GtkLabel" id="label13">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">DSCP fields</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkButton" id="dscp_edit_button">
+                                <property name="label">gtk-edit</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="use_stock">True</property>
+                                <signal name="clicked" handler="linphone_gtk_dscp_edit" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                              </packing>
+                            </child>
                           </object>
                         </child>
                       </object>
                         <child>
                           <object class="GtkRadioButton" id="no_nat">
                             <property name="label" translatable="yes">Direct connection to the Internet</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="active">True</property>
                             <property name="draw_indicator">True</property>
                             <signal name="toggled" handler="linphone_gtk_no_firewall_toggled" swapped="no"/>
                             <child>
                               <object class="GtkRadioButton" id="use_nat_address">
                                 <property name="label" translatable="yes">Behind NAT / Firewall (specify gateway IP below)</property>
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="active">True</property>
                                 <property name="draw_indicator">True</property>
                                 <property name="group">no_nat</property>
                         <child>
                           <object class="GtkRadioButton" id="use_stun">
                             <property name="label" translatable="yes">Behind NAT / Firewall (use STUN to resolve)</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="draw_indicator">True</property>
                             <property name="group">no_nat</property>
                             <signal name="toggled" handler="linphone_gtk_use_stun_toggled" swapped="no"/>
                         <child>
                           <object class="GtkRadioButton" id="use_ice">
                             <property name="label" translatable="yes">Behind NAT / Firewall (use ICE)</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="draw_indicator">True</property>
                             <property name="group">no_nat</property>
                             <signal name="toggled" handler="linphone_gtk_use_ice_toggled" swapped="no"/>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                             <property name="n_rows">6</property>
                             <property name="n_columns">2</property>
-                            <child>
-                              <placeholder/>
-                            </child>
                             <child>
                               <object class="GtkHBox" id="ring_sound_box">
                                 <property name="visible">True</property>
                                 <child>
                                   <object class="GtkButton" id="play_ring">
                                     <property name="label">gtk-media-play</property>
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_stock">True</property>
                                     <signal name="clicked" handler="linphone_gtk_play_ring_file" swapped="no"/>
                                   </object>
                             <child>
                               <object class="GtkCheckButton" id="echo_cancelation">
                                 <property name="label" translatable="yes">Enable echo cancellation</property>
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="draw_indicator">True</property>
                                 <signal name="toggled" handler="linphone_gtk_echo_cancelation_toggled" swapped="no"/>
                               </object>
                                 <property name="bottom_attach">6</property>
                               </packing>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </object>
                         </child>
                       </object>
                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                 <child>
                                   <object class="GtkButton" id="wizard">
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
+                                    <property name="use_action_appearance">False</property>
                                     <signal name="clicked" handler="linphone_gtk_display_wizard" swapped="no"/>
                                     <child>
                                       <object class="GtkHBox" id="hbox5">
                                 </child>
                                 <child>
                                   <object class="GtkButton" id="add_proxy">
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="use_action_appearance">False</property>
                                     <signal name="clicked" handler="linphone_gtk_add_proxy" swapped="no"/>
                                     <child>
                                       <object class="GtkHBox" id="hbox14">
                                 </child>
                                 <child>
                                   <object class="GtkButton" id="edit_proxy">
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="use_action_appearance">False</property>
                                     <signal name="clicked" handler="linphone_gtk_edit_proxy" swapped="no"/>
                                     <child>
                                       <object class="GtkHBox" id="hbox16">
                                 </child>
                                 <child>
                                   <object class="GtkButton" id="remove_proxy">
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="use_action_appearance">False</property>
                                     <signal name="clicked" handler="linphone_gtk_remove_proxy" swapped="no"/>
                                     <child>
                                       <object class="GtkHBox" id="hbox7">
                                 </child>
                                 <child>
                                   <object class="GtkButton" id="create_phonics">
-                                    <property name="use_action_appearance">False</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
+                                    <property name="use_action_appearance">False</property>
                                     <signal name="clicked" handler="linphone_gtk_create_fonics_account" swapped="no"/>
                                     <child>
                                       <object class="GtkHBox" id="hbox1">
@@ -1573,11 +1602,11 @@ virtual network !</property>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                             <child>
                               <object class="GtkButton" id="erase_passwords">
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                <property name="use_action_appearance">False</property>
                                 <signal name="clicked" handler="linphone_gtk_clear_passwords" swapped="no"/>
                                 <child>
                                   <object class="GtkHBox" id="hbox18">
@@ -1759,11 +1788,11 @@ virtual network !</property>
                                     <child>
                                       <object class="GtkButton" id="button4">
                                         <property name="label">gtk-go-up</property>
-                                        <property name="use_action_appearance">False</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">True</property>
                                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="use_action_appearance">False</property>
                                         <property name="use_stock">True</property>
                                         <signal name="clicked" handler="linphone_gtk_codec_up" swapped="no"/>
                                       </object>
@@ -1776,11 +1805,11 @@ virtual network !</property>
                                     <child>
                                       <object class="GtkButton" id="up_codec">
                                         <property name="label">gtk-go-down</property>
-                                        <property name="use_action_appearance">False</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">True</property>
                                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="use_action_appearance">False</property>
                                         <property name="use_stock">True</property>
                                         <signal name="clicked" handler="linphone_gtk_codec_down" swapped="no"/>
                                       </object>
@@ -1792,11 +1821,11 @@ virtual network !</property>
                                     </child>
                                     <child>
                                       <object class="GtkButton" id="enable_codec">
-                                        <property name="use_action_appearance">False</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">True</property>
                                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="use_action_appearance">False</property>
                                         <signal name="clicked" handler="linphone_gtk_codec_enable" swapped="no"/>
                                         <child>
                                           <object class="GtkHBox" id="hbox8">
@@ -1840,11 +1869,11 @@ virtual network !</property>
                                     </child>
                                     <child>
                                       <object class="GtkButton" id="disable_codec">
-                                        <property name="use_action_appearance">False</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">True</property>
                                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="use_action_appearance">False</property>
                                         <signal name="clicked" handler="linphone_gtk_codec_disable" swapped="no"/>
                                         <child>
                                           <object class="GtkHBox" id="hbox9">
@@ -2007,10 +2036,10 @@ virtual network !</property>
                             <child>
                               <object class="GtkCheckButton" id="adaptive_rate_control">
                                 <property name="label" translatable="yes">Enable adaptive rate control</property>
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="xalign">0</property>
                                 <property name="draw_indicator">True</property>
                                 <signal name="toggled" handler="linphone_gtk_adaptive_rate_control_toggled" swapped="no"/>
@@ -2162,10 +2191,10 @@ virtual network !</property>
                         <child>
                           <object class="GtkCheckButton" id="ui_level">
                             <property name="label" translatable="yes">Show advanced settings</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="draw_indicator">True</property>
                             <signal name="toggled" handler="linphone_gtk_ui_level_toggled" swapped="no"/>
                           </object>
@@ -2242,11 +2271,11 @@ virtual network !</property>
             <property name="layout_style">end</property>
             <child>
               <object class="GtkButton" id="button5">
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="use_action_appearance">False</property>
                 <signal name="clicked" handler="linphone_gtk_parameters_closed" swapped="no"/>
                 <child>
                   <object class="GtkHBox" id="hbox3">
index 6870e278687f2870c1e5cf7178a1677cd7e0df2a..31c76f93b216b64bd52e5b97472d17cb2ea48ef7 100644 (file)
@@ -1131,3 +1131,55 @@ void linphone_gtk_tunnel_ok(GtkButton *button){
 void linphone_gtk_tunnel_cancel(GtkButton *button){
 
 }
+
+static void show_dscp(GtkWidget *entry, int val){
+       char tmp[20];
+       snprintf(tmp,sizeof(tmp),"0x%x",val);
+       gtk_entry_set_text(GTK_ENTRY(entry),tmp);
+       
+}
+
+static int read_dscp(GtkWidget *entry){
+       const char *val=gtk_entry_get_text(GTK_ENTRY(entry));
+       const char *begin;
+       int ret=0;
+       if (val==NULL || val[0]=='\0') return 0;
+       /*skip potential 0x*/
+       begin=strstr(val,"0x");
+       if (begin) begin+=2;
+       else begin=val;
+       if (sscanf(begin,"%x",&ret)==1)
+               return ret;
+       return -1;
+}
+
+void linphone_gtk_dscp_edit(){
+       LinphoneCore *lc=linphone_gtk_get_core();
+       GtkWidget *widget=linphone_gtk_create_window("dscp_settings");
+       show_dscp(linphone_gtk_get_widget(widget,"sip_dscp"),
+                 linphone_core_get_sip_dscp(lc));
+       show_dscp(linphone_gtk_get_widget(widget,"audio_dscp"),
+                 linphone_core_get_audio_dscp(lc));
+       show_dscp(linphone_gtk_get_widget(widget,"video_dscp"),
+                 linphone_core_get_video_dscp(lc));
+       gtk_widget_show(widget);
+}
+
+void linphone_gtk_dscp_edit_response(GtkWidget *dialog, guint response_id){
+       LinphoneCore *lc=linphone_gtk_get_core();
+       switch(response_id){
+               case GTK_RESPONSE_OK:
+                       linphone_core_set_sip_dscp(lc,
+                               read_dscp(linphone_gtk_get_widget(dialog,"sip_dscp")));
+                       linphone_core_set_audio_dscp(lc,
+                               read_dscp(linphone_gtk_get_widget(dialog,"audio_dscp")));
+                       linphone_core_set_video_dscp(lc,
+                               read_dscp(linphone_gtk_get_widget(dialog,"video_dscp")));
+                       
+               break;
+               default:
+               break;
+       }
+       gtk_widget_destroy(dialog);
+}
+