Revert "Fix for win32 compiling with i686-w64-mingw32-gcc on ubuntu"
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 10 Jun 2014 07:57:20 +0000 (09:57 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 10 Jun 2014 07:57:20 +0000 (09:57 +0200)
This reverts commit a36245314b1874b940037d3e486796d1a623dd78.

It breaks the windows builds on Debian Squeeze

14 files changed:
.gitignore
Makefile.inc
lib/httpinfo/Makefile
lib/httpinfo/src/admin_interface.c
lib/httpinfo/src/admin_interface.h
lib/httpinfo/src/olsrd_httpinfo.c
lib/nameservice/Makefile
lib/nameservice/contrib/libregex.a [deleted file]
lib/nameservice/src/nameservice.c
src/cfgparser/olsrd_cfgparser.def
src/cfgparser/olsrd_conf.c
src/win32/compat.c
src/win32/compat.h
src/win32/ifnet.c

index 14e1cbe..66e1cd0 100644 (file)
@@ -29,4 +29,3 @@
 /olsr_switch.exe
 /olsr-setup.exe
 /src/cfgparser/olsrd_cfgparser
-!lib/nameservice/contrib/libregex.a
index e70c434..dc1122c 100644 (file)
@@ -171,9 +171,6 @@ else
 # c and ld flags for main
 ifeq ($(OS),win32)
   LDFLAGS +=   -Wl,-export-all-symbols
-  ifndef WINCE
-    LIBS +=            -lwlanapi -lole32 
-  endif
 else 
   LDFLAGS +=   -Wl,-export-dynamic 
 endif
index 6c792bd..3a8d65e 100644 (file)
@@ -52,10 +52,6 @@ OBJS += $(TOPDIR)/src/cfgparser/cfgfile_gen.o
 default_target: $(PLUGIN_FULLNAME)
 ifdef ADMIN_INTERFACE
                @echo 'WARNING - BUILT WITH EXPERIMENTAL ADMIN INTERFACE!'
-ifeq ($(OS), win32)
-                LDFLAGS += -lwsock32
-                OBJS += $(TOPDIR)/src/win32/compat.o
-endif
 endif
 
 $(PLUGIN_FULLNAME): $(OBJS) version-script.txt
index 599666a..9815dcc 100644 (file)
@@ -80,11 +80,9 @@ static const char admin_frame_epilog[] =
   "</table>\n<br>\n" "<center><input type=\"submit\" value=\"Delete selected\" class=\"input_button\"></center>\n" "</form>\n";
 
 int
-build_admin_body(struct autobuf *abuf)
+build_admin_body(char *buf, uint32_t bufsize __attribute__ ((unused)))
 {
-  int size = abuf->len;
-  char *buf = abuf->buf;
-  int bufsize = abuf->size;
+  int size = 0;
   size += snprintf(&buf[size], bufsize - size, admin_frame_prolog);
 
   size += snprintf(&buf[size], bufsize - size, "<tr>\n");
@@ -143,7 +141,6 @@ build_admin_body(struct autobuf *abuf)
     }
   }
   size += snprintf(&buf[size], bufsize - size, admin_frame_epilog);
-  abuf->len += size;
   return size;
 }
 
@@ -164,15 +161,6 @@ process_param(char *key, char *value)
     return 1;
   }
 
-  if (!strcmp(key, "tos")) {
-    int ival = atoi(value);
-    if ((ival < 0) || (ival > 16))
-      return -1;
-
-    olsr_cnf->tos = ival;
-    return 1;
-  }
-
   if (!strcmp(key, "tc_redundancy")) {
     int ival = atoi(value);
     if ((ival < 0) || (ival > 3))
@@ -214,7 +202,7 @@ process_param(char *key, char *value)
     if ((ival < 0) || (ival > 10))
       return -1;
 
-    //olsr_cnf->lq_wsize = ival; //error: ‘struct olsrd_config’ has no member named ‘lq_wsize’
+    olsr_cnf->lq_wsize = ival;
     return 1;
   }
 
index 380758c..7d52133 100644 (file)
@@ -46,7 +46,7 @@
 #ifndef ADMIN_INTERFACE_H
 #define ADMIN_INTERFACE_H
 
-int build_admin_body(struct autobuf *abuf);
+int build_admin_body(char *, uint32_t);
 
 int process_set_values(char *, uint32_t, char *, uint32_t);
 
index 56dc4cb..0dff3b7 100644 (file)
@@ -418,14 +418,14 @@ parse_http_request(int fd, void *data __attribute__ ((unused)), unsigned int fla
 
         stats.ok_hits++;
 
-        param_size = recv(client_socket, header_buf, sizeof(header_buf) - 1, 0);
+        param_size = recv(client_sockets[curr_clients], header_buf, sizeof(header_buf) - 1, 0);
 
         header_buf[param_size] = '\0';
         printf("Dynamic read %d bytes\n", param_size);
 
         //memcpy(body, dynamic_files[i].data, static_bin_files[i].data_size);
-        body_abuf.len += dynamic_files[i].process_data_cb(header_buf, param_size, &body_abuf.buf[body_abuf.len], sizeof(body_abuf.buf) - body_abuf.len);
-        header_length = build_http_header(HTTP_OK, true, body_abuf.len, header_buf, sizeof(header_buf));
+        body_length += dynamic_files[i].process_data_cb(header_buf, param_size, &body_buf[body_length], sizeof(body_buf) - body_length);
+        header_length = build_http_header(HTTP_OK, true, body_length, header_buf, sizeof(header_buf));
         goto send_http_data;
       }
       i++;
@@ -479,7 +479,7 @@ parse_http_request(int fd, void *data __attribute__ ((unused)), unsigned int fla
     if (tab_entries[i].filename) {
 #ifdef NETDIRECT
       header_length = build_http_header(HTTP_OK, true, body_length, header_buf, sizeof(header_buf));
-      r = send(client_socket, header_buf, header_length, 0);
+      r = send(client_sockets[curr_clients], header_buf, header_length, 0);
       if (r < 0) {
         olsr_printf(1, "(HTTPINFO) Failed sending data to client!\n");
         goto close_connection;
index 7328bbf..a6ab59a 100644 (file)
@@ -44,9 +44,9 @@ TOPDIR = ../..
 include $(TOPDIR)/Makefile.inc
 
 ifeq ($(OS),win32)
-       LIBS += -lregex
-       LDFLAGS += -Lcontrib/ 
-endif
+default_target install clean:
+       @echo "**** We use the regex library here. Does Win32 has something like this?"
+else
 ifeq ($(OS),android)
 # On Android Google forgot to include regex engine code for Froyo version (but also there was
 # no support in older versions for it) so we have here this missing code.
@@ -72,3 +72,4 @@ uninstall:
 
 clean:         $(REGEX_CLEAN)
                rm -f $(OBJS) $(SRCS:%.c=%.d) $(PLUGIN_FULLNAME)
+endif
diff --git a/lib/nameservice/contrib/libregex.a b/lib/nameservice/contrib/libregex.a
deleted file mode 100644 (file)
index 96bee44..0000000
Binary files a/lib/nameservice/contrib/libregex.a and /dev/null differ
index 0fa3496..04873f2 100644 (file)
@@ -147,8 +147,8 @@ name_constructor(void)
 
   len = strlen(my_hosts_file);
   if (my_hosts_file[len - 1] != '\\')
-    strscat(my_hosts_file, "\\", sizeof(my_hosts_file));
-  strscat(my_hosts_file, "hosts_olsr", sizeof(my_hosts_file));
+    strscat(my_hosts_file, "\\", sizeof(my_host_file));
+  strscat(my_hosts_file, "hosts_olsr", sizeof(my_host_file));
 
   len = strlen(my_services_file);
   if (my_services_file[len - 1] != '\\')
@@ -418,9 +418,7 @@ static void name_lazy_init(void) {
   my_services = remove_nonvalid_names_from_list(my_services, NAME_SERVICE);
   my_macs = remove_nonvalid_names_from_list(my_macs, NAME_MACADDR);
 
-#ifndef _WIN32
   mapwrite_init(my_latlon_file);
-#endif /* _WIN32 */
 
   return;
 }
@@ -499,9 +497,7 @@ name_destructor(void)
 
   regfree(&regex_t_name);
   regfree(&regex_t_service);
-#ifndef _WIN32
   mapwrite_exit();
-#endif /* _WIN32 */
 }
 
 /* free all list entries */
index b1e768b..847392f 100644 (file)
@@ -10,4 +10,3 @@ EXPORTS
        win32_stdio_hack
        win32_olsrd_malloc
        win32_olsrd_free
-        olsr_cnf
index f54faeb..c68d244 100644 (file)
@@ -152,11 +152,9 @@ olsrd_parse_cnf(const char *filename)
   }
 
   current_line = 1;
-  if (olsr_cnf==NULL)
-      olsr_cnf = olsrd_get_default_cnf();    
   rc = yyparse();
   fclose(yyin);
-  if (rc != 0 || olsr_cnf==NULL || olsr_cnf->interfaces==NULL) {
+  if (rc != 0) {
     return -1;
   }
 
@@ -1136,11 +1134,6 @@ olsrd_print_cnf(struct olsrd_config *cnf)
   if (in) {
     /*print interface default config*/
     printf(" InterfaceDefaults: \n");
-    
-    if (cnf->interface_defaults == NULL) {                              
-      /* get a default configuration if the user did not specify one */ 
-      cnf->interface_defaults = get_default_if_config();                
-    }                                                                   
     olsrd_print_interface_cnf(cnf->interface_defaults, cnf->interface_defaults, true);
 
     while (in)
index 97e589e..0a06954 100644 (file)
@@ -131,7 +131,7 @@ times(struct tms *Dummy __attribute__ ((unused)))
   return (long)GetTickCount();
 }
 
-#if !defined(inet_aton) || !defined(MINGW_VERSION) || MINGW_VERSION < 40600
+#if !defined(MINGW_VERSION) || MINGW_VERSION < 40600
 int
 inet_aton(const char *AddrStr, struct in_addr *Addr)
 {
index 81896cc..e9a7149 100644 (file)
@@ -48,8 +48,7 @@
 
 #include <sys/time.h>
 
-//src/win32/compat.c:481:1: error: expected declaration specifiers or ‘...’ before ‘(’ token
-//#define inet_ntop(af, src, dst, size) inet_ntop(af, (void *)(src), dst, size)
+#define inet_ntop(af, src, dst, size) inet_ntop(af, (void *)(src), dst, size)
 
 # define timeradd(a, b, result)                 \
   do {                        \
index d60da8b..58d0c6f 100644 (file)
 
 #include <arpa/inet.h>
 
-#if !defined WINCE
-#include <wlanapi.h>
-#endif
-
 #define BUFSPACE  (127*1024)    /* max. input buffer size to request */
 
 struct MibIpInterfaceRow {
@@ -353,7 +349,7 @@ GetIntInfo(struct InterfaceInfo *Info, char *Name)
 
   if ((IfTable->table[TabIdx].dwOperStatus != MIB_IF_OPER_STATUS_CONNECTED
        && IfTable->table[TabIdx].dwOperStatus != MIB_IF_OPER_STATUS_OPERATIONAL) || Info->Addr == 0) {
-    OLSR_PRINTF(3, "Interface %s not up! Status = %d\n", Name, IfTable->table[TabIdx].dwOperStatus);
+    OLSR_PRINTF(3, "Interface %s not up!\n", Name);
     return -1;
   }
 
@@ -368,22 +364,6 @@ GetIntInfo(struct InterfaceInfo *Info, char *Name)
 #define IOCTL_NDIS_QUERY_GLOBAL_STATS 0x00170002
 #endif /* !defined IOCTL_NDIS_QUERY_GLOBAL_STATS */
 
-static bool IsVistaOrHigher()
-{
-       OSVERSIONINFO osVersion;
-       ZeroMemory(&osVersion, sizeof(OSVERSIONINFO));
-       osVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-               if(!GetVersionEx(&osVersion))
-               {
-                       return false;
-               }
-               if(osVersion.dwMajorVersion >= 6)
-               {
-                       return true;
-               }
-               return false;
-}
-
 static int
 IsWireless(char *IntName)
 {
@@ -425,34 +405,7 @@ IsWireless(char *IntName)
     CloseHandle(DevHand);
 
     if (ErrNo == ERROR_GEN_FAILURE || ErrNo == ERROR_INVALID_PARAMETER) {
-               if (ErrNo == ERROR_INVALID_PARAMETER && IsVistaOrHigher()) 
-               {
-                       DWORD dwClientVersion = 2;
-                       DWORD hResult =ERROR_SUCCESS;
-                       DWORD pdwNegotiatedVersion      =0;
-                       HANDLE phClientHandle           =NULL;
-                       PWLAN_INTERFACE_INFO_LIST       pIfList = NULL;
-                       WCHAR SGuid[256];
-                       char guid[256];
-                       unsigned int i;
-
-                       hResult=WlanOpenHandle(dwClientVersion,NULL,&pdwNegotiatedVersion,&phClientHandle);
-                       if(hResult!=ERROR_SUCCESS) return 0;
-                       //Enumerates all the wifi adapters currently enabled on PC.
-                       //Returns the list of interface list that are enabled on PC.
-                       hResult=WlanEnumInterfaces(phClientHandle,NULL,&pIfList);
-                       if(hResult!=ERROR_SUCCESS) return 0;
-
-                       for(i=0;(i < pIfList->dwNumberOfItems);i++)
-                       {
-                               StringFromGUID2(&pIfList->InterfaceInfo[pIfList->dwIndex].InterfaceGuid,SGuid,256);
-                               sprintf(guid, "%ws",SGuid);
-                               if(!strcmp(Info.Guid, guid))
-                                       return 1;
-                       }
-               }
-      OLSR_PRINTF(5, "OID not supported. Device probably not wireless. ErrNo = %d\n", ErrNo);
-
+      OLSR_PRINTF(5, "OID not supported. Device probably not wireless.\n");
       return 0;
     }
 
@@ -515,7 +468,6 @@ ListInterfaces(void)
     for (Walker2 = &Walker->IpAddressList; Walker2 != NULL; Walker2 = Walker2->Next)
       printf(" %s", Walker2->IpAddress.String);
 
-       OLSR_PRINTF(2, " %s %s", Walker->AdapterName, Walker->Description);
     printf("\n");
   }
 }