Explorar el Código

Fix build in Windows

ambrop7 hace 15 años
padre
commit
b2f673d1c1
Se han modificado 3 ficheros con 19 adiciones y 9 borrados
  1. 8 6
      dhcpclient/CMakeLists.txt
  2. 3 3
      examples/CMakeLists.txt
  3. 8 0
      system/BAddr.h

+ 8 - 6
dhcpclient/CMakeLists.txt

@@ -3,9 +3,11 @@ add_library(dhcpclientcore
 )
 target_link_libraries(dhcpclientcore system flow security)
 
-add_library(dhcpclient
-    BDHCPClient.c
-    DHCPIpUdpEncoder.c
-    DHCPIpUdpDecoder.c
-)
-target_link_libraries(dhcpclient system flow dhcpclientcore)
+if (NOT WIN32)
+    add_library(dhcpclient
+        BDHCPClient.c
+        DHCPIpUdpEncoder.c
+        DHCPIpUdpDecoder.c
+    )
+    target_link_libraries(dhcpclient system flow dhcpclientcore)
+endif ()

+ 3 - 3
examples/CMakeLists.txt

@@ -21,13 +21,13 @@ target_link_libraries(bavl_test security)
 add_executable(bencryption_bench bencryption_bench.c)
 target_link_libraries(bencryption_bench system security)
 
-add_executable(dhcpclient_test dhcpclient_test.c)
-target_link_libraries(dhcpclient_test dhcpclient)
-
 if (NOT WIN32)
     add_executable(ipc_server ipc_server.c)
     target_link_libraries(ipc_server ipc)
 
     add_executable(ipc_client ipc_client.c)
     target_link_libraries(ipc_client ipc)
+
+    add_executable(dhcpclient_test dhcpclient_test.c)
+    target_link_libraries(dhcpclient_test dhcpclient)
 endif ()

+ 8 - 0
system/BAddr.h

@@ -469,6 +469,8 @@ void BAddr_InitIPv6 (BAddr *addr, uint8_t *ip, uint16_t port)
     addr->ipv6.port = port;
 }
 
+#ifndef BADVPN_USE_WINAPI
+
 void BAddr_InitPacket (BAddr *addr, uint16_t phys_proto, int interface_index, int header_type, int packet_type, uint8_t *phys_addr)
 {
     ASSERT(header_type == BADDR_PACKET_HEADER_TYPE_ETHERNET)
@@ -484,13 +486,17 @@ void BAddr_InitPacket (BAddr *addr, uint16_t phys_proto, int interface_index, in
     memcpy(addr->packet.phys_addr, phys_addr, 6);
 }
 
+#endif
+
 int BAddr_IsRecognized (BAddr *addr)
 {
     switch (addr->type) {
         case BADDR_TYPE_NONE:
         case BADDR_TYPE_IPV4:
         case BADDR_TYPE_IPV6:
+        #ifndef BADVPN_USE_WINAPI
         case BADDR_TYPE_PACKET:
+        #endif
             return 1;
         default:
             return 0;
@@ -524,6 +530,7 @@ void BAddr_Print (BAddr *addr, char *out)
             BIPAddr_Print(&ipaddr, out);
             sprintf(out + strlen(out), ":%"PRIu16, ntoh16(addr->ipv6.port));
             break;
+        #ifndef BADVPN_USE_WINAPI
         case BADDR_TYPE_PACKET:
             ASSERT(addr->packet.header_type == BADDR_PACKET_HEADER_TYPE_ETHERNET)
             sprintf(out, "proto=%"PRIu16",ifindex=%d,htype=eth,ptype=%d,addr=%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8,
@@ -531,6 +538,7 @@ void BAddr_Print (BAddr *addr, char *out)
                     addr->packet.phys_addr[0], addr->packet.phys_addr[1], addr->packet.phys_addr[2],
                     addr->packet.phys_addr[3], addr->packet.phys_addr[4], addr->packet.phys_addr[5]);
             break;
+        #endif
         default:
             ASSERT(0);
     }