Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1298918ybi; Wed, 17 Jul 2019 12:48:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNdYCX+CYZvLViLZhsllvCnHaXzqxUPoDgm4crIHiOI1D/RG3Q9iu2eQ/Exrp0Fz71OPza X-Received: by 2002:a63:2c8:: with SMTP id 191mr42642107pgc.139.1563392880198; Wed, 17 Jul 2019 12:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563392880; cv=none; d=google.com; s=arc-20160816; b=lzwYtSwOIfx8eDH5nw6M5V8L472BjWn6Cov9gMPt214Ra9rYXbSGJT2Q2h65kJdHHh uJ0p0Nhd7CRg05X9gNTz67agAVA0QW15gOP3F8paNc9UnlWN1qbXJlf8PrPoYhBVt/oD 6CxnwgKrhtzMeXezBTdELxwe9yjkA6lb6VOt1j1AWPle9kz2rGnWGmRdrNN2gt3ZZLqr gxgFnXDHiCk6g6wLXF/mTKrAutGMmN2cjVpdMOfRrFnbEabLRRtS78r7DIiHj8BQPj24 lF7ozghvGSR0TGAc5HXlwHJ+gP2aHJIGCbDz00CyX81UFupkNrA/bz/Cfs3ykiB3T+wW 2A0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=KuS3p44w3UruS4OuPrSqFeaKxSkFSr7gA4eaO2Vuhwk=; b=Wq3Zg9JcqpI3YnBCP2nXbXmaabsXDDtBnPkO/S/hgCOLliTI3dl4mYYKltuQ0lpojs Tj1SlwpJ2PmSZ8sG6phfjoPXT9HjP+7kfJg6LzevScZcsz8mEQne8liMkOBDYoasK2Ue a1X8Se2QX1yIHP3YAkLPmaotcy7p+6sfL40n2mRXIb6aPIg7uZp4QcGen8tPWJMF91cJ SYBXlNQvqhxJSxopOM8u7HPbP8VXA+EzdR8MVNfiMm/eNWleNvdPTzGqQX/CaBTf/o13 1GPds01en+05sfRkgT3AgmczycrLqd2Z7uJ5RcNlhtfwYzkztMrU7vlED3A5LqRlUXUd /LtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=YZFpUtbr; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97si140017ple.161.2019.07.17.12.47.37; Wed, 17 Jul 2019 12:48:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=YZFpUtbr; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725993AbfGQTrQ (ORCPT + 99 others); Wed, 17 Jul 2019 15:47:16 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:41834 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725873AbfGQTrQ (ORCPT ); Wed, 17 Jul 2019 15:47:16 -0400 Received: by mail-lj1-f196.google.com with SMTP id d24so24851958ljg.8 for ; Wed, 17 Jul 2019 12:47:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silvair-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=KuS3p44w3UruS4OuPrSqFeaKxSkFSr7gA4eaO2Vuhwk=; b=YZFpUtbrR/mm0I/cu+Fkeq9yufbZYBIgbqBW41WOJj8VkUF9BfagTVrqm/pCiNjsjv f4HP96v1cyJ1oL59RKctub5GD8rBCmjfiS4Jp57rKAtLeWCKaXhhyW8slVlvA23izIhs E41gX+RX9+/w8ZfH1dNE1gdbBtnQiNopRs9V0yrWnHv70IVMoB8bxN8wVsDQrDCrHTNQ /5O3maEx/AZjePFNfd6aqr6lo4IDzcTWVe2zOKewp0DLr7kmB3V+JCdi+N46nWeJ+jj4 CvDdtK5maFHIzt5Nozd3sYhSAGfsGTfOYnWh5YHIkq3bYND25uojLsJA58QwzoVM54Fb 8ejw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=KuS3p44w3UruS4OuPrSqFeaKxSkFSr7gA4eaO2Vuhwk=; b=IbOJy0EQv3C7nNig9wp8OUdGNRkYH4kEKNv44POVT5guCvNzh5Y4dHzxIEteGOVS/G f1bxqJ8bvsExE8RIps7KlIewXuebXiMdKkjhKou3OX055blhqt0YTiWYhhRwJK1uHC2+ dTwRyQgJ1Jy85RD5eFq8cxALFIIF8Vaix4+St+/c9F8WXcKvhiviu2v0kpb9yTNY5EGx GS3jfwoS6QJbakGHFtKQ8k8X2la4M68qtKctvB/cLWEGB1EoVfzC+k35KCJpS5TywZlG oAnLlHzI+nj6DBSV3mTjlIXHm4IS3HPEho5c/VE34m2Bw5BKekylkGt8KpQs7TaWzduE ISaw== X-Gm-Message-State: APjAAAW57KUBEvl6Jnyb/4NMDx+XGVw6VO0K7c4mkra4A4SneeDO/wn2 EBdOl5RkOC0n9SXTWmw1widX1g== X-Received: by 2002:a2e:b0c4:: with SMTP id g4mr6519009ljl.155.1563392834378; Wed, 17 Jul 2019 12:47:14 -0700 (PDT) Received: from kynes (apn-77-112-37-101.dynamic.gprs.plus.pl. [77.112.37.101]) by smtp.gmail.com with ESMTPSA id u11sm5074832ljd.90.2019.07.17.12.47.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Jul 2019 12:47:13 -0700 (PDT) Date: Wed, 17 Jul 2019 21:47:12 +0200 From: "michal.lowas-rzechonek@silvair.com" To: "Stotland, Inga" Cc: "linux-bluetooth@vger.kernel.org" , "jakub.witowski@silvair.com" , "Gix, Brian" Subject: Re: [PATCH BlueZ v5 1/4] mesh: Add ImportLocalNode API documentation Message-ID: <20190717194712.i4dtiwhldq2is2z2@kynes> Mail-Followup-To: "Stotland, Inga" , "linux-bluetooth@vger.kernel.org" , "jakub.witowski@silvair.com" , "Gix, Brian" References: <20190717083650.26346-1-michal.lowas-rzechonek@silvair.com> <20190717083650.26346-2-michal.lowas-rzechonek@silvair.com> <915ea1c10883aaf1e4d42c5a749bfda964b54b51.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <915ea1c10883aaf1e4d42c5a749bfda964b54b51.camel@intel.com> User-Agent: NeoMutt/20180716 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hello, On 07/17, Stotland, Inga wrote: > I feel like having "object app_root" is unnecessary and also, creates > some gnarly pathways within the code. > > What exactly is the problem for requiring the composition data to be > part of the import_data? It's just weird to say "oh, it may be there or > it may be not". The main issue lies on the application side. In order to properly Attach(), the application must expose element structure via D-Bus. If we say that it must also do the same via JSON, to call ImportLocalNode, it leads to code duplication on the application side. Moreover, the app still needs to be queried via D-Bus to check that the passed JSON matches the D-Bus structure - otherwise the app would then fail to Attach() and the user would be in deep trouble. > Getting rid of the app_root and mandating the composition to be part of > the import_data allows: > > 1) Avoid checking whether this is a "full" configuration or the > "minimal" one I'm not convinced that the "full" configuration is even needed. We certaintly don't use it in our use case, but it might be required in the future. > 2) Efficiently re-use the existing code: > Adding an API call like this one may be sufficient > > mesh_config_import(const char *cfg_dir, > const uint8_t uuid[16], > const uint8 *import_data, ?, > mesh_config_node_func_t cb, > void *user_data) > > We can just re-factor the code that parses and populates a single node > from the stored configuration. user_data may contain whatever we need > to preserve in order to respond to d-bus call. After refactoring node validation to byte-compare composition data, the code also becomes significantly simpler, and execution paths for Join(), Attach(), CreateNetwork() and ImportLocalNode() converge. I've implemented this validation method on top of this patch-set. I'll send it as RFC shortly. regards -- Michał Lowas-Rzechonek Silvair http://silvair.com Jasnogórska 44, 31-358 Krakow, POLAND