10 #include "../misc/coding/coding.h" 18 Buffer[(*Length)++] = 0x87;
19 Buffer[(*Length)++] = ID;
20 Buffer[(*Length)++] = 0x11;
21 Buffer[(*Length)++] = 0x03;
23 Buffer[(*Length)++] = Text[i];
25 Buffer[(*Length)++] = 0x00;
26 Buffer[(*Length)++] = 0x01;
32 Buffer[(*Length)++] = 0x87;
33 Buffer[(*Length)++] = ID;
34 Buffer[(*Length)++] = Value;
35 Buffer[(*Length)++] = 0x01;
44 unsigned char buffer[400];
46 Buffer[(*Length)++] = 0x01;
47 Buffer[(*Length)++] = 0x06;
48 Buffer[(*Length)++] = 0x2C;
49 strcpy(Buffer+(*Length),
"\x1F\x2A");
50 (*Length)=(*Length)+2;
51 strcpy(Buffer+(*Length),
"application/x-wap-prov.browser-settings");
52 (*Length)=(*Length)+39;
53 Buffer[(*Length)++] = 0x00;
54 strcpy(Buffer+(*Length),
"\x81\xEA");
55 (*Length)=(*Length)+2;
56 strcpy(Buffer+(*Length),
"\x01\x01");
57 (*Length)=(*Length)+2;
58 Buffer[(*Length)++] = 0x6A;
59 Buffer[(*Length)++] = 0x00;
61 Buffer[(*Length)++] = 0x45;
62 Buffer[(*Length)++] = 0xC6;
63 Buffer[(*Length)++] = 0x06;
64 Buffer[(*Length)++] = 0x01;
65 switch (settings->
Bearer) {
122 switch (settings->
Speed) {
159 Buffer[(*Length)++] = 0x01;
162 Buffer[(*Length)++] = 0x86;
164 Buffer[(*Length)++] = 0x7C;
166 Buffer[(*Length)++] = 0x07;
168 Buffer[(*Length)++] = 0x11;
169 Buffer[(*Length)++] = 0x03;
171 for (i=0;i<(int)strlen(buffer);i++) {
172 Buffer[(*Length)++] = buffer[i];
174 Buffer[(*Length)++] = 0x00;
175 Buffer[(*Length)++] = 0x01;
178 Buffer[(*Length)++] = 0xC6;
179 Buffer[(*Length)++] = 0x08;
180 Buffer[(*Length)++] = 0x01;
183 Buffer[(*Length)++] = 0x01;
184 Buffer[(*Length)++] = 0x01;
192 unsigned char buffer[100];
194 Buffer[(*Length)++] = 0x01;
195 Buffer[(*Length)++] = 0x06;
196 Buffer[(*Length)++] = 0x2D;
197 strcpy(Buffer+(*Length),
"\x1F\x2B");
198 (*Length)=(*Length)+2;
199 strcpy(Buffer+(*Length),
"application/x-wap-prov.browser-bookmarks");
200 (*Length)=(*Length)+40;
201 Buffer[(*Length)++] = 0x00;
202 strcpy(Buffer+(*Length),
"\x81\xEA");
203 (*Length)=(*Length)+2;
206 Buffer[(*Length)++] = 0x01;
207 Buffer[(*Length)++] = 0x01;
208 Buffer[(*Length)++] = 0x6A;
209 Buffer[(*Length)++] = 0x00;
211 Buffer[(*Length)++] = 0x45;
213 Buffer[(*Length)++] = 0xC6;
214 Buffer[(*Length)++] = 0x7F;
215 Buffer[(*Length)++] = 0x01;
224 Buffer[(*Length)++] = 0x01;
225 Buffer[(*Length)++] = 0x01;
237 Buffer[(*Length)++] = 0x01;
238 Buffer[(*Length)++] = 0x06;
239 Buffer[(*Length)++] = 0x01;
240 Buffer[(*Length)++] = 0xAE;
242 Buffer[(*Length)++] = 0x02;
243 Buffer[(*Length)++] = 0x05;
244 Buffer[(*Length)++] = 0x6A;
245 Buffer[(*Length)++] = 0x00;
246 Buffer[(*Length)++] = 0x45;
247 Buffer[(*Length)++] = 0xC6;
248 Buffer[(*Length)++] = 0x0B;
249 Buffer[(*Length)++] = 0x03;
251 for (i = 0; i < len; i++) {
252 Buffer[(*Length)++] = URL[i];
254 Buffer[(*Length)++] = 0x00;
257 Buffer[(*Length)++] = 0x0A;
258 Buffer[(*Length)++] = 0xC3;
259 Buffer[(*Length)++] = 0x07;
260 Buffer[(*Length)++] = 0x20;
261 Buffer[(*Length)++] = 0x08;
262 Buffer[(*Length)++] = 0x12;
263 Buffer[(*Length)++] = 0x10;
264 Buffer[(*Length)++] = 0x00;
265 Buffer[(*Length)++] = 0x00;
266 Buffer[(*Length)++] = 0x00;
268 Buffer[(*Length)++] = 0x10;
269 Buffer[(*Length)++] = 0xC3;
270 Buffer[(*Length)++] = 0x04;
271 Buffer[(*Length)++] = 0x20;
272 Buffer[(*Length)++] = 0x10;
273 Buffer[(*Length)++] = 0x06;
274 Buffer[(*Length)++] = 0x25;
277 Buffer[(*Length)++] = 0x01;
278 Buffer[(*Length)++] = 0x03;
280 for (i = 0; i < len; i++) {
281 Buffer[(*Length)++] = Text[i];
283 Buffer[(*Length)++] = 0x00;
284 Buffer[(*Length)++] = 0x01;
285 Buffer[(*Length)++] = 0x01;
290 *Length+=sprintf(Buffer+(*Length),
"BEGIN:VBKM%c%c",13,10);
291 *Length+=sprintf(Buffer+(*Length),
"VERSION:1.0%c%c",13,10);
294 *Length+=sprintf(Buffer+(*Length),
"BEGIN:ENV%c%c",13,10);
295 *Length+=sprintf(Buffer+(*Length),
"X-IRMC-URL;QUOTED-PRINTABLE:=%c%c",13,10);
296 *Length+=sprintf(Buffer+(*Length),
"[InternetShortcut] =%c%c",13,10);
298 *Length+=sprintf(Buffer+(*Length),
"END:ENV%c%c",13,10);
299 *Length+=sprintf(Buffer+(*Length),
"END:VBKM%c%c",13,10);
309 unsigned char buffer[200];
318 Buffer[(*Length)++] = 0xe6;
320 Buffer[(*Length)++] = 0x06;
322 Buffer[(*Length)++] = 0x22;
324 strcpy(Buffer+(*Length),
"application/vnd.wap.mms-message");
325 (*Length)=(*Length)+31;
326 Buffer[(*Length)++] = 0x00;
329 Buffer[(*Length)++] = 0xaf;
330 Buffer[(*Length)++] = 0x84;
337 Buffer[(*Length)++] = 0x8c;
339 Buffer[(*Length)++] = 0x82;
342 Buffer[(*Length)++] = 0x98;
343 i = strlen(Indicator->
Address);
344 while (Indicator->
Address[i] !=
'/' && i!=0) i--;
345 strcpy(Buffer+(*Length),Indicator->
Address+i+1);
346 (*Length)=(*Length)+strlen(Indicator->
Address+i+1);
347 Buffer[(*Length)++] = 0x00;
350 Buffer[(*Length)++] = 0x8d;
352 Buffer[(*Length)++] = 0x92;
355 switch (Indicator->
Class) {
360 Buffer[(*Length)++] = 0x8a;
361 Buffer[(*Length)++] = 0x80;
364 Buffer[(*Length)++] = 0x8a;
365 Buffer[(*Length)++] = 0x81;
368 Buffer[(*Length)++] = 0x8a;
369 Buffer[(*Length)++] = 0x82;
372 Buffer[(*Length)++] = 0x8a;
373 Buffer[(*Length)++] = 0x83;
379 Buffer[(*Length)++] = 0x8e;
381 Buffer[(*Length)++] = 0x04;
382 Buffer[(*Length)++] = ((long)Indicator->
MessageSize >> 24) & 0xff;
383 Buffer[(*Length)++] = ((long)Indicator->
MessageSize >> 16) & 0xff;
384 Buffer[(*Length)++] = ((long)Indicator->
MessageSize >> 8) & 0xff;
385 Buffer[(*Length)++] = ((long)Indicator->
MessageSize >> 0) & 0xff;
389 Buffer[(*Length)++] = 0x89;
390 sprintf(buffer,
"%s/TYPE=PLMN",Indicator->
Sender);
392 Buffer[(*Length)++] = (
unsigned char)(strlen(buffer) + 2);
394 Buffer[(*Length)++] = 0x80;
395 strcpy(Buffer+(*Length),buffer);
396 (*Length)=(*Length)+strlen(buffer);
398 Buffer[(*Length)++] = 0x00;
401 Buffer[(*Length)++] = 0x96;
402 strcpy(Buffer+(*Length),Indicator->
Title);
403 (*Length)=(*Length)+strlen(Indicator->
Title);
404 Buffer[(*Length)++] = 0x00;
406 strcpy(Buffer+(*Length),
"\x88\x05\x81\x03\x02\xA3\xA3");
407 (*Length)=(*Length)+7;
410 Buffer[(*Length)++] = 0x83;
411 strcpy(Buffer+(*Length),Indicator->
Address);
412 (*Length)=(*Length)+strlen(Indicator->
Address);
413 Buffer[(*Length)++] = 0x00;
442 strcat(buffer,
"text/plain");
445 strcat(buffer,
"text/x-vCalendar");
448 strcat(buffer,
"text/x-vCard");
451 strcat(buffer,
"image/gif");
454 strcat(buffer,
"image/jpeg");
457 strcat(buffer,
"application/vnd.wap.multipart.mixed");
460 strcat(buffer,
"application/vnd.wap.multipart.related");
463 sprintf(tmpbuf,
"application/x-%d", type);
464 strcat(buffer, tmpbuf);
473 int i,len2,len3,value2;
477 char buff[200],buff2[200];
481 if (pos > file->
Used)
break;
482 if (!(file->
Buffer[pos] & 0x80))
break;
483 switch (file->
Buffer[pos++] & 0x7F) {
490 while (file->
Buffer[pos]!=0x00) {
491 buff[i++] = file->
Buffer[pos++];
495 if (strstr(buff,
"/TYPE=PLMN")!=NULL) {
496 buff[strlen(buff)-10] = 0;
506 smfprintf(di,
" Content location : not done yet\n");
511 if (file->
Buffer[pos] <= 0x1E) {
512 len2 = file->
Buffer[pos++];
513 type = file->
Buffer[pos++] & 0x7f;
517 switch (file->
Buffer[pos+i]) {
519 strcat(buff,
"; type=");
521 while (file->
Buffer[pos+i]!=0x00) {
522 buff[strlen(buff)+1] = 0;
523 buff[strlen(buff)] = file->
Buffer[pos+i];
529 strcat(buff,
"; start=");
531 while (file->
Buffer[pos+i]!=0x00) {
532 buff[strlen(buff)+1] = 0;
533 buff[strlen(buff)] = file->
Buffer[pos+i];
544 }
else if (file->
Buffer[pos] == 0x1F) {
546 len2 = file->
Buffer[pos++];
547 type = file->
Buffer[pos++] & 0x7f;
552 switch (file->
Buffer[pos+i]) {
554 strcat(buff,
"; type=");
556 while (file->
Buffer[pos+i]!=0x00) {
557 buff[strlen(buff)+1] = 0;
558 buff[strlen(buff)] = file->
Buffer[pos+i];
564 strcat(buff,
"; start=");
566 while (file->
Buffer[pos+i]!=0x00) {
567 buff[strlen(buff)+1] = 0;
568 buff[strlen(buff)] = file->
Buffer[pos+i];
579 }
else if (file->
Buffer[pos] >= 0x20 && file->
Buffer[pos] <= 0x7F) {
582 }
else if (file->
Buffer[pos] >= 0x80 && file->
Buffer[pos] < 0xFF) {
583 type = file->
Buffer[pos++] & 0x7f;
592 len2 = file->
Buffer[pos++];
593 for (i=0;i<len2;i++) {
595 value |= file->
Buffer[pos++];
606 switch(file->
Buffer[pos++]) {
623 switch (file->
Buffer[pos]) {
624 case 0x80:
smfprintf(di,
"date - ignored\n");
break;
625 case 0x81:
smfprintf(di,
"seconds - ignored\n");
break;
637 if (file->
Buffer[pos-1] == 128) {
639 len2=file->
Buffer[pos-2]-1;
640 for (i=0;i<len2;i++) {
641 buff[i] = file->
Buffer[pos++];
644 if (strstr(buff,
"/TYPE=PLMN")!=NULL) {
645 buff[strlen(buff)-10] = 0;
657 switch (file->
Buffer[pos++]) {
658 case 0x80:
smfprintf(di,
"personal\n");
break;
659 case 0x81:
smfprintf(di,
"advertisment\n");
break;
660 case 0x82:
smfprintf(di,
"informational\n");
break;
661 case 0x83:
smfprintf(di,
"auto\n");
break;
662 default :
smfprintf(di,
"unknown\n");
break;
667 while (file->
Buffer[pos]!=0x00) {
676 switch (file->
Buffer[pos++]) {
677 case 0x80: sprintf(info->
MSGType,
"m-send-req");
break;
678 case 0x81: sprintf(info->
MSGType,
"m-send-conf");
break;
679 case 0x82: sprintf(info->
MSGType,
"m-notification-ind");
break;
680 case 0x83: sprintf(info->
MSGType,
"m-notifyresp-ind");
break;
681 case 0x84: sprintf(info->
MSGType,
"m-retrieve-conf");
break;
682 case 0x85: sprintf(info->
MSGType,
"m-acknowledge-ind");
break;
683 case 0x86: sprintf(info->
MSGType,
"m-delivery-ind");
break;
689 value2 = file->
Buffer[pos] & 0x7F;
690 smfprintf(di,
" MMS version : %i.%i\n", (value2 & 0x70) >> 4, value2 & 0x0f);
694 smfprintf(di,
" Message size : ignored for now\n");
699 switch (file->
Buffer[pos++]) {
700 case 0x80:
smfprintf(di,
"low\n");
break;
701 case 0x81:
smfprintf(di,
"normal\n");
break;
702 case 0x82:
smfprintf(di,
"high\n");
break;
703 default :
smfprintf(di,
"unknown\n");
break;
708 switch(file->
Buffer[pos++]) {
709 case 0x80:
smfprintf(di,
"yes\n");
break;
715 smfprintf(di,
" Report allowed : not done yet\n");
718 smfprintf(di,
" Response status : not done yet\n");
721 smfprintf(di,
" Response text : not done yet\n");
724 smfprintf(di,
" Sender visibility : not done yet\n");
728 switch (file->
Buffer[pos++]) {
729 case 0x80:
smfprintf(di,
"expired\n");
break;
730 case 0x81:
smfprintf(di,
"retrieved\n");
break;
731 case 0x82:
smfprintf(di,
"rejected\n");
break;
732 case 0x83:
smfprintf(di,
"deferred\n");
break;
733 case 0x84:
smfprintf(di,
"unrecognized\n");
break;
741 if (file->
Buffer[pos+1]==0xEA) {
745 while (file->
Buffer[pos]!=0x00) {
746 buff[i++] = file->
Buffer[pos++];
756 while (file->
Buffer[pos]!=0x00) {
757 buff[i++] = file->
Buffer[pos++];
760 if (strstr(buff,
"/TYPE=PLMN")!=NULL) {
761 buff[strlen(buff)-10] = 0;
773 while (file->
Buffer[pos]!=0x00) {
787 if (type != 35 && type != 51)
return ERR_NONE;
792 value |= file->
Buffer[pos] & 0x7F;
794 if (!(file->
Buffer[pos-1] & 0x80))
break;
800 for (j=0;j<parts;j++) {
804 value |= file->
Buffer[pos] & 0x7F;
806 if (!(file->
Buffer[pos-1] & 0x80))
break;
814 value |= file->
Buffer[pos] & 0x7F;
816 if (!(file->
Buffer[pos-1] & 0x80))
break;
818 smfprintf(di,
", data len: %li\n",value);
825 if (file->
Buffer[pos] >= 0x80) {
826 type = file->
Buffer[pos] & 0x7f;
828 }
else if (file->
Buffer[pos+i] == 0x1F) {
833 if (!(file->
Buffer[pos+i] & 0x80)) {
834 while (file->
Buffer[pos+i]!=0x00) {
835 buff[strlen(buff)+1] = 0;
836 buff[strlen(buff)] = file->
Buffer[pos+i];
841 value = file->
Buffer[pos+i] & 0x7F;
845 }
else if (file->
Buffer[pos+i] < 0x1F) {
847 if (file->
Buffer[pos+i] & 0x80) {
848 type = file->
Buffer[pos+i] & 0x7f;
852 while (file->
Buffer[pos+i]!=0x00) {
853 buff[strlen(buff)+1] = 0;
854 buff[strlen(buff)] = file->
Buffer[pos+i];
860 while (file->
Buffer[pos+i]!=0x00) {
861 buff[strlen(buff)+1] = 0;
862 buff[strlen(buff)] = file->
Buffer[pos+i];
874 switch (file->
Buffer[pos+i]) {
884 while (file->
Buffer[pos+i]!=0x00) {
885 buff2[strlen(buff2)+1] = 0;
886 buff2[strlen(buff2)] = file->
Buffer[pos+i];
892 while (file->
Buffer[pos+i]!=0x00) i++;
895 strcpy(buff,
"; type=");
897 while (file->
Buffer[pos+i]!=0x00) {
898 buff[strlen(buff)+1] = 0;
899 buff[strlen(buff)] = file->
Buffer[pos+i];
905 strcpy(buff,
"; type=");
907 while (file->
Buffer[pos+i]!=0x00) {
908 buff[strlen(buff)+1] = 0;
909 buff[strlen(buff)] = file->
Buffer[pos+i];
918 while (file->
Buffer[pos+i]!=0x00) {
919 buff[strlen(buff)+1] = 0;
920 buff[strlen(buff)] = file->
Buffer[pos+i];
927 while (file->
Buffer[pos+i]!=0x00) i++;
934 while (file->
Buffer[pos+i]!=0x00) {
935 buff[strlen(buff)+1] = 0;
936 buff[strlen(buff)] = file->
Buffer[pos+i];
char IPAddress[(20+1) *2]
gboolean IsNormalAuthentication
unsigned char Name[2 *(GSM_MAX_FILENAME_LENGTH+1)]
char * DecodeUnicodeString(const unsigned char *src)
void GSM_AddWAPMIMEType(int type, char *buffer)
unsigned char MSGType[50]
void GSM_EncodeMMSIndicatorSMSText(unsigned char *Buffer, size_t *Length, GSM_MMSIndicator *Indicator)
void NOKIA_EncodeWAPMMSSettingsSMSText(unsigned char *Buffer, size_t *Length, GSM_WAPSettings *settings, gboolean MMS)
size_t UnicodeLength(const unsigned char *str)
static void AddWAPSMSParameterInt(unsigned char *Buffer, size_t *Length, unsigned char ID, unsigned char Value)
unsigned char Source[200]
void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, size_t *Length, GSM_WAPBookmark *bookmark)
GSM_Error GSM_ClearMMSMultiPart(GSM_EncodedMultiPartMMSInfo *info)
unsigned char ContentType[400]
WAPSettings_Bearer Bearer
static void AddWAPSMSParameterText(unsigned char *Buffer, size_t *Length, unsigned char ID, char *Text, int Len)
MMSAddressType DestinationType
gboolean MMSReportAvailable
void Fill_GSM_DateTime(GSM_DateTime *Date, time_t timet)
gboolean DateTimeAvailable
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
GSM_Error GSM_EncodeURLFile(unsigned char *Buffer, size_t *Length, GSM_WAPBookmark *bookmark)
unsigned char ContentType[400]
unsigned char Subject[200]
char * OSDateTime(GSM_DateTime dt, gboolean TimeZone)
void GSM_EncodeWAPIndicatorSMSText(unsigned char *Buffer, size_t *Length, char *Text, char *URL)
GSM_Error GSM_DecodeMMSFileToMultiPart(GSM_Debug_Info *di, GSM_File *file, GSM_EncodedMultiPartMMSInfo *info)
unsigned char Destination[200]
unsigned char Title[(50+1) *2]
int smfprintf(GSM_Debug_Info *d, const char *format,...)
gboolean EncodeUTF8(char *dest, const unsigned char *src)
char HomePage[(100+1) *2]
unsigned char Address[(255+1) *2]
MMSAddressType SourceType
#define GSM_MAX_MULTI_MMS
GSM_EncodedMultiPartMMSEntry Entries[GSM_MAX_MULTI_MMS]