Re: fluctuating between XXX_UNDEF and '-1' in Kannel code

2005-03-21 Thread Stipe Tolj
Hi Davy
Davy Chan wrote:
**Date: Mon, 28 Feb 2005 19:40:58 +0100
**From: Stipe Tolj [EMAIL PROTECTED]
**To: Davy Chan [EMAIL PROTECTED]
**CC: devel@kannel.org
**In-Reply-To: [EMAIL PROTECTED]
**
**Hi Davi,
**
**any patch for this one now? Looking forward to review and commit ;)
Sorry ... was into it full steam and then hit into the wall called
wapbox.  With most of the other code, -1 = bad.  With wapbox code,
-2 = bad, -1 = might be bad depending on the current state engine.
Am busy now trying to understand the WAP code (gessh...tracing
gateway/gw/wap_push_pap_compiler.c for return codes is really painful...
Oh look! -2 = bad, don't even have a -1 return, but we check for
that return code ... aaaggh!).
Unfortunately, my boss called and reminded me about my other commitments.
So, I don't think I'll be able to post a clean patch until next week
at the earliest.
understand. wapbox code is pretty complex to trace. But we'd also accept 
cleanups for the sms part first. And drop the wap related cleanups afterwards.

Any patch to submit?
Stipe
mailto:stolj_{at}_wapme.de
---
Wapme Systems AG
Vogelsanger Weg 80
40470 Düsseldorf, NRW, Germany
phone: +49.211.74845.0
fax: +49.211.74845.299
mailto:info_{at}_wapme-systems.de
http://www.wapme-systems.de/
---


Re: fluctuating between XXX_UNDEF and '-1' in Kannel code

2005-03-02 Thread Davy Chan
**Date: Mon, 28 Feb 2005 19:40:58 +0100
**From: Stipe Tolj [EMAIL PROTECTED]
**To: Davy Chan [EMAIL PROTECTED]
**CC: devel@kannel.org
**In-Reply-To: [EMAIL PROTECTED]
**
**Hi Davi,
**
**any patch for this one now? Looking forward to review and commit ;)

Sorry ... was into it full steam and then hit into the wall called
wapbox.  With most of the other code, -1 = bad.  With wapbox code,
-2 = bad, -1 = might be bad depending on the current state engine.
Am busy now trying to understand the WAP code (gessh...tracing
gateway/gw/wap_push_pap_compiler.c for return codes is really painful...
Oh look! -2 = bad, don't even have a -1 return, but we check for
that return code ... aaaggh!).

Unfortunately, my boss called and reminded me about my other commitments.

So, I don't think I'll be able to post a clean patch until next week
at the earliest.

See ya...

d.c.



Re: fluctuating between XXX_UNDEF and '-1' in Kannel code

2005-02-28 Thread Stipe Tolj
Hi Davi,
any patch for this one now? Looking forward to review and commit ;)
Stipe
mailto:stolj_{at}_wapme.de
---
Wapme Systems AG
Vogelsanger Weg 80
40470 Düsseldorf, NRW, Germany
phone: +49.211.74845.0
fax: +49.211.74845.299
mailto:info_{at}_wapme-systems.de
http://www.wapme-systems.de/
---


Re: fluctuating between XXX_UNDEF and '-1' in Kannel code

2005-02-20 Thread Davy Chan
**To: devel@kannel.org
**From: Alexander Malysh [EMAIL PROTECTED]
**Subject: Re: fluctuating between XXX_UNDEF and '-1' in Kannel code
**Date: Fri, 18 Feb 2005 15:26:53 +0100
**
**Hi Davy,
**
**Davy Chan wrote:
**
** Statement:
**   We are now using -1 as the definition for an undefined value:
** DLR_UNDEFINED = MSG_PARAM_UNDEFINED = SMS_PARAM_UNDEFINED =
** MC_UNDEF = MWI_UNDEF = DC_UNDEF = COMPRESS_UNDEF = RPI_UNDEF
** = -1
**
**hmm, don't have code to check now but IIRC we have onl MSG_PARAM_UNDEFINED 
**SMS_PARAM_UNDEFINED.
**that was intentional so that MSG_PARAM_UNDEFINED may have another undefined
**value as SMS_PARAM_UNDEFINED.

Actually, in gateway/gw/sms.h, the other UNDEF's are defined there. Of
course, currently, they are defined based on the SMS_PARAM_UNDEFINED which
is based on MSG_PARAM_UNDEFINED.

But, the other UNDEFs are in the header, and I think they should be
used instead of -1 in gateway/gw/smsbox.c:smsbox_req_handle(). As
a matter of fact, my patch will use the defined symbols as
much as possible. Fixed two bugs (rpi cannot be greater than 1 not 2; and
alt_dcs can be greater than 1 [max is 2]) by using the defines instead
of hardcoding the values.

**
** 
** Problem:
**   1) Some of our code still has '-1' hardcoded instead of using the
**  symbolic XXX_UNDEF.
**
**this should be fixed
**
**   2) Some places in the code have a comparison to '-1' to check for
**  an undefined value instead of using the symbolic XXX_UNDEF.
**
**ditto
**
**   3) Some places in the code use a comparison to '-1' to check for
**  an undefined value because we did not specify a symbolic
**  name for an undefined value (usually return values from
**  the gwlib functions).
**
**we should not define all undefined values as you write above. sms messages
**should check against SMS_PARAM_UNDEFINED and global msg values (not sms
**specific) against MSG_PARAM_UNDEFINED.

Sorry.  Not as clear as I should have been.  I mean to use SMS_PARAM_UNDEFINED,
MSG_PARAM_UNDEFINED, DLR_UNDEFINED, MC_UNDEF,  MWI_UNDEF, DC_UNDEF,
COMPRESS_UNDEF, and RPI_UNDEF where appliable.  When a -1 is present
where it is not related to SMS or MSG (e.g. octstr functions and
conn connections), then use IS_UNDEFINED.

Doing it this way allowed me to find another bug in the code in
gateway/gw/wap_push_pap_compiler.c:parse_attribute(). Down in the
code, there's a check to see if set_attribute_value() returns -1 or
not.  Well, set_attribute_value() cannot return -1.  It can only
return [-2,0,1,2,3]. They correspond to the values returned by
parse_requirements(), parse_priority(), and parse_delivery_method().

** 
** Proposed Remedy:
**   1) Add the definition:
**#define IS_UNDEFINED -1
**  into gateway/gwlib/gwlib.h
**   2) Go through the code and change comparisions to '-1' into
**  comparisions to IS_UNDEFINED.
**   3) Go through the code and change assignments to '-1' to
**  assignments to the proper XXX_UNDEF for that variable.
** 
** I voluntee to do this if everyone feels this type of code cleanup
** is desired. (yeah, this is annoying the heck out of me while I'm coding
** my statusbox stuff).

I've got most of it done.  Will try compiling and running it now...

See ya...

d.c.