Hy, we've started testing, and got blocked by test_ppg sending outdated timestamps and not wanting our xml. So i've modified it to take some further arguments to the -H directive to add custom phone values and insert a actual timestamp as start and add 600 secs to the expire timestamp. so now there will be an sms sent by test_ppg if a correct number is specified.

I took snprintf to merge the string, as i don't know yet which octstr_* function to choose, please correct me on that...

Wilfried Goesgens
Index: test_ppg.c
===================================================================
RCS file: /home/cvs/gateway/test/test_ppg.c,v
retrieving revision 1.26
diff -r1.26 test_ppg.c
71a72,80
> #define EXPIRE_TIME_SEC 600
> #define VENDOR_URL "[EMAIL PROTECTED]">"
> 
> 
> //#define _XOPEN_SOURCE_EXTENDED
> //#define _GNU_SOURCE
> 
> #include <sys/time.h>
> #include <time.h>
76a86
> 
119a130,134
> static char *phonenumber="+11111";
> static char *target_url="http://www.slashdot.org";;
> static char *signature="[EMAIL PROTECTED]";
> static char *message_text="News for Nerds. Stuff that matters";
> 
343a359,370
>       char  expire_time_str[22];
>       char  actual_time_str[22];
>       struct tm dummy, dummy2;
>       struct timezone tz;//=DST_MET;//TIMEZONE;
>       struct timeval actualtime;
> 
>       if (0==gettimeofday(&actualtime, &tz))
>         {
>               time_t expiretime=actualtime.tv_sec+EXPIRE_TIME_SEC;
>               strftime(actual_time_str, 22, 
> "%Y-%m-%dT%H:%M:%SZ",gmtime_r(&actualtime.tv_sec,&dummy));
>               strftime(expire_time_str, 22, 
> "%Y-%m-%dT%H:%M:%SZ",gmtime_r(&expiretime,&dummy2));
>         }
348,353c375,382
<         push_content = octstr_create("\r\n\r\n"
<                   "--asdlfkjiurwgasf\r\n"
<                   "Content-Type: application/xml\r\n\r\n"
<                   "<?xml version=\"1.0\"?>"
<                   "<!DOCTYPE pap PUBLIC \"-//WAPFORUM//DTD PAP//EN\""
<                              " \"http://www.wapforum.org/DTD/pap_1.0.dtd\";>"
---
>         char request[5000];
>         snprintf(request,5000,
>                          "\r\n\r\n"
>                          "--asdlfkjiurwgasf\r\n"
>                          "Content-Type: application/xml\r\n\r\n"
>                          "<?xml version=\"1.0\"?>"
>                          "<!DOCTYPE pap PUBLIC \"-//WAPFORUM//DTD PAP//EN\""
>                          " \"http://www.wapforum.org/DTD/pap_1.0.dtd\";>"
356,357c385,386
<                           " deliver-before-timestamp=\"2002-11-01T06:45:00Z\""
<                           " deliver-after-timestamp=\"2000-02-27T06:45:00Z\""
---
>                          " deliver-before-timestamp=\"%s\"" // date 1
>                          " deliver-after-timestamp=\"%s\"" // expiredate 1
359,360c388,389
<                            "<address address-value=\"WAPPUSH=+358408676001/"
<                               "[EMAIL PROTECTED]">"
---
>                          "<address address-value=\"WAPPUSH=%s/" //phone
>                          VENDOR_URL
371,383c400,412
<                   "</pap>\r\n\r\n"         
<                   "--asdlfkjiurwgasf\r\n"
<                   "Content-Type: text/vnd.wap.si\r\n\r\n"
<                   "<?xml version=\"1.0\"?>"
<                   "<!DOCTYPE si PUBLIC \"-//WAPFORUM//DTD SI 1.0//EN\" "
<                     " \"http://www.wapforum.org/DTD/si.dtd\";>"
<                   "<si>"
<                       "<indication href=\"http://wap.iobox.fi\"";
<                           " si-id=\"[EMAIL PROTECTED]""
<                           " action=\"signal-high\""
<                           " created=\"1999-06-25T15:23:15Z\""
<                           " si-expires=\"2002-12-30T00:00:00Z\">"
<                           "Want to test a fetch?"
---
>                          "</pap>\r\n\r\n"         
>                          "--asdlfkjiurwgasf\r\n"
>                          "Content-Type: text/vnd.wap.si\r\n\r\n"
>                          "<?xml version=\"1.0\"?>"
>                          "<!DOCTYPE si PUBLIC \"-//WAPFORUM//DTD SI 1.0//EN\" "
>                          " \"http://www.wapforum.org/DTD/si.dtd\";>"
>                          "<si>"
>                          "<indication href=\"%s\"" //target url
>                                     " si-id=\"%s\"" // signatur
>                                     " action=\"signal-high\"" 
>                                     " created=\"%s\"" // date 2
>                                     " si-expires=\"%s\">" // expire 2
>                                     "%s" // Message text
385,387c414,426
<                    "</si>\r\n\r\n"
<                  "--asdlfkjiurwgasf--\r\n\r\n"
<                  "");
---
>                          "</si>\r\n\r\n"
>                          "--asdlfkjiurwgasf--\r\n\r\n"
>                          "",
>                          (char*)actual_time_str,
>                          (char*)expire_time_str,
>                          phonenumber,
>                          target_url,
>                          signature, // [EMAIL PROTECTED]
>                          (char*)actual_time_str,
>                          (char*)expire_time_str,
>                          message_text); //Want to test a fetch?
>               push_content = octstr_create(request);
>                                                                
731d769
<     info(0, "flag -b is set, too");
732a771,774
>     info(0, "-P Specify Phonenumber");
>     info(0, "-U Specify targetUrl");
>     info(0, "-I Specify sIgnature");
>     info(0, "-M Specify Messagetext");
762c804
<     while ((opt = getopt(argc, argv, "HhBbnEpv:qr:t:c:a:i:e:k:d:s:S:")) != EOF) {
---
>     while ((opt = getopt(argc, argv, "HhBbnEpv:qr:t:c:a:i:e:k:d:s:S:P:U:I:M:")) != 
> EOF) {
788a831,846
>           break;
> 
>           case 'P':
>                 phonenumber=optarg;
>           break;
> 
>           case 'U':
>                 target_url=optarg;
>           break;
> 
>           case 'I':
>                 signature=optarg;
>           break;
> 
>           case 'M':
>                 message_text=optarg;

Reply via email to