diff -ur docsis-0.9.5-orig/configure docsis-0.9.5-dw/configure --- docsis-0.9.5-orig/configure 2005-07-06 01:53:59.000000000 +0200 +++ docsis-0.9.5-dw/configure 2009-09-09 13:20:09.000000000 +0200 @@ -463,7 +463,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LEX LEXLIB LEX_OUTPUT_ROOT M4 BISON YACC NETSNMP_CONFIG NETSNMP_LIBS NETSNMP_CFLAGS NETSNMP_RPATH NETSNMP_PREFIX CYGWIN_BUILDROOT NETSNMP_MIBPATH MAKENSIS CYGWIN_BUILD_TRUE CYGWIN_BUILD_FALSE CYGWIN_BUILD_SETUP_EXE_TRUE CYGWIN_BUILD_SETUP_EXE_FALSE LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LEX LEXLIB LEX_OUTPUT_ROOT LIBM M4 BISON YACC NETSNMP_CONFIG NETSNMP_LIBS NETSNMP_CFLAGS NETSNMP_RPATH NETSNMP_PREFIX CYGWIN_BUILDROOT NETSNMP_MIBPATH MAKENSIS CYGWIN_BUILD_TRUE CYGWIN_BUILD_FALSE CYGWIN_BUILD_SETUP_EXE_TRUE CYGWIN_BUILD_SETUP_EXE_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -19457,6 +19457,222 @@ fi +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + echo "$as_me:$LINENO: checking for _mwvalidcheckl in -lmw" >&5 +echo $ECHO_N "checking for _mwvalidcheckl in -lmw... $ECHO_C" >&6 +if test "${ac_cv_lib_mw__mwvalidcheckl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmw $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char _mwvalidcheckl (); +int +main () +{ +_mwvalidcheckl (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_mw__mwvalidcheckl=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_mw__mwvalidcheckl=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_mw__mwvalidcheckl" >&5 +echo "${ECHO_T}$ac_cv_lib_mw__mwvalidcheckl" >&6 +if test $ac_cv_lib_mw__mwvalidcheckl = yes; then + LIBM="-lmw" +fi + + echo "$as_me:$LINENO: checking for cos in -lm" >&5 +echo $ECHO_N "checking for cos in -lm... $ECHO_C" >&6 +if test "${ac_cv_lib_m_cos+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char cos (); +int +main () +{ +cos (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_m_cos=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_m_cos=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_m_cos" >&5 +echo "${ECHO_T}$ac_cv_lib_m_cos" >&6 +if test $ac_cv_lib_m_cos = yes; then + LIBM="$LIBM -lm" +fi + + ;; +*) + echo "$as_me:$LINENO: checking for cos in -lm" >&5 +echo $ECHO_N "checking for cos in -lm... $ECHO_C" >&6 +if test "${ac_cv_lib_m_cos+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char cos (); +int +main () +{ +cos (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_m_cos=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_m_cos=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_m_cos" >&5 +echo "${ECHO_T}$ac_cv_lib_m_cos" >&6 +if test $ac_cv_lib_m_cos = yes; then + LIBM="-lm" +fi + + ;; +esac + + for ac_prog in gm4 gnum4 m4 do @@ -19510,7 +19726,7 @@ { (exit 1); exit 1; }; } else ac_m4_vers=`$M4 --version 2>/dev/null | head -1` ; - ac_is_gnu_m4=`echo $ac_m4_vers | cut -d' ' -f1`; + ac_is_gnu_m4=`echo $ac_m4_vers | grep -q GNU && echo GNU` ; if test "x$ac_is_gnu_m4" = "xGNU"; then echo "$as_me:$LINENO: result: found $ac_m4_vers at $M4 " >&5 echo "${ECHO_T} found $ac_m4_vers at $M4 " >&6 @@ -20488,6 +20704,7 @@ s,@LEX@,$LEX,;t t s,@LEXLIB@,$LEXLIB,;t t s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t +s,@LIBM@,$LIBM,;t t s,@M4@,$M4,;t t s,@BISON@,$BISON,;t t s,@YACC@,$YACC,;t t diff -ur docsis-0.9.5-orig/configure.in docsis-0.9.5-dw/configure.in --- docsis-0.9.5-orig/configure.in 2005-07-06 01:53:18.000000000 +0200 +++ docsis-0.9.5-dw/configure.in 2009-09-09 13:20:09.000000000 +0200 @@ -10,13 +10,15 @@ AC_PROG_LEX AC_CHECK_LIB(resolv, inet_aton) +AC_CHECK_LIBM +AC_SUBST(LIBM) AC_PATH_PROGS([M4], [gm4 gnum4 m4], [notfound],[/usr/local/bin:/usr/freeware/bin:/usr/gnu/bin:${prefix}/bin:${exec_prefix}/bin:$PATH] ) if test "x$M4" = "xnotfound"; then AC_MSG_ERROR([M4 is required]) else ac_m4_vers=`$M4 --version 2>/dev/null | head -1` ; - ac_is_gnu_m4=`echo $ac_m4_vers | cut -d' ' -f1`; + ac_is_gnu_m4=`echo $ac_m4_vers | grep -q GNU && echo GNU` ; if test "x$ac_is_gnu_m4" = "xGNU"; then AC_MSG_RESULT([ found $ac_m4_vers at $M4 ]) else diff -ur docsis-0.9.5-orig/src/Makefile.am docsis-0.9.5-dw/src/Makefile.am --- docsis-0.9.5-orig/src/Makefile.am 2003-10-23 23:34:45.000000000 +0200 +++ docsis-0.9.5-dw/src/Makefile.am 2009-09-09 13:20:09.000000000 +0200 @@ -5,7 +5,7 @@ INCLUDES= $(all_includes) $(NETSNMP_CFLAGS) # the library search path. -docsis_LDFLAGS = $(all_libraries) $(NETSNMP_LIBS) $(LEXLIB) +docsis_LDFLAGS = $(all_libraries) $(NETSNMP_LIBS) $(LEXLIB) $(LIBM) noinst_HEADERS = ethermac.h md5.h docsis.h docsis_common.h docsis_decode.h docsis_encode.h docsis_symtable.h docsis_snmp.h docsis_globals.h EXTRA_DIST=docsis_yy.h CLEANFILES=docsis_yy.c docsis_yy.h docsis_yy.output docsis_lex.c diff -ur docsis-0.9.5-orig/src/Makefile.in docsis-0.9.5-dw/src/Makefile.in --- docsis-0.9.5-orig/src/Makefile.in 2005-07-06 01:53:58.000000000 +0200 +++ docsis-0.9.5-dw/src/Makefile.in 2009-09-09 13:20:09.000000000 +0200 @@ -124,6 +124,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -201,7 +202,7 @@ INCLUDES = $(all_includes) $(NETSNMP_CFLAGS) # the library search path. -docsis_LDFLAGS = $(all_libraries) $(NETSNMP_LIBS) $(LEXLIB) +docsis_LDFLAGS = $(all_libraries) $(NETSNMP_LIBS) $(LEXLIB) $(LIBM) noinst_HEADERS = ethermac.h md5.h docsis.h docsis_common.h docsis_decode.h docsis_encode.h docsis_symtable.h docsis_snmp.h docsis_globals.h EXTRA_DIST = docsis_yy.h CLEANFILES = docsis_yy.c docsis_yy.h docsis_yy.output docsis_lex.c diff -ur docsis-0.9.5-orig/src/docsis_common.h docsis-0.9.5-dw/src/docsis_common.h --- docsis-0.9.5-orig/src/docsis_common.h 2005-08-01 15:18:15.000000000 +0200 +++ docsis-0.9.5-dw/src/docsis_common.h 2009-09-09 13:20:09.000000000 +0200 @@ -67,8 +67,8 @@ }; union t_val { /* union for returning token values */ - int intval; /* For integers */ - unsigned int uintval; /* For unsigned integers */ + int longval; /* For integers */ + unsigned int ulongval; /* For unsigned integers */ symbol_type *symptr; /* For token identifiers */ char *strval; /* For strings */ unsigned char *ustrval; /* For (unsigned char *) strings */ diff -ur docsis-0.9.5-orig/src/docsis_decode.c docsis-0.9.5-dw/src/docsis_decode.c --- docsis-0.9.5-orig/src/docsis_decode.c 2005-08-01 15:30:42.000000000 +0200 +++ docsis-0.9.5-dw/src/docsis_decode.c 2009-09-09 13:20:09.000000000 +0200 @@ -218,7 +218,7 @@ void decode_unknown (unsigned char *tlvbuf, symbol_type *sym, size_t length ) { - int len=0; + unsigned int len=0; char *cp,*value; char hexvalue[514]; @@ -468,10 +468,10 @@ void -snprint_hexadecimal ( unsigned char *outbuf, size_t outsize, const char *str, size_t str_len ) +snprint_hexadecimal ( char *outbuf, size_t outsize, const char *str, size_t str_len ) { unsigned int i; - unsigned char *cp; + char *cp; cp=outbuf; diff -ur docsis-0.9.5-orig/src/docsis_decode.h docsis-0.9.5-dw/src/docsis_decode.h --- docsis-0.9.5-orig/src/docsis_decode.h 2005-07-14 00:37:18.000000000 +0200 +++ docsis-0.9.5-dw/src/docsis_decode.h 2009-09-09 13:20:09.000000000 +0200 @@ -50,7 +50,7 @@ int hexadecimal_to_binary(const char *string, unsigned char *out_buf); int str_isalpha (const char *str, size_t str_len); int str_isprint (const char *str, size_t str_len); -void snprint_hexadecimal ( unsigned char *outbuf, size_t outsize, const char *str, size_t str_len ); +void snprint_hexadecimal ( char *outbuf, size_t outsize, const char *str, size_t str_len ); void __docsis_indent ( int opCode, int doPrint ); diff -ur docsis-0.9.5-orig/src/docsis_encode.c docsis-0.9.5-dw/src/docsis_encode.c --- docsis-0.9.5-orig/src/docsis_encode.c 2005-08-15 22:17:56.000000000 +0200 +++ docsis-0.9.5-dw/src/docsis_encode.c 2009-09-09 13:20:09.000000000 +0200 @@ -56,14 +56,14 @@ } helper = (union t_val *) tval; if ( sym_ptr->low_limit || sym_ptr->high_limit ) { - if ( helper->uintval < sym_ptr->low_limit || helper->uintval > sym_ptr->high_limit ) { - printf ("%s: at line %d, %s value %d out of range %hd-%hd\n ", prog_name,line,sym_ptr->sym_ident,helper->uintval,sym_ptr->low_limit, sym_ptr->high_limit); + if ( helper->ulongval < sym_ptr->low_limit || helper->ulongval > sym_ptr->high_limit ) { + printf ("%s: at line %d, %s value %d out of range %hd-%hd\n ", prog_name,line,sym_ptr->sym_ident,helper->ulongval,sym_ptr->low_limit, sym_ptr->high_limit); exit(-15); } } - int_value = htonl( helper->uintval ); + int_value = htonl( helper->ulongval ); #ifdef DEBUG - printf ("encode_uint: found %s value %d\n",sym_ptr->sym_ident, helper->uintval); + printf ("encode_uint: found %s value %d\n",sym_ptr->sym_ident, helper->ulongval); #endif /* DEBUG */ memcpy ( buf,&int_value, sizeof(unsigned int)); return ( sizeof(unsigned int)); @@ -85,14 +85,14 @@ } helper = (union t_val *) tval; if ( sym_ptr->low_limit || sym_ptr->high_limit ) { - if ( helper->uintval < sym_ptr->low_limit || helper->uintval > sym_ptr->high_limit ) { - printf ("%s: at line %d, %s value %d out of range %hd-%hd\n ", prog_name,line,sym_ptr->sym_ident,helper->uintval,sym_ptr->low_limit, sym_ptr->high_limit); + if ( helper->ulongval < sym_ptr->low_limit || helper->ulongval > sym_ptr->high_limit ) { + printf ("%s: at line %d, %s value %d out of range %hd-%hd\n ", prog_name,line,sym_ptr->sym_ident,helper->ulongval,sym_ptr->low_limit, sym_ptr->high_limit); exit(-15); } } - sint = htons( (unsigned short) helper->uintval ); + sint = htons( (unsigned short) helper->ulongval ); #ifdef DEBUG - printf ("encode_ushort: found %s value %hd\n",sym_ptr->sym_ident, helper->uintval); + printf ("encode_ushort: found %s value %hd\n",sym_ptr->sym_ident, helper->ulongval); #endif /* DEBUG */ memcpy ( buf,&sint,sizeof(unsigned short)); return ( sizeof(unsigned short)); @@ -114,18 +114,18 @@ } helper = (union t_val *) tval; - int_value = htonl( helper->uintval ); + int_value = htonl( helper->ulongval ); if ( sym_ptr->low_limit || sym_ptr->high_limit ) { - if ( helper->uintval < sym_ptr->low_limit || helper->uintval > sym_ptr->high_limit ) { - printf ("%s: at line %d, %s value %d out of range %hd-%hd\n ", prog_name,line,sym_ptr->sym_ident,helper->uintval,sym_ptr->low_limit, sym_ptr->high_limit); + if ( helper->ulongval < sym_ptr->low_limit || helper->ulongval > sym_ptr->high_limit ) { + printf ("%s: at line %d, %s value %d out of range %hd-%hd\n ", prog_name,line,sym_ptr->sym_ident,helper->ulongval,sym_ptr->low_limit, sym_ptr->high_limit); exit(-15); } } cp = (char *)&int_value; buf[0]=(unsigned char)cp[3]; #ifdef DEBUG - printf ("encode_uchar: found %s value %hd\n",sym_ptr->sym_ident, helper->uintval); + printf ("encode_uchar: found %s value %hd\n",sym_ptr->sym_ident, helper->ulongval); #endif return ( sizeof(unsigned char)); diff -ur docsis-0.9.5-orig/src/docsis_lex.l docsis-0.9.5-dw/src/docsis_lex.l --- docsis-0.9.5-orig/src/docsis_lex.l 2005-09-13 17:12:19.000000000 +0200 +++ docsis-0.9.5-dw/src/docsis_lex.l 2009-09-09 13:20:09.000000000 +0200 @@ -111,8 +111,8 @@ \/[*]+ { printf ("line %d: comment-in-comment not supported", line) ; } [*]+\/ { BEGIN 0; } -[0-9]+ { yylval.intval=atoi(yytext);return T_INTEGER; } --[0-9]+ { yylval.intval=atoi(yytext);return T_INTEGER; } +[0-9]+ { yylval.longval=atoi(yytext);return T_INTEGER; } +-[0-9]+ { yylval.longval=atoi(yytext);return T_INTEGER; } [ \t]+ ; \r\n { line++; } \n { line++; } diff -ur docsis-0.9.5-orig/src/docsis_snmp.c docsis-0.9.5-dw/src/docsis_snmp.c --- docsis-0.9.5-orig/src/docsis_snmp.c 2005-10-12 15:30:20.000000000 +0200 +++ docsis-0.9.5-dw/src/docsis_snmp.c 2009-09-09 13:20:09.000000000 +0200 @@ -29,7 +29,7 @@ unsigned int encode_vbind (char *oid_string, char oid_asntype, union t_val *value, - unsigned char *out_buffer, unsigned int out_size) + unsigned char *out_buffer, size_t out_size) { oid var_name[MAX_OID_LEN]; size_t name_len = MAX_OID_LEN; @@ -102,8 +102,8 @@ var_name, &name_len, ASN_INTEGER, - sizeof (int), - (unsigned char *) &value->intval, + sizeof (long), + (unsigned char *) &value->longval, &out_size); return data_ptr - out_buffer; break; @@ -113,8 +113,8 @@ var_name, &name_len, ASN_GAUGE, - sizeof (int), - (unsigned char *) &value->intval, + sizeof (long), + (unsigned char *) &value->longval, &out_size); return data_ptr - out_buffer; break; @@ -124,8 +124,8 @@ var_name, &name_len, ASN_COUNTER, - sizeof (int), - (unsigned char *) &value->intval, + sizeof (long), + (unsigned char *) &value->longval, &out_size); return data_ptr - out_buffer; break; @@ -135,8 +135,8 @@ var_name, &name_len, ASN_GAUGE, - sizeof (int), - (unsigned char *) &value->intval, + sizeof (long), + (unsigned char *) &value->longval, &out_size); return data_ptr - out_buffer; break; @@ -146,8 +146,8 @@ var_name, &name_len, ASN_TIMETICKS, - sizeof (int), - (unsigned char *) &value->intval, + sizeof (long), + (unsigned char *) &value->longval, &out_size); return data_ptr - out_buffer; break; @@ -245,7 +245,7 @@ strncpy ((char *) buf, value->strval, SPRINT_MAX_LEN); len = strlen ((char *) buf); - if (!read_objid (buf, oid_value, &oid_value_len)) + if (!read_objid ((char *) buf, oid_value, &oid_value_len)) { printf ("Can't find oid %s at line %d\n", buf, line); return 0; @@ -277,7 +277,7 @@ oid var_name[MAX_OID_LEN]; /* To test the objid */ size_t name_len = MAX_OID_LEN; /* To test the objid */ int badtype=0; - unsigned int len; + size_t len; struct variable_list *vp; oid objid[MAX_OID_LEN]; char _docsis_snmp_label[50]; /* To hold the 'name' of the type, i.e. Integer etc */ @@ -563,18 +563,18 @@ switch ((short) vp->type) { case ASN_OCTET_STR: - if (str_isprint(vp->val.string, vp->val_len)) + if (str_isprint((char *) vp->val.string, vp->val_len)) { snprintf(outbuf, vp->val_len+5, "\"%s\"", vp->val.string); } else { - snprint_hexadecimal (outbuf, 1023, vp->val.string, vp->val_len); + snprint_hexadecimal (outbuf, 1023, (char *)vp->val.string, vp->val_len); memset (_docsis_snmp_label, 0, 50); sprintf (_docsis_snmp_label, "HexString"); } break; case ASN_BIT_STR: - snprint_hexadecimal (outbuf, 1023, vp->val.bitstring, vp->val_len); + snprint_hexadecimal (outbuf, 1023, (char *)vp->val.bitstring, vp->val_len); break; case ASN_OBJECT_ID: netsnmp_ds_set_int (NETSNMP_DS_LIBRARY_ID, @@ -614,7 +614,7 @@ unsigned int encode_snmp_oid (char *oid_string, unsigned char *out_buffer, - unsigned int out_size) + size_t out_size) { oid var_name[MAX_OID_LEN]; size_t name_len = MAX_OID_LEN; @@ -644,7 +644,7 @@ size_t oid_len = MAX_OID_LEN; unsigned char type; void *retval; /* generic pointer, will only use to check return value */ - int len; + size_t len; static char outbuf[1024]; memset (outbuf, 0, 1024); @@ -696,6 +696,7 @@ u_char *tmpDataPtr; u_char *dataPtr; + dummyLen = *listlength; dataPtr = data; #if 0 diff -ur docsis-0.9.5-orig/src/docsis_snmp.h docsis-0.9.5-dw/src/docsis_snmp.h --- docsis-0.9.5-orig/src/docsis_snmp.h 2004-03-17 16:01:37.000000000 +0100 +++ docsis-0.9.5-dw/src/docsis_snmp.h 2009-09-09 13:20:09.000000000 +0200 @@ -33,9 +33,9 @@ #include "docsis.h" unsigned int encode_vbind ( char *oid_string, char oid_asntype, union t_val *value, - unsigned char *out_buffer, unsigned int out_size ); + unsigned char *out_buffer, size_t out_size ); int decode_vbind ( unsigned char *, unsigned int); -unsigned int encode_snmp_oid ( char *oid_string, unsigned char *out_buffer, unsigned int out_size ); +unsigned int encode_snmp_oid ( char *oid_string, unsigned char *out_buffer, size_t out_size ); unsigned int decode_snmp_oid ( unsigned char *data, unsigned int data_len); unsigned char *_docsis_snmp_build_var_op(unsigned char * data, diff -ur docsis-0.9.5-orig/src/docsis_yy.h docsis-0.9.5-dw/src/docsis_yy.h --- docsis-0.9.5-orig/src/docsis_yy.h 2005-09-13 11:20:36.000000000 +0200 +++ docsis-0.9.5-dw/src/docsis_yy.h 2009-09-09 13:20:40.000000000 +0200 @@ -112,8 +112,8 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) #line 46 "docsis_yy.y" typedef union YYSTYPE { /* Token types */ - int intval; /* For integers */ - unsigned int uintval; /* For unsigned integers */ + int longval; /* For integers */ + unsigned int ulongval; /* For unsigned integers */ symbol_type *symptr; /* For token identifiers */ char *strval; /* For strings */ unsigned char *ustrval; /* For any other types */ diff -ur docsis-0.9.5-orig/src/docsis_yy.y docsis-0.9.5-dw/src/docsis_yy.y --- docsis-0.9.5-orig/src/docsis_yy.y 2005-09-13 17:15:14.000000000 +0200 +++ docsis-0.9.5-dw/src/docsis_yy.y 2009-09-09 13:20:09.000000000 +0200 @@ -44,8 +44,8 @@ %} %union { /* Token types */ - int intval; /* For integers */ - unsigned int uintval; /* For unsigned integers */ + int longval; /* For integers */ + unsigned int ulongval; /* For unsigned integers */ symbol_type *symptr; /* For token identifiers */ char *strval; /* For strings */ unsigned char *ustrval; /* For any other types */ @@ -55,7 +55,7 @@ } %token T_IDENTIFIER -%token T_INTEGER +%token T_INTEGER %token T_IDENT_COS %token T_IDENT_BPI %token T_IDENT_SNMPW @@ -72,26 +72,26 @@ %token T_HEX_STRING %token T_TIMETICKS -%token T_ASNTYPE_INT -%token T_ASNTYPE_UINT -%token T_ASNTYPE_GAUGE -%token T_ASNTYPE_COUNTER -%token T_ASNTYPE_TIMETICKS -%token T_ASNTYPE_IP -%token T_ASNTYPE_OBJID -%token T_ASNTYPE_STRING -%token T_ASNTYPE_HEXSTR -%token T_ASNTYPE_DECSTR -%token T_ASNTYPE_BITSTR -%token T_ASNTYPE_BIGINT -%token T_ASNTYPE_UBIGINT -%token T_ASNTYPE_FLOAT -%token T_ASNTYPE_DOUBLE -%token T_TLV_CODE -%token T_TLV_LENGTH -%token T_TLV_VALUE -%token T_TLV_STR_VALUE -%token T_TLV_STRZERO_VALUE +%token T_ASNTYPE_INT +%token T_ASNTYPE_UINT +%token T_ASNTYPE_GAUGE +%token T_ASNTYPE_COUNTER +%token T_ASNTYPE_TIMETICKS +%token T_ASNTYPE_IP +%token T_ASNTYPE_OBJID +%token T_ASNTYPE_STRING +%token T_ASNTYPE_HEXSTR +%token T_ASNTYPE_DECSTR +%token T_ASNTYPE_BITSTR +%token T_ASNTYPE_BIGINT +%token T_ASNTYPE_UBIGINT +%token T_ASNTYPE_FLOAT +%token T_ASNTYPE_DOUBLE +%token T_TLV_CODE +%token T_TLV_LENGTH +%token T_TLV_VALUE +%token T_TLV_STR_VALUE +%token T_TLV_STRZERO_VALUE %type assignment_stmt @@ -281,7 +281,7 @@ printf ("got len 0 value while scanning for %s\n at line %d\n",sym_ptr->sym_ident,line ); exit (-1); } - tlvbuf->tlv_value[tlvbuf->tlv_len] = (unsigned char) value->intval ; + tlvbuf->tlv_value[tlvbuf->tlv_len] = (unsigned char) value->longval ; tlvbuf->tlv_len++; free(oid_string); return tlvbuf; diff -ur docsis-0.9.5-orig/src/md5.c docsis-0.9.5-dw/src/md5.c --- docsis-0.9.5-orig/src/md5.c 2003-10-24 21:54:42.000000000 +0200 +++ docsis-0.9.5-dw/src/md5.c 2009-09-09 13:20:09.000000000 +0200 @@ -23,6 +23,7 @@ documentation and/or software. */ +#include #include "md5.h" /* Constants for MD5Transform routine. @@ -46,9 +47,9 @@ #define S43 15 #define S44 21 -static void MD5Transform (UINT4 [4], unsigned char [64]); -static void Encode (unsigned char *, UINT4 *, unsigned int); -static void Decode (UINT4 *, unsigned char *, unsigned int); +static void MD5Transform (u_int32_t [4], unsigned char [64]); +static void Encode (unsigned char *, u_int32_t *, unsigned int); +static void Decode (u_int32_t *, unsigned char *, unsigned int); static void MD5_memcpy (POINTER, POINTER, unsigned int); static void MD5_memset (POINTER, int, unsigned int); @@ -73,22 +74,22 @@ Rotation is separate from addition to prevent recomputation. */ #define FF(a, b, c, d, x, s, ac) { \ - (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) += F ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define GG(a, b, c, d, x, s, ac) { \ - (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) += G ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define HH(a, b, c, d, x, s, ac) { \ - (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) += H ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define II(a, b, c, d, x, s, ac) { \ - (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) += I ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } @@ -122,10 +123,10 @@ index = (unsigned int)((context->count[0] >> 3) & 0x3F); /* Update number of bits */ - if ((context->count[0] += ((UINT4)inputLen << 3)) - < ((UINT4)inputLen << 3)) + if ((context->count[0] += ((u_int32_t)inputLen << 3)) + < ((u_int32_t)inputLen << 3)) context->count[1]++; - context->count[1] += ((UINT4)inputLen >> 29); + context->count[1] += ((u_int32_t)inputLen >> 29); partLen = 64 - index; @@ -181,10 +182,10 @@ /* MD5 basic transformation. Transforms state based on block. */ static void MD5Transform (state, block) -UINT4 state[4]; +u_int32_t state[4]; unsigned char block[64]; { - UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + u_int32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; Decode (x, block, 64); @@ -270,12 +271,12 @@ MD5_memset ((POINTER)x, 0, sizeof (x)); } -/* Encodes input (UINT4) into output (unsigned char). Assumes len is +/* Encodes input (u_int32_t) into output (unsigned char). Assumes len is a multiple of 4. */ static void Encode (output, input, len) unsigned char *output; -UINT4 *input; +u_int32_t *input; unsigned int len; { unsigned int i, j; @@ -288,19 +289,19 @@ } } -/* Decodes input (unsigned char) into output (UINT4). Assumes len is +/* Decodes input (unsigned char) into output (u_int32_t). Assumes len is a multiple of 4. */ static void Decode (output, input, len) -UINT4 *output; +u_int32_t *output; unsigned char *input; unsigned int len; { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | - (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); + output[i] = ((u_int32_t)input[j]) | (((u_int32_t)input[j+1]) << 8) | + (((u_int32_t)input[j+2]) << 16) | (((u_int32_t)input[j+3]) << 24); } /* Note: Replace "for loop" with standard memcpy if possible. diff -ur docsis-0.9.5-orig/src/md5.h docsis-0.9.5-dw/src/md5.h --- docsis-0.9.5-orig/src/md5.h 2004-03-17 16:09:31.000000000 +0100 +++ docsis-0.9.5-dw/src/md5.h 2009-09-09 13:20:09.000000000 +0200 @@ -22,19 +22,15 @@ documentation and/or software. */ +#include + /* POINTER defines a generic pointer type */ typedef unsigned char *POINTER; -/* UINT2 defines a two byte word */ -typedef unsigned short int UINT2; - -/* UINT4 defines a four byte word */ -typedef unsigned long int UINT4; - /* MD5 context. */ typedef struct { - UINT4 state[4]; /* state (ABCD) */ - UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + u_int32_t state[4]; /* state (ABCD) */ + u_int32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ } MD5_CTX;