Daily patch: gateway

kannel at kannel.org kannel at kannel.org
Mon Feb 16 06:30:04 CET 2009


File gateway/ChangeLog changed from revision 1.3020 to 1.3024
File gateway/doc/userguide/userguide.xml changed from revision 1.344 to 1.345
File gateway/gw/meta_data.c changed from revision 1.2 to 1.3
File gateway/gw/shared.c changed from revision 1.44 to 1.45
File gateway/gw/shared.h changed from revision 1.22 to 1.23
File gateway/gw/smsc/smsc_at.c changed from revision 1.56 to 1.57
File gateway/gwlib/utils.c changed from revision 1.55 to 1.56
File gateway/gwlib/utils.h changed from revision 1.31 to 1.32
File gateway/test/test_octstr_format.c changed from revision 1.13 to 1.14



Index: gateway/ChangeLog
diff -u gateway/ChangeLog:1.3020 gateway/ChangeLog:1.3024
--- gateway/ChangeLog:1.3020	Tue Feb 10 16:36:10 2009
+++ gateway/ChangeLog	Sun Feb 15 23:13:55 2009
@@ -1,5 +1,30 @@
+2009-02-16  Stipe Tolj  <stolj at kannel.org>
+    * doc/userguide/userguide.xml: adding documetation section for the
+      command line switch for showing the version.
+    * gw/shared.[ch]: moved the version printing related public functions.
+    * gwlib/utils.[ch]: places the printing functions here and adding the
+      --version command line switch to the general command line intrpreting
+      function.
+      [Msg-Id: <4996DF94.5010505 at tolj.org>]
+      
+2009-02-15 Alexander Malysh <amalysh at kannel.org>
+    * test/test_octstr_format.c: fixed compiler warnings.
+      Thanks to Vincent CHAVANIS <v.chavanis at telemaque.fr> for patch.
+
+2009-02-15 Alexander Malysh <amalysh at kannel.org>
+    * gw/meta_data.c: fixed compiler warnings.
+      Thanks to Vincent CHAVANIS <v.chavanis at telemaque.fr> for patch
+      and to "Nikos Balkanas" <nbalkanas at gmail.com>.
+
+2009-02-15 Alexander Malysh <amalysh at kannel.org>
+    * gw/smsc/smsc_at.c: applied patch that includes more speed cases,
+      and allows the default to be any speed (rather than 9600) *if* the OS
+      behaves like OSX where B9600 == 9600 (not so under Linux).
+      Thanks to Paul Bagyenda <bagyenda at dsmagic.com> for this patch.
+      [Msg-ID: <48DB2FB0-2D8B-4FC0-A00B-A33E36DAA45D at dsmagic.com>]
+
 2009-02-10 Alexander Malysh <amalysh at kannel.org>
-     * checks, gw/pushkannel.conf, gw/smskannel.conf, gw/wapkannel.conf: fixes
+    * checks, gw/pushkannel.conf, gw/smskannel.conf, gw/wapkannel.conf: fixes
        for make check. It works now.
        Thanks to Vincent CHAVANIS <v.chavanis at telemaque.fr> for patch.
 
Index: gateway/doc/userguide/userguide.xml
diff -u gateway/doc/userguide/userguide.xml:1.344 gateway/doc/userguide/userguide.xml:1.345
--- gateway/doc/userguide/userguide.xml:1.344	Wed Jan 14 11:11:46 2009
+++ gateway/doc/userguide/userguide.xml	Sun Feb 15 23:13:55 2009
@@ -1654,6 +1654,12 @@
   <title>Kannel Command Line Options</title>
   <tgroup cols="2">
   <tbody>
+   <row><entry><literal></literal></entry>
+        <entry morerows="1" valign="bottom">
+             Print the version of the Kannel binary.
+        </entry></row>
+   <row><entry><literal>--version</literal></entry></row>
+
    <row><entry><literal>-v &lt;level&gt;</literal></entry>
         <entry morerows="1" valign="bottom">
              Set verbosity level for stdout (screen) logging. Default is 0,
Index: gateway/gw/meta_data.c
diff -u gateway/gw/meta_data.c:1.2 gateway/gw/meta_data.c:1.3
--- gateway/gw/meta_data.c:1.2	Wed Jan 14 11:11:46 2009
+++ gateway/gw/meta_data.c	Sun Feb 15 19:55:50 2009
@@ -335,12 +335,12 @@
     }
     if (replace) {
         /* delete old value if any */
-        dict_put(curr->values, key, NULL);
+        dict_put(curr->values, (Octstr *) key, NULL);
         /* put new value */
-        dict_put(curr->values, key, octstr_duplicate(value));
-    } else if (dict_get(curr->values, key) == NULL) {
+        dict_put(curr->values, (Octstr *) key, octstr_duplicate(value));
+    } else if (dict_get(curr->values, (Octstr *) key) == NULL) {
         /* put new value */
-        dict_put(curr->values, key, octstr_duplicate(value));
+        dict_put(curr->values, (Octstr *) key, octstr_duplicate(value));
     }
 
     /* pack it */
@@ -365,7 +365,7 @@
         return NULL;
     for (curr = mdata; curr != NULL; curr = curr->next) {
         if (octstr_str_case_compare(curr->group, group) == 0) {
-            ret = dict_remove(curr->values, key);
+            ret = dict_remove(curr->values, (Octstr *) key);
             break;
         }
     }
Index: gateway/gw/shared.c
diff -u gateway/gw/shared.c:1.44 gateway/gw/shared.c:1.45
--- gateway/gw/shared.c:1.44	Mon Jan 12 16:46:56 2009
+++ gateway/gw/shared.c	Sun Feb 15 23:13:55 2009
@@ -60,108 +60,15 @@
  * Lars Wirzenius
  */
 
-#include <sys/utsname.h>
 #include <libxml/xmlversion.h>
 
 #include "gwlib/gwlib.h"
 #include "shared.h"
 
-#if defined(HAVE_LIBSSL) || defined(HAVE_WTLS_OPENSSL) 
-#include <openssl/opensslv.h>
-#endif
-#ifdef HAVE_MYSQL 
-#include <mysql_version.h>
-#include <mysql.h>
-#endif
-#ifdef HAVE_SQLITE 
-#include <sqlite.h>
-#endif
-#ifdef HAVE_SQLITE3 
-#include <sqlite3.h>
-#endif
-#ifdef HAVE_ORACLE 
-#include <oci.h>
-#endif
-
 
 volatile enum program_status program_status = starting_up;
 
 
-void report_versions(const char *boxname)
-{
-    Octstr *os;
-    
-    os = version_report_string(boxname);
-    debug("gwlib.gwlib", 0, "%s", octstr_get_cstr(os));
-    octstr_destroy(os);
-}
-
-
-Octstr *version_report_string(const char *boxname)
-{
-    struct utsname u;
-
-    uname(&u);
-    return octstr_format(GW_NAME " %s version `%s'.\nBuild `%s', compiler `%s'.\n"
-    	    	    	 "System %s, release %s, version %s, machine %s.\n"
-			 "Hostname %s, IP %s.\n"
-			 "Libxml version %s.\n"
-#ifdef HAVE_LIBSSL
-             "Using "
-#ifdef HAVE_WTLS_OPENSSL
-             "WTLS library "
-#endif
-             "%s.\n"
-#endif
-#ifdef HAVE_MYSQL
-             "Compiled with MySQL %s, using MySQL %s.\n"
-#endif
-#ifdef HAVE_SDB
-             "Using LibSDB %s.\n"
-#endif
-#if defined(HAVE_SQLITE) || defined(HAVE_SQLITE3)
-             "Using SQLite %s.\n"
-#endif
-#ifdef HAVE_ORACLE
-#if defined(OCI_MAJOR_VERSION) && defined(OCI_MINOR_VERSION)
-             "Using Oracle OCI %d.%d.\n"
-#else
-             "Using Oracle OCI.\n"
-#endif
-#endif
-             "Using %s malloc.\n",
-			 boxname, GW_VERSION,
-#ifdef __GNUC__ 
-             (__DATE__ " " __TIME__) ,
-             __VERSION__,
-#else 
-             "unknown" , "unknown",
-#endif 
-			 u.sysname, u.release, u.version, u.machine,
-			 octstr_get_cstr(get_official_name()),
-			 octstr_get_cstr(get_official_ip()),
-			 LIBXML_DOTTED_VERSION,
-#ifdef HAVE_LIBSSL
-             OPENSSL_VERSION_TEXT,
-#endif
-#ifdef HAVE_MYSQL
-             MYSQL_SERVER_VERSION, mysql_get_client_info(),
-#endif
-#ifdef HAVE_SDB
-             LIBSDB_VERSION,
-#endif
-#if defined(HAVE_SQLITE) || defined(HAVE_SQLITE3)
-             SQLITE_VERSION,
-#endif
-#ifdef HAVE_ORACLE
-#if defined(OCI_MAJOR_VERSION) && defined(OCI_MINOR_VERSION)
-             OCI_MAJOR_VERSION, OCI_MINOR_VERSION,
-#endif
-#endif
-             octstr_get_cstr(gwmem_type()));
-}
-
-
 /***********************************************************************
  * Communication with the bearerbox.
  */
Index: gateway/gw/shared.h
diff -u gateway/gw/shared.h:1.22 gateway/gw/shared.h:1.23
--- gateway/gw/shared.h:1.22	Mon Jan 12 16:46:55 2009
+++ gateway/gw/shared.h	Sun Feb 15 23:13:55 2009
@@ -84,21 +84,6 @@
 
 
 /*
- * Return an octet string with information about Kannel version,
- * operating system, and libxml version. The caller must take care to
- * destroy the string when done.
- */
-Octstr *version_report_string(const char *boxname);
-
-
-/*
- * Output the information returned by version_report_string to the log
- * files.
- */
-void report_versions(const char *boxname);
-
-
-/*
  * Open a connection to the bearerbox.
  */
 Connection *connect_to_bearerbox_real(Octstr *host, int port, int ssl, Octstr *our_host);
Index: gateway/gw/smsc/smsc_at.c
diff -u gateway/gw/smsc/smsc_at.c:1.56 gateway/gw/smsc/smsc_at.c:1.57
--- gateway/gw/smsc/smsc_at.c:1.56	Fri Feb  6 11:35:36 2009
+++ gateway/gw/smsc/smsc_at.c	Sun Feb 15 19:49:26 2009
@@ -1202,8 +1202,37 @@
             speed = B115200;
             break;
 #endif
+#ifdef B230400
+        case 230400:
+            speed = B230400;
+            break;
+#endif
+#ifdef B460800
+        case 460800:
+            speed = B460800;
+            break;
+#endif
+#ifdef B500000
+        case 500000:
+            speed = B500000;
+            break;
+#endif
+#ifdef B576000
+        case 576000:
+            speed = B576000;
+            break;
+#endif
+#ifdef B921600
+        case 921600:
+            speed = B921600;
+            break;
+#endif
         default:
-            speed = B9600;
+#if B9600 == 9600
+	     speed = bps;
+#else
+             speed = B9600;
+#endif
     }
     
     cfsetospeed(&tios, speed);
Index: gateway/gwlib/utils.c
diff -u gateway/gwlib/utils.c:1.55 gateway/gwlib/utils.c:1.56
--- gateway/gwlib/utils.c:1.55	Mon Jan 12 16:46:52 2009
+++ gateway/gwlib/utils.c	Sun Feb 15 23:13:55 2009
@@ -74,12 +74,33 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
+#include <sys/utsname.h>
 #include <fcntl.h>
 #include <pwd.h>
 #include <grp.h>
+#include <libgen.h>
 
 #include "gwlib.h"
 
+/* Headers required for the version dump. */
+#if defined(HAVE_LIBSSL) || defined(HAVE_WTLS_OPENSSL) 
+#include <openssl/opensslv.h>
+#endif
+#ifdef HAVE_MYSQL 
+#include <mysql_version.h>
+#include <mysql.h>
+#endif
+#ifdef HAVE_SQLITE 
+#include <sqlite.h>
+#endif
+#ifdef HAVE_SQLITE3 
+#include <sqlite3.h>
+#endif
+#ifdef HAVE_ORACLE 
+#include <oci.h>
+#endif
+
+
 /* pid of child process when parachute is used */
 static pid_t child_pid = -1;
 /* saved child signal handlers */
@@ -346,6 +367,7 @@
         error(errno, "Could not unlink pid-file `%s'", pid_file);
 }
 
+
 static int change_user(const char *user)
 {
     struct passwd *pass;
@@ -381,7 +403,6 @@
  */
 
 
-
 MultibyteInt get_variable_value(Octet *source, int *len)
 {
     MultibyteInt retval = 0;
@@ -415,6 +436,7 @@
     return loc;
 }
 
+
 Octet reverse_octet(Octet source)
 {
     Octet	dest;
@@ -431,6 +453,81 @@
 }
 
 
+void report_versions(const char *boxname)
+{
+    Octstr *os;
+    
+    os = version_report_string(boxname);
+    debug("gwlib.gwlib", 0, "%s", octstr_get_cstr(os));
+    octstr_destroy(os);
+}
+
+
+Octstr *version_report_string(const char *boxname)
+{
+    struct utsname u;
+
+    uname(&u);
+    return octstr_format(GW_NAME " %s version `%s'.\nBuild `%s', compiler `%s'.\n"
+                         "System %s, release %s, version %s, machine %s.\n"
+             "Hostname %s, IP %s.\n"
+             "Libxml version %s.\n"
+#ifdef HAVE_LIBSSL
+             "Using "
+#ifdef HAVE_WTLS_OPENSSL
+             "WTLS library "
+#endif
+             "%s.\n"
+#endif
+#ifdef HAVE_MYSQL
+             "Compiled with MySQL %s, using MySQL %s.\n"
+#endif
+#ifdef HAVE_SDB
+             "Using LibSDB %s.\n"
+#endif
+#if defined(HAVE_SQLITE) || defined(HAVE_SQLITE3)
+             "Using SQLite %s.\n"
+#endif
+#ifdef HAVE_ORACLE
+#if defined(OCI_MAJOR_VERSION) && defined(OCI_MINOR_VERSION)
+             "Using Oracle OCI %d.%d.\n"
+#else
+             "Using Oracle OCI.\n"
+#endif
+#endif
+             "Using %s malloc.\n",
+             boxname, GW_VERSION,
+#ifdef __GNUC__ 
+             (__DATE__ " " __TIME__) ,
+             __VERSION__,
+#else 
+             "unknown" , "unknown",
+#endif 
+             u.sysname, u.release, u.version, u.machine,
+             octstr_get_cstr(get_official_name()),
+             octstr_get_cstr(get_official_ip()),
+             LIBXML_DOTTED_VERSION,
+#ifdef HAVE_LIBSSL
+             OPENSSL_VERSION_TEXT,
+#endif
+#ifdef HAVE_MYSQL
+             MYSQL_SERVER_VERSION, mysql_get_client_info(),
+#endif
+#ifdef HAVE_SDB
+             LIBSDB_VERSION,
+#endif
+#if defined(HAVE_SQLITE) || defined(HAVE_SQLITE3)
+             SQLITE_VERSION,
+#endif
+#ifdef HAVE_ORACLE
+#if defined(OCI_MAJOR_VERSION) && defined(OCI_MINOR_VERSION)
+             OCI_MAJOR_VERSION, OCI_MINOR_VERSION,
+#endif
+#endif
+             octstr_get_cstr(gwmem_type()));
+}
+
+
 int get_and_set_debugs(int argc, char **argv,
 		       int (*find_own) (int index, int argc, char **argv))
 {
@@ -492,6 +589,11 @@
         } else if (strcmp(argv[i], "-g")==0 || strcmp(argv[i], "--generate")==0) {
             cfg_dump_all();
             exit(0);
+        } else if (strcmp(argv[i], "--version")==0) {
+            Octstr *version = version_report_string(basename(argv[0]));
+            printf("%s", octstr_get_cstr(version));
+            octstr_destroy(version);
+            exit(0);
         } else if (strcmp(argv[i],"--")==0) {
             i++;
             break;
Index: gateway/gwlib/utils.h
diff -u gateway/gwlib/utils.h:1.31 gateway/gwlib/utils.h:1.32
--- gateway/gwlib/utils.h:1.31	Mon Jan 12 16:46:54 2009
+++ gateway/gwlib/utils.h	Sun Feb 15 23:13:55 2009
@@ -199,4 +199,19 @@
 unsigned long long gw_generate_id(void);
 
 
+/*
+ * Return an octet string with information about Kannel version,
+ * operating system, and libxml version. The caller must take care to
+ * destroy the string when done.
+ */
+Octstr *version_report_string(const char *boxname);
+
+
+/*
+ * Output the information returned by version_report_string to the log
+ * files.
+ */
+void report_versions(const char *boxname);
+
+
 #endif
Index: gateway/test/test_octstr_format.c
diff -u gateway/test/test_octstr_format.c:1.13 gateway/test/test_octstr_format.c:1.14
--- gateway/test/test_octstr_format.c:1.13	Wed Feb  4 15:16:37 2009
+++ gateway/test/test_octstr_format.c	Sun Feb 15 19:58:24 2009
@@ -63,7 +63,7 @@
 int main(void) 
 {
     Octstr *os, *os2, *os3, *os4, *os5;
-    unsigned long long n = 78234782386423784267234;
+    unsigned long long n = 18446744073709551615ull;
 
     gwlib_init();
 



More information about the devel-reports mailing list