From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DF1D2A052B; Thu, 30 Jul 2020 23:08:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CE6391C0AF; Thu, 30 Jul 2020 23:07:34 +0200 (CEST) Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by dpdk.org (Postfix) with ESMTP id 6647D1C00E for ; Thu, 30 Jul 2020 23:07:28 +0200 (CEST) Received: by mail-lj1-f193.google.com with SMTP id b25so30362332ljp.6 for ; Thu, 30 Jul 2020 14:07:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e6aBSrUhn/lvL9t4L3t396NYrgm2JEJBD4+yWf55VC8=; b=dhMuoSiK8pcBos8C2P5B9xjiltMmsMmUS0ADqOviHMX9+4ybXO6+vna79+7UM6hTEo R6XYfue66Hv/fvJhML0BlJaaeCe2Wujuuhou1WUj3a9o+pTzeOhXjRgQWXyjSi/DKRHF onN42BZVg7SHXekmdk4dRuAdPNf3MngxDL6gh5UoBS6NQFHBheK8X3Y8GXA8eFpJDYh8 HTbeSZSCZV+ICxzjsuFu+jkpc2LIWAuy62JXBZrrksrZI/HHa6U39m+OIeHsSsoRKRIf m7OsI+1htBdSjD1HKqUkFSse2BKIsZtrf14DE8QprMOZ1nfAMlGfBLdFcOFfert2vVAL Ys0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e6aBSrUhn/lvL9t4L3t396NYrgm2JEJBD4+yWf55VC8=; b=BohDvPFl/goXHpJWL3ftKo3WQr1kJVvdEwB33sG4dM9rJlyqggBbNLSN5c07NPJkG5 eCxuDpm/CZL3MyVOLas4aIc3KlsmWVR9fjvLZSffysB8z8k6s8uVN0vh1GM0sbK87TQx 1IQlOd27VexfhG/UZ5yLSJ8E0L2F5GpANKfLlLFmN+5JwEF+ofCCPF79cKpTj2PFI4SW F9HjZr1ngeGpbJ7VX+QajyDTrfWshWdykxCiKKjWr/PTSJkTlCI84erdVWZ/eFze0ILp z2nIQLH4w1shVm9vPkjQpKkImJXVU5pKD5E2YdCT5sTLz+zV30kCygK6OBOUGVfv0TxR XDcw== X-Gm-Message-State: AOAM531uh9Volg5PeUbmU5i/wz4dD7s03KKBxMyqG4nJDJqDbz09GZh9 K6z8Z0KhXRGtRo8Ajr3p/CGkP6YAJ/MV0A== X-Google-Smtp-Source: ABdhPJwlOqqIzRdiv6/5AZIo2BkwXA9enOEGXZkib5YGEU5s9cZtLDR+RMqnBNGa0j8njqHa6Ph+Cw== X-Received: by 2002:a05:651c:2dc:: with SMTP id f28mr433114ljo.404.1596143247626; Thu, 30 Jul 2020 14:07:27 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id y9sm1257763lji.49.2020.07.30.14.07.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jul 2020 14:07:27 -0700 (PDT) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Malloy , Narcisa Ana Maria Vasile , Fady Bader , Tal Shnaiderman , "Kadam, Pallavi" , Dmitry Kozlyuk , Harini Ramakrishnan , Omar Cardona , Ranjit Menon Date: Fri, 31 Jul 2020 00:06:49 +0300 Message-Id: <20200730210652.14568-6-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200730210652.14568-1-dmitry.kozliuk@gmail.com> References: <20200620210511.13134-1-dmitry.kozliuk@gmail.com> <20200730210652.14568-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 5/7] eal/windows: improve compatibility networking headers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Extend compatibility header system to support librte_cmdline. pthread.h has to include windows.h, which exposes struct in_addr, etc. conflicting with compatibility headers. WIN32_LEAN_AND_MEAN macro is required to disable this behavior. Use rte_windows.h to define WIN32_LEAN_AND_MEAN for pthread library. Signed-off-by: Dmitry Kozlyuk --- lib/librte_eal/windows/include/arpa/inet.h | 30 +++++++++++++++++++++ lib/librte_eal/windows/include/netinet/in.h | 12 +++++++++ lib/librte_eal/windows/include/sys/socket.h | 24 +++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 lib/librte_eal/windows/include/arpa/inet.h create mode 100644 lib/librte_eal/windows/include/sys/socket.h diff --git a/lib/librte_eal/windows/include/arpa/inet.h b/lib/librte_eal/windows/include/arpa/inet.h new file mode 100644 index 000000000..96b698438 --- /dev/null +++ b/lib/librte_eal/windows/include/arpa/inet.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2020 Dmitry Kozlyuk + */ + +#ifndef _ARPA_INET_H_ +#define _ARPA_INET_H_ + +/** + * @file + * + * Compatibility header + * + * Although symbols declared here are present on Windows, + * including would expose too much macros breaking common code. + */ + +#include +#include + +/* defined in ws2_32.dll */ +__attribute__((stdcall)) +int +inet_pton(int af, const char *src, void *dst); + +/* defined in ws2_32.dll */ +__attribute__((stdcall)) +const char * +inet_ntop(int af, const void *src, char *dst, socklen_t size); + +#endif /* _ARPA_INET_H_ */ diff --git a/lib/librte_eal/windows/include/netinet/in.h b/lib/librte_eal/windows/include/netinet/in.h index 2be25c8be..f7c486be6 100644 --- a/lib/librte_eal/windows/include/netinet/in.h +++ b/lib/librte_eal/windows/include/netinet/in.h @@ -5,6 +5,8 @@ #ifndef _IN_H_ #define _IN_H_ +#include + #define IPPROTO_IP 0 /* Dummy for IP */ #define IPPROTO_HOPOPTS 0 /* IPv6 Hop-by-Hop options */ #define IPPROTO_IPIP 4 /* IPIP tunnels (for compatibility) */ @@ -20,4 +22,14 @@ #define IPPROTO_DSTOPTS 60 /* IPv6 destination option */ #define IPPROTO_SCTP 132 /* Stream Control Transmission Protocol */ +#define INET6_ADDRSTRLEN 46 + +struct in_addr { + uint32_t s_addr; +}; + +struct in6_addr { + uint8_t s6_addr[16]; +}; + #endif diff --git a/lib/librte_eal/windows/include/sys/socket.h b/lib/librte_eal/windows/include/sys/socket.h new file mode 100644 index 000000000..9536cf8e6 --- /dev/null +++ b/lib/librte_eal/windows/include/sys/socket.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2020 Dmitry Kozlyuk + */ + +#ifndef _SYS_SOCKET_H_ +#define _SYS_SOCKET_H_ + +/** + * @file + * + * Compatibility header + * + * Although symbols declared here are present on Windows, + * including would expose too much macros breaking common code. + */ + +#include + +#define AF_INET 2 +#define AF_INET6 23 + +typedef size_t socklen_t; + +#endif /* _SYS_SOCKET_H_ */ -- 2.25.4