webrtc_ini: Add new item to enable to conceal private IP address 92/286492/1
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 27 Dec 2022 08:01:55 +0000 (17:01 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 9 Jan 2023 03:33:46 +0000 (12:33 +0900)
Default value is false. If 'conceal private ip' in ini file is
set to yes, then hostname for the private IP address will be used
in each local ICE candidate.

e.g)
[general]
conceal private ip = yes

[Version] 0.3.277
[Issue type] New feature

Change-Id: Ida5eb1db00d40661cb32c6501515874a85246328
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/webrtc_private.h
packaging/capi-media-webrtc.spec
src/webrtc.c
src/webrtc_ini.c

index cc863585e6ffa2e16043f6ad885260443c1ace14..08168f3c616975a386c65887db8a5ca38bbbf00d 100644 (file)
@@ -339,6 +339,7 @@ typedef struct _ini_item_general_s {
        const char *stun_server;
        int jitterbuffer_latency;
        int bundle_policy;
+       bool conceal_private_ip;
 } ini_item_general_s;
 
 typedef struct _ini_item_media_source_s {
index bd0c0934fc11219eba247c7920525e281d511556..3171b93fa8a3344b96103612d594af973665289a 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.276
+Version:    0.3.277
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 73e06de23128f0d6365b44681779b2bc9a13064a..c082d625a7ed10cae7b117090eb3fd51ad21f569 100644 (file)
@@ -110,6 +110,11 @@ int webrtc_create(webrtc_h *webrtc)
 #endif
        }
 
+       if (_webrtc->ini.general.conceal_private_ip) {
+               if ((ret = _register_dns_service(_webrtc)) != WEBRTC_ERROR_NONE)
+                       LOG_WARNING("failed to _register_dns_service() but keep going");
+       }
+
        if ((ret = _init_convert_thread(_webrtc)) != WEBRTC_ERROR_NONE)
                goto error;
 
@@ -159,6 +164,9 @@ int webrtc_destroy(webrtc_h webrtc)
        ret = _gst_pipeline_set_state(_webrtc, GST_STATE_NULL);
        RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to _gst_pipeline_set_state()");
 
+       if (_webrtc->ini.general.conceal_private_ip)
+               _unregister_dns_service(_webrtc);
+
 #ifndef TIZEN_TV
        ret = _destroy_resource_manager(_webrtc);
        RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to _destroy_resource_manager()");
index ad38011bec3b76ecc6e8bf8f177e276096a394e1..49fc7fe0be3adce88716ac5203016f0cfa0bff04 100644 (file)
@@ -28,6 +28,7 @@
 #define DEFAULT_DUMP_PATH                 "/tmp"
 #define DEFAULT_JITTERBUFFER_LATENCY      200  /* ms */
 #define DEFAULT_BUNDLE_POLICY             GST_WEBRTC_BUNDLE_POLICY_MAX_BUNDLE
+#define DEFAULT_CONCEAL_PRIVATE_IP        false
 
 /* categories */
 #define INI_CATEGORY_GENERAL              "general"
@@ -60,6 +61,7 @@
 #define INI_ITEM_STUN_SERVER              "stun server"
 #define INI_ITEM_RTP_JITTERBUFFER_LATENCY "rtp jitterbuffer latency"
 #define INI_ITEM_BUNDLE_POLICY            "bundle policy"
+#define INI_ITEM_CONCEAL_PRIVATE_IP       "conceal private ip"
 
 /* items for media source */
 #define INI_ITEM_SOURCE_ELEMENT            "source element"
@@ -242,6 +244,7 @@ static void __dump_ini(webrtc_ini_s *ini)
        __dump_item(INI_ITEM_STUN_SERVER, INI_ITEM_TYPE_STRING, (void *)ini->general.stun_server);
        __dump_item(INI_ITEM_RTP_JITTERBUFFER_LATENCY, INI_ITEM_TYPE_INT, &ini->general.jitterbuffer_latency);
        __dump_item(INI_ITEM_BUNDLE_POLICY, INI_ITEM_TYPE_INT, &ini->general.bundle_policy);
+       __dump_item(INI_ITEM_CONCEAL_PRIVATE_IP, INI_ITEM_TYPE_BOOL, &ini->general.conceal_private_ip);
 
        LOG_INFO("[%s]", INI_CATEGORY_MEDIA_SOURCE);
        __dump_items_of_source(&ini->media_source);
@@ -525,6 +528,7 @@ void _load_ini(webrtc_s *webrtc)
        ini->general.stun_server = __ini_get_string(ini->dict, INI_CATEGORY_GENERAL, INI_ITEM_STUN_SERVER, NULL);
        ini->general.jitterbuffer_latency = __ini_get_int(ini->dict, INI_CATEGORY_GENERAL, INI_ITEM_RTP_JITTERBUFFER_LATENCY, DEFAULT_JITTERBUFFER_LATENCY);
        ini->general.bundle_policy = __ini_get_int(ini->dict, INI_CATEGORY_GENERAL, INI_ITEM_BUNDLE_POLICY, DEFAULT_BUNDLE_POLICY);
+       ini->general.conceal_private_ip = __ini_get_boolean(ini->dict, INI_CATEGORY_GENERAL, INI_ITEM_CONCEAL_PRIVATE_IP, DEFAULT_CONCEAL_PRIVATE_IP);
 
        /* default setting for a media source */
        __apply_media_source_setting(ini, &ini->media_source, INI_CATEGORY_MEDIA_SOURCE);