summaryrefslogtreecommitdiff
path: root/include/windows
diff options
context:
space:
mode:
authorAlin Serdean <aserdean@cloudbasesolutions.com>2014-07-29 15:21:16 +0000
committerBen Pfaff <blp@nicira.com>2014-07-29 09:28:31 -0700
commitcafc0664aa93c9baaa75296b1e95f718706dcc28 (patch)
treeee8f8fbf6e99d72e96dfc7d8fe6ff410fddea143 /include/windows
parent6bc3bb829c5fbcd77a1fd3ee18dbaea49b464e8f (diff)
downloadopenvswitch-cafc0664aa93c9baaa75296b1e95f718706dcc28.tar.gz
Add defines, enums and headers for MSVC
Add defines needed to compile netlink-socket.c and netlink.c. Add a wrapper and the functionality behind it for syconf. Add the newly created files to the noinst_HEADERS in windows/automake.mk Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'include/windows')
-rw-r--r--include/windows/automake.mk1
-rw-r--r--include/windows/net/if.h50
-rw-r--r--include/windows/netpacket/packet.h40
-rw-r--r--include/windows/sys/uio.h22
-rw-r--r--include/windows/unistd.h50
5 files changed, 163 insertions, 0 deletions
diff --git a/include/windows/automake.mk b/include/windows/automake.mk
index 4d5a42cfc..2f1b631df 100644
--- a/include/windows/automake.mk
+++ b/include/windows/automake.mk
@@ -11,6 +11,7 @@ noinst_HEADERS += \
include/windows/getopt.h \
include/windows/net/if.h \
include/windows/netdb.h \
+ include/windows/netpacket/packet.h \
include/windows/netinet/icmp6.h \
include/windows/netinet/in.h \
include/windows/netinet/in_systm.h \
diff --git a/include/windows/net/if.h b/include/windows/net/if.h
index 893ffe4d1..3a064ae7a 100644
--- a/include/windows/net/if.h
+++ b/include/windows/net/if.h
@@ -21,4 +21,54 @@
#define IFNAMSIZ IF_NAMESIZE
+enum {
+ IFLA_UNSPEC,
+ IFLA_ADDRESS,
+ IFLA_BROADCAST,
+ IFLA_IFNAME,
+ IFLA_MTU,
+ IFLA_LINK,
+ IFLA_QDISC,
+ IFLA_STATS,
+ IFLA_COST,
+#define IFLA_COST IFLA_COST
+ IFLA_PRIORITY,
+#define IFLA_PRIORITY IFLA_PRIORITY
+ IFLA_MASTER,
+#define IFLA_MASTER IFLA_MASTER
+ IFLA_WIRELESS,
+#define IFLA_WIRELESS IFLA_WIRELESS
+ IFLA_PROTINFO,
+#define IFLA_PROTINFO IFLA_PROTINFO
+ IFLA_TXQLEN,
+#define IFLA_TXQLEN IFLA_TXQLEN
+ IFLA_MAP,
+#define IFLA_MAP IFLA_MAP
+ IFLA_WEIGHT,
+#define IFLA_WEIGHT IFLA_WEIGHT
+ IFLA_OPERSTATE,
+ IFLA_LINKMODE,
+ IFLA_LINKINFO,
+#define IFLA_LINKINFO IFLA_LINKINFO
+ IFLA_NET_NS_PID,
+ IFLA_IFALIAS,
+ IFLA_NUM_VF,
+ IFLA_VFINFO_LIST,
+ IFLA_STATS64,
+ IFLA_VF_PORTS,
+ IFLA_PORT_SELF,
+ IFLA_AF_SPEC,
+ IFLA_GROUP,
+ IFLA_NET_NS_FD,
+ IFLA_EXT_MASK,
+ IFLA_PROMISCUITY,
+#define IFLA_PROMISCUITY IFLA_PROMISCUITY
+ IFLA_NUM_TX_QUEUES,
+ IFLA_NUM_RX_QUEUES,
+ IFLA_CARRIER,
+ IFLA_PHYS_PORT_ID,
+ __IFLA_MAX
+};
+#define IFLA_MAX (__IFLA_MAX - 1)
+
#endif /* net/if.h */
diff --git a/include/windows/netpacket/packet.h b/include/windows/netpacket/packet.h
new file mode 100644
index 000000000..cf26a70f2
--- /dev/null
+++ b/include/windows/netpacket/packet.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2014 Cloudbase Solutions Srl
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __NETPACKET_PACKET_H
+#define __NETPACKET_PACKET_H 1
+
+struct iovec
+{
+ void *iov_base;
+ unsigned int iov_len;
+};
+
+struct msghdr
+ {
+ void *msg_name;
+ socklen_t msg_namelen;
+
+ struct iovec *msg_iov;
+ size_t msg_iovlen;
+
+ void *msg_control;
+ size_t msg_controllen;
+
+ int msg_flags;
+ };
+
+#endif /* netpacket/packet.h */ \ No newline at end of file
diff --git a/include/windows/sys/uio.h b/include/windows/sys/uio.h
index e69de29bb..b51c367ee 100644
--- a/include/windows/sys/uio.h
+++ b/include/windows/sys/uio.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2014 Cloudbase Solutions Srl
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __SYS_UIO_H
+#define __SYS_UIO_H 1
+
+#include <netpacket/packet.h>
+
+#endif /* sys/uio.h */ \ No newline at end of file
diff --git a/include/windows/unistd.h b/include/windows/unistd.h
index d9ded5ac8..8629f7e11 100644
--- a/include/windows/unistd.h
+++ b/include/windows/unistd.h
@@ -16,6 +16,9 @@
#ifndef _UNISTD_H
#define _UNISTD_H 1
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
#define fsync _commit
/* Standard file descriptors. */
@@ -23,4 +26,51 @@
#define STDOUT_FILENO 1 /* Standard output. */
#define STDERR_FILENO 2 /* Standard error output. */
+#define _SC_UIO_MAXIOV 2
+#define _XOPEN_IOV_MAX 16
+
+#define _SC_PAGESIZE 0x1
+#define _SC_NPROCESSORS_ONLN 0x2
+#define _SC_PHYS_PAGES 0x4
+
+__inline int GetNumLogicalProcessors(void)
+{
+ SYSTEM_INFO info_temp;
+ GetSystemInfo(&info_temp);
+ long int n_cores = info_temp.dwNumberOfProcessors;
+ return n_cores;
+}
+
+__inline long sysconf(int type)
+{
+ long value = -1;
+ long page_size = -1;
+ SYSTEM_INFO sys_info;
+ MEMORYSTATUSEX status;
+
+ switch (type) {
+ case _SC_NPROCESSORS_ONLN:
+ value = GetNumLogicalProcessors();
+ break;
+
+ case _SC_PAGESIZE:
+ GetSystemInfo(&sys_info);
+ value = sys_info.dwPageSize;
+ break;
+
+ case _SC_PHYS_PAGES:
+ status.dwLength = sizeof(status);
+ page_size = sysconf(_SC_PAGESIZE);
+ if (GlobalMemoryStatusEx(&status) && page_size != -1) {
+ value = status.ullTotalPhys / page_size;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return value;
+}
+
#endif /* unistd.h */