From patchwork Wed Jul 31 11:48:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guy Morand X-Patchwork-Id: 1139680 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::43d; helo=mail-wr1-x43d.google.com; envelope-from=swupdate+bncbc5yhxvzyypbbd4aq3vakgqezcyqrcq@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=scewo.ch Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="d0r9MyBS"; dkim-atps=neutral Received: from mail-wr1-x43d.google.com (mail-wr1-x43d.google.com [IPv6:2a00:1450:4864:20::43d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45zBX50BqCz9s00 for ; Wed, 31 Jul 2019 21:48:35 +1000 (AEST) Received: by mail-wr1-x43d.google.com with SMTP id g2sf33712573wrq.19 for ; Wed, 31 Jul 2019 04:48:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1564573711; cv=pass; d=google.com; s=arc-20160816; b=YZrAcSpEPk4FYuPDvVYUfcg3WQ8EvkpfH1E+0Vm+5hgvku1hNpb6pEf4qjRUbwee2j 0Wn14o00Oju1QwLCpBnKa/D4swm7Mra8E3zDrbpFxSTkOMLg+Af7NHdqEh+p2u0YCk+5 pBudB8YhwMru0uPoVK66XsxMAAtp5DY1Y9BxelJ/csKfQhp17q/m0KmmfQIGz0j71iZA eE2G+cn/QFyQyX+XvH83d+NiEq1SLxTK0qh7tyqCLzuwrOB4gXxngU8z7qvjLprxwILx EaBKydkL9hC4J6pR5qA2KwQIzIj54hXKqhIawX8afvJQgUbM9u4sHdLs3uM7cJaoJFu3 +IIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:message-id:date:subject:cc:to:from :mime-version:sender:dkim-signature; bh=67wDWfsnOVcQ/pgmHwo7LXRpZ1lPtExZHCkUAdNKJ44=; b=t7upo/VJe5tWPB1hUNJdn7RNiE5lzeP4d+hHG49eDe3uUhi/h76a2Z9qjfOlxNFpZB 6xulonTVJIjXuTmkEdOQemyAsAj58sqy2CiWJ6Dr6ZIFutgsRDxMiUZJykTN0JhfWwa7 UST7IszS7SQa7ktkwSLVpHGL4kcqjG/jRpT3JYOOnKx6lMzv5riJC/NQOG3hzbHpzUVQ n7n1qLNkDHAhw8PmlHOfCksRqQ3oZuKt40sMhjlXbauET7tB0Eu4IUD9cBDY8jk4uJbD IMLCV1o1s5w0y7rI3HErWG+4h4KdBCPrVQDLRfGeIgTXm3jmkxYA0cKoF87jd6sbhmcV iUzA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=softfail (google.com: domain of transitioning g.morand@scewo.ch does not designate 128.65.195.4 as permitted sender) smtp.mailfrom=g.morand@scewo.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=67wDWfsnOVcQ/pgmHwo7LXRpZ1lPtExZHCkUAdNKJ44=; b=d0r9MyBSYZuXOi509h0mLcedp3LATl//u4u+xNUBoHxhUI6KwURZ3KmbakS5teCGqQ SwWNg4fw7EiOD5SdPFcGyRkqC6ZT2MoF+A10D6eisY0W/2jxOUWacNYoDE9NxNrF7sHI 8tPQWct7B+y+buA0qcgzvT6hIJza59Le5T9swCTqyO7cKKIoNE6f1uVI/z5GQpMkCvP6 AEJr2oweIXHfcaDLRhrlhXlA4Q+k8PFeUldC0Wi918f3oaIgzKeF8ddT4bR4Yd9G0aEB 0zCGUeRQGSo0yN7Vvaoukxu3wSQl5aagovd3+e0Am0Qv5A16S/DDjIxZ1C3u7VUU80pg JJ1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=67wDWfsnOVcQ/pgmHwo7LXRpZ1lPtExZHCkUAdNKJ44=; b=jzEgW4ihx7GkU/9atbfDaq5apwKzV2nNvI+0d5iKN24Iz9n7wXQjbVfhg4hrV4yEdt /mrA3bxnLMlNG+3ki3vm9txWYoyrAxqeOfukLhDqA1RoSuSw40Q70kM4Spna4vvvMkR5 hJYPjH8BApe+fm4lSP2+xxOljzQcmJ8DITCWPXyDGyQ4Be/6b2HJzop51yaaN1pgdgQY AI+qaPv8aRpKeJ9OCqcL135QacGiFKCwQ9xzYwrNvxmRqJ8O7FfOyEkAxNUvhrWdpXrL odbnf3aDz2hgc9rHrf4ziHDGTfLNynmh9IPR2tc2fWIJGmYtCAIp+ytMZpVMAootyufx tF7w== Sender: swupdate@googlegroups.com X-Gm-Message-State: APjAAAWYQapV7OuwGNMFtMl2RvktxOD1H9mbBQh+q5NVKr2Pkg8ajL6p EVCdU3yoLqdo5bu368cKjdY= X-Google-Smtp-Source: APXvYqwtRqfrCw2tdYVQuXIOxetnWRMkADCvOCvCM1FE7qtdE4/5byUr8x8bagMkFaKb3VrgQ8SzwQ== X-Received: by 2002:a1c:7304:: with SMTP id d4mr109276693wmb.39.1564573711711; Wed, 31 Jul 2019 04:48:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:adf:9083:: with SMTP id i3ls20406497wri.14.gmail; Wed, 31 Jul 2019 04:48:31 -0700 (PDT) X-Received: by 2002:a5d:63c8:: with SMTP id c8mr54323685wrw.21.1564573711260; Wed, 31 Jul 2019 04:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564573711; cv=none; d=google.com; s=arc-20160816; b=i1nm7+jpFhO98UmArD8Gl+k1ddkS/BpQ/FPE1c9fLGMEhXZ0JL327q0L+DWwMOFMhd HLl6Tn6SUmCAQ00ZsNOkxOciMZ6k5+vtNjEh2Y5je4R5FSMXUEVCK94akuOPnZ3dI7F0 NczLUb6hGqjCufhcRwHSEenMZJMhNNaYqWPb/3UKf0hKzpZsGIUy2SQHhx2flLEEIzds pN+gwKIZYVFTeuGayjnK2xehnrgK4Nue2CbnhplMicE1RCQOpQbk1KT++dcmCUtwy2py 1GlRspcTZ0Tgjji7UJAgl4QaJPPeYtA6ORKqodCZaFiqMI9kpGj0KUNG/P3va9INwjs2 +3qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=nDfYMB3ZhVpVfAiiKX5Otk15LHvten/JiJt0oOndRHM=; b=heRVVl0vHKUrdD37ntuhD3kaKrPQazuIPhBPzOAPOKw1jtDukDHzqZ7MlcVJNGH1ib B+suxV2GRXFy5mGrCEe3wQZyo5FyzsROGvniIkoCn0e7RLhpCgyRmO5eTw7KthF7Fox9 wCeR0Yj7aFhC1jwzju8R8tLcEpD4UZXn45rEuh0ccJWiF/+v+ueOrV9jhEt3u6V8FHeN /FFApAOhy8R14KX9Kod7VNsRihuHtDPNpCbnMn27jfc69kATsucK/X37bc8nbRqcCEof y5Or0UwpIiOlbmZCDuybT2foJk8uvHfuSOgPAyzprRF809crFVR1JpnJ7t+SzqGh7OA0 FuoA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=softfail (google.com: domain of transitioning g.morand@scewo.ch does not designate 128.65.195.4 as permitted sender) smtp.mailfrom=g.morand@scewo.ch Received: from smtp-sh.infomaniak.ch (smtp-sh.infomaniak.ch. [128.65.195.4]) by gmr-mx.google.com with ESMTPS id p4si2179770wme.2.2019.07.31.04.48.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jul 2019 04:48:31 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning g.morand@scewo.ch does not designate 128.65.195.4 as permitted sender) client-ip=128.65.195.4; Received: from smtp6.infomaniak.ch (smtp6.infomaniak.ch [83.166.132.19]) by smtp-sh.infomaniak.ch (8.14.5/8.14.5) with ESMTP id x6VBmUCT032371 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 31 Jul 2019 13:48:30 +0200 Received: from morand-desktop.fritz.box (cpe002.tpw.isi.ch [185.198.204.195] (may be forged)) (authenticated bits=0) by smtp6.infomaniak.ch (8.14.5/8.14.5) with ESMTP id x6VBmS0k049909 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Wed, 31 Jul 2019 13:48:30 +0200 From: Guy Morand To: swupdate@googlegroups.com Cc: Guy Morand Subject: [swupdate] [PATCH v2] Add cpp guards in IPC interface Date: Wed, 31 Jul 2019 13:48:18 +0200 Message-Id: <20190731114818.11884-1-g.morand@scewo.ch> X-Mailer: git-send-email 2.11.0 X-Antivirus: Dr.Web (R) for Unix mail servers drweb plugin ver.6.0.2.8 X-Antivirus-Code: 0x100000 X-Original-Sender: g.morand@scewo.ch X-Original-Authentication-Results: gmr-mx.google.com; spf=softfail (google.com: domain of transitioning g.morand@scewo.ch does not designate 128.65.195.4 as permitted sender) smtp.mailfrom=g.morand@scewo.ch Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , This allows linking from CPP applications without the need of using extern "C" when including swupdate header files, that is ugly. This follows the guide line of many other libraries. Signed-off-by: Guy Morand --- include/network_ipc.h | 14 +++++++++++--- include/progress_ipc.h | 10 ++++++++++ include/swupdate_status.h | 8 ++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/include/network_ipc.h b/include/network_ipc.h index e41493c..a4ce763 100644 --- a/include/network_ipc.h +++ b/include/network_ipc.h @@ -9,15 +9,19 @@ #ifndef _IPC_H #define _IPC_H +#include +#include "swupdate_status.h" + +#ifdef __cplusplus +extern "C" { +#endif + /* * Be careful to include further headers here. This file is the interface * to external programs interfacing with SWUpdate as client, and further * headers are not exported. */ -#include -#include "swupdate_status.h" - #define IPC_MAGIC 0x14052001 typedef enum { @@ -78,4 +82,8 @@ int swupdate_image_write(char *buf, int size); int swupdate_async_start(writedata wr_func, getstatus status_func, terminated end_func, bool dryrun); +#ifdef __cplusplus +} // extern "C" +#endif + #endif diff --git a/include/progress_ipc.h b/include/progress_ipc.h index 2587cc7..2c242eb 100644 --- a/include/progress_ipc.h +++ b/include/progress_ipc.h @@ -11,6 +11,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + extern char* SOCKET_PROGRESS_PATH; /* @@ -44,4 +49,9 @@ int progress_ipc_connect_with_path(const char *socketpath, bool reconnect); /* Retrieve messages from progress interface (it blocks) */ int progress_ipc_receive(int *connfd, struct progress_msg *msg); + +#ifdef __cplusplus +} // extern "C" +#endif + #endif diff --git a/include/swupdate_status.h b/include/swupdate_status.h index a63595b..38811e3 100644 --- a/include/swupdate_status.h +++ b/include/swupdate_status.h @@ -8,6 +8,10 @@ #ifndef _SWUPDATE_STATUS_H #define _SWUPDATE_STATUS_H +#ifdef __cplusplus +extern "C" { +#endif + /* * This is used to send back the result of an update. * It is strictly forbidden to change the order of entries. @@ -33,4 +37,8 @@ typedef enum { SOURCE_LOCAL } sourcetype; +#ifdef __cplusplus +} // extern "C" +#endif + #endif