The SMSD (SMS daemon) program is intended for receiving and sending SMS's.
This code is a part of one project on which I work and I provide it for free
use under GPL. I provide the program AS IS without any warranty.

The program is designed to use modules (plugins) to work with SQL server.
Curently are supported PostgreSQL and MySQL. See option --module. SMSD uses
SQL server as repository for SMS's. You must create a database (default name
is 'sms') with tables defined in sms.tables.{module}.sql files. Table
'inbox' is for received SMS's: 
number     - phone number from which is sms received
smsdate    - date setted by SMS center
insertdate - date of inserting SMS in table
text       - SMS text
processed  - smsd sets this always to FALSE. You can use it for another
             program which will parse SMS's.

When phone receives SMS, SMSD moves it into table 'inbox'. (SMSD removes SMS
from phone.)

Table 'outbox' is for outgoing SMS's. SMSD periodicaly looks into this table
and searches for lines with attribut 'processed' setted to FALSE. If it find
such SMS, it will send SMS to 'number':
number         - recipient's phone number
processed_date - date of processing SMS.
insertdate     - date of inserting SMS in table
text           - SMS text
processed      - new SMS must have this attribut setted to FALSE. 
                 SMSD will send this SMS and will update 'processed' to TRUE.
error          - This attribut contains return value of SendSMS function.
                 For explanation of numeric values see gsm-error.h in gnokii
                 source.                 

SMSD is multi threaded program. After running SMSD you can see 5 threads.
The first thread is thread manager, the second is for lowlevel communication
with phone, the third for high level phone monitoring, the fourth is for
receiving SMS's and last fifth is for SMS's sending.

Options:
-u, --user db_username
	Specify users name.

-p, --password db_password
	Specify users password.

-d, --db db_name
	Specify database name.
 
-c, --host db_hostname
	Specify database server.

-r, --reports
	By default smsd do not receives or sends delivery reports. You can
	change this behaviour with option.
 
-m, --module db_module
	Specify which module to use for connection to DB server.
	Curently supported are pq for PostgreSQL and mysql for MySQL.

-l, --libdir path_to_db_module
	Specify path to DB modules. If you specify pq module, smsd searches
	in libdir for file libpq.so (for mysql - libmysql.so). Do not
	interchange this plugins with default SQL libraries from database
	distribution!

-h, --help
	Shows short help.

SMSD is not compiled by default with gnokii 'make' command. You must compile it
manually by typing 'make' in smsd directory. But before SMSD compilation
you must right configure gnokii (autoconf, configure). You must edit
"DB Modules" section in smsd's Makefile and adapt paths to your system and
compile module for your DB server.

For example:
(in gnokii directory)
autoconf
./configure
cd smsd
vi Makefile (edit paths in "DB Modules" section)
make
make libpq.so OR make libmysql.so
make install

SMSD shares gnokii's runtime configuration file and libgnokii. 

					Jan Derfinak <ja@mail.upjs.sk>
					14 Februar 2002



In some distributions of MySQL you need to link zlib with smsd or db module.
Please add '-lz' to Makefile if smsd cannot load libmysql.so.

					Jan Derfinak <ja@mail.upjs.sk>
					07 Jul 2002
