b88f231.patch 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  1. diff -Nuar a/libdleyna/core/context-filter.c b/libdleyna/core/context-filter.c
  2. --- a/libdleyna/core/context-filter.c 1970-01-01 02:00:00.000000000 +0200
  3. +++ b/libdleyna/core/context-filter.c 2022-06-03 00:22:19.000000000 +0300
  4. @@ -0,0 +1,140 @@
  5. +/*
  6. + * dLeyna
  7. + *
  8. + * Copyright (C) 2012-2017 Intel Corporation. All rights reserved.
  9. + *
  10. + * This program is free software; you can redistribute it and/or modify it
  11. + * under the terms and conditions of the GNU Lesser General Public License,
  12. + * version 2.1, as published by the Free Software Foundation.
  13. + *
  14. + * This program is distributed in the hope it will be useful, but WITHOUT
  15. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  16. + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
  17. + * for more details.
  18. + *
  19. + * You should have received a copy of the GNU Lesser General Public License
  20. + * along with this program; if not, write to the Free Software Foundation, Inc.,
  21. + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  22. + *
  23. + * Ludovic Ferrandis <ludovic.ferrandis@intel.com>
  24. + *
  25. + */
  26. +
  27. +#include <config.h>
  28. +
  29. +#include <string.h>
  30. +
  31. +#include "context-filter.h"
  32. +#include "log.h"
  33. +
  34. +struct dleyna_context_filter_t_ {
  35. + GUPnPContextFilter *gupnp_cf;
  36. +};
  37. +
  38. +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG
  39. +static void prv_dump_cf_entries(GUPnPContextFilter *cf)
  40. +{
  41. + GList *l;
  42. +
  43. + l = gupnp_context_filter_get_entries(cf);
  44. +
  45. + DLEYNA_LOG_DEBUG_NL();
  46. + DLEYNA_LOG_DEBUG("Context Filter entries:");
  47. +
  48. + if (l != NULL) {
  49. + while (l != NULL) {
  50. + DLEYNA_LOG_DEBUG(" Entry: [%s].", (char *)l->data);
  51. + l = l->next;
  52. + }
  53. + } else {
  54. + DLEYNA_LOG_DEBUG(" Context Filter Empty.");
  55. + }
  56. +
  57. + DLEYNA_LOG_DEBUG_NL();
  58. +}
  59. +#endif
  60. +
  61. +dleyna_context_filter_t *dleyna_context_filter_new(GUPnPContextFilter *gupnp_cf)
  62. +{
  63. + dleyna_context_filter_t *cf;
  64. +
  65. + if (gupnp_cf != NULL) {
  66. + cf = g_new0(dleyna_context_filter_t, 1);
  67. +
  68. + cf->gupnp_cf = gupnp_cf;
  69. + } else {
  70. + cf = NULL;
  71. + DLEYNA_LOG_DEBUG("Parameter must not be NULL");
  72. + }
  73. +
  74. +
  75. + return cf;
  76. +}
  77. +
  78. +void dleyna_context_filter_delete(dleyna_context_filter_t *cf)
  79. +{
  80. + g_free(cf);
  81. +}
  82. +
  83. +void dleyna_context_filter_enable(dleyna_context_filter_t *cf,
  84. + gboolean enabled)
  85. +{
  86. + if (cf->gupnp_cf != NULL) {
  87. + gupnp_context_filter_set_enabled(cf->gupnp_cf, enabled);
  88. +
  89. + DLEYNA_LOG_DEBUG("White List enabled: %d", enabled);
  90. + }
  91. +}
  92. +
  93. +void dleyna_context_filter_add_entries(dleyna_context_filter_t *cf,
  94. + GVariant *entries)
  95. +{
  96. + GVariantIter viter;
  97. + gchar *entry;
  98. +
  99. + DLEYNA_LOG_DEBUG("Enter");
  100. +
  101. + if ((entries != NULL) && (cf->gupnp_cf != NULL)) {
  102. + (void) g_variant_iter_init(&viter, entries);
  103. +
  104. + while (g_variant_iter_next(&viter, "&s", &entry))
  105. + (void) gupnp_context_filter_add_entry(cf->gupnp_cf, entry);
  106. +
  107. +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG
  108. + prv_dump_cf_entries(cf->gupnp_cf);
  109. +#endif
  110. + }
  111. +
  112. + DLEYNA_LOG_DEBUG("Exit");
  113. +}
  114. +
  115. +void dleyna_context_filter_remove_entries(dleyna_context_filter_t *cf,
  116. + GVariant *entries)
  117. +{
  118. + GVariantIter viter;
  119. + gchar *entry;
  120. +
  121. + if ((entries != NULL) && (cf->gupnp_cf != NULL)) {
  122. + (void) g_variant_iter_init(&viter, entries);
  123. +
  124. + while (g_variant_iter_next(&viter, "&s", &entry))
  125. + (void) gupnp_context_filter_remove_entry(cf->gupnp_cf,
  126. + entry);
  127. +
  128. +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG
  129. + prv_dump_cf_entries(cf->gupnp_cf);
  130. +#endif
  131. + }
  132. +}
  133. +
  134. +void dleyna_context_filter_clear(dleyna_context_filter_t *cf)
  135. +{
  136. + if (cf->gupnp_cf != NULL) {
  137. + DLEYNA_LOG_DEBUG("Clear white list");
  138. + gupnp_context_filter_clear(cf->gupnp_cf);
  139. +
  140. +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG
  141. + prv_dump_cf_entries(cf->gupnp_cf);
  142. +#endif
  143. + }
  144. +}
  145. diff -Nuar a/libdleyna/core/context-filter.h b/libdleyna/core/context-filter.h
  146. --- a/libdleyna/core/context-filter.h 1970-01-01 02:00:00.000000000 +0200
  147. +++ b/libdleyna/core/context-filter.h 2022-06-03 00:22:19.000000000 +0300
  148. @@ -0,0 +1,41 @@
  149. +/*
  150. + * dLeyna
  151. + *
  152. + * Copyright (C) 2012-2017 Intel Corporation. All rights reserved.
  153. + *
  154. + * This program is free software; you can redistribute it and/or modify it
  155. + * under the terms and conditions of the GNU Lesser General Public License,
  156. + * version 2.1, as published by the Free Software Foundation.
  157. + *
  158. + * This program is distributed in the hope it will be useful, but WITHOUT
  159. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  160. + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
  161. + * for more details.
  162. + *
  163. + * You should have received a copy of the GNU Lesser General Public License
  164. + * along with this program; if not, write to the Free Software Foundation, Inc.,
  165. + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  166. + *
  167. + * Ludovic Ferrandis <ludovic.ferrandis@intel.com>
  168. + *
  169. + */
  170. +
  171. +#pragma once
  172. +
  173. +#include <glib.h>
  174. +#include <libgupnp/gupnp-context-filter.h>
  175. +
  176. +typedef struct dleyna_context_filter_t_ dleyna_context_filter_t;
  177. +
  178. +dleyna_context_filter_t *dleyna_context_filter_new(GUPnPContextFilter *gupnp_wl);
  179. +
  180. +void dleyna_context_filter_delete(dleyna_context_filter_t *wl);
  181. +
  182. +void dleyna_context_filter_enable(dleyna_context_filter_t *wl, gboolean enabled);
  183. +
  184. +void dleyna_context_filter_add_entries(dleyna_context_filter_t *wl, GVariant *entries);
  185. +
  186. +void dleyna_context_filter_remove_entries(dleyna_context_filter_t *wl,
  187. + GVariant *entries);
  188. +
  189. +void dleyna_context_filter_clear(dleyna_context_filter_t *wl);
  190. diff -Nuar a/libdleyna/core/gasync-task.c b/libdleyna/core/gasync-task.c
  191. --- a/libdleyna/core/gasync-task.c 1970-01-01 02:00:00.000000000 +0200
  192. +++ b/libdleyna/core/gasync-task.c 2022-06-03 00:22:19.000000000 +0300
  193. @@ -0,0 +1,115 @@
  194. +/*
  195. + * dLeyna
  196. + *
  197. + * Copyright (c) 2019 Jens Georg <mail@jensge.org>
  198. + *
  199. + * This program is free software; you can redistribute it and/or modify it
  200. + * under the terms and conditions of the GNU Lesser General Public License,
  201. + * version 2.1, as published by the Free Software Foundation.
  202. + *
  203. + * This program is distributed in the hope it will be useful, but WITHOUT
  204. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  205. + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
  206. + * for more details.
  207. + *
  208. + * You should have received a copy of the GNU Lesser General Public License
  209. + * along with this program; if not, write to the Free Software Foundation, Inc.,
  210. + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  211. + *
  212. + */
  213. +
  214. +#include "gasync-task.h"
  215. +#include <libdleyna/core/task-processor.h>
  216. +
  217. +struct dleyna_gasync_task_t_ {
  218. + dleyna_task_atom_t base;
  219. + dleyna_gasync_task_action action;
  220. + GObject *target;
  221. + GCancellable *cancellable;
  222. + GDestroyNotify free_func;
  223. + gboolean current;
  224. + gpointer cb_user_data;
  225. +};
  226. +
  227. +const char *dleyna_gasync_task_create_source(void)
  228. +{
  229. + static unsigned int cpt = 1;
  230. + static char source[27];
  231. +
  232. + g_snprintf(source, 27, "gasync-source-%d", cpt);
  233. + cpt++;
  234. +
  235. + return source;
  236. +}
  237. +
  238. +void dleyna_gasync_task_add(const dleyna_task_queue_key_t *queue_id,
  239. + dleyna_gasync_task_action action,
  240. + GObject *target,
  241. + GCancellable *cancellable,
  242. + GDestroyNotify free_func,
  243. + gpointer cb_user_data)
  244. +{
  245. + dleyna_gasync_task_t *task;
  246. +
  247. + task = g_new0(dleyna_gasync_task_t, 1);
  248. +
  249. + task->action = action;
  250. + task->cancellable = cancellable;
  251. + task->free_func = free_func;
  252. + task->cb_user_data = cb_user_data;
  253. + task->target = target;
  254. +
  255. + if (target != NULL) {
  256. + g_object_add_weak_pointer (target, (gpointer *)(&task->target));
  257. + }
  258. +
  259. + dleyna_task_queue_add_task(queue_id, &task->base);
  260. +}
  261. +
  262. +void dleyna_gasync_task_process_cb(dleyna_task_atom_t *atom,
  263. + gpointer user_data)
  264. +{
  265. + dleyna_gasync_task_t *task = (dleyna_gasync_task_t *)atom;
  266. +
  267. + task->current = TRUE;
  268. + task->action(task, task->target);
  269. +}
  270. +
  271. +void dleyna_gasync_task_cancel_cb(dleyna_task_atom_t *atom,
  272. + gpointer user_data)
  273. +{
  274. + dleyna_gasync_task_t *task = (dleyna_gasync_task_t *)atom;
  275. +
  276. + if (task->cancellable) {
  277. + g_cancellable_cancel (task->cancellable);
  278. + task->cancellable = NULL;
  279. +
  280. + if (task->current)
  281. + dleyna_task_queue_task_completed(task->base.queue_id);
  282. + }
  283. +}
  284. +
  285. +void dleyna_gasync_task_delete_cb(dleyna_task_atom_t *atom,
  286. + gpointer user_data)
  287. +{
  288. + dleyna_gasync_task_t *task = (dleyna_gasync_task_t *)atom;
  289. +
  290. + if (task->free_func != NULL)
  291. + task->free_func(task->cb_user_data);
  292. +
  293. + if (task->target != NULL) {
  294. + g_object_remove_weak_pointer(task->target, (gpointer *)&task->target);
  295. + }
  296. +
  297. + g_free(task);
  298. +}
  299. +
  300. +gpointer dleyna_gasync_task_get_user_data(dleyna_gasync_task_t *task)
  301. +{
  302. + return task->cb_user_data;
  303. +}
  304. +
  305. +GCancellable *dleyna_gasync_task_get_cancellable(dleyna_gasync_task_t *task)
  306. +{
  307. + return task->cancellable;
  308. +}
  309. diff -Nuar a/libdleyna/core/gasync-task.h b/libdleyna/core/gasync-task.h
  310. --- a/libdleyna/core/gasync-task.h 1970-01-01 02:00:00.000000000 +0200
  311. +++ b/libdleyna/core/gasync-task.h 2022-06-03 00:22:19.000000000 +0300
  312. @@ -0,0 +1,56 @@
  313. +/*
  314. + * dLeyna
  315. + *
  316. + * Copyright (c) 2019 Jens Georg <mail@jensge.org>
  317. + *
  318. + * This program is free software; you can redistribute it and/or modify it
  319. + * under the terms and conditions of the GNU Lesser General Public License,
  320. + * version 2.1, as published by the Free Software Foundation.
  321. + *
  322. + * This program is distributed in the hope it will be useful, but WITHOUT
  323. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  324. + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
  325. + * for more details.
  326. + *
  327. + * You should have received a copy of the GNU Lesser General Public License
  328. + * along with this program; if not, write to the Free Software Foundation, Inc.,
  329. + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  330. + *
  331. + */
  332. +
  333. +#pragma once
  334. +
  335. +#include <libdleyna/core/task-atom.h>
  336. +
  337. +#include <glib.h>
  338. +#include <gio/gio.h>
  339. +
  340. +typedef struct dleyna_gasync_task_t_ dleyna_gasync_task_t;
  341. +
  342. +typedef gboolean (*dleyna_gasync_task_action)
  343. + (dleyna_gasync_task_t *task,
  344. + GObject *target);
  345. +
  346. +const char *dleyna_gasync_task_create_source(void);
  347. +
  348. +void dleyna_gasync_task_add(const dleyna_task_queue_key_t *queue_id,
  349. + dleyna_gasync_task_action action,
  350. + GObject *target,
  351. + GCancellable *cancellable,
  352. + GDestroyNotify free_func,
  353. + gpointer cb_user_data);
  354. +
  355. +void dleyna_gasync_task_ready_cb(GObject *source, GAsyncResult *res, gpointer user_data);
  356. +
  357. +void dleyna_gasync_task_process_cb(dleyna_task_atom_t *atom,
  358. + gpointer user_data);
  359. +
  360. +void dleyna_gasync_task_cancel_cb(dleyna_task_atom_t *atom,
  361. + gpointer user_data);
  362. +
  363. +void dleyna_gasync_task_delete_cb(dleyna_task_atom_t *atom,
  364. + gpointer user_data);
  365. +
  366. +gpointer dleyna_gasync_task_get_user_data(dleyna_gasync_task_t *task);
  367. +
  368. +GCancellable *dleyna_gasync_task_get_cancellable(dleyna_gasync_task_t *task);
  369. diff -Nuar a/libdleyna/core/meson.build b/libdleyna/core/meson.build
  370. --- a/libdleyna/core/meson.build 2021-04-08 13:22:31.000000000 +0300
  371. +++ b/libdleyna/core/meson.build 2022-06-03 00:22:19.000000000 +0300
  372. @@ -10,11 +10,11 @@
  373. 'error.h',
  374. 'log.h',
  375. 'main-loop.h',
  376. - 'service-task.h',
  377. + 'gasync-task.h',
  378. 'settings.h',
  379. 'task-atom.h',
  380. 'task-processor.h',
  381. - 'white-list.h',
  382. + 'context-filter.h',
  383. ),
  384. subdir : 'dleyna-1.0/libdleyna/core'
  385. )
  386. @@ -27,17 +27,17 @@
  387. 'error.c',
  388. 'log.c',
  389. 'main-loop.c',
  390. - 'service-task.c',
  391. + 'gasync-task.c',
  392. 'settings.c',
  393. 'task-processor.c',
  394. - 'white-list.c'
  395. + 'context-filter.c'
  396. ),
  397. - version : '5.0.0',
  398. + version : '6.0.0',
  399. dependencies : [
  400. dependency('glib-2.0', version : '>= 2.28'),
  401. dependency('gio-2.0', version : '>= 2.28'),
  402. dependency('gmodule-2.0', version : '>= 2.28'),
  403. - dependency('gupnp-1.2', version : '>= 1.2.0'),
  404. + dependency('gupnp-1.6', version : '>= 1.2.0'),
  405. config_h
  406. ],
  407. c_args : [
  408. @@ -58,7 +58,7 @@
  409. description : 'UPnP & DLNA core library',
  410. subdirs : 'dleyna-1.0',
  411. version: meson.project_version(),
  412. - requires: ['gupnp-1.2', 'glib-2.0', 'gio-2.0'],
  413. + requires: ['gupnp-1.6', 'glib-2.0', 'gio-2.0'],
  414. )
  415. meson.override_dependency('dleyna-core-1.0', core_dep)
  416. diff -Nuar a/libdleyna/core/settings.c b/libdleyna/core/settings.c
  417. --- a/libdleyna/core/settings.c 2021-04-08 13:22:31.000000000 +0300
  418. +++ b/libdleyna/core/settings.c 2022-06-03 00:22:19.000000000 +0300
  419. @@ -25,7 +25,7 @@
  420. #include "log.h"
  421. #include "settings.h"
  422. -#include "white-list.h"
  423. +#include "context-filter.h"
  424. struct dleyna_settings_t_ {
  425. GKeyFile *keyfile;
  426. @@ -514,12 +514,12 @@
  427. DLEYNA_LOG_DEBUG("Exit");
  428. }
  429. -gboolean dleyna_settings_is_white_list_enabled(dleyna_settings_t *settings)
  430. +gboolean dleyna_settings_is_context_filter_enabled(dleyna_settings_t *settings)
  431. {
  432. return settings->netf_enabled;
  433. }
  434. -void dleyna_settings_set_white_list_enabled(dleyna_settings_t *settings,
  435. +void dleyna_settings_set_context_filter_enabled(dleyna_settings_t *settings,
  436. gboolean enabled,
  437. GError **error)
  438. {
  439. @@ -538,7 +538,7 @@
  440. DLEYNA_LOG_DEBUG("Exit");
  441. }
  442. -GVariant *dleyna_settings_white_list_entries(dleyna_settings_t *settings)
  443. +GVariant *dleyna_settings_context_filter_entries(dleyna_settings_t *settings)
  444. {
  445. return settings->netf_entries;
  446. }
  447. @@ -567,7 +567,7 @@
  448. return strv;
  449. }
  450. -void dleyna_settings_set_white_list_entries(dleyna_settings_t *settings,
  451. +void dleyna_settings_set_context_filter_entries(dleyna_settings_t *settings,
  452. GVariant *entries,
  453. GError **error)
  454. {
  455. diff -Nuar a/libdleyna/core/settings.h b/libdleyna/core/settings.h
  456. --- a/libdleyna/core/settings.h 2021-04-08 13:22:31.000000000 +0300
  457. +++ b/libdleyna/core/settings.h 2022-06-03 00:22:19.000000000 +0300
  458. @@ -43,15 +43,15 @@
  459. gboolean never_quit,
  460. GError **error);
  461. -gboolean dleyna_settings_is_white_list_enabled(dleyna_settings_t *settings);
  462. +gboolean dleyna_settings_is_context_filter_enabled(dleyna_settings_t *settings);
  463. -void dleyna_settings_set_white_list_enabled(dleyna_settings_t *settings,
  464. +void dleyna_settings_set_context_filter_enabled(dleyna_settings_t *settings,
  465. gboolean enabled,
  466. GError **error);
  467. -GVariant *dleyna_settings_white_list_entries(dleyna_settings_t *settings);
  468. +GVariant *dleyna_settings_context_filter_entries(dleyna_settings_t *settings);
  469. -void dleyna_settings_set_white_list_entries(dleyna_settings_t *settings,
  470. +void dleyna_settings_set_context_filter_entries(dleyna_settings_t *settings,
  471. GVariant *entries,
  472. GError **error);
  473. diff -Nuar a/libdleyna/core/white-list.c b/libdleyna/core/white-list.c
  474. --- a/libdleyna/core/white-list.c 2021-04-08 13:22:31.000000000 +0300
  475. +++ b/libdleyna/core/white-list.c 1970-01-01 02:00:00.000000000 +0200
  476. @@ -1,138 +0,0 @@
  477. -/*
  478. - * dLeyna
  479. - *
  480. - * Copyright (C) 2012-2017 Intel Corporation. All rights reserved.
  481. - *
  482. - * This program is free software; you can redistribute it and/or modify it
  483. - * under the terms and conditions of the GNU Lesser General Public License,
  484. - * version 2.1, as published by the Free Software Foundation.
  485. - *
  486. - * This program is distributed in the hope it will be useful, but WITHOUT
  487. - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  488. - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
  489. - * for more details.
  490. - *
  491. - * You should have received a copy of the GNU Lesser General Public License
  492. - * along with this program; if not, write to the Free Software Foundation, Inc.,
  493. - * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  494. - *
  495. - * Ludovic Ferrandis <ludovic.ferrandis@intel.com>
  496. - *
  497. - */
  498. -
  499. -#include <string.h>
  500. -
  501. -#include "white-list.h"
  502. -#include "log.h"
  503. -
  504. -struct dleyna_white_list_t_ {
  505. - GUPnPWhiteList *gupnp_wl;
  506. -};
  507. -
  508. -#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG
  509. -static void prv_dump_wl_entries(GUPnPWhiteList *wl)
  510. -{
  511. - GList *l;
  512. -
  513. - l = gupnp_white_list_get_entries(wl);
  514. -
  515. - DLEYNA_LOG_DEBUG_NL();
  516. - DLEYNA_LOG_DEBUG("White List entries:");
  517. -
  518. - if (l != NULL) {
  519. - while (l != NULL) {
  520. - DLEYNA_LOG_DEBUG(" Entry: [%s].", (char *)l->data);
  521. - l = l->next;
  522. - }
  523. - } else {
  524. - DLEYNA_LOG_DEBUG(" White List Empty.");
  525. - }
  526. -
  527. - DLEYNA_LOG_DEBUG_NL();
  528. -}
  529. -#endif
  530. -
  531. -dleyna_white_list_t *dleyna_white_list_new(GUPnPWhiteList *gupnp_wl)
  532. -{
  533. - dleyna_white_list_t *wl;
  534. -
  535. - if (gupnp_wl != NULL) {
  536. - wl = g_new0(dleyna_white_list_t, 1);
  537. -
  538. - wl->gupnp_wl = gupnp_wl;
  539. - } else {
  540. - wl = NULL;
  541. - DLEYNA_LOG_DEBUG("Parameter must not be NULL");
  542. - }
  543. -
  544. -
  545. - return wl;
  546. -}
  547. -
  548. -void dleyna_white_list_delete(dleyna_white_list_t *wl)
  549. -{
  550. - g_free(wl);
  551. -}
  552. -
  553. -void dleyna_white_list_enable(dleyna_white_list_t *wl,
  554. - gboolean enabled)
  555. -{
  556. - if (wl->gupnp_wl != NULL) {
  557. - gupnp_white_list_set_enabled(wl->gupnp_wl, enabled);
  558. -
  559. - DLEYNA_LOG_DEBUG("White List enabled: %d", enabled);
  560. - }
  561. -}
  562. -
  563. -void dleyna_white_list_add_entries(dleyna_white_list_t *wl,
  564. - GVariant *entries)
  565. -{
  566. - GVariantIter viter;
  567. - gchar *entry;
  568. -
  569. - DLEYNA_LOG_DEBUG("Enter");
  570. -
  571. - if ((entries != NULL) && (wl->gupnp_wl != NULL)) {
  572. - (void) g_variant_iter_init(&viter, entries);
  573. -
  574. - while (g_variant_iter_next(&viter, "&s", &entry))
  575. - (void) gupnp_white_list_add_entry(wl->gupnp_wl, entry);
  576. -
  577. -#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG
  578. - prv_dump_wl_entries(wl->gupnp_wl);
  579. -#endif
  580. - }
  581. -
  582. - DLEYNA_LOG_DEBUG("Exit");
  583. -}
  584. -
  585. -void dleyna_white_list_remove_entries(dleyna_white_list_t *wl,
  586. - GVariant *entries)
  587. -{
  588. - GVariantIter viter;
  589. - gchar *entry;
  590. -
  591. - if ((entries != NULL) && (wl->gupnp_wl != NULL)) {
  592. - (void) g_variant_iter_init(&viter, entries);
  593. -
  594. - while (g_variant_iter_next(&viter, "&s", &entry))
  595. - (void) gupnp_white_list_remove_entry(wl->gupnp_wl,
  596. - entry);
  597. -
  598. -#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG
  599. - prv_dump_wl_entries(wl->gupnp_wl);
  600. -#endif
  601. - }
  602. -}
  603. -
  604. -void dleyna_white_list_clear(dleyna_white_list_t *wl)
  605. -{
  606. - if (wl->gupnp_wl != NULL) {
  607. - DLEYNA_LOG_DEBUG("Clear white list");
  608. - gupnp_white_list_clear(wl->gupnp_wl);
  609. -
  610. -#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG
  611. - prv_dump_wl_entries(wl->gupnp_wl);
  612. -#endif
  613. - }
  614. -}
  615. diff -Nuar a/libdleyna/core/white-list.h b/libdleyna/core/white-list.h
  616. --- a/libdleyna/core/white-list.h 2021-04-08 13:22:31.000000000 +0300
  617. +++ b/libdleyna/core/white-list.h 1970-01-01 02:00:00.000000000 +0200
  618. @@ -1,44 +0,0 @@
  619. -/*
  620. - * dLeyna
  621. - *
  622. - * Copyright (C) 2012-2017 Intel Corporation. All rights reserved.
  623. - *
  624. - * This program is free software; you can redistribute it and/or modify it
  625. - * under the terms and conditions of the GNU Lesser General Public License,
  626. - * version 2.1, as published by the Free Software Foundation.
  627. - *
  628. - * This program is distributed in the hope it will be useful, but WITHOUT
  629. - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  630. - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
  631. - * for more details.
  632. - *
  633. - * You should have received a copy of the GNU Lesser General Public License
  634. - * along with this program; if not, write to the Free Software Foundation, Inc.,
  635. - * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  636. - *
  637. - * Ludovic Ferrandis <ludovic.ferrandis@intel.com>
  638. - *
  639. - */
  640. -
  641. -#ifndef DLEYNA_WHITE_LIST_H__
  642. -#define DLEYNA_WHITE_LIST_H__
  643. -
  644. -#include <glib.h>
  645. -#include <libgupnp/gupnp-white-list.h>
  646. -
  647. -typedef struct dleyna_white_list_t_ dleyna_white_list_t;
  648. -
  649. -dleyna_white_list_t *dleyna_white_list_new(GUPnPWhiteList *gupnp_wl);
  650. -
  651. -void dleyna_white_list_delete(dleyna_white_list_t *wl);
  652. -
  653. -void dleyna_white_list_enable(dleyna_white_list_t *wl, gboolean enabled);
  654. -
  655. -void dleyna_white_list_add_entries(dleyna_white_list_t *wl, GVariant *entries);
  656. -
  657. -void dleyna_white_list_remove_entries(dleyna_white_list_t *wl,
  658. - GVariant *entries);
  659. -
  660. -void dleyna_white_list_clear(dleyna_white_list_t *wl);
  661. -
  662. -#endif /* DLEYNA_WHITE_LIST_H__ */
  663. diff -Nuar a/meson.build b/meson.build
  664. --- a/meson.build 2021-04-08 13:22:31.000000000 +0300
  665. +++ b/meson.build 2022-06-03 00:22:19.000000000 +0300
  666. @@ -1,4 +1,8 @@
  667. -project('dleyna-core', 'c', version: '0.7.0')
  668. +project('dleyna-core', 'c',
  669. + version: '0.8.0',
  670. + license: 'LGPL-2.1-or-later',
  671. + meson_version: '>=0.54.0'
  672. +)
  673. pkg = import('pkgconfig')
  674. @@ -32,6 +36,7 @@
  675. conf.set_quoted('DLEYNA_CONNECTOR_NAME', 'dbus', description : 'IPC connector name')
  676. conf.set_quoted('DLEYNA_CONNECTOR_LIB_PATTERN', 'libdleyna-connector-', description : 'Starting pattern for dleyna connector libraries')
  677. conf.set('DLEYNA_LOG_TYPE', '0', description: 'Define log output technology')
  678. +conf.set('DLEYNA_ENABLE_DEBUG', '1')
  679. exclusive = get_option('log_level').contains('0') or get_option('log_level').contains('7') or get_option('log_level').contains('8')
  680. diff -Nuar a/meson_options.txt b/meson_options.txt
  681. --- a/meson_options.txt 2021-04-08 13:22:31.000000000 +0300
  682. +++ b/meson_options.txt 2022-06-03 00:22:19.000000000 +0300
  683. @@ -1 +1,2 @@
  684. option('log_level', type: 'array', choices : ['0', '1', '2', '3', '4', '5', '6', '7', '8'], value : ['7'])
  685. +option('enable_debug', type: 'boolean', value: 'false')
  686. diff -Nuar a/README.md b/README.md
  687. --- a/README.md 2021-04-08 13:22:31.000000000 +0300
  688. +++ b/README.md 2022-06-03 00:22:19.000000000 +0300
  689. @@ -16,7 +16,7 @@
  690. Clone repository
  691. ```
  692. - # git clone git://github.com/phako/dleyna-core.git
  693. + # git clone https://github.com/phako/dleyna-core.git
  694. # cd dleyna-core
  695. ```
  696. Configure and build