Re: new sqlbox patch
Alex Kinch <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Rene I've just tried applying the patch against the latest CVS. As I'm using Postgresql for sqlbox, I configured with --enable-pgsql. However, when I try to compile, it complains like hell. See below.. Alex gcc -D_REENTRANT=1 -I. -Igw -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -DBROKEN_PTHREADS=1 -I/usr/include/libxml2 -I/usr/local/ssl/include -I'/usr/include/mysql' -I/usr/include/pgsql -o gw/sqlbox_pgsql.o -c gw/sqlbox_pgsql.c gw/sqlbox_pgsql.c: In function `pgsql_open_conn': gw/sqlbox_pgsql.c:27: `PGconn' undeclared (first use in this function) gw/sqlbox_pgsql.c:27: (Each undeclared identifier is reported only once gw/sqlbox_pgsql.c:27: for each function it appears in.) gw/sqlbox_pgsql.c:27: `conn' undeclared (first use in this function) gw/sqlbox_pgsql.c:27: invalid lvalue in assignment gw/sqlbox_pgsql.c:28: parse error before `*' gw/sqlbox_pgsql.c:32: `cs' undeclared (first use in this function) gw/sqlbox_pgsql.c:35: `conf' undeclared (first use in this function) gw/sqlbox_pgsql.c:38: `tmp' undeclared (first use in this function) gw/sqlbox_pgsql.c:62: `CONNECTION_BAD' undeclared (first use in this function) gw/sqlbox_pgsql.c:78: parse error before `static' gw/sqlbox_pgsql.c:81: `PGresult' undeclared (first use in this function) gw/sqlbox_pgsql.c:81: `res' undeclared (first use in this function) gw/sqlbox_pgsql.c:82: `ExecStatusType' undeclared (first use in this function) gw/sqlbox_pgsql.c:82: parse error before `status' gw/sqlbox_pgsql.c:88: `pc' undeclared (first use in this function) gw/sqlbox_pgsql.c:94: `sql' undeclared (first use in this function) gw/sqlbox_pgsql.c:95: `status' undeclared (first use in this function) gw/sqlbox_pgsql.c:97: `PGRES_BAD_RESPONSE' undeclared (first use in this function) gw/sqlbox_pgsql.c:98: `PGRES_NONFATAL_ERROR' undeclared (first use in this function) gw/sqlbox_pgsql.c:99: `PGRES_FATAL_ERROR' undeclared (first use in this function) gw/sqlbox_pgsql.c:101: break statement not within loop or switch gw/sqlbox_pgsql.c: At top level: gw/sqlbox_pgsql.c:107: parse error before `*' gw/sqlbox_pgsql.c: In function `pgsql_select': gw/sqlbox_pgsql.c:110: `PGresult' undeclared (first use in this function) gw/sqlbox_pgsql.c:110: `res' undeclared (first use in this function) gw/sqlbox_pgsql.c:110: invalid lvalue in assignment gw/sqlbox_pgsql.c:111: parse error before `*' gw/sqlbox_pgsql.c:117: `pc' undeclared (first use in this function) gw/sqlbox_pgsql.c:125: `PGRES_EMPTY_QUERY' undeclared (first use in this function) gw/sqlbox_pgsql.c:126: `PGRES_BAD_RESPONSE' undeclared (first use in this function) gw/sqlbox_pgsql.c:127: `PGRES_NONFATAL_ERROR' undeclared (first use in this function) gw/sqlbox_pgsql.c:128: `PGRES_FATAL_ERROR' undeclared (first use in this function) gw/sqlbox_pgsql.c:129: warning: unreachable code at beginning of switch statement gw/sqlbox_pgsql.c: In function `pgsql_fetch_msg': gw/sqlbox_pgsql.c:169: `PGresult' undeclared (first use in this function) gw/sqlbox_pgsql.c:169: `res' undeclared (first use in this function) gw/sqlbox_pgsql.c:178: `row' undeclared (first use in this function) gw/sqlbox_pgsql.c: At top level: gw/sqlbox_pgsql.c:275: redefinition of `pgsql_fetch_msg' gw/sqlbox_pgsql.c:166: `pgsql_fetch_msg' previously defined here gw/sqlbox_pgsql.c: In function `pgsql_fetch_msg': gw/sqlbox_pgsql.c:287: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:287: warning: passing arg 1 of `octstr_create_real' makes pointer from integer without a cast gw/sqlbox_pgsql.c:290: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:290: warning: passing arg 1 of `octstr_create_real' makes pointer from integer without a cast gw/sqlbox_pgsql.c:291: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:291: warning: passing arg 1 of `octstr_create_real' makes pointer from integer without a cast gw/sqlbox_pgsql.c:292: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:292: warning: passing arg 1 of `octstr_create_real' makes pointer from integer without a cast gw/sqlbox_pgsql.c:293: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:293: warning: passing arg 1 of `octstr_create_real' makes pointer from integer without a cast gw/sqlbox_pgsql.c:294: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:294: warning: passing arg 1 of `atol' makes pointer from integer without a cast gw/sqlbox_pgsql.c:295: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:295: warning: passing arg 1 of `octstr_create_real' makes pointer from integer without a cast gw/sqlbox_pgsql.c:296: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:296: warning: passing arg 1 of `octstr_create_real' makes pointer from integer without a cast gw/sqlbox_pgsql.c:297: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:297: warning: passing arg 1 of `octstr_create_real' makes pointer from integer without a cast gw/sqlbox_pgsql.c:299: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:299: warning: passing arg 1 of `atol' makes pointer from integer without a cast gw/sqlbox_pgsql.c:300: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:300: warning: passing arg 1 of `atol' makes pointer from integer without a cast gw/sqlbox_pgsql.c:301: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:301: warning: passing arg 1 of `atol' makes pointer from integer without a cast gw/sqlbox_pgsql.c:302: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:302: warning: passing arg 1 of `atol' makes pointer from integer without a cast gw/sqlbox_pgsql.c:303: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:303: warning: passing arg 1 of `atol' makes pointer from integer without a cast gw/sqlbox_pgsql.c:304: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:304: warning: passing arg 1 of `atol' makes pointer from integer without a cast gw/sqlbox_pgsql.c:305: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:305: warning: passing arg 1 of `atol' makes pointer from integer without a cast gw/sqlbox_pgsql.c:306: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:306: warning: passing arg 1 of `atol' makes pointer from integer without a cast gw/sqlbox_pgsql.c:307: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:307: warning: passing arg 1 of `octstr_create_real' makes pointer from integer without a cast gw/sqlbox_pgsql.c:308: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:308: warning: passing arg 1 of `atol' makes pointer from integer without a cast gw/sqlbox_pgsql.c:309: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:309: warning: passing arg 1 of `atol' makes pointer from integer without a cast gw/sqlbox_pgsql.c:310: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:310: warning: passing arg 1 of `atol' makes pointer from integer without a cast gw/sqlbox_pgsql.c:311: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:311: warning: passing arg 1 of `octstr_create_real' makes pointer from integer without a cast gw/sqlbox_pgsql.c:312: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:312: warning: passing arg 1 of `octstr_create_real' makes pointer from integer without a cast gw/sqlbox_pgsql.c:313: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:317: warning: comparison between pointer and integer gw/sqlbox_pgsql.c:317: warning: passing arg 1 of `octstr_create_real' makes pointer from integer without a cast gw/sqlbox_pgsql.c: At top level: gw/sqlbox_pgsql.c:334: conflicting types for `sqlbox_init_pgsql' gw/sqlbox_pgsql.h:10: previous declaration of `sqlbox_init_pgsql' gw/sqlbox_pgsql.c: In function `sqlbox_init_pgsql': gw/sqlbox_pgsql.c:394: `PGSQLConf' undeclared (first use in this function) gw/sqlbox_pgsql.c:397: structure has no member named `host' gw/sqlbox_pgsql.c:398: structure has no member named `username' gw/sqlbox_pgsql.c:400: structure has no member named `database' make: *** [gw/sqlbox_pgsql.o] Error 1 Rene Kluwen wrote: >The sqlbox programming has been a little bit behind on the kannel mainline >development. >Business is going well, but unfortunately it means that open source projects >need a little more time to catch up. > >Either way, here is a link to the new patch that patches cleanly against >current HEAD version. >It is made available on the web because (luckily) the list doesnt allow big >emails. >The link: http://www.chimit.nl/kannel/sqlbox_patch-20041012.tar > >Apart from a few compilation warnings, this is the same version as before. >Please email all experiences (good or bad) to the list or directly to me, so >that appropriate action can be undertaken. > >Cheers! > >Rene Kluwen >Chimit > >p.d.: I forget to include the FAQ, so that why it was attached seperately. A >section about how-to-compile has been included. > > >------------------------------------------------------------------------ > >This is the SQLBOX FAQ. >It's function is to help people going, at least before there is a proper documentation patch. > >Q. >How do I compile sqlbox support into Kannel? > >A. >untar sqlbox_patch.tar in the main Kannel source folder (the one where configure, Makefile, etc. reside). >Then type: 'patch -p0 < sqlbox.patch' (without the single quotes) >Then (as usual): make distclean; ./configure --your-options; make > > >Q. >Is there any documentation that could help in setting it up and gain a better understanding of it? > >A. >When runnig for the first time, sqlbox creates automatically 2 tables, called send_sms and sent_sms (configurable). > >In the first table, you can insert SMS messages that will be sent out (MT). In the second table, all SMS traffic from and to > >smsbox is logged. > >In kannel.conf, the following options are added: > > > >The patch includes Postgres, MySQL and MS-SQL support (also for DLR's) for anybody that feels the need to use it. >MS-SQL client libraries are either sybase or free-tds (./configure autodetects). > > > >Here follows some documentation that in fact (I admit) should be included in the patch against the doc tree: >There is one extra configure option in group = smsbox, which is: > ># bearerbox-is-sqlbox indicates if the smsbox is connected to the bearerbox or an sql box >bearerbox-is-sqlbox = true/false > >For the rest, the group = sqlbox contains the following options: > >group = sqlbox ># id corresponds to id in group = mysql-connection. ># this is analogous to id in group = dlr-db >id = dlr-db2 ># smsbox-id indicates the box where SQL-injected messages appear to be coming fr >om >smsbox-id = sqlbox2 ># bearerbox host to connect to >bearerbox-host = "127.0.0.1" ># smsbox port to be listening on >smsbox-port = 13005 >smsbox-port-ssl = false ># sql-log-table is the table used to log all sent messages >sql-log-table = sent_sms ># sql-insert-table is the table that is monitored for new messages to send >sql-insert-table = send_sms ># global sender: If no sender is specified in sql-insert-table then this ># value is used. >global-sender = 06121 ># log-file = "" ># log-level = 10 ># ssl-client-certkey-file = "" ># ssl-server-cert-file = "" ># ssl-server-key-file = "" ># ssl-trusted-ca-file = "" > >Q. >Does sqlbox replace sms box or is It an additional module that must be run? > >A. >sqlbox is an additional module. You now have to start kannel in the following manner: > >1st: bearerbox <conf-file> >2nd: sqlbox <conf-file> >3rd: smsbox <conf-file> and wapbox <conf-file> > >A picture of the new situation (with sqlbox included is as follows): > >http request <--> [ smsbox ] <--> [ sqlbox ] <--> [ bearerbox ] <--> sms gateway > >I hope this picture make things clear. In text: sqlbox is sitting in between smsbox and bearerbox, passing all messages back and forth between the two. As a side-effect, also the messages that are passed back and forth are logged in the sent_sms table. > >Q. >Can you use http requests or posting messages to the send_sms table to send messages? > >A. >You can use both http requests to the smsbox, as usual (nothing changes here), as well as insert messages in send_sms. SQL Box checks the records in send_sms every so many seconds and posts them to the bearerbox to be delivered to the SMSC. After that, the entry in send_sms is deleted. > >Q. (Configuration options part #1) >bearerbox-is-sqlbox = true/false >If this value is set to true would you not have to run the sqlbox as the bearerbox should function as the sqlbox? > >A. >It is as follows: if this value is set to true then smsbox connects to sqlbox, rather than the bearerbox. >(see the previous picture) > >Q. (Configuration options part #2) >smsbox-id = sqlbox2 -> Can this be any unique string? > >A. >Yes, exactly. > >Q. (Configuration options part #3) ># smsbox port to be listening on >smsbox-port = 13005 -> must this value be the same as the send-sms-port value in the smsbox? > >A. >Nopes. This smsbox-port is the port that the bearerbox or sqlbox listen on to connections from smsbox. >send-sms-port is a different port. It is the port that smsbox listens on to http requests to receive messages. > >