Explorar el Código

Merge branch 'type-cleanup'

* type-cleanup:
  * Remove unneeded SIZEOF checks
  * Remove port_t typedef
  * Fix source port comparison
  * Check for std types in configure
  * Remove unneeded dword type
  * Cleanup uintX_t type usage

Conflicts:
	src/mod/server.mod/server.c
	src/mod/server.mod/server.h
Bryan Drewery hace 14 años
padre
commit
190f4115a5

+ 13 - 7
autotools/configure.ac

@@ -163,13 +163,19 @@ AC_C_CHAR_UNSIGNED
 #checkpoint
 AC_CACHE_SAVE 
 
-AC_CHECK_SIZEOF(short, 0)
-AC_CHECK_SIZEOF(int, 0)
-AC_CHECK_SIZEOF(long, 0)
-AC_CHECK_SIZEOF(long long,0)
-AC_CHECK_SIZEOF(size_t, 0)
-AC_CHECK_SIZEOF(ptrdiff_t, 0)
-AC_CHECK_SIZEOF(time_t, 0)
+# Checks for typedefs, structures, and compiler characteristics
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_TYPE_UID_T
+AC_TYPE_LONG_LONG_INT
+AC_TYPE_INT8_T
+AC_TYPE_UINT8_T
+AC_TYPE_INT16_T
+AC_TYPE_UINT16_T
+AC_TYPE_INT32_T
+AC_TYPE_UINT32_T
+AC_TYPE_INT64_T
+AC_TYPE_UINT64_T
 
 
 AC_STRUCT_TIMEZONE

+ 50 - 21
config.h.in

@@ -81,6 +81,9 @@
 /* Define to 1 if you have the <locale.h> header file. */
 #undef HAVE_LOCALE_H
 
+/* Define to 1 if the system has the type `long long int'. */
+#undef HAVE_LONG_LONG_INT
+
 /* Define to 1 if `lstat' has the bug that it succeeds when given the
    zero-length file name argument. */
 #undef HAVE_LSTAT_EMPTY_STRING_BUG
@@ -292,27 +295,6 @@
 /* Define limit of random() function. */
 #undef RANDOM_MAX
 
-/* The size of `int', as computed by sizeof. */
-#undef SIZEOF_INT
-
-/* The size of `long', as computed by sizeof. */
-#undef SIZEOF_LONG
-
-/* The size of `long long', as computed by sizeof. */
-#undef SIZEOF_LONG_LONG
-
-/* The size of `ptrdiff_t', as computed by sizeof. */
-#undef SIZEOF_PTRDIFF_T
-
-/* The size of `short', as computed by sizeof. */
-#undef SIZEOF_SHORT
-
-/* The size of `size_t', as computed by sizeof. */
-#undef SIZEOF_SIZE_T
-
-/* The size of `time_t', as computed by sizeof. */
-#undef SIZEOF_TIME_T
-
 /* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
 #undef STAT_MACROS_BROKEN
 
@@ -375,6 +357,21 @@
 /* Define to 1 if you need to in order for `stat' and other things to work. */
 #undef _POSIX_SOURCE
 
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT32_T
+
+/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT64_T
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT8_T
+
 /* Define to 1 if type `char' is unsigned and you are not using gcc.  */
 #ifndef __CHAR_UNSIGNED__
 # undef __CHAR_UNSIGNED__
@@ -383,6 +380,22 @@
 /* Define to `int' if <sys/types.h> doesn't define. */
 #undef gid_t
 
+/* Define to the type of a signed integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int16_t
+
+/* Define to the type of a signed integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int32_t
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int64_t
+
+/* Define to the type of a signed integer type of width exactly 8 bits if such
+   a type exists and the standard includes do not define it. */
+#undef int8_t
+
 /* Define to rpl_malloc if the replacement function should be used. */
 #undef malloc
 
@@ -398,6 +411,22 @@
 /* Define to `int' if <sys/types.h> doesn't define. */
 #undef uid_t
 
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint16_t
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint32_t
+
+/* Define to the type of an unsigned integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint64_t
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint8_t
+
 /* Define as `fork' if `vfork' does not work. */
 #undef vfork
 

+ 253 - 293
configure

@@ -1751,39 +1751,31 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_cxx_check_type
 
-# ac_fn_cxx_compute_int LINENO EXPR VAR INCLUDES
-# ----------------------------------------------
-# Tries to find the compile-time value of EXPR in a program that includes
-# INCLUDES, setting VAR accordingly. Returns whether the value could be
-# computed
-ac_fn_cxx_compute_int ()
+# ac_fn_c_find_intX_t LINENO BITS VAR
+# -----------------------------------
+# Finds a signed integer type with width BITS, setting cache variable VAR
+# accordingly.
+ac_fn_c_find_intX_t ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if test "$cross_compiling" = yes; then
-    # Depending upon the size, compute the lo and hi bounds.
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
+$as_echo_n "checking for int$2_t... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+     # Order is important - never check a type that is potentially smaller
+     # than half of the expected target width.
+     for ac_type in int$2_t 'int' 'long int' \
+	 'long long int' 'short int' 'signed char'; do
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$4
+$ac_includes_default
+	     enum { N = $2 / 2 - 1 };
 int
 main ()
 {
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
 test_array [0] = 0
 
   ;
@@ -1791,25 +1783,15 @@ test_array [0] = 0
 }
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
-  ac_hi=$ac_mid; break
-else
-  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$4
+$ac_includes_default
+	        enum { N = $2 / 2 - 1 };
 int
 main ()
 {
-static int test_array [1 - 2 * !(($2) < 0)];
+static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
+		 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
 test_array [0] = 0
 
   ;
@@ -1817,49 +1799,56 @@ test_array [0] = 0
 }
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  ac_lo=$ac_mid; break
 else
-  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+  case $ac_type in #(
+  int$2_t) :
+    eval "$3=yes" ;; #(
+  *) :
+    eval "$3=\$ac_type" ;;
+esac
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  ac_lo= ac_hi=
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       if eval test \"x\$"$3"\" = x"no"; then :
+
+else
+  break
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+     done
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_find_intX_t
+
+# ac_fn_c_find_uintX_t LINENO BITS VAR
+# ------------------------------------
+# Finds an unsigned integer type with width BITS, setting cache variable VAR
+# accordingly.
+ac_fn_c_find_uintX_t ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
+$as_echo_n "checking for uint$2_t... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+     # Order is important - never check a type that is potentially smaller
+     # than half of the expected target width.
+     for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \
+	 'unsigned long long int' 'unsigned short int' 'unsigned char'; do
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$4
+$ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
 test_array [0] = 0
 
   ;
@@ -1867,67 +1856,27 @@ test_array [0] = 0
 }
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
-  ac_hi=$ac_mid
-else
-  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+  case $ac_type in #(
+  uint$2_t) :
+    eval "$3=yes" ;; #(
+  *) :
+    eval "$3=\$ac_type" ;;
+esac
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in #((
-?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
-'') ac_retval=1 ;;
-esac
-  else
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-static long int longval () { return $2; }
-static unsigned long int ulongval () { return $2; }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (($2) < 0)
-    {
-      long int i = longval ();
-      if (i != ($2))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ($2))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
+       if eval test \"x\$"$3"\" = x"no"; then :
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_run "$LINENO"; then :
-  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
 else
-  ac_retval=1
+  break
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-rm -f conftest.val
-
-  fi
+     done
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
 
-} # ac_fn_cxx_compute_int
+} # ac_fn_c_find_uintX_t
 
 # ac_fn_cxx_check_member LINENO AGGR MEMBER VAR INCLUDES
 # ------------------------------------------------------
@@ -6661,236 +6610,247 @@ $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
 fi
 rm -f confcache
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
-$as_echo_n "checking size of short... " >&6; }
-if ${ac_cv_sizeof_short+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short"        "$ac_includes_default"; then :
+# Checks for typedefs, structures, and compiler characteristics
+ac_fn_cxx_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = xyes; then :
 
 else
-  if test "$ac_cv_type_short" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (short)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_short=0
-   fi
-fi
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
-$as_echo "$ac_cv_sizeof_short" >&6; }
 
+ac_fn_cxx_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
 
+else
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_SHORT $ac_cv_sizeof_short
+#define size_t unsigned int
 _ACEOF
 
+fi
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
-$as_echo_n "checking size of int... " >&6; }
-if ${ac_cv_sizeof_int+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
+$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
+if ${ac_cv_type_uid_t+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int"        "$ac_includes_default"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
 
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "uid_t" >/dev/null 2>&1; then :
+  ac_cv_type_uid_t=yes
 else
-  if test "$ac_cv_type_int" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (int)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_int=0
-   fi
+  ac_cv_type_uid_t=no
 fi
+rm -f conftest*
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
-$as_echo "$ac_cv_sizeof_int" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
+$as_echo "$ac_cv_type_uid_t" >&6; }
+if test $ac_cv_type_uid_t = no; then
+
+$as_echo "#define uid_t int" >>confdefs.h
 
 
+$as_echo "#define gid_t int" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_INT $ac_cv_sizeof_int
-_ACEOF
+fi
 
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
-$as_echo_n "checking size of long... " >&6; }
-if ${ac_cv_sizeof_long+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5
+$as_echo_n "checking for long long int... " >&6; }
+if ${ac_cv_type_long_long_int+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long"        "$ac_includes_default"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+  /* For now, do not test the preprocessor; as of 2007 there are too many
+         implementations with broken preprocessors.  Perhaps this can
+         be revisited in 2012.  In the meantime, code should not expect
+         #if to work with literals wider than 32 bits.  */
+      /* Test literals.  */
+      long long int ll = 9223372036854775807ll;
+      long long int nll = -9223372036854775807LL;
+      unsigned long long int ull = 18446744073709551615ULL;
+      /* Test constant expressions.   */
+      typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
+                     ? 1 : -1)];
+      typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
+                     ? 1 : -1)];
+      int i = 63;
+int
+main ()
+{
+/* Test availability of runtime routines for shift and division.  */
+      long long int llmax = 9223372036854775807ll;
+      unsigned long long int ullmax = 18446744073709551615ull;
+      return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
+              | (llmax / ll) | (llmax % ll)
+              | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+              | (ullmax / ull) | (ullmax % ull));
+  ;
+  return 0;
+}
 
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+                          if test "$cross_compiling" = yes; then :
+  ac_cv_type_long_long_int=yes
 else
-  if test "$ac_cv_type_long" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (long)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_long=0
-   fi
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <limits.h>
+               #ifndef LLONG_MAX
+               # define HALF \
+                        (1LL << (sizeof (long long int) * CHAR_BIT - 2))
+               # define LLONG_MAX (HALF - 1 + HALF)
+               #endif
+int
+main ()
+{
+long long int n = 1;
+               int i;
+               for (i = 0; ; i++)
+                 {
+                   long long int m = n << i;
+                   if (m >> i != n)
+                     return 1;
+                   if (LLONG_MAX / 2 < m)
+                     break;
+                 }
+               return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
+  ac_cv_type_long_long_int=yes
+else
+  ac_cv_type_long_long_int=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
+else
+  ac_cv_type_long_long_int=no
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
-$as_echo "$ac_cv_sizeof_long" >&6; }
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5
+$as_echo "$ac_cv_type_long_long_int" >&6; }
+  if test $ac_cv_type_long_long_int = yes; then
+
+$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h
 
+  fi
 
+ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t"
+case $ac_cv_c_int8_t in #(
+  no|yes) ;; #(
+  *)
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
+#define int8_t $ac_cv_c_int8_t
 _ACEOF
+;;
+esac
 
+ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t"
+case $ac_cv_c_uint8_t in #(
+  no|yes) ;; #(
+  *)
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
-$as_echo_n "checking size of long long... " >&6; }
-if ${ac_cv_sizeof_long_long+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
-
-else
-  if test "$ac_cv_type_long_long" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (long long)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_long_long=0
-   fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
-$as_echo "$ac_cv_sizeof_long_long" >&6; }
-
+$as_echo "#define _UINT8_T 1" >>confdefs.h
 
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+#define uint8_t $ac_cv_c_uint8_t
 _ACEOF
+;;
+  esac
 
+ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t"
+case $ac_cv_c_int16_t in #(
+  no|yes) ;; #(
+  *)
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5
-$as_echo_n "checking size of size_t... " >&6; }
-if ${ac_cv_sizeof_size_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t"        "$ac_includes_default"; then :
-
-else
-  if test "$ac_cv_type_size_t" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (size_t)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_size_t=0
-   fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5
-$as_echo "$ac_cv_sizeof_size_t" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define int16_t $ac_cv_c_int16_t
+_ACEOF
+;;
+esac
 
+ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t"
+case $ac_cv_c_uint16_t in #(
+  no|yes) ;; #(
+  *)
 
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t
+#define uint16_t $ac_cv_c_uint16_t
 _ACEOF
+;;
+  esac
 
+ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t"
+case $ac_cv_c_int32_t in #(
+  no|yes) ;; #(
+  *)
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of ptrdiff_t" >&5
-$as_echo_n "checking size of ptrdiff_t... " >&6; }
-if ${ac_cv_sizeof_ptrdiff_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (ptrdiff_t))" "ac_cv_sizeof_ptrdiff_t"        "$ac_includes_default"; then :
-
-else
-  if test "$ac_cv_type_ptrdiff_t" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (ptrdiff_t)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_ptrdiff_t=0
-   fi
-fi
+cat >>confdefs.h <<_ACEOF
+#define int32_t $ac_cv_c_int32_t
+_ACEOF
+;;
+esac
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_ptrdiff_t" >&5
-$as_echo "$ac_cv_sizeof_ptrdiff_t" >&6; }
+ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
+case $ac_cv_c_uint32_t in #(
+  no|yes) ;; #(
+  *)
 
+$as_echo "#define _UINT32_T 1" >>confdefs.h
 
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_PTRDIFF_T $ac_cv_sizeof_ptrdiff_t
+#define uint32_t $ac_cv_c_uint32_t
 _ACEOF
+;;
+  esac
 
+ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t"
+case $ac_cv_c_int64_t in #(
+  no|yes) ;; #(
+  *)
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5
-$as_echo_n "checking size of time_t... " >&6; }
-if ${ac_cv_sizeof_time_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t"        "$ac_includes_default"; then :
-
-else
-  if test "$ac_cv_type_time_t" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (time_t)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_time_t=0
-   fi
-fi
+cat >>confdefs.h <<_ACEOF
+#define int64_t $ac_cv_c_int64_t
+_ACEOF
+;;
+esac
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5
-$as_echo "$ac_cv_sizeof_time_t" >&6; }
+ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t"
+case $ac_cv_c_uint64_t in #(
+  no|yes) ;; #(
+  *)
 
+$as_echo "#define _UINT64_T 1" >>confdefs.h
 
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_TIME_T $ac_cv_sizeof_time_t
+#define uint64_t $ac_cv_c_uint64_t
 _ACEOF
-
+;;
+  esac
 
 
 

+ 1 - 1
src/botnet.c

@@ -985,7 +985,7 @@ int botlink(char *linker, int idx, char *nick)
       correct_handle(nick);
 
       char *address = NULL;
-      port_t port = 0;
+      in_port_t port = 0;
 
       if (unix_domain) {
         address = conf.localhub_socket;

+ 3 - 3
src/chanprog.c

@@ -63,7 +63,7 @@ char			origbotnick[HANDLEN + 1] = "";	/* from -B (placed into conf.bot->nick ..
 char 			origbotname[NICKLEN] = "";	/* Nick to regain */
 char                    jupenick[NICKLEN] = "";
 char 			botname[NICKLEN] = "";	/* IRC nickname */
-port_t     		my_port = 0;
+in_port_t     		my_port = 0;
 int			reset_chans = 0;
 bool                    cookies_disabled = 0;
 char s2_4[3] = "",s1_6[3] = "",s1_11[3] = "";
@@ -404,7 +404,7 @@ void load_internal_users()
     bd::String handle(params[0]);
     if (!get_user_by_handle(userlist, const_cast<char*>(handle.c_str()))) {
       bd::String address(params[1]);
-      port_t port = atoi(static_cast<bd::String>(params[2]).c_str());
+      in_port_t port = atoi(static_cast<bd::String>(params[2]).c_str());
       unsigned short hublevel = params.length() == 4 ? atoi(static_cast<bd::String>(params[3]).c_str()) : (idx + 1);
 
       userlist = adduser(userlist, handle.c_str(), "none", "-", USER_OP, 1);
@@ -572,7 +572,7 @@ void rehash_ip() {
     }
     if (!listening) {
       // Listen on the unix domain socket
-      port_t port;
+      in_port_t port;
       int i = open_listen_addr_by_af(conf.localhub_socket, &port, AF_UNIX);
       if (i < 0) {
         putlog(LOG_ERRORS, "*", "Can't listen on %s - %s", conf.localhub_socket, i == -1 ? "it's taken." : "couldn't assign file.");

+ 1 - 1
src/chanprog.h

@@ -38,7 +38,7 @@ void keyx(const bd::String& target);
 
 extern struct chanset_t		*chanset, *chanset_default;
 extern char			admin[], origbotnick[HANDLEN + 1], origbotname[NICKLEN], jupenick[NICKLEN], botname[NICKLEN], *def_chanset;
-extern port_t			my_port;
+extern in_port_t			my_port;
 extern int			reset_chans;
 extern bool			cookies_disabled;
 

+ 3 - 3
src/cmds.c

@@ -1508,7 +1508,7 @@ static void cmd_chaddr(int idx, char *par)
   putlog(LOG_CMDS, "*", "#%s# chaddr %s %s", dcc[idx].nick, handle, addr);
   dprintf(idx, "Changed bot's address.\n");
 
-  port_t telnet_port = 3333, relay_port = 3333;
+  in_port_t telnet_port = 3333, relay_port = 3333;
   char *p = NULL, *q = NULL;
 #ifdef USE_IPV6
   char *r = NULL;
@@ -3274,7 +3274,7 @@ static void cmd_newhub(int idx, char *par)
   }
 
   bd::String address(params[1]);
-  port_t port = atoi(static_cast<bd::String>(params[2]).c_str());
+  in_port_t port = atoi(static_cast<bd::String>(params[2]).c_str());
 
   unsigned short hublevel = 0;
   // Was a hublevel passed in?
@@ -4362,7 +4362,7 @@ static void rcmd_jump(char * frombot, char * fromhand, char * fromidx, char * pa
   if (!conf.bot->hub) {
     if (par[0]) {
       char *other = newsplit(&par), *p = NULL;
-      port_t port = atoi(newsplit(&par));
+      in_port_t port = atoi(newsplit(&par));
 
       if ((p = strchr(other, ':'))) {
         *p = 0;

+ 1 - 1
src/conf.c

@@ -811,7 +811,7 @@ writeconf(char *filename, int fd, int bits)
     for (size_t idx = 0; idx < sortedhubs.length(); ++idx) {
       bd::Array<bd::String> hubparams(static_cast<bd::String>(sortedhubs[idx]).split(' '));
       bd::String hubnick(hubparams[0]), address(hubparams[1]);
-      port_t port = atoi(static_cast<bd::String>(hubparams[2]).c_str());
+      in_port_t port = atoi(static_cast<bd::String>(hubparams[2]).c_str());
       *stream << bd::String::printf(STR("! hub %s %s %d\n"), hubnick.c_str(), address.c_str(), port);
     }
     comment("");

+ 2 - 2
src/conf.h

@@ -40,8 +40,8 @@ typedef struct conf_b {
   char *datadir;
   char *username;       /* shell username */
   char *homedir;        /* homedir */
-  port_t portmin;       /* for hubs, the reserved port range for incoming connections */
-  port_t portmax;       /* for hubs, the reserved port range for incoming connections */
+  in_port_t portmin;       /* for hubs, the reserved port range for incoming connections */
+  in_port_t portmax;       /* for hubs, the reserved port range for incoming connections */
 } conf_t;
 
 extern conf_t		conf;

+ 3 - 7
src/dcc.c

@@ -613,7 +613,7 @@ static void
 dcc_identd_connect(int idx, char *buf, int atr)
 {
   in_addr_t ip;
-  port_t port;
+  in_port_t port;
   int j, sock;
   char s[UHOSTLEN + 1] = "";
 
@@ -1375,7 +1375,7 @@ static void
 dcc_telnet(int idx, char *buf, int ii)
 {
   in_addr_t ip;
-  port_t port;
+  in_port_t port;
   char s[UHOSTLEN + 1] = "";
   int i;
   char x[1024] = "";
@@ -1421,11 +1421,7 @@ dcc_telnet(int idx, char *buf, int ii)
     return;
   }
 
-#if SIZEOF_SHORT == 2
-  if (port < 1024) {
-#else
-  if (port < 1024 || port > 65535) {
-#endif
+  if (port < 1024 || port > 65534) {
     putlog(LOG_BOTS, "*", "Refused %s/%d (bad src port)", s, port);
     killsock(sock);
     return;

+ 3 - 3
src/dcc.h

@@ -61,7 +61,7 @@ struct dcc_t {
 //  int auth;
   bool whowas;
   int dns_id;
-  port_t port;
+  in_port_t port;
   char simulbot[HANDLEN + 1];       /* used for hub->leaf cmd simulation, holds bot that results should be sent to */
   char hash[MD5_HASH_LENGTH + 1];                /* used for dcc authing */
   char shahash[SHA_HASH_LENGTH + 1];
@@ -118,7 +118,7 @@ struct xfer_info {
 struct bot_info {
   int  numver;
   int  uff_flags;               /* user file feature flags              */
-  port_t port;		        /* base port                            */
+  in_port_t port;		        /* base port                            */
   char linker[NOTENAMELEN + 1]; /* who requested this link              */
   char sysname[121];
   char version[121];            /* channel/version info                 */
@@ -132,7 +132,7 @@ struct relay_info {
 #ifdef USE_IPV6
   int af;
 #endif /* USE_IPV6 */
-  port_t port;
+  in_port_t port;
 };
 
 struct dupwait_info {

+ 3 - 3
src/dccutil.c

@@ -879,10 +879,10 @@ do_boot(int idx, const char *by, const char *reason)
 }
 
 int
-listen_all(port_t lport, bool off, bool should_v6)
+listen_all(in_port_t lport, bool off, bool should_v6)
 {
   int idx = -1;
-  port_t port, realport;
+  in_port_t port, realport;
 
 #ifdef USE_IPV6
   int i6 = -1;
@@ -1009,7 +1009,7 @@ identd_open(const char *sourceIp, const char *destIp, int identd)
   {
     int idx;
     int i = -1;
-    port_t port = 113;
+    in_port_t port = 113;
 
     for (idx = 0; idx < dcc_total; idx++)
       if (dcc[idx].type == &DCC_IDENTD_CONNECT)

+ 3 - 3
src/dccutil.h

@@ -7,8 +7,8 @@
 
 /* Public structure for the listening port map */
 struct portmap {
-  port_t realport;
-  port_t mappedto;
+  in_port_t realport;
+  in_port_t mappedto;
   struct portmap *next;
 };
 
@@ -60,7 +60,7 @@ void do_boot(int, const char *, const char *);
 int detect_dcc_flood(time_t *, struct chat_info *, int);
 void identd_open(const char * = NULL, const char * = NULL, int identd = 1);
 void identd_close();
-int listen_all(port_t, bool, bool);
+int listen_all(in_port_t, bool, bool);
 bool valid_idx(int);
 int dcc_read(bd::Stream&);
 void dcc_write(bd::Stream&, int);

+ 5 - 5
src/enclink.c

@@ -38,7 +38,7 @@ static void ghost_link_case(int idx, direction_t direction)
   if (likely(snum >= 0)) {
     char initkey[33] = "", *tmp2 = NULL;
     char *keyp = NULL, *nick1 = NULL, *nick2 = NULL;
-    port_t port = 0;
+    in_port_t port = 0;
     const char salt1[] = SALT1;
     const char salt2[] = SALT2;
 
@@ -124,10 +124,10 @@ static void
 rotate_key(char* key, int& seed)
 {
   if (seed) {
-    *(dword *) & key[0] = prand(&seed, 0xFFFFFFFF);
-    *(dword *) & key[4] = prand(&seed, 0xFFFFFFFF);
-    *(dword *) & key[8] = prand(&seed, 0xFFFFFFFF);
-    *(dword *) & key[12] = prand(&seed, 0xFFFFFFFF);
+    *(uint32_t *) & key[0] = prand(&seed, 0xFFFFFFFF);
+    *(uint32_t *) & key[4] = prand(&seed, 0xFFFFFFFF);
+    *(uint32_t *) & key[8] = prand(&seed, 0xFFFFFFFF);
+    *(uint32_t *) & key[12] = prand(&seed, 0xFFFFFFFF);
 
     if (!seed)
       seed++;

+ 5 - 5
src/mod/server.mod/server.c

@@ -58,12 +58,12 @@ int ctcp_mode;
 int serv = -1;		/* sock # of server currently */
 int servidx = -1;		/* idx of server */
 char newserver[121] = "";	/* new server? */
-port_t newserverport = 0;		/* new server port? */
+in_port_t newserverport = 0;		/* new server port? */
 char newserverpass[121] = "";	/* new server password? */
 static char serverpass[121] = "";
 static time_t trying_server;	/* trying to connect to a server right now? */
 int curserv = 999;		/* current position in server list: */
-port_t curservport = 0;
+in_port_t curservport = 0;
 rate_t flood_msg = { 5, 60 };
 rate_t flood_ctcp = { 3, 60 };
 char botuserhost[UHOSTLEN] = "";	/* bot's user@host (refreshed whenever the bot joins a channel) */
@@ -86,8 +86,8 @@ static const interval_t stoned_timeout = 500;
 struct server_list *serverlist = NULL;	/* old-style queue, still used by
 					   server list */
 interval_t cycle_time;			/* cycle time till next server connect */
-port_t default_port = 6667;		/* default IRC port */
-port_t default_port_ssl = 6697;		/* default IRC SSL port */
+in_port_t default_port = 6667;		/* default IRC port */
+in_port_t default_port_ssl = 6697;		/* default IRC SSL port */
 bool trigger_on_ignore;	/* trigger bindings if user is ignored ? */
 int answer_ctcp = 1;		/* answer how many stacked ctcp's ? */
 static bool resolvserv;		/* in the process of resolving a server host */
@@ -798,7 +798,7 @@ void clearq(struct server_list *xx)
  *
  * -> if (*ptr == -1) then jump to that particular server
  */
-void next_server(int *ptr, char *servname, port_t *port, char *pass)
+void next_server(int *ptr, char *servname, in_port_t *port, char *pass)
 {
   struct server_list *x = serverlist;
 

+ 3 - 3
src/mod/server.mod/server.h

@@ -35,7 +35,7 @@ struct server_list {
   struct server_list	*next;
   char			*name;
   char			*pass;
-  port_t		 port;
+  in_port_t		 port;
 };
 
 /* Available net types.  */
@@ -59,7 +59,7 @@ extern size_t		nick_len;
 extern bool		trigger_on_ignore, floodless, keepnick, in_deaf, in_callerid, have_cprivmsg, have_cnotice;
 extern int 		servidx, ctcp_mode, answer_ctcp, serv, curserv, default_alines, flood_count, burst;
 extern unsigned int     rolls;
-extern port_t		default_port, default_port_ssl, newserverport, curservport;
+extern in_port_t		default_port, default_port_ssl, newserverport, curservport;
 extern time_t		server_online, tried_jupenick, tried_nick, release_time, connect_bursting;
 extern interval_t	cycle_time;
 extern char		cursrvname[], botrealname[121], botuserhost[], ctcp_reply[1024],
@@ -90,7 +90,7 @@ void rehash_monitor_list();
 void replay_cache(int, bd::Stream*);
 void join_chans();
 void check_hostmask();
-void next_server(int *, char *, port_t *, char *);
+void next_server(int *, char *, in_port_t *, char *);
 void server_send_ison();
 void reset_flood();
 

+ 1 - 1
src/mod/server.mod/servmsg.c

@@ -1980,7 +1980,7 @@ static void connect_server(void)
 {
   char pass[121] = "", botserver[UHOSTLEN] = "";
   int newidx;
-  port_t botserverport = 0;
+  in_port_t botserverport = 0;
 
   waiting_for_awake = 0;
   /* trying_server = now; */

+ 6 - 6
src/mod/transfer.mod/transfer.c

@@ -226,13 +226,13 @@ static void eof_dcc_send(int idx)
 
 /* Determine byte order. Used for resend DCC startup packets.
  */
-static inline u_8bit_t byte_order_test(void)
+static inline uint8_t byte_order_test(void)
 {
-  u_16bit_t test = TRANSFER_REGET_PACKETID;
+  uint16_t test = TRANSFER_REGET_PACKETID;
 
-  if (*((u_8bit_t *)&test) == ((TRANSFER_REGET_PACKETID & 0xff00) >> 8))
+  if (*((uint8_t *)&test) == ((TRANSFER_REGET_PACKETID & 0xff00) >> 8))
     return 0;
-  if (*((u_8bit_t *)&test) == (TRANSFER_REGET_PACKETID & 0x00ff))
+  if (*((uint8_t *)&test) == (TRANSFER_REGET_PACKETID & 0x00ff))
     return 1;
   return 0;
 }
@@ -737,7 +737,7 @@ struct dcc_table DCC_GET_PENDING =
 static void dcc_get_pending(int idx, char *buf, int len)
 {
   in_addr_t ip;
-  port_t port;
+  in_port_t port;
   int i;
   char s[UHOSTLEN] = "";
 
@@ -813,7 +813,7 @@ static int raw_dcc_resend_send(char *filename, char *nick, char *from, int resen
 {
   int zz = -1;
   int i;
-  port_t port;
+  in_port_t port;
   char *buf = NULL;
   long dccfilesize;
   FILE *f = NULL, *dccfile = NULL;

+ 3 - 3
src/mod/transfer.mod/transfer.h

@@ -36,11 +36,11 @@ int raw_dcc_send(char *, char *, char *, int *);
 #define TRANSFER_REGET_PACKETID 0xfeab
 
 typedef struct {
-  u_32bit_t byte_offset;	/* Number of bytes to skip relative to
+  uint32_t byte_offset;	/* Number of bytes to skip relative to
 				   the file beginning			*/
-  u_16bit_t packet_id;		/* Identification ID, should be equal
+  uint16_t packet_id;		/* Identification ID, should be equal
 	 			   to TRANSFER_REGET_PACKETID		*/
-  u_8bit_t  byte_order;		/* Byte ordering, see byte_order_test()	*/
+  uint8_t  byte_order;		/* Byte ordering, see byte_order_test()	*/
 } transfer_reget;
 #endif				/* MAKING_TRANSFER */
 

+ 13 - 13
src/net.c

@@ -77,7 +77,7 @@ jmp_buf	alarmret;		/* Env buffer for alarm() returns	    */
 
 /* This *MUST* be an ip */
 char   firewall[121] = "";     /* Socks server for firewall                */
-port_t firewallport = 1080;    /* Default port of Sock4/5 firewalls        */
+in_port_t firewallport = 1080;    /* Default port of Sock4/5 firewalls        */
 /* Types of proxy */
 #define PROXY_SOCKS   1
 #define PROXY_SUN     2
@@ -438,7 +438,7 @@ void real_killsock(register int sock, const char *file, int line)
 
 /* Send connection request to proxy
  */
-static int proxy_connect(int sock, const char *ip, port_t port, int proxy_type)
+static int proxy_connect(int sock, const char *ip, in_port_t port, int proxy_type)
 {
   sdprintf("proxy_connect(%d, %s, %d, %d)", sock, ip, port, proxy_type);
 #ifdef USE_IPV6
@@ -485,7 +485,7 @@ static int proxy_connect(int sock, const char *ip, port_t port, int proxy_type)
 }
 
 /* FIXME: REPLACE WITH SOCK_NAME() */
-void initialize_sockaddr(int af_type, const char *host, port_t port, union sockaddr_union *so)
+void initialize_sockaddr(int af_type, const char *host, in_port_t port, union sockaddr_union *so)
 {
     bzero(so, sizeof(*so));
 
@@ -522,9 +522,9 @@ void initialize_sockaddr(int af_type, const char *host, port_t port, union socka
  *   -1  strerror()/errno type error
  *   -2  can't resolve hostname
  */
-int open_telnet_raw(int sock, const char *ipIn, port_t sport, bool proxy_on, int identd)
+int open_telnet_raw(int sock, const char *ipIn, in_port_t sport, bool proxy_on, int identd)
 {
-  static port_t port = 0;
+  static in_port_t port = 0;
   union sockaddr_union so;
   char ip[121] = "";
   int is_resolved = 0;
@@ -671,7 +671,7 @@ error:
 #endif
 
 /* Ordinary non-binary connection attempt */
-int open_telnet(const char *ip, port_t port, bool proxy, int identd)
+int open_telnet(const char *ip, in_port_t port, bool proxy, int identd)
 {
   int sock = -1;
   
@@ -691,9 +691,9 @@ int open_telnet(const char *ip, port_t port, bool proxy, int identd)
  * 'addr' is ignored if af_def is AF_INET6 -poptix (02/03/03)
  */
 #ifdef USE_IPV6
-int open_address_listen(const char* ip, int af_def, port_t *port) {
+int open_address_listen(const char* ip, int af_def, in_port_t *port) {
 #else
-int open_address_listen(const char* ip, port_t *port) {
+int open_address_listen(const char* ip, in_port_t *port) {
    int af_def = AF_INET;
 #endif /* USE_IPV6 */
 //  if (firewall[0]) {
@@ -810,7 +810,7 @@ int open_address_listen(const char* ip, port_t *port) {
 /* Returns a socket number for a listening socket that will accept any
  * connection -- port # is returned in port
  */
-int open_listen(port_t *port)
+int open_listen(in_port_t *port)
 {
 #ifdef USE_IPV6
   return open_address_listen(iptostr(getmyip()), AF_INET, port);
@@ -823,7 +823,7 @@ int open_listen(port_t *port)
  * the above is being left in for compatibility, and should NOT LONGER BE USED IN THE CORE CODE.
  */
 
-int open_listen_by_af(port_t *port, int af_def)
+int open_listen_by_af(in_port_t *port, int af_def)
 {
 #ifdef USE_IPV6
   return open_address_listen(iptostr(getmyip()), af_def, port);
@@ -832,7 +832,7 @@ int open_listen_by_af(port_t *port, int af_def)
 #endif /* USE_IPV6 */
 }
 
-int open_listen_addr_by_af(const char *ip, port_t *port, int af_def)
+int open_listen_addr_by_af(const char *ip, in_port_t *port, int af_def)
 {
   if (!ip)
     ip = iptostr(getmyip());
@@ -859,7 +859,7 @@ char *iptostr(in_addr_t ip)
  * by open_listen ... returns hostname of the caller & the new socket
  * does NOT dispose of old "public" socket!
  */
-int answer(int sock, char *caller, in_addr_t *ip, port_t *port, int binary)
+int answer(int sock, char *caller, in_addr_t *ip, in_port_t *port, int binary)
 {
   int new_sock;
   socklen_t addrlen;
@@ -941,7 +941,7 @@ int answer(int sock, char *caller, in_addr_t *ip, port_t *port, int binary)
  */
 int open_telnet_dcc(int sock, char *ip, char *port)
 {
-  port_t p;
+  in_port_t p;
   unsigned long addr;
   char sv[100] = "";
   unsigned char c[4] = "";

+ 10 - 10
src/net.h

@@ -92,7 +92,7 @@ typedef struct {
   bd::String* inbuf;
   bd::String* outbuf;
   char *host;
-  port_t port;
+  in_port_t port;
   short          flags;
   char okey[ENC_KEY_LEN + 1];                        /* botlink enckey: out */
   char ikey[ENC_KEY_LEN + 1];                        /* botlink enckey: in  */
@@ -119,20 +119,20 @@ int real_getsock(int, const char *, int);
 
 int sockprotocol(int);
 void real_killsock(int, const char *, int);
-int answer(int, char *, in_addr_t *, port_t *, int);
+int answer(int, char *, in_addr_t *, in_port_t *, int);
 int findanysnum(register int);
 int findanyidx(register int sock);
-int open_listen(port_t *);
-int open_listen_by_af(port_t *, int);
-int open_listen_addr_by_af(const char*, port_t *, int);
+int open_listen(in_port_t *);
+int open_listen_by_af(in_port_t *, int);
+int open_listen_addr_by_af(const char*, in_port_t *, int);
 #ifdef USE_IPV6
-int open_address_listen(const char*, int, port_t *);
+int open_address_listen(const char*, int, in_port_t *);
 #else
-int open_address_listen(const char*, port_t *);
+int open_address_listen(const char*, in_port_t *);
 #endif /* USE_IPV6 */
-int open_telnet(const char *, port_t, bool proxy = 0, int identd = 0);
+int open_telnet(const char *, in_port_t, bool proxy = 0, int identd = 0);
 int open_telnet_dcc(int, char *, char *);
-int open_telnet_raw(int, const char *, port_t, bool, int = 0);
+int open_telnet_raw(int, const char *, in_port_t, bool, int = 0);
 void tputs(int, const char *, size_t);
 void dequeue_sockets();
 int sockgets(char *, int *);
@@ -155,7 +155,7 @@ extern unsigned long			notalloc;
 extern char				firewall[], botuser[21];
 extern int				MAXSOCKS, socks_total;
 extern bool				identd_hack, cached_ip;
-extern port_t				firewallport;
+extern in_port_t				firewallport;
 extern jmp_buf				alarmret;
 extern sock_list			*socklist;
 

+ 1 - 1
src/socket.h

@@ -28,7 +28,7 @@ typedef struct {
 //#define SOCKNAME_INADDR(x) (((x).family == AF_INET6) ? x.u.ipv6.sin6_addr : x.u.ipv4.sin_addr)
 //#define SOCKNAME_ADDR(x) (((x).family == AF_INET6) ? x.u.ipv6.sin6_addr.s6_addr : x.u.ipv4.sin_addr.s_addr)
 
-int socket_name(sockname_t *name, const char *ipaddr, port_t port);
+int socket_name(sockname_t *name, const char *ipaddr, in_port_t port);
 
 
 /* globals */

+ 0 - 19
src/types.h

@@ -22,25 +22,6 @@ typedef intptr_t (*FunctionPtr) ();
 typedef int socklen_t;
 #endif
 
-/* 32 bit type */
-#if (SIZEOF_INT == 4)
-typedef unsigned int            u_32bit_t;
-#else
-#  if (SIZEOF_LONG == 4)
-typedef unsigned long           u_32bit_t;
-#  else
-#    include "cant/find/32bit/type"
-#  endif
-#endif
-
-typedef unsigned short int      u_16bit_t;
-typedef unsigned char           u_8bit_t;
-
-typedef u_32bit_t 		dword;
-
-/* port */
-typedef in_port_t		port_t;
-
 // Signed so that it can play nice with time_t
 typedef int			interval_t;
 

+ 2 - 2
src/users.h

@@ -62,8 +62,8 @@ struct bot_addr {
   char *address;
   char *uplink;
   unsigned short hublevel;
-  port_t telnet_port;
-  port_t relay_port;
+  in_port_t telnet_port;
+  in_port_t relay_port;
 };
 
 struct user_entry {