Re: [PATCH] WSP headers with end-of-string value

2005-02-02 Thread Vjacheslav Chekushin
Hi, Stipe.
I've tested it with Nokia 3660 (which uses exactly this Accept header in
Connect PDU and doesn't work without patch). Everything is ok.
Stipe Tolj wrote:
Aarno Syvänen wrote:
Have you tested the modification ? What will be result of parsing 0x80 
0x00 ? Accept:empty string
is ok according the rfc 2616. (Because this is a low level parsing 
function, you definitely want to test.)

Aarno, did you have chances to test this with various phones?
Stipe
mailto:stolj_{at}_wapme.de
---
Wapme Systems AG



--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [PATCH] WSP headers with end-of-string value

2005-01-27 Thread Vjacheslav Chekushin
Hi, all.
+1 from me
Just one comment.
This patch will be good as far as no any header with special treatment
for No-value.
We unpack fields in wsp_unpack_well_known_field().
I checked that in current specs no any header with special hanling for
No-value. But if it will be added, than this patch is
Stipe Tolj wrote:
 Ok,

 regarding the Siemens SX1 kludge and the WSP headers with
 end-of-string as only value byte, I'd like to get at least a vote for
 commiting this patch from the following developers:

   Aarno, Paul, Slava

 please.

 You guys haven't stated yet nothing regarding a vote. Please do so. I'd
 like to keep it that way in order to have a negotiated consensus.

 Stipe

 mailto:stolj_{at}_wapme.de
 ---
 Wapme Systems AG


 Index: wap/wsp_headers.c
 ===
 RCS file: /home/cvs/gateway/wap/wsp_headers.c,v
 retrieving revision 1.19
 diff -u -r1.19 wsp_headers.c
 --- wap/wsp_headers.c  8 Aug 2004 20:39:56 -   1.19
 +++ wap/wsp_headers.c  21 Jan 2005 01:11:50 -
 @@ -110,7 +110,7 @@
  unsigned long len;

  val = parse_get_char(context);
 -if (val = 0  val  31) {
 +if (val  0  val  31) {
  *well_known_value = -1;
  parse_limit(context, val);
  return WSP_FIELD_VALUE_DATA;
 @@ -126,7 +126,7 @@
  *well_known_value = -1;
  /* We already consumed the Quote */
  return WSP_FIELD_VALUE_NUL_STRING;
 -} else {
 +} else {/* implicite val == 0 */
  *well_known_value = -1;
  /* Un-parse the character we just read */
  parse_skip(context, -1);
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [PATCH] http client/server timeout

2005-01-27 Thread Vjacheslav Chekushin
Hi,
Great work!
Definitly +1 for this approach.
Draft tests seems to works.
Alexander Malysh wrote:
Hello together,
please find attached patch that implements http server  client idle
timeout. In order to efficient handle timeouts and don't start yet another
thread we use already available fdset's threads. With this patch applied
we will have a possibility to set timeout for all filedescriptors in fdset
and after timeout elapsed registered callback function with POLLERR as
event will be called. I'm surprised with sooo little code change reach full
working server/client timeout handling :)
Maybe we want implement (yet missing) things too:
- dont wait for set-timeout instead find the min timeout (this part is not
implemented yet because will cause parformance bust due to a need to rescan
the whole fdset after all callbacks were executed and anyway for boxes with
high traffic earlier timeout check will catch).
- timeout for each fd (IMHO: it's oversized for our needs)
Comments  votes please!


--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [PATCH] Siemens SX1 kludge

2005-01-21 Thread Vjacheslav Chekushin

Stipe Tolj wrote:
Vjacheslav Chekushin wrote:
Just remark.
SX1 behavior _NOT_ conforms to wap specification, because besides general
encoding there is well-known encoding for Accept header:
8.4.2.7 Accept field
The following rules are used to encode accept values.
Accept-value = Constrained-media | Accept-general-form
Accept-general-form = Value-length Media-range [Accept-parameters]
Media-range = (Well-known-media | Extension-Media) *(Parameter)
Accept-parameters = Q-token Q-value *(Accept-extension)
Accept-extension = Parameter
Constrained-media = Constrained-encoding
Well-known-media = Integer-value
; Both are encoded using values from Content Type Assignments table in 
Assigned Numbers
Q-token = Octet 128 )

And we have: Accept-general-form = Value-length Media-range 
[Accept-parameters]

So value-length is 0 and Media-range (mandatory) is absent.
So Accept header must be either as string Accept: ... or 80 ...
and in the last case it _MUST_ be encoded as Accept-value.

ok, agreeing for the 'Accept-value = Constrained-media | 
_Accept-general-form_' value. _BUT_ what about _Constrained-media_?

If comes up to Extension-media where the reference BNF is used. IMO the 
Accept encoded byte 0x80 followed by a 0*TEXT (hence nothing), followed 
by a end-of-string 0x00 is allowed then.

Comments on this please.
My comments:
Constrained-media = Constrained-encoding
Constrained-encoding = Token-Text | Short-Integer
Token-Text = Token End-of-string
Token = 1*any CHAR except CTLs or tspecials (from RFC 2068)
So, we _need_ at least 1 non End-of-string simbols ;)
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/
---

--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [PATCH] Siemens SX1 kludge

2005-01-21 Thread Vjacheslav Chekushin
You are rigth, I give up.
I have printed basic rules from one of the first final WSP spec (1998).
As I see it was changed. Heh, I'll need to refresh some printed hand-on
materials :(.
Aarno Syvänen wrote:
Slave, what spec are you reading ?
 From WAP-203-WSP-2504, clause 8.4.2.1:
Constrained-encoding = Extension-Media | Short-integer
; This encoding is used for token values, which have no well-known 
binary encoding, or when
; the assigned number of the well-known encoding is small enough to fit 
into Short-integer.

Extension-media = *TEXT End-of-string
; This encoding is used for media values, which have no well-known 
binary encoding

Aarno
On 21.1.2005, at 10:11, Vjacheslav Chekushin wrote:

Stipe Tolj wrote:
Vjacheslav Chekushin wrote:
Just remark.
SX1 behavior _NOT_ conforms to wap specification, because
besides general
encoding there is well-known encoding for Accept header:
8.4.2.7 Accept field
The following rules are used to encode accept values.
Accept-value = Constrained-media | Accept-general-form
Accept-general-form = Value-length Media-range
[Accept-parameters]
Media-range = (Well-known-media | Extension-Media) *(Parameter)
Accept-parameters = Q-token Q-value *(Accept-extension)
Accept-extension = Parameter
Constrained-media = Constrained-encoding
Well-known-media = Integer-value
; Both are encoded using values from Content Type
Assignments table in Assigned Numbers
Q-token = Octet 128 )
And we have: Accept-general-form = Value-length Media-range
[Accept-parameters]
So value-length is 0 and Media-range (mandatory) is absent.
So Accept header must be either as string Accept: ... or
80 ...
and in the last case it _MUST_ be encoded as Accept-value.
ok, agreeing for the 'Accept-value = Constrained-media |
_Accept-general-form_' value. _BUT_ what about _Constrained-media_?
If comes up to Extension-media where the reference BNF is used.
IMO the Accept encoded byte 0x80 followed by a 0*TEXT (hence
nothing), followed by a end-of-string 0x00 is allowed then.
Comments on this please.
My comments:
Constrained-media = Constrained-encoding
Constrained-encoding = Token-Text | Short-Integer
Token-Text = Token End-of-string
Token = 1*any CHAR except CTLs or tspecials (from RFC 2068)
So, we _need_ at least 1 non End-of-string simbols ;)

Vjacheslav Chekushin mailto:[EMAIL PROTECTED]
Latvian Mobile Phone Company http://www.lmt.lv



--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [PATCH] http client timeouts part1 (v2)

2004-11-05 Thread Vjacheslav Chekushin
Hi, Alexander.
Patch looks good. I try to test it next week, but
conceptually I am +1.
(by the way, in conn_pool_get ifdef not needed IMHO).
Alexander Malysh wrote:
second version of this patch (fixed double free bug).
Alexander Malysh wrote:

Hi,
attached you can find path that fixes a problem with dead connections in
http client connection pool. It's only a first part of fixes that we need
(we still need to kill inactive connection after timeout expired).
How it works is simple:
1) before putting connection into connection pool register dummy callback
2) if dummy callback called (we will receive error poll event) check if
connection still ok and if not destroy it
3) before return connection from pool, unregister dummy callback
Comments/votes please!


--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: closing WSP sessions

2004-11-01 Thread Vjacheslav Chekushin
Hi, Yury.
There is a problem in http.c with socket pool. Cached connection
to http resources never cleaned from this pool, even if it closed by other
side. So if you do not use proxy for your requests you will reach the limit of
open descriptor soon (depend on load).
I have patch againtst 1.3.2 which clean these connections. It doensn't accepted
by kannel because it creates one extra thread to clean descriptors.
But I use it in my kannel branch.
So either setup own proxy, either try my patch,
either do something else (restart kannel every hour ;))
Yury Mikhienko wrote:
Hi developers!
I was start kannel wapbox on Solaris 2.9 system.
But after some time I got error on opening new socket to bearerbox (Too many open 
files error)
lsof command show me 277 open descriptors on wapbox process, but 90% at all in 
CLOSE_WAIT station
Can I set timeout on unused WSP session and close the connect to bearerbox?
Or may be closing sessions (scavenging) must be automatically?
I can set up system parameters rlim_fd_max and rlim_fd_cur, but I do not sure of that 
method (system overflow may be caused)
Thanx for your answers.

--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
--- ../gateway_base/gwlib/http.cTue Mar  2 11:16:35 2004
+++ gwlib/http.cTue Mar  2 13:56:59 2004
@@ -709,7 +709,7 @@
  */
 static Dict *conn_pool = NULL;
 static Mutex *conn_pool_lock = NULL;
-
+static long pool_control_thread_id = -1;
 
 static void conn_pool_item_destroy(void *item)
 {
@@ -726,17 +726,52 @@
 conn_pool_lock = mutex_create();
 }
 
-
-static void conn_pool_shutdown(void)
+static Octstr *conn_pool_key(Octstr *host, int port)
 {
-dict_destroy(conn_pool);
-mutex_destroy(conn_pool_lock);
+return octstr_format(%S:%d, host, port);
 }
 
+#define KEEPALIVE_TIMEOUT 600
 
-static Octstr *conn_pool_key(Octstr *host, int port)
-{
-return octstr_format(%S:%d, host, port);
+static void conn_pool_clean(void) {
+List *all_keys, *list;
+Octstr *key;
+Connection *conn;
+int i;
+
+mutex_lock(conn_pool_lock);
+  
+all_keys = dict_keys(conn_pool);
+while ((key = list_extract_first(all_keys)) != NULL) {
+list = dict_get(conn_pool,key);
+i = 0;
+while (i  list_len(list)) {
+conn = list_get(list, i);
+
+/* Check whether the server has closed the connection while
+ * it has been in the pool. */
+conn_wait(conn, 0);
+if (conn_eof(conn) || conn_error(conn)) {
+   debug(gwlib.http, 0, Delete connection with fd 
%d.,conn_get_id(conn));
+conn_destroy(conn);
+list_delete(list, i, 1);
+} else {
+   if (conn_is_expired(conn,KEEPALIVE_TIMEOUT) == 0) {
+ debug(gwlib.http, 0, Delete connection with fd %d. (timeout),
+   conn_get_id(conn));
+ conn_destroy(conn);
+ list_delete(list, i, 1);
+   } else {
+debug(gwlib.http, 0, Fd %d is alive.,conn_get_id(conn));
+i++;
+   }
+}
+}
+octstr_destroy(key);
+}
+
+list_destroy(all_keys, NULL);
+mutex_unlock(conn_pool_lock);
 }
 
 
@@ -804,6 +839,22 @@
 }
 #endif
 
+static void pool_control_thread(void *arg) {
+  while (run_status == running) {
+gwthread_sleep(60);
+conn_pool_clean();
+  }
+  pool_control_thread_id = -1;
+}
+
+static void conn_pool_shutdown(void)
+{
+if (pool_control_thread_id = 0) 
+gwthread_wakeup(pool_control_thread_id);
+gwthread_join_every(pool_control_thread);
+dict_destroy(conn_pool);
+mutex_destroy(conn_pool_lock);
+}
 
 /*
  * Internal lists of completely unhandled requests and requests for which
@@ -1049,6 +1100,7 @@
 
 #ifdef USE_KEEPALIVE 
 if (trans-persistent) {
+conn_update_usage(trans-conn);
 if (proxy_used_for_host(trans-host))
 conn_pool_put(trans-conn, proxy_hostname, proxy_port);
 else
@@ -1601,6 +1653,7 @@
if (!client_threads_are_running) {
client_fdset = fdset_create();
gwthread_create(write_request_thread, NULL);
+   pool_control_thread_id = gwthread_create(pool_control_thread, NULL);
client_threads_are_running = 1;
}
mutex_unlock(client_thread_lock);
--- ../gateway_base/gwlib/conn.cTue Mar  2 11:16:35 2004
+++ gwlib/conn.cTue Mar  2 13:58:46 2004
@@ -119,6 +119,9 @@
 /* socket state */
 enum {yes,no} connected;
 
+/* time of last usage */
+unsigned long last_ts;
+
 /* Protected by outlock */
 Octstr *outbuf;
 long outbufpos;   /* start of unwritten data in outbuf */
@@ -495,6 +498,17 @@
   return -1;
 }
 
+void conn_update_usage(Connection *conn) {
+  conn-last_ts = time(NULL);
+}
+ 
+int conn_is_expired(Connection *conn, unsigned long

Re: [Q] OMA browser settings

2004-09-09 Thread Vjacheslav Chekushin
Hi, again.
Paul P Komkoff Jr wrote:
I'll test siemens now, thanks for your help. I was trying to send
something to SonyEricsson T100 for about 3 hours, with no luck.
( I am able to receive settings from www.sonyericsson.com but I have
no equipment to decode it )
It is very hard to retrieve any useful information, for example, what
kind of OTA spec those T100 supports... 

I am trying with auth and without. No sucess with OMA at all.
(4hours of dancing around computer)
It seems that me or my smsc is just badly injured. I didn't managed to
make ANYTHING oma-compliant work. I even tried trial version of nowsms
gateway to send OMA settings to anything I have here. Phones just
silently discarding what I send them.
And of course no siemens. C55 I have won't recognize OMA (as all
others), it reacts on //PP Ap;... though, but behaves weirdly (and
there's no publicly available specs on that control character). I
tried to send myself some settings from siemens-mobile.com and wonder
what I see? Siemens ST55 is using Nokia OTA format!!
IMHO siemens starts to support OMA provisioning from series 65.
For 55 they use own proprietary format (available under NDA).
Ericsson supports OMA at least for P800/900. I have doubts about T100.

I'm pissed off. Ruined. Don't know what to do now. Maybe I'll give you
all my stuff and you'll be so kind so will run it against your smsc
and maybe even my phones?
;|

--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [Q] OMA browser settings

2004-09-08 Thread Vjacheslav Chekushin
Hi, Paul.
I send OMA bootstrap configuration aside from kannel.
I didn't test samsung, but I have different OMA for nokia, siemens and motorola.
First of all, do you use authentication (pin or imsi)?
As I remember it is mandatory for some manufacters.
Second, try to generate wbxml without string table. Some model doesn't handle
it.
Here is working example for siemens OMA WAP configuration.
?xml version=1.0?
!DOCTYPE wap-provisioningdoc PUBLIC -//WAPFORUM//DTD PROV 1.0//EN 
http://www.wapforum.org/DTD/prov.dtd;
wap-provisioningdoc
 characteristic type=NAPDEF
  parm name=NAPID value=x
  /parm
  parm name=NAME value=x
  /parm
  parm name=BEARER value=GSM-GPRS
  /parm
  parm name=NAP-ADDRESS value=internet
  /parm
  parm name=NAP-ADDRTYPE value=APN
  /parm
  characteristic type=NAPAUTHINFO
   parm name=AUTHTYPE value=PAP
   /parm
   parm name=AUTHNAME value=
   /parm
   parm name=AUTHSECRET value=
   /parm
  /characteristic
 /characteristic
 characteristic type=PXLOGICAL
  parm name=PROXY-ID value=xxx.xxx.xxx.xxx
  /parm
  parm name=NAME value=x
  /parm
  parm name=STARTPAGE value=http://www.lmt.lv/wap/;
  /parm
  characteristic type=PXPHYSICAL
   parm name=PXADDR value=xxx.xxx.xxx.xxx
   /parm
   parm name=PXADDRTYPE value=IPV4
   /parm
   parm name=TO-NAPID value=x
   /parm
   characteristic type=PORT
parm name=PORTNBR value=9201
/parm
parm name=SERVICE value=CO-WSP
/parm
   /characteristic
  /characteristic
 /characteristic
 characteristic type=APPLICATION
  parm name=APPID value=w2
  /parm
  parm name=NAME value=x
  /parm
  parm name=TO-PROXY value=xxx.xxx.xxx.xxx
  /parm
  characteristic type=RESOURCE
   parm name=URI value=http://www.lmt.lv/wap/;
   /parm
   parm name=NAME value=x
   /parm
   parm name=STARTPAGE value=http://www.lmt.lv/wap/;
   /parm
  /characteristic
 /characteristic
/wap-provisioningdoc

P.S. Siemens software version 9 supports only USERPIN auth and wapmms
must be configurated separatly.
Paul P Komkoff Jr wrote:
Hello developers!
Have you (anyone :)) made any progress in sending browser settings to
OMA-compliant devices?
I was trying to do so here by 2 hours. Maybe I've picked wrong phone.
I just ensured that all works with nokia phone and nokia OTA, then
replaced all from WSP (including WSP header) to wbxml.
No luck.
I see three possible problems:
1. I am compiling wrong xml, or miscompiling right xml. I am using
libwbxml (http://libwbxml.aymerick.com) to compile. Nokia OTA settings
xml compiles by it just fine.
2. I am including wrong WSP header. I am trying to pass in
minimalistic WSP header, e.g. '\x01\x06\x01\xb6'. second 01 here means
length, and b6 means well-known type for
application/vnd.wap.connectivity-wbxml.
3. I am picked a wrong phone to use in my experiments. I was using
some flipflop samsung, borrowed from my colleague (because it was too
late and thus I had no access to Secret Stash(tm))
Comments?
Maybe anyone have WORKING code, working xml, working headers, etc?

--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



MMS indication on siemens cx65

2004-08-25 Thread Vjacheslav Chekushin
Hi, list
Did someone successfully send mms indication to Siemens CX65?
I mean with 1.3.2 version. Because I can send only if change
default encoding version for push messages from 1.3 to 1.2 in wsp_unit.c.
Is there the way to make this to work without changing the sources?
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



[PATCH] datatype inconsistency in wsp_strings.c

2004-08-24 Thread Vjacheslav Chekushin
Hi, list.
This patch fix quite obviouse data type inconsistency.
This make sence in 64 bit environment where sizeof(int) != sizeof(long)
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
--- ../gateway-1.3.2_base/wap/wsp_strings.c Thu Jan 22 16:08:25 2004
+++ wap/wsp_strings.c   Mon Aug 16 14:52:38 2004
@@ -203,7 +203,7 @@
 static long string_to_versioned_number(Octstr *ostr, struct table *table, 
int version)
 {
-unsigned int i, ret;
+long i, ret;
 
 gw_assert(initialized);
 


[PATCH] wml compiler panics on some wml files

2004-08-24 Thread Vjacheslav Chekushin
Hi, list.
wml_compiler PANIC on wml files with some DOCTYPE definition.
(PANIC: gwlib/octstr.c:242: octstr_create_real: Assertion `cstr != NULL' failed.)
One example is below. You can check with wml file
with wml_tester. Attached patch fixes this problem.
?xml version='1.0'?
!DOCTYPE chapter SYSTEM /just/a/test.dtd [
!ENTITY plainEntity FOO entity]
wml
   card id=main name=Test
 img src=/img/logo.wbmp alt=image/
p
 a href=1.php1/abr/
 a href=2.php2/abr/
 a href=3.php3/abr/
 a href=4.php4/abr/
   /p
   /card
/wml
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
--- ../gateway-1.3.2_base/gw/wml_compiler.c Wed Apr 21 13:45:35 2004
+++ gw/wml_compiler.c   Mon Aug  9 14:51:54 2004
@@ -597,7 +597,7 @@
 }
 
 /* Return WML Version dependent on xml ExternalID string */
-if (document-intSubset != NULL)
+if ((document-intSubset != NULL)  (document-intSubset-ExternalID != NULL))
 externalID = octstr_create(document-intSubset-ExternalID);
 if (externalID == NULL) {
 (*wbxml)-wml_public_id = 0x04; /* WML 1.1 Public ID */



[PATCH] Memory leak in wap-appl.c

2004-08-24 Thread Vjacheslav Chekushin
Hi, list.
There is obvious memory leak in wap-appl.c
ret = wml_compile(content-body, content-charset, wmlc,
  content-version);
If you will check wml_compile function from wml_compiler.c, than you'll see that
it allocates wmlc at the start and doesn't deallocate it even if
we have compilation error.
So in case of compilation error we must free it in wap-appl.c
Provided patch fixes this problem.
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
--- ../gateway_base/gw/wap-appl.c   Thu Oct  9 15:04:18 2003
+++ gw/wap-appl.c   Thu Oct 23 16:58:37 2003
@@ -1230,6 +1230,7 @@
 if (ret == 0)
 return wmlc;
 
+octstr_destroy(wmlc);
 warning(0, WSP: WML compilation failed.);
 return NULL;
 }


Question about Set-Cookie encoding

2004-03-15 Thread Vjacheslav Chekushin
Hi, list.

I've encode Set-Cookie header as specified in WSP (encoding-version 1.3):

c1 - Set-Cookie header
0e - value-length
9f - version (1)
74 t
65 e
73 s
74 t
00
73 s
73 s
73 s
73 s
73 s
73 s
73 s
00
(From WSP:
Set-Cookie-value = Value-length Cookie-version Cookie-name Cookie-val *Parameter
Cookie-version = Version-value
Cookie-name = Text-string
Cookie-val = Text-string)
But seems phone does not accept it. (At least it does not send Cookie header
back to server)
I can't find out where I am wrong.

Test phone is SonyEricsson t68i and it accepts encoding version 1.3

--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
VAS Technologies Division



Re: Question about Set-Cookie encoding

2004-03-15 Thread Vjacheslav Chekushin
Hi, Stipe.
No, I didn't ask.
But if phone states in connect PDU that it supports version-encoding 1.3,
then, I think, it must support this version.
And Set-Cookie header is in the 1.3 header subset.
I'll try to get some other phones that works with 1.3.
Stipe Tolj wrote:

did you ask the Ericsson developer's zone (where some of the staff is
answering) if the phone is able to do the operation?
AFAIK, even while phones indicate specific encoding versions, that
*does not* mean they have all the sets implemented. Is the set-cookie
feature in encoding version 1.3 optional or mandatory according to the
WSP specs and unit conformance documents?!
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
VAS Technologies Division



Re: Question about Set-Cookie encoding

2004-03-15 Thread Vjacheslav Chekushin
Hi, Stipe.
Thank for advice, I got SE P900 (it supports even 1.4)
And it processed encoded cookie successfully.
So I hope that my packing code is ok.
Stipe Tolj wrote:
Vjacheslav Chekushin schrieb:

Hi, Stipe.
No, I didn't ask.
But if phone states in connect PDU that it supports version-encoding 1.3,
then, I think, it must support this version.
And Set-Cookie header is in the 1.3 header subset.
I'll try to get some other phones that works with 1.3.


I could offer a request with an SE P800 on your Kannel instance to
check?!
Stipe


--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
VAS Technologies Division



Re: Question about Set-Cookie encoding

2004-03-15 Thread Vjacheslav Chekushin
Hi.
It is funny how my SE P900 encode version-value in Cookie header:
Version 0 it encodes as octet 80 (instead of 30 00)
Version 1 it encodes as octet 81 (instead of 9F)
Vjacheslav Chekushin wrote:
Hi, Stipe.
Thank for advice, I got SE P900 (it supports even 1.4)
And it processed encoded cookie successfully.
So I hope that my packing code is ok.
Stipe Tolj wrote:

Vjacheslav Chekushin schrieb:

Hi, Stipe.
No, I didn't ask.
But if phone states in connect PDU that it supports version-encoding 
1.3,
then, I think, it must support this version.
And Set-Cookie header is in the 1.3 header subset.
I'll try to get some other phones that works with 1.3.


I could offer a request with an SE P800 on your Kannel instance to
check?!
Stipe





--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
VAS Technologies Division



Re: Encoding-Version support

2004-03-12 Thread Vjacheslav Chekushin
Hi, Stipe.

Stipe Tolj wrote:
Vjacheslav Chekushin schrieb:

Hi, Stipe.
Cookies wsp packing/unpacking is the secondary problem.
The primary problem for me now is Encoding-Version support.
In wsp_headers.c Version-Encodning handled in some places, but not handled in
another impotent places. This is for example parameter packing, accept packing
and others. There is used hardcoded WSP_1_2 instead of real one.


ok, AFAIR, the state machine has the encoding version handled and we
pass this to wsp_headers_pack() as argument and that one uses
wsp_string_to_versioned_header() to select the right binary
representation for the header, right?!
I see that the problem is that the information about the
encoding-version is not available at places where it is needed to pass
the argument, since the state machine isn't present there. This is the
main problem about it, IMO.
Checking on how to elaborate this.


So Version-Encoding support is started but not completed. Is it planed to be
completed? Which way? Can I help?


Yes, please verify in how the state machine attached
encoding-version information can be passed/used within the calling
places where the specific encoding-version has to be passed into the
packing/unpacking routines.
First approach.
The easy way is to add parameter wsp_version for every pack funcions.
So in struct wsp_headers.h we need to change
typedef int header_pack_func_t(Octstr *packed, Octstr *value);
to
typedef int header_pack_func_t(Octstr *packed, Octstr *value, int wsp_version);
And after that add this parameter to all packing functions.

Question: what to do with packing functions that doesn't need version
information at all (like wsp_pack_text())?
And for public packing functions (like the same wsp_pack_text) all calls for
these functions from other modules must be modified as well.
Second approach.
If we want to keep public functions untouched, we can do it, adding
to headerinfo structure additonal function like:
typedef int header_versioned_pack_func_t(Octstr *packed, Octstr *value, int 
wsp_version);

And than, if it is defined, call this function with wsp_version, else call
header_pack_func_t
What do you think?

--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
VAS Technologies Division



Re: Encoding-Version support

2004-03-11 Thread Vjacheslav Chekushin
Hi, Stipe.
Cookies wsp packing/unpacking is the secondary problem.
The primary problem for me now is Encoding-Version support.
In wsp_headers.c Version-Encodning handled in some places, but not handled in
another impotent places. This is for example parameter packing, accept packing
and others. There is used hardcoded WSP_1_2 instead of real one.
So Version-Encoding support is started but not completed. Is it planed to be
completed? Which way? Can I help?
Stipe Tolj wrote:
Vjacheslav Chekushin wrote:

I want to ask about Encoding-Version support.
Looking in sources, I found that some steps are done, but now it is
not developing.
What about these comments in wsp_headers.c :
/* XXX this should obey what kind of WSP Encoding-Version the client is using */
I'm planning to make cookie wsp packing/unpacking and I need this
Encoding-Version handling at least for parameter encoding
(Max-Age, Domain, Path supported only for 1.3 version).
Stipe Tolj, as ChangeLog states, you are the person who started this handling.
Can you comment how did you plan to develop it?


didn't get the point right I guess. You want to WSP unpack/pach the
WSP cookie information into the value segments?! Is that right?



--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
VAS Technologies Division



Encoding-Version support

2004-03-05 Thread Vjacheslav Chekushin
Hi, List.

I want to ask about Encoding-Version support.
Looking in sources, I found that some steps are done, but now it is
not developing.
What about these comments in wsp_headers.c :
/* XXX this should obey what kind of WSP Encoding-Version the client is using */
I'm planning to make cookie wsp packing/unpacking and I need this
Encoding-Version handling at least for parameter encoding
(Max-Age, Domain, Path supported only for 1.3 version).
Stipe Tolj, as ChangeLog states, you are the person who started this handling.
Can you comment how did you plan to develop it?
BTW, there is bug in existing implementation:

--- ../gateway_base/wap/wsp_server_method_states.defTue Mar  2 11:16:36 2004
+++ wap/wsp_server_method_states.defFri Mar  5 14:27:54 2004
@@ -305,7 +305,7 @@
new_pdu-u.Reply.status =
wsp_convert_http_status_to_wsp_status(e-status);
new_pdu-u.Reply.headers =
-   wsp_headers_pack(e-response_headers, 1, WSP_1_2);
+   wsp_headers_pack(e-response_headers, 1, 
sm-encoding_version);
new_pdu-u.Reply.data = octstr_duplicate(e-response_body);

/* Send TR-Result.req to WTP */

--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
VAS Technologies Division



Re: SMPP SUBMIT_SM optional Parameters - how to set?

2004-02-25 Thread Vjacheslav Chekushin


Stipe Tolj wrote:
Andreas Rektenwald schrieb:

I have played around with kannel for a while and have initiated a SMPP
connection to my provider. Works great!
My Provider needs the optional parameter its_session_info set for MT SMS (MO
SMS works fine).
I've tried to understand the preproc stuff
(Is there any documentation about that?), I think I know that I have to
hardcode that in function
msg_to_pdu (for test purposes), but how?


there is no exclusive documentation on the preproc magic, unfortunatly
;(. It's a bit tricky to understand, even while very powerfull in its
backend usage.
Ok, this preprocessor magic pretty well described.
See http://liw.iki.fi/liw/texts/cpp-trick.html
Simply think of real macro'ing of the things defined in the .def files
and how they are #define'ed within the sources. Sorry, it's hard to
explain in two sentences.
Kannel does currently not use optional (v3.4) parameters. They are
very specific to SMPP and as be try to abstract the frontend (smsbox
for MT direction) to all supported protocolls, there is no way to
inject data to specific optional parameters of the SMPP module.
If the data you have to store in the optional field is static, you can
hardcode it within the smpp packing (msg_to_pdu) function. Even while
I'm not sure if the encoding for the optional parameters is yet done?!
Stipe

mailto:[EMAIL PROTECTED]
---
Wapme Systems AG
Münsterstr. 248
40470 Düsseldorf, NRW, Germany
phone: +49.211.74845.0
fax: +49.211.74845.299
mailto:[EMAIL PROTECTED]
http://www.wapme-systems.de/
---
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: Bug in wsp_server_method_states.def

2004-02-19 Thread Vjacheslav Chekushin
Hi, all

It is funny, but problem was discussed already in list:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg02191.html
And we got +1 from Stipe already for fixing this!

Paul Keogh wrote:
hmm, did you use a specific handset for this where it corrupts?!



I don't believe it is handset specific.


This thing works for me with various devices and does not 
corrupt MMS messages. 
Can you explain a bit more in details, please?!


Sure. The MM1 M-Send.req is carried by a WSP POST request which is
issued by the device. The MMS message is WBXML encoded, so its quite
possible
that the last byte of this encoding is 0x00, depending on what the user
has put into the MMS message. 

The offending code in wsp_server_method_states.def looks at the last
byte
of the POST data and truncates it if it is == 0x00. So the MMS message
gets truncated and hence corrupted. I've done a round trip test against
an MMSC and the test fails with the code in and succeeds with it out.
Anyway, regardless of the scenario, does it make any sense that the WSP
layer chops off the last byte of its POST data just because it is ==
0x00 ?
No, of course it does'nt.




--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
VAS Technologies Division   +371 7773436
+371 9248284 (mobile)



Re: [PATCH] octstr performance

2004-01-19 Thread Vjacheslav Chekushin
Hi, all

If this patch is error free, than it can be considered
as bug fix and should be applied ;).
Alexander Malysh wrote:
Hi List,

attached is a patch that adds more 'const' modifiers to 'Octstr' and get 
better 'octstr' performance (some functions were hand-optimized but not all, 
means more work should be done;)). Also you can find some simple benchmarks 
in attached .txt file.

Comments and votes please!





--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



[PATCH] Binding HTTP clients calls to specific interface

2003-12-18 Thread Vjacheslav Chekushin
Hi, Alexander.

I've included update to userguide.
Could you check, is it enough?
Alexander Malysh wrote:
On Tuesday 16 December 2003 13:53, Vjacheslav Chekushin wrote:

Hi, Alexander.

The problem is that I haven't write access to CVS ;).


oops, I thought you have write access...
would you please add new option to userguide and resend a whole patch. I will 
commit it then.

Thanks in advance...


Alexander Malysh wrote:

Hi Slava,

as a known open-source-process , no votes/comments are equal to +0 , so
you as a one that have write access should just commit things, because
some time for review by others elapsed and no vetos are there.
Only one comment from me: I'm +1 for this patch , but please add this new
config option to userguide. We _must_ keep userguide uptodate.
On Tuesday 16 December 2003 13:00, Vjacheslav Chekushin wrote:


--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv


http_interface.patch.gz
Description: GNU Zip compressed data


Re: [PATCH] Binding HTTP clients calls to specific interface

2003-12-18 Thread Vjacheslav Chekushin
Hi, Alexandr.
I didn't get your point. How do you want to choose with
each interface to call http_start_request? Is it just round-robin?
I can show you why I using this patch (simplified):
My host has 2 interfaces - into intranet and into internet.
What I want is to allow wap user go to internet only.
So I bind http requests to external interface and that is all.
Requests can't go to intranet now.
Alexander Malysh wrote:
Hi Slava,

just a question: your patch sets http-interface static for the whole process 
(http-interface). Would it make sense to set 'interface' for each http 
request (i.e. by calling http_start_request with wished interface) ? 

e.g. one application with 2 threads: first thread starts http request through 
eth0 and second thread through eth1. such is impossible with attached patch 
or I'm missing something?

On Thursday 18 December 2003 09:13, Vjacheslav Chekushin wrote:

Hi, Alexander.

I've included update to userguide.
Could you check, is it enough?
Alexander Malysh wrote:

On Tuesday 16 December 2003 13:53, Vjacheslav Chekushin wrote:

Hi, Alexander.

The problem is that I haven't write access to CVS ;).
oops, I thought you have write access...
would you please add new option to userguide and resend a whole patch. I
will commit it then.
Thanks in advance...


Alexander Malysh wrote:

Hi Slava,

as a known open-source-process , no votes/comments are equal to +0 , so
you as a one that have write access should just commit things, because
some time for review by others elapsed and no vetos are there.
Only one comment from me: I'm +1 for this patch , but please add this
new config option to userguide. We _must_ keep userguide uptodate.
On Tuesday 16 December 2003 13:00, Vjacheslav Chekushin wrote:




--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Binding HTTP clients calls to specific interface

2003-12-18 Thread Vjacheslav Chekushin
Hi, Alexander.
Do you talk about calls from different boxes?
It is quite simple to modify http library to do so.
1. Inject additional arg into http_start_request()
   (rewrite current calls to use NULL for this arg)
2. Add to structure HTTPserver field octstr *outgoing_interface.
3. In get_connection() use http_interface only if *outgoing_interface not NULL.
If you think it is useful, I can do it.
But anyway, for using it, corresponded boxes must be tuned to use
http_start_request with real interface, not NULL.
Alexander Malysh wrote:
 On Thursday 18 December 2003 13:22, Vjacheslav Chekushin wrote:

Hi, Alexandr.
I didn't get your point. How do you want to choose with
each interface to call http_start_request? Is it just round-robin?


 nope, it would be specified explicitely, i.e.
 http_start_request(...params..., interface)


I can show you why I using this patch (simplified):
My host has 2 interfaces - into intranet and into internet.
What I want is to allow wap user go to internet only.
So I bind http requests to external interface and that is all.
Requests can't go to intranet now.


 ok, I got your point... But assume you would like additionaly to allow for
 some user requests to go into intranet (password/username/msidn protected),
 then you have no chance todo that on this wapbox because all http request
 would go through internet interface.


Alexander Malysh wrote:

Hi Slava,

just a question: your patch sets http-interface static for the whole
process (http-interface). Would it make sense to set 'interface' for each
http request (i.e. by calling http_start_request with wished interface) ?

e.g. one application with 2 threads: first thread starts http request
through eth0 and second thread through eth1. such is impossible with
attached patch or I'm missing something?

On Thursday 18 December 2003 09:13, Vjacheslav Chekushin wrote:

Hi, Alexander.

I've included update to userguide.
Could you check, is it enough?

Alexander Malysh wrote:

On Tuesday 16 December 2003 13:53, Vjacheslav Chekushin wrote:

Hi, Alexander.

The problem is that I haven't write access to CVS ;).

oops, I thought you have write access...
would you please add new option to userguide and resend a whole patch. I
will commit it then.

Thanks in advance...


Alexander Malysh wrote:

Hi Slava,

as a known open-source-process , no votes/comments are equal to +0 ,
so you as a one that have write access should just commit things,
because some time for review by others elapsed and no vetos are
there.

Only one comment from me: I'm +1 for this patch , but please add this
new config option to userguide. We _must_ keep userguide uptodate.

On Tuesday 16 December 2003 13:00, Vjacheslav Chekushin wrote:


--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
Network Support and Information Technology Group+371 7773436
+371 9248284 (mobile)
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv
Network Support and Information Technology Group+371 7773436
+371 9248284 (mobile)



Re: [RFC] Call for more development participation

2003-12-16 Thread Vjacheslav Chekushin
Hi, Alexander.

The problem is that I haven't write access to CVS ;).

Alexander Malysh wrote:
Hi Slava,

as a known open-source-process , no votes/comments are equal to +0 , so you as 
a one that have write access should just commit things, because some time for 
review by others elapsed and no vetos are there.

Only one comment from me: I'm +1 for this patch , but please add this new 
config option to userguide. We _must_ keep userguide uptodate.

On Tuesday 16 December 2003 13:00, Vjacheslav Chekushin wrote:

Hi, List.
I agree with Angel about his feeling.
As example I can point to one provided patch:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg01697.html

I posted it and didn't get any comments (negative or positive).
So I just use it in my enviroment.
Angel Fradejas wrote:

Hi all,

First of all, I must say I love to contribute to the kannel project, and
I tried hard months ago to be more active, both with
comments/votes/advice and mainly with new code/ideas/features.
We use kannel hard to process heavy premium-sms traffic (several millions
MOs/month), so I guess we have dealed with the kind of issues you might
expect doing this business: thousands of sms-services, sessions,
centralized accounting, and so on. Not so much familiar with the heavy
push-only business (although there we have the push-guru Alex :-)
My main concern about our loss in activity in the devel list is the
somewhat random criteria to accept or reject contributions: a developer
is mainly motivated to contribute to an open source project if he/she
sees his/her work is being taken into consideration, becames part of the
tree, you know what.
But here, to be frank, I have certain bad feelings that my contributions
(not only code, but also ideas, suggestions, RFCs, etc.) have not been
very sucessful (surely for very good reasons), but anyway you cannot
abstract from that feelings.
It comes to my minf for example discussing the need to make billing-info
flow from smsbox to bearerbox (and there were several patches for that,
not mine I have to say), and everybody replying that billing were
something outside the scope of kannel, and so on, so we had the extra
work of keeping that kind of patch in sync with cvs version, and then one
day, voilá, binfo= appears without any further explanation. That is the
kind of randomness I'm referring to.
Nobody takes offense from my comments, please.

I'm just trying to explain my thoughts.

Cheers.

Angel Fradejas
Mediafusión España, S.A.
[EMAIL PROTECTED]
www.mediafusion.es




--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



[BUG] wsp_headers.c, header's handling in Connect PDU

2003-12-11 Thread Vjacheslav Chekushin
:   data: 43 2d 31 2e 30 00 b5 68   C-1.0..h
2003-12-11 09:13:44 [3] DEBUG:   data: 74 74 70 3a 2f 2f 6e 64   ttp://nd
2003-12-11 09:13:44 [3] DEBUG:   data: 73 31 2e 6e 64 73 2e 6e   s1.nds.n
2003-12-11 09:13:44 [3] DEBUG:   data: 6f 6b 69 61 2e 63 6f 6d   okia.com
2003-12-11 09:13:44 [3] DEBUG:   data: 2f 75 61 70 72 6f 66 2f   /uaprof/
2003-12-11 09:13:44 [3] DEBUG:   data: 4e 33 36 36 30 72 31 30   N3660r10
2003-12-11 09:13:44 [3] DEBUG:   data: 30 2e 78 6d 6c 00 0.xml.
2003-12-11 09:13:44 [3] DEBUG: Octet string dump ends.
2003-12-11 09:13:44 [3] WARNING: bad media-range or media-type
2003-12-11 09:13:44 [3] WARNING: WSP: Accept: skipping 1 trailing octets.
2003-12-11 09:13:44 [3] WARNING: Skipping faulty header.
2003-12-11 09:13:44 [3] DEBUG: WSP: decoded headers:
2003-12-11 09:13:44 [3] DEBUG: Accept: text/X-CalypsoLink
2003-12-11 09:13:44 [3] DEBUG: Accept: text/x-vCalendar
2003-12-11 09:13:44 [3] DEBUG: Accept: text/calendar
2003-12-11 09:13:44 [3] DEBUG: Accept: text/x-vCard
2003-12-11 09:13:44 [3] DEBUG: Accept: text/plain
2003-12-11 09:13:44 [3] DEBUG: Accept: application/vnd.wap.wtls-ca-certificate
2003-12-11 09:13:44 [3] DEBUG: Accept: application/vnd.oma.dd+xml
2003-12-11 09:13:44 [3] DEBUG: Accept: text/x-co-desc
2003-12-11 09:13:44 [3] DEBUG: Accept: application/vnd.oma.drm.message
2003-12-11 09:13:44 [3] DEBUG: Accept: application/x-java-archive
2003-12-11 09:13:44 [3] DEBUG: Accept: video/vnd.nokia.interleaved-multimedia
2003-12-11 09:13:44 [3] DEBUG: Accept: application/vnd.symbian.install
2003-12-11 09:13:44 [3] DEBUG: Accept: application/vnd.nokia.ringing-tone
2003-12-11 09:13:44 [3] DEBUG: Accept: audio/x-xmrcc-sp-midi
2003-12-11 09:13:44 [3] DEBUG: Accept: audio/x-xmrcc-midi
2003-12-11 09:13:44 [3] DEBUG: Accept: audio/x-xmrcc-x-beatnik-rmf
2003-12-11 09:13:44 [3] DEBUG: Accept: audio/sp-midi
2003-12-11 09:13:44 [3] DEBUG: Accept: audio/midi
2003-12-11 09:13:44 [3] DEBUG: Accept: audio/x-beatnik-rmf
2003-12-11 09:13:44 [3] DEBUG: Accept: image/tiff
2003-12-11 09:13:44 [3] DEBUG: Accept: image/x-wmf
2003-12-11 09:13:44 [3] DEBUG: Accept: image/png
2003-12-11 09:13:44 [3] DEBUG: Accept: image/vnd.nokia.ota-bitmap
2003-12-11 09:13:44 [3] DEBUG: Accept: image/vnd.wap.wbmp
2003-12-11 09:13:44 [3] DEBUG: Accept: image/x-bmp
2003-12-11 09:13:44 [3] DEBUG: Accept: image/x-epoc-mbm
2003-12-11 09:13:44 [3] DEBUG: Accept: audio/basic
2003-12-11 09:13:44 [3] DEBUG: Accept: audio/x-sibo-wve
2003-12-11 09:13:44 [3] DEBUG: Accept: audio/x-epoc-wve
2003-12-11 09:13:44 [3] DEBUG: Accept: image/jpeg
2003-12-11 09:13:44 [3] DEBUG: Accept: image/gif
2003-12-11 09:13:44 [3] DEBUG: Accept: audio/x-wav
2003-12-11 09:13:44 [3] DEBUG: Accept: application/java-archive
2003-12-11 09:13:44 [3] DEBUG: Accept: text/vnd.sun.j2me.app-descriptor
2003-12-11 09:13:44 [3] DEBUG: WSP: End of decoded headers.
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [BUG] wsp_headers.c, header's handling in Connect PDU

2003-12-11 Thread Vjacheslav Chekushin
Hi, Stipe
No, it doesn't PANIC. It simply doesn't serve request because think
that client doesn't support wmlc.
To be correct WAP gw send Not Acceptable response.
Stipe Tolj wrote:
Vjacheslav Chekushin wrote:

Hi, list.

I'm encounter problem in header's handling in Connect PDU.
If Accept header contain value 00, (80 00), than it doesn't
parsed and all remaining headers are skipped.
It is clear that zero value is not expected by Accept header,
but this header constructed accoding to WSP rules and must not
break all remaining headers.
And as well as Accept: application/vnd.wap.wmlc is located after
this point and doesn't go into decoded headers we get error indication
instead of content:
2003-12-11 09:13:47 [9] WARNING: WSP: content-type application/vnd.wap.wmlc
not supported


does it PANIC after the warning?

Stipe

mailto:[EMAIL PROTECTED]
---


--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [BUG] wsp_headers.c, header's handling in Connect PDU

2003-12-11 Thread Vjacheslav Chekushin
Yes.
WSP 8.4.1.2 Field values:
first octet in all the field values can be interpreted as follows:

0 - 30 : This octet is followed by the indicated number (0 30) of data octets,

So 0 is included in this range.

So in mean of general WSP encoding everything is ok.
But of course, Nokia send malformed Accept header:
( 8.4.2.7 Accept field
The following rules are used to encode accept values.
Accept-value = Constrained-media | Accept-general-form
Accept-general-form = Value-length Media-range [Accept-parameters]
Media-range = (Well-known-media | Extension-Media) *(Parameter)
Accept-parameters = Q-token Q-value *(Accept-extension)
Accept-extension = Parameter
Constrained-media = Constrained-encoding
Well-known-media = Integer-value
; Both are encoded using values from Content Type Assignments table in Assigned 
Numbers
Q-token = Octet 128 )

And we have: Accept-general-form = Value-length Media-range [Accept-parameters]
So value-length is 0 and Media-range is absent.
So we have 2 options:
1) Say to Nokia 3660 users - sorry, your phone doesn't work with our
WAP gw
2) Patch wap gateway to skip this faulty Accept header and process rest
headers.
Stipe Tolj wrote:
can you point us directly to the section of the WSP spec where you
see that a WSP header may be empty, hence with 0x00 as value?!
Stipe

--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [BUG] wsp_headers.c, header's handling in Connect PDU

2003-12-11 Thread Vjacheslav Chekushin
Hi, Stipe.
It doesn't help, because
ret = wsp_secondary_field_value(context, val)
return error on context, not WSP_FIELD_VALUE_NONE!
I've wrote quick hack to make this phone to work:

int wsp_secondary_field_value(ParseContext *context, long *result)
{
int val;
long length;
+if (parse_octets_left(context) == 0) {
+  *result = 0;
+  return WSP_FIELD_VALUE_NONE;
+}
/* this parse_get_char() return  -1 because earlier in wsp_field_value()
   we set parse_limit(context, 0) and any parse operation will return -1
   because parse_octets_left = 0 */
   val = parse_get_char(context);
if (val == 0) {
*result = 0;
return WSP_FIELD_VALUE_NONE;
} else if (val  0  val  31) {


Stipe Tolj wrote:
Ok, 

ow about trying this patch and access with the device again to see
what happens.
Stipe

mailto:[EMAIL PROTECTED]
---
Wapme Systems AG
Münsterstr. 248
40470 Düsseldorf, NRW, Germany


--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [PATCH] Naive approach to HTTP-timeouts (Final?)

2003-11-28 Thread Vjacheslav Chekushin
Hi, Alexander.
First of all, test shows that _YAT_ approach works faster:
THREAD-VERSION : Time taken for tests:   4.688475 seconds
WITHOUT THREADS: Time taken for tests:   243.150797 seconds
But, to be honest, I don't beleive in it.
The only choice for it: patch occasionaly remove some bug or
perfomance bottleneck from sources.
And can you explain about expected perfomance degradation in YAT aproach.
Do you mean thread's swithing once at 20 seconds? I don't think so.
IMHO kernel switches between threads _realy_ fast, because threads
share the same address space, stack, code, etc.
I remember the time when kannel created new thread for every outgoing http
request. And even this worked pretty fast.
Alexander Malysh wrote:
hey, factor 50 I want see a patch w/o YAT!!!
It can't be s bad... 

On Thursday 27 November 2003 17:24, David Schmitz wrote:

Hi,

your YAT-hatred ;) is well known and understood. See the attachment for
some naive benchmarks. Please draw your own conclusions.
Regards,
David
Alexander Malysh schrieb:

Hi David/Slava,

as you know, I do not like yet another thread (YAT) approach...
Would you please try get some benchmark results w/ and w/o YAT, so we can
see how is performance w/o YAT affected?
Thanks in advance...

On Thursday 27 November 2003 15:02, David Schmitz wrote:

Hi list,

attached is the IMHO final version of the timeout-patch.  I took the
thread-approach as discussed with Slava (thanks for your input and help
:)). If there are no objections/corrections I would like to commit the

patch.

Note: configuration of the timeout-values is done in http.h.

Best regards,
David




--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



ambiguous POST data truncation.

2003-11-28 Thread Vjacheslav Chekushin
Hi, list

In wsp_server_method_states.def:

/*
 * The Siemens S35 adds an extra NUL character to the end
 * of the request body which may not work with certain cgi
 * scripts. It is removed here by truncating the length.
 */
req_body_size = octstr_len(pdu-u.Post.data);
if(octstr_get_char(pdu-u.Post.data,(req_body_size - 1)) == 0)
octstr_truncate(pdu-u.Post.data,(req_body_size - 1));
I encounter the problem with truncated NULL for binary POSTs.
Some samsung phones send this trailing NULL in jpegs. WAP gw truncate it.
Samsung phone fails to receive such truncated message.
I remove this ambiguous truncation to fix the problem.
I'm not sure about these certain cgi scripts but to remove some data from POST
not a good solution.
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [PATCH] Naive approach to HTTP-timeouts

2003-11-27 Thread Vjacheslav Chekushin
Hi, David.

You start timeout_control_thread in http_init(). It is wrong because this code:

 +static void timeout_control_thread(void *arg) {
 +  while (run_status == running) {
 +debug(,0, timeout_control sleeping);
 +gwthread_sleep(MIN_TIME_OUT);
 +debug(,0, timeout_control awake);
 +check_timeout();
 +  }
 +  timeout_control_thread_id = -1;
will be executed when run_status still is limbo.

David Schmitz wrote:
Hi Slava,

no need to vote for my patch, because your approach is better.
IMO the discussion difftime vs. thread is needless, because we should 
aim for scalability, and the thread-approach scales
Thus I have merged my client stuff into your thread-stuff and voila, see 
the attached patch. Let me know what you think :)

Regards,
David
Vjacheslav Chekushin schrieb:

Hi, David.
Yes, I have thought about exactly the same:
either difftime+last_check or thread-switch.
I didn't compare the efficient of thease methods.
I'v made thread because switch occur 1 time at minute (or any configured
timeout) but difftime can occur many times in minute (unpredictable, 
depends
on load).
PS. I'm not running sms gateway part of kannel,
so I have not load on http server,
so I'm ready to vote for your difftime+last_check solution ;).

David Schmitz wrote:

Hi Slava (and others),

yeah, you have got a point there...
But this can be avoided by using something like:
last_check = time(NULL);
while

now = time(NULL);
   if ((ret == 0) || (difftime(now, last_check) = MIN_TIME_OUT)) {
   check_timeout();
   last_check = time(NULL);
   }

It depends on whether you prefer a contex-switch (because of a 
thread) to the calculation of a difftime.



--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [PATCH] Naive approach to HTTP-timeouts

2003-11-26 Thread Vjacheslav Chekushin
Hi, David.

If I understand correctly then check_timeouts() will be called only if no any 
new connection to kannel http server for MIN_TIME_OUT time.
So for busy enviroment this check will be quite undeterminate and can
be not called for hours. Isn't it?

David Schmitz wrote:
Hi again,

attached is the new patch for HTTP-timeouts. I have included the work of 
Slava wrt. server-timeouts, but modified it such that no new thread is 
needed. Another new thing is the purging of active clients upon 
port-removal, as suggested by Alex.

Please, try it out and share your comments :)

Best regards,
David
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [PATCH] Naive approach to HTTP-timeouts

2003-11-24 Thread Vjacheslav Chekushin
Hi, David.
Current kannel http implementation doesn't free sockets for client-server
part too (I mean conn_pool dictionary).
This part even more important for WAP than server's part of http library.
I've made patch some time ago to clean timeouted connection for this part of
library. It works fine for me.


David Schmitz wrote:
Hi everybody,

attached is a patch that implements a rather naive HTTP-timeout solution.
Problem:
The current http-module will not disconnect clients, thus resources 
(e.g. sockets) are not reclaimed.
Approach of the solution:
* each new client registers itself in a dictionary of active clients 
upon creation.
* the server thread checks after a certain timeout each client in the 
dictionary whether or not the connection has been timed out.
* 2 kinds of timeout are supported:
(1) CONNECTION: the time between creation of the client and the first 
input.
(2) IDLE: the time between subsequent data transfers.
* clients that are waiting for an answer (e.g. clients in the 
request_is_being_handled and sending_reply state) are not disconnected.
* each data transfer resets the client's timestamp.
* the configuration of the timeout-values is done in the http.h file, 
which I know is not a very sane approach.

Please have a look at the patch. If anyone comes up with a better 
solution or finds errors/mistakes: I am happy to learn :))).

Mit freundlichen Gruessen/Best regards

David Schmitz

Softwareentwicklung



--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv


conn_pool.patch.gz
Description: GNU Zip compressed data


Re: [PATCH] Naive approach to HTTP-timeouts

2003-11-24 Thread Vjacheslav Chekushin
Hi, Alexander,

I agree with you about yet another thread.
But sockets are limited resources too.
Now sockets from conn_pool (client part of http library)
_never_ released after use (see conn_pool_put function).
David patch cleans sockets only for server part of http library, and it is good,
but what about sockets at client part?
 From http.c:
/* XXX re-implement socket pools, with idle connection killing to save sockets
*/ - it is about client part.
This means that either with new thread or without, but this part must be
patched too.
I post my patch with goal to remind about the problem.
It is not problem for me to patch sources on my side by myself ;)
And about David's patch:
in function pointer_to_octstr()
+char *tmp = (char *) gw_malloc(sizeof(char) * 255);
+sprintf(tmp, %ld, p);
+tmp_oct = octstr_create(tmp);
+gw_free(tmp);
can be changed to use octstr_format()

Alexander Malysh wrote:
 Hi Slava,

 I would vote -1 for your patch. I see no need to start yet another thread
 only to watch timedout connections (threads are limited resources). David's
 patch (though only for http-server part) avoid it gracefully...

 David your patch has one problem (what I can see right now):
 please add cleanup for appropriate clients into port_remove function;
 otherwise callback function will be called for those clients, wich call
 port_put function then and we have panic, because port just doesn't exists in
 the dictionary anymore.

 On Monday 24 November 2003 13:52, Vjacheslav Chekushin wrote:

--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv




[PATCH] Problem with WAP-Gateway/File sizes

2003-11-21 Thread Vjacheslav Chekushin
Hi, list.

It is not enough just to change packet size. We must avoid PANIC if
maximal document size exceeded.
Wap gw must send abort indication instead of PANIC if segment's count
more than 255.
Attached patch do it.

Stipe Tolj wrote:
Igor Ivoilov wrote:

I have changed packet size to be 1400 on my production server
and don't see any problem for now.
I have not see javagames more than 358k till now.
So as a temporary work around it's very good me.
I don't have any other problem. But we provide access to our wap gw only to our 
customers,
and we pretty sure that the network from them to us also let packets to be 1500 bytes.
Please provide me with your opinion if we such change in cvs


Hi Igor, yes, we may consider this...

How about sending in a patch to the list (in diff -u format), so that
Aarno and I can test it on our MMSC installations and on the Kannel
REFPOOL WAP GW??!
Stipe

mailto:[EMAIL PROTECTED]
---
Wapme Systems AG
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv


wtp_sar.patch.gz
Description: GNU Zip compressed data


Re: [PATCH] Problem with WAP-Gateway/File sizes

2003-11-21 Thread Vjacheslav Chekushin
Hi, Stipe.
You can close BUG #4 now.
Stipe Tolj wrote:
Vjacheslav Chekushin wrote:


It is not enough just to change packet size. We must avoid PANIC if
maximal document size exceeded.
Wap gw must send abort indication instead of PANIC if segment's count
more than 255.
Attached patch do it.


++1, commited to cvs.

Stipe

mailto:[EMAIL PROTECTED]
---
Wapme Systems AG
Münsterstr. 248
40470 Düsseldorf, NRW, Germany
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: PANIC in wapbox (Too many immutable strings.)

2003-10-21 Thread Vjacheslav Chekushin
Hi, David.

David Chkhartishvili wrote:
Hi Stipe, Slava, List,

my compile flags are: --disable-ssl --disable-docs --disable-assertions.
I have no debugging enabled for wmls compiler.
 Kannel limits maximum count for immutable octstr. It limited in octstr.c
 to 1024 (#define MAX_IMMUTABLES 1024).
 So _this_ limit has been exceeded by gateway.
 Solution: either increase limit, either descrese immutable octstr usage.


I think increasing maximum count for immutable octstr is not solution,  
because if I have now limit to 1024 and I change to something bigger it 
will exceed in more time, BUT it will exceed.
and how I can decrease immutable octstr usage?


No. It helps, because immutable octstrs are constants, and their using is
limited. They do not allocated and deallocated dynamically as simple octstr.
The immutable octet strings are destroyed automatically when the process ends.
Problem is that kannel now use too many string constants.
(You can grep source files for octstr_imm and see what I mean).
PS: But if some process create immutable string not from constant then it is bug.

Stipe Tolj wrote:

I've experienced PANIC in latest CVS wapbox. unfortubately I have no
debug log, but can supply log with level 1 (if it helps):
  


did you compile Kannel with debugging on? Beware that the debug
version of the malloc wrappers have only a certain room to address.



--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



[BUG] #78

2003-10-21 Thread Vjacheslav Chekushin
Hi, List.

What about bug #78 in Mantis?
It is described cleanly and has patch attached.
Stipe, seems you have changed described http.c behavior at 01.Aug,2003.
(At least cvs annotate shows it ;) ).
So I think you must either explain why you did it or apply patch and close
this report.
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



[PATCH] Bug in wml_compiler.c (wml file without DTD)

2003-10-21 Thread Vjacheslav Chekushin
Hi, list.

Following simple wml documents causes segmentation fault in wapbox
(because it has no DTD section)
(tested system: Linux 2.4.18 + libxml2 2.4.19)
?xml version=1.0 encoding=utf-8?wmlcard id=2pTest/p/card/wml

Patch :

--- ../gateway_base/gw/wml_compiler.c   Thu Oct  9 15:04:18 2003
+++ gw/wml_compiler.c   Tue Oct 21 14:45:49 2003
@@ -540,6 +513,7 @@
 }
 /* Return WML Version dependent on xml ExternalID string */
+if (document-intSubset != NULL)
 externalID = octstr_create(document-intSubset-ExternalID);
 if (externalID == NULL) {
 (*wbxml)-wml_public_id = 0x04; /* WML 1.1 Public ID */
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [PATCH] radius accounting proxy

2003-10-15 Thread Vjacheslav Chekushin
Hi, all.

This problem and solution was described at:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg01749.html

Alexander Malysh wrote:
 Sorry, attached patch doesn't work.. Please ignore it...

 On Wednesday 15 October 2003 11:58, Alexander Malysh wrote:

Hi David,

make install fixed in cvs, please try it. Thanks for pointing...

Unfortunately, I'm not a wap expert :( I guess, it's just a typo, so please
try attached patch... Please report if it works and I will commit it
then...

On Wednesday 15 October 2003 08:57, David Chkhartishvili wrote:

Hi Alexander,

I've just tried latest CVS and got errors from 'make install':

./install-sh -c -d /usr/local/kannel-rad2/include/kannel/gwlib
(cd gwlib  find . -type f -name *.h | while read a ; do ./install-sh
-c -m 644 $a /usr/local/kannel-rad2/include/kannel/gwlib ; done)
/bin/sh: ./install-sh: not found

[snip]


also, I've experienced wapbox misbehavour:

2003-10-15 11:48:08 [8] DEBUG: WSP: Converting from text/vnd.wap.wml
to application/vnd.wap.wmlc
2003-10-15 11:48:08 [8] DEBUG: WBXML: Encoding with wbxml version 1.3
2003-10-15 11:48:08 [8] DEBUG: WBXML: WML with ExternalID
-//WAPFORUM//DTD WML 1.1//EN
2003-10-15 11:48:08 [8] DEBUG: WSP: Content-type is now
application/vnd.wap.wmlc, size 114 bytes (before: 333 bytes), content
body is:
2003-10-15 11:48:08 [8] DEBUG: Octet string at 124a28:
2003-10-15 11:48:08 [8] DEBUG:   len:  114
2003-10-15 11:48:08 [8] DEBUG:   size: 115
2003-10-15 11:48:08 [8] DEBUG:   immutable: 0
2003-10-15 11:48:08 [8] DEBUG:   data: 03 04 6a 00 7f e7 55 03 63 61 72
64 30 00 36 03   ..j...U.card0.6.
2003-10-15 11:48:08 [8] DEBUG:   data: 4d 61 67 74 69 20 47 53 4d 00 01
e0 07 01 ae 32   Magti GSM..2
2003-10-15 11:48:08 [8] DEBUG:   data: 03 6c 6f 67 6f 31 2e 77 62 6d 70
00 0c 03 4d 61   .logo1.wbmp...Ma
2003-10-15 11:48:08 [8] DEBUG:   data: 67 74 69 47 53 4d 2e 2e 2e 00 01
26 dc 4a 03 67   gtiGSM..J.g
2003-10-15 11:48:08 [8] DEBUG:   data: 65 6f 2e 77 6d 6c 00 01 03 47 65
6f 72 67 69 61   eo.wml...Georgia
2003-10-15 11:48:08 [8] DEBUG:   data: 6e 00 01 26 dc 4a 03 65 6e 2f 69
6e 64 65 78 2e   n...J.en/index.
2003-10-15 11:48:08 [8] DEBUG:   data: 77 6d 6c 00 01 03 45 6e 67 6c 69
73 68 00 01 01   wml...English...
2003-10-15 11:48:08 [8] DEBUG:   data: 01
01 ..
2003-10-15 11:48:08 [8] DEBUG: Octet string dump ends.
2003-10-15 11:48:08 [8] DEBUG: WSP: Setting Referer URL to
http://wap.magtigsm.ge/
2003-10-15 11:48:08 [8] WARNING: WSP: content-type
application/vnd.wap.wmlc not supported
2003-10-15 11:48:08 [2] DEBUG: WSP: machine 124600, state CONNECTED,
event S-MethodResult.req
2003-10-15 11:48:08 [2] DEBUG: WSP: method 3, state PROCESSING, event
S-MethodResult.req
2003-10-15 11:48:08 [2] DEBUG: WSP: Mapping string `text/plain', WSP
version 1.2 to binary representation `0x0003'.
2003-10-15 11:48:08 [2] DEBUG: WSP: Mapping string `Date', WSP version
1.2 to binary representation `0x0012'.
2003-10-15 11:48:08 [2] DEBUG: WSP: Mapping string `Server', WSP version
1.2 to binary representation `0x0026'.
2003-10-15 11:48:08 [2] DEBUG: WSP: Mapping string `Last-Modified', WSP
version 1.2 to binary representation `0x001d'.
2003-10-15 11:48:08 [2] DEBUG: WSP: Mapping string `ETag', WSP version
1.2 to binary representation `0x0013'.
2003-10-15 11:48:08 [2] DEBUG: WSP: Mapping string `Accept-Ranges', WSP
version 1.2 to binary representation `0x0004'.
2003-10-15 11:48:08 [2] DEBUG: WSP: Mapping string `Content-Length', WSP
version 1.2 to binary representation `0x000d'.
2003-10-15 11:48:08 [2] DEBUG: WSP: Mapping string `Content-Type', WSP
version 1.2 to binary representation `0x0011'.
2003-10-15 11:48:08 [2] DEBUG: WSP 0/3: New method state REPLYING
2003-10-15 11:48:08 [2] DEBUG: WSP 0: New state CONNECTED
2003-10-15 11:48:08 [6] DEBUG: WTP: resp_machine 3, state RESULT_WAIT,
event TR-Result.req.
2003-10-15 11:48:08 [6] DEBUG: WTP: begin_sar_result(): data len = 74
2003-10-15 11:48:08 [6] DEBUG: WTP: dispath_to_wdp(): psn = 0
2003-10-15 11:48:08 [6] DEBUG: WTP 32003-10-15 11:48:08 [16] DEBUG:
boxc_receiver: got wdp from wapbox

: New state RESULT_RESP_WAIT

2003-10-15 11:48:08 [10] DEBUG: udp: sending message
2003-10-15 11:48:09 [9] DEBUG: datagram received

Alexander Malysh wrote:

--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv




[BUG] http.c (http_something_accepted())

2003-10-10 Thread Vjacheslav Chekushin
Hi, list.

octstr_compare() can't be used because http headers are packed by http_pack()
and headers can contain many values.
So octstr_search() must be used.
By the way, why do you need octstr_convert_range() in this function if we could
use octstr_case_search() ?
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [BUG] http.c (http_something_accepted())

2003-10-10 Thread Vjacheslav Chekushin
Hi, Stipe.

Stipe Tolj wrote:
Vjacheslav Chekushin wrote:

Hi, list.

octstr_compare() can't be used because http headers are packed by http_pack()
and headers can contain many values.
So octstr_search() must be used.


ok, you consider that you have multi-valued headers, like for the
'Accept-Charset' headers, right? That would be a problem, yes. 

But actually I just wanted to get rid of the istrup() function and use
Ocstr* instead. I have not claimed that it would now work even for
multi-value headers.
Can you preliminary file this as a bug report to
http://bugs.kannel.org/ so we keep track of it?! Thanks.
I think, that such simple bug must not be filed into bugs.kannel.org.

All what you need is change:
if (octstr_compare(header_value, oswhat) == 0)
to:

if (octstr_search(header_value, oswhat, 0) = 0)



By the way, why do you need octstr_convert_range() in this function if we could
use octstr_case_search() ?


That's a good question?! ;) seems you're right here, of course. It's
unnecessary to upcase both operands in order to have a case sensitive
search while there is an incase sensitive search function available.
I'll change this.

Stipe



--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [BUG] http.c (http_something_accepted())

2003-10-10 Thread Vjacheslav Chekushin
Hi, Stipe.

Stipe Tolj wrote:
I think, that such simple bug must not be filed into bugs.kannel.org.

All what you need is change:
if (octstr_compare(header_value, oswhat) == 0)
to:

if (octstr_search(header_value, oswhat, 0) = 0)


ok, so want it the dirty way ;)

I thought of parsing a HTTP multi-value and provide a List* structure
that then is searched for a specific element. 
Anyway we must not use octstr_compare, but octstr_search
Example:
phone sends Accept: text/plain; q=0.5
http server sends content text/plain.
So now octstr_compare(text/plain; q=0.5, text/plain) != 0,
and conclusion from http_something_accept: text/plain not acceptable.
This multi-value HTTP representation may be then used for several
other header types too, like 'Content-Type', which can look very
complex in some cases.
Stipe




--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



[PATCH] radius accounting proxy

2003-10-09 Thread Vjacheslav Chekushin
Hi, list.

Numerous memory leaks are patched in radius accounting proxy.

PS:
It could be nice if developers before commiting something into cvs check
code against memory leaks. It is quite simple:
./configure with-malloc=check,
compile, run in test enviroment. Stop.
Now, if in log files you see:
2003-10-08 13:23:54 [0] DEBUG: Current allocations: 0 areas, 0 bytes

then everything is Ok, but if you see something like:

2003-10-08 11:40:57 [0] DEBUG: Area 0x8271768, size 16, max_size 16
2003-10-08 11:40:57 [0] DEBUG: Allocated by udp_recvfrom() at gwlib/socket.c:733
2003-10-08 11:40:57 [0] DEBUG: Claimed by udp_recvfrom() at gwlib/socket.c:733
2003-10-08 11:40:57 [0] DEBUG: Contents of area (first 16 bytes):
2003-10-08 11:40:57 [0] DEBUG:   48 a2 26 08 10 00 00 00 11 00 00 00 00 00 00 00
2003-10-08 11:40:57 [0] DEBUG: Area 0x8271d18, size 16, max_size 16
2003-10-08 11:40:57 [0] DEBUG: Allocated by radius_attr_pack() at 
radius/radius_pdu.c:156
2003-10-08 11:40:57 [0] DEBUG: Claimed by radius_attr_pack() at 
radius/radius_pdu.c:156
2003-10-08 11:40:57 [0] DEBUG: Contents of area (first 16 bytes):
2003-10-08 11:40:57 [0] DEBUG:   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

2003-10-08 11:59:25 [0] DEBUG: Area 0x82d12d8, size 16, max_size 16
2003-10-08 11:59:25 [0] DEBUG: Allocated by update_tables() at 
radius/radius_acct.c:84
2003-10-08 11:59:25 [0] DEBUG: Claimed by update_tables() at radius/radius_acct.c:84
2003-10-08 11:59:25 [0] DEBUG: Contents of area (first 16 bytes):
2003-10-08 11:59:25 [0] DEBUG:   e8 a7 2d 08 0d 00 00 00 0e 00 00 00 00 00 00 00

Then something is wrong and memory leaks are exists.

--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv


radius_acct.patch.gz
Description: GNU Zip compressed data


Re: charset transcoding question

2003-10-08 Thread Vjacheslav Chekushin
Hi, Stipe

Stipe Tolj wrote:
 Vjacheslav Chekushin wrote:

There is transcoding staff in wap-appl.c (static void return_reply()) and
wml_compiler.c (some parsing routines, that do charset_convert).
There are some bugs in this transcoding staff (I affraid - many bugs) but
I want waste my time to clean this code.
I just commented out this code from both modules because it seems unneeded to me
at all.
If someone can show me why trancoding is used and what phone doesn't work
without it, I am ready to make patches for this.


 AFAIS, Bruno did these changes in return_reply(). In the comment he
 states it is required for the Sharp GX20?!
No, I undestood from comment that Sharp works with UTF-8. So
libxml2 do his job perfectly and sharp can work without transcoding.

 AFAIS, the block in retrun_reply() cares about transcoding the HTTP
 response body to either UTF-8 (or ISO-Latin1) *if* the charset of the
 body is *not* accepted by the device (indicated via corresponding HTTP
 headers in WSP code).

 This is legitimate IMO, even while my comment above the block states,
 that the HTTP server (and the corresponding application) should take
 care of it. This can be considered as fall-back-sanity.

 So, you indicate there are bugs. Please report and let's get them out
 of there if you consider there are some.

Some bugs:

1. Let's take that original charset not UTF-8 and not ISO-8859-1 and
phone supports ISO-8859-1
/* If device doesn't support body's charset but supports UTF-8, this
* block tries to convert body to UTF-8. */
if (octstr_case_compare(charset, octstr_imm(UTF-8))  0 
 !http_charset_accepted(device_headers, octstr_get_cstr(charset))) {
 /* convert to utf-8 if original charset is not utf-8
  * and device supports it */

/* convert to iso-8859-1 if original charset is not iso
  * and device supports it */
} else {
   if (octstr_case_compare(charset, octstr_imm(ISO-8859-1))  0 
  !http_charset_accepted(device_headers, octstr_get_cstr(charset))) {
   }
}
else cause must be processed but it will not be processed.
(First if is true,  but phone doesn't support UTF8, so content not converted)
2. Let's take simple file:

?xml version=1.0 encoding=iso-8859-7?
!DOCTYPE wml PUBLIC -//WAPFORUM//DTD WML 1.1//EN
http://www.wapforum.org/DTD/wml_1.1.xml;
wml
card id=main_card title=LMT WAP
 pa href=starts.phpLMT/a/p
/card
/wml
(encoding iso-8859-7 doesn't supported by phone)

wapbox.log shows error

2003-10-07 15:58:45 [9] WARNING: WSP: Device doesn't support charset
iso-8859-7 neither UTF-8
2003-10-07 15:58:45 [9] DEBUG: WSP: Converting from text/vnd.wap.wml to
application/vnd.wap.wmlc
2003-10-07 15:58:45 [9] INFO: WBXML: No wbxml version given, assuming 1.1
And compiled deck with iso-8859-7 goes to phone and phone shows error:
2003-10-07 15:58:45 [9] DEBUG:   data: 01 04 0a ...
01 - version 1
04 - Public identifier
0a - iso-8859-7
...
 Stipe

--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv




charset transcoding question

2003-10-07 Thread Vjacheslav Chekushin
Hi, list.

I have some questions about new transcoding feature, implemented in
cvs tree. (see http://www.mail-archive.com/[EMAIL PROTECTED]/msg00196.html)
(In Kannel 1.3.1 all content, compiled by libxml2 was sent to phone in UTF-8)

Stipe Tolj wrote:
...
defines the WML source to be in ISO-8859-1 encoding. Kannel did anyway
tried this as UTF-8 and also set the WBXML flags as UTF-8. Hence you
could *not* tell Kannel to encode the wml_compile() output in an other
charset encoding then UTF-8.
skipped
The hack includes a transcoding of the text elements while libxml2
does the parsing of the tree. libxml2 uses UTF-8 encoding as internal
encoding. Hence we have to transcode to our targeted charset (ie.
ISO-8859-1) at the point we inject the characters to the WBXML code.
This should work now smoothly. Please test on your own and report if
something has been broken by the changes.
Why do we need double work if every phone supports UTF-8?
Why we can't simply send content in UTF-8?
Or at least recode to original encoding only if device doesn't support
UTF-8 encoding?
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: Radius accounting proxy thread. (need help)

2003-10-07 Thread Vjacheslav Chekushin
Hi, Yury.
I affraid that our configuration doesn't help because we have quite complicated
configuration with many NAS servers etc.
And anyway, configuration depends on NAS software.
You must explain clearly your problem.

Check that you do not forward AUTH packets to kannel.
Only accounting packets must be sent to kannel from NAS.
Yury Mikhienko wrote:
Hi, Vjacheslav.

Can you send me your worked NAS (may be RAS in additional) configuration (approximate of course)?


Hi, Yury.

There are two differnet things: accounting and authorization.
There are even differnet default ports (1813 and 1812).
So accounting packets has been not used for authorization.
You must be able to configure AUTH packets at NAS to go directly to RAS.
Yury Mikhienko wrote:

No, not radius-acct section.
with RADIUS config I'm mean the radius server config.
My problem detail:
1. Kannel get account request from NAS properlly.
2. Kannel succesfully forward that request to radius server
3. Kannel got responce from radius server.
but radius server do not autorize accounting request.
May be I need configure radius server for forwarding autorization responce to NAS 
directly? (but how?)


Hi, Yury.
I didn't undestand your problem.
And what you mean RADIUS config?
Is it kannel radius-acct section?
Yury Mikhienko wrote:

Hi Vjacheslav !
Can you send me your RADIUS config, for example?
I as yet not configure the NAS-KANNEL-RADIUS scheme for this time :((
RADIUS did not autorize request from NAS (forwarding from kannel)
my logs:
...
2003-09-30 16:44:23 [1] INFO: RADIUS PDU type: Accounting_Request
2003-09-30 16:44:23 [1] INFO: RADIUS: Mapping `172.16.188.2 - 7xx' for session id 
0033FDED added.
/ FORWARD DATA to RADIUS */
2003-09-30 16:44:23 [1] INFO: RADIUS: Got data from remote RADIUS 1.1.1.3:1813
2003-09-30 16:44:23 [1] DEBUG: Octet string at 131d58:
2003-09-30 16:44:23 [1] DEBUG:   len:  20
2003-09-30 16:44:23 [1] DEBUG:   size: 21
2003-09-30 16:44:23 [1] DEBUG:   immutable: 0
2003-09-30 16:44:23 [1] DEBUG:   data: 05 d9 00 14 a1 2b 54 d0 0e f8 a1 68 95 d9 55 09 
  .+Th..U.
2003-09-30 16:44:23 [1] DEBUG:   data: c9 28 a5 f6 
  .(..
2003-09-30 16:44:23 [1] DEBUG: Octet string dump ends.
2003-09-30 16:44:23 [1] DEBUG: RADIUS: Mapping table contains 1 elements
2003-09-30 16:44:23 [1] DEBUG: RADIUS: Session table contains 1 elements
2003-09-30 16:44:23 [1] DEBUG: RADIUS: Client table contains 1 elements
...












--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: Radius accounting proxy thread. (need help)

2003-10-06 Thread Vjacheslav Chekushin
Hi, Yury.

There are two differnet things: accounting and authorization.
There are even differnet default ports (1813 and 1812).
So accounting packets has been not used for authorization.
You must be able to configure AUTH packets at NAS to go directly to RAS.
Yury Mikhienko wrote:
No, not radius-acct section.
with RADIUS config I'm mean the radius server config.
My problem detail:
1. Kannel get account request from NAS properlly.
2. Kannel succesfully forward that request to radius server
3. Kannel got responce from radius server.
but radius server do not autorize accounting request.
May be I need configure radius server for forwarding autorization responce to NAS 
directly? (but how?)

Hi, Yury.
I didn't undestand your problem.
And what you mean RADIUS config?
Is it kannel radius-acct section?
Yury Mikhienko wrote:
Hi Vjacheslav !
Can you send me your RADIUS config, for example?
I as yet not configure the NAS-KANNEL-RADIUS scheme for this time :((
RADIUS did not autorize request from NAS (forwarding from kannel)
my logs:
...
2003-09-30 16:44:23 [1] INFO: RADIUS PDU type: Accounting_Request
2003-09-30 16:44:23 [1] INFO: RADIUS: Mapping `172.16.188.2 - 7xx' for session id 
0033FDED added.
/ FORWARD DATA to RADIUS */
2003-09-30 16:44:23 [1] INFO: RADIUS: Got data from remote RADIUS 1.1.1.3:1813
2003-09-30 16:44:23 [1] DEBUG: Octet string at 131d58:
2003-09-30 16:44:23 [1] DEBUG:   len:  20
2003-09-30 16:44:23 [1] DEBUG:   size: 21
2003-09-30 16:44:23 [1] DEBUG:   immutable: 0
2003-09-30 16:44:23 [1] DEBUG:   data: 05 d9 00 14 a1 2b 54 d0 0e f8 a1 68 95 d9 55 09 
  .+Th..U.
2003-09-30 16:44:23 [1] DEBUG:   data: c9 28 a5 f6 
  .(..
2003-09-30 16:44:23 [1] DEBUG: Octet string dump ends.
2003-09-30 16:44:23 [1] DEBUG: RADIUS: Mapping table contains 1 elements
2003-09-30 16:44:23 [1] DEBUG: RADIUS: Session table contains 1 elements
2003-09-30 16:44:23 [1] DEBUG: RADIUS: Client table contains 1 elements
...


Hi, list.

There are some problems in current radius account proxy implementation.
First, as I mentioned before, is that Kannel RADIUS accounting proxy
_allways_ forward incoming packets to somewhere (default localhost).
I don't undestand why? In many cases kannel is the end point for these packets.
I think that if remote_host not defined, then packets must not be forwarded.
Second problem is blocking read from UDP sockets. So if you start wapbox and
then try to stop it, it waits for for packet from RAS forever:
2003-10-03 10:03:58 [0] DEBUG: Waiting for 1 (radius/radius_acct.c:proxy_thread) 
to terminate

And strace show us that wapbox wait data on socket:

[EMAIL PROTECTED] wapgw]$ strace -p18071
recvfrom(11,  unfinished ...
Attached patch solve both problems. Please look at it.
I send two patches:
1) radius_accnt.patch - functionality patch
2) radius_accnt_style.patch with style modifications for patched radius_acct.c 
according doc/CodingStyle document. (can be apllied only after first patch)

And I still have some questions.
1. Persistent storage for mapping.
2. Why session and client table not cleaned when accounting stop packet received:
2003-10-06 14:09:11 [1] DEBUG: RADIUS: Mapping table contains 5 elements
2003-10-06 14:09:11 [1] DEBUG: RADIUS: Session table contains 53 elements
2003-10-06 14:09:11 [1] DEBUG: RADIUS: Client table contains 53 elements
Is it a bug or planned behavior?


 




--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



RADIUS accnt. proxy

2003-10-03 Thread Vjacheslav Chekushin
Hi, list.
Kannel RADIUS accounting proxy _allways_ forward incoming
packets to some real RAS.
I think packets must be forwarded only if remote-host and remote-port
are defined.
I don't want to forward these packets to somewhere (because my WAP radius thread
get forwarded packets from one global forwarder)
And second question.
As I see ip-msisdn mapping is kept internally. So if our WAP gateways
restarts, than all mapping will be lost. Does exist any plans to implement
external storage?
--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv



Re: [RFC] cookie support per detault in wapbox?!

2003-06-20 Thread Vjacheslav Chekushin
Hi, Stipe.
There are 2 issues.
Current cookie implementation cache this cookie in session machine.
So it works only for connection-oriented mode and only for
current session. From other side,
WAP user can't manage own cookies with this approach.
And by cookie's RFC (RFC 2109) user agent must be able to completely disable
the sending and saving of cookies (7.1)
So I recommend to support cookies by implementing normal
WSP-HTTP cookie header encoding, couse almost all modern WAP phones
can deal with cookies by itself.
Current implementation doesn't know how to encode Cookie's headers:

2003-06-20 14:20:56 [1] ERROR: WSP: Do not know how to encode header type 65
2003-06-20 14:20:56 [1] WARNING: Skipping header: Set-Cookie: 
JSESSIONID=bhFsO7t57CM7; Path=/

Stipe Tolj wrote:
Stipe Tolj wrote:

Hi list,

I'd like to throw the --enable-cookie directive from configure and
make cookie support for wapbox now a permanent default feature.
Any objections for doing this?


no objections?! Votes please.

Stipe

--
Vjacheslav Chekushinmailto:[EMAIL PROTECTED]
Latvian Mobile Phone Companyhttp://www.lmt.lv