Change license to APLv2.0
[platform/core/messaging/msg-service.git] / utils / MsgUtilFunction.cpp
1 /*
2  * msg-service
3  *
4  * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18 */
19
20 #include "MsgDebug.h"
21 #include "MsgUtilFunction.h"
22
23  /*==================================================================================================
24                                      FUNCTION IMPLEMENTATION
25 ==================================================================================================*/
26
27 // Encoders
28 int MsgEncodeCountInfo(MSG_COUNT_INFO_S *pCountInfo, char **ppDest)
29 {
30         int dataSize = 0;
31
32         dataSize = sizeof(MSG_COUNT_INFO_S);
33
34         *ppDest = (char*)new char[dataSize];
35
36         void* p = (void*)*ppDest;
37
38         memcpy(p, pCountInfo, dataSize);
39
40         return dataSize;
41 }
42
43
44 int MsgEncodeRecipientList(MSG_RECIPIENTS_LIST_S *pRecipientList, char **ppDest)
45 {
46         int count = 0, dataSize = 0;
47
48         count = pRecipientList->recipientCnt;
49         dataSize = sizeof(int) + (sizeof(MSG_ADDRESS_INFO_S)*count);
50
51         *ppDest = (char*)new char[dataSize];
52
53         void* p = (void*)*ppDest;
54
55         memcpy(p, &count, sizeof(int));
56         p = (void*)((char*)p + sizeof(int));
57
58         for (int i = 0; i < count; i++)
59         {
60                 memcpy(p, &(pRecipientList->recipientAddr[i]), sizeof(MSG_ADDRESS_INFO_S));
61                 p = (void*)((char*)p + sizeof(MSG_ADDRESS_INFO_S));
62         }
63
64         return dataSize;
65 }
66
67
68 int MsgEncodeCountByMsgType(int MsgCount, char **ppDest)
69 {
70         int dataSize = 0;
71
72         dataSize = sizeof(int);
73
74         *ppDest = (char*)new char[dataSize];
75
76         void* p = (void*)*ppDest;
77
78         memcpy(p, &MsgCount, dataSize);
79
80         return dataSize;
81 }
82
83
84 int MsgEncodeMsgId(msg_message_id_t *pMsgId, char **ppDest)
85 {
86         int dataSize = 0;
87
88         dataSize = (sizeof(msg_message_id_t));
89
90         *ppDest = (char*)new char[dataSize];
91
92         void* p = (void*)*ppDest;
93
94         memcpy(p, pMsgId, dataSize);
95
96         return dataSize;
97 }
98
99
100 int MsgEncodeMsgInfo(MSG_MESSAGE_INFO_S *pMsgInfo, char **ppDest)
101 {
102         int dataSize = 0;
103
104         dataSize = sizeof(MSG_MESSAGE_INFO_S);
105
106         *ppDest = (char*)new char[dataSize];
107
108         void* p = (void*)*ppDest;
109
110         memcpy(p, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S));
111
112         p = (void*)((char*)p + sizeof(MSG_MESSAGE_INFO_S));
113
114         return dataSize;
115 }
116
117
118 int MsgEncodeMsgInfo(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo, char **ppDest)
119 {
120         int dataSize = 0;
121
122         dataSize = (sizeof(MSG_MESSAGE_INFO_S) + sizeof(MSG_SENDINGOPT_INFO_S));
123
124         *ppDest = (char*)new char[dataSize];
125
126         void* p = (void*)*ppDest;
127
128         memcpy(p, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S));
129
130         p = (void*)((char*)p + sizeof(MSG_MESSAGE_INFO_S));
131
132         memcpy(p, pSendOptInfo, sizeof(MSG_SENDINGOPT_INFO_S));
133
134         return dataSize;
135 }
136
137 int MsgEncodeFolderList(msg_struct_list_s *pFolderList, char **ppDest)
138 {
139         int count = 0, dataSize = 0;
140
141         count = pFolderList->nCount;
142         dataSize = sizeof(int) + (sizeof(MSG_FOLDER_INFO_S)*count);
143
144         *ppDest = (char*)new char[dataSize];
145
146         void* p = (void*)*ppDest;
147
148         memcpy(p, &count, sizeof(int));
149         p = (void*)((char*)p + sizeof(int));
150
151         msg_struct_s *folder_info = NULL;
152
153         for (int i = 0; i < count; i++)
154         {
155                 folder_info = (msg_struct_s *)pFolderList->msg_struct_info[i];
156                 memcpy(p, folder_info->data, sizeof(MSG_FOLDER_INFO_S));
157                 p = (void*)((char*)p + sizeof(MSG_FOLDER_INFO_S));
158         }
159
160         return dataSize;
161 }
162
163 int MsgEncodeFilterList(msg_struct_list_s *pFilterList, char **ppDest)
164 {
165         int count = 0, dataSize = 0;
166
167         count = pFilterList->nCount;
168         dataSize = sizeof(int) + (sizeof(MSG_FILTER_S)*count);
169
170         *ppDest = (char*)new char[dataSize];
171
172         void* p = (void*)*ppDest;
173
174         memcpy(p, &count, sizeof(int));
175         p = (void*)((char*)p + sizeof(int));
176
177         msg_struct_s *filter_info = NULL;
178
179         for (int i = 0; i < count; i++)
180         {
181                 filter_info = (msg_struct_s *)pFilterList->msg_struct_info[i];
182                 memcpy(p, filter_info->data, sizeof(MSG_FILTER_S));
183                 p = (void*)((char*)p + sizeof(MSG_FILTER_S));
184         }
185
186         return dataSize;
187 }
188
189
190 int MsgEncodeFilterFlag(bool *pSetFlag, char **ppDest)
191 {
192         int dataSize = 0;
193
194         dataSize = (sizeof(bool));
195
196         *ppDest = (char*)new char[dataSize];
197
198         void* p = (void*)*ppDest;
199
200         memcpy(p, pSetFlag, dataSize);
201
202         return dataSize;
203 }
204
205
206 int MsgEncodeMsgType(MSG_MESSAGE_TYPE_S *pMsgType, char **ppDest)
207 {
208         int dataSize = 0;
209
210         dataSize = (sizeof(MSG_MESSAGE_TYPE_S));
211
212         *ppDest = (char*)new char[dataSize];
213
214         void* p = (void*)*ppDest;
215
216         memcpy(p, pMsgType, dataSize);
217
218         return dataSize;
219 }
220
221
222 int MsgEncodeThreadViewList(msg_struct_list_s *pThreadViewList, char **ppDest)
223 {
224         int count = 0, dataSize = 0;
225
226         count = pThreadViewList->nCount;
227
228         dataSize = sizeof(int) + (sizeof(MSG_THREAD_VIEW_S)*count);
229
230         *ppDest = (char*)new char[dataSize];
231
232         void* p = (void*)*ppDest;
233
234         memcpy(p, &count, sizeof(int));
235         p = (void*)((char*)p + sizeof(int));
236
237         msg_struct_s *thread_info = NULL;
238
239         for (int i = 0; i < count; i++)
240         {
241                 thread_info = (msg_struct_s *)pThreadViewList->msg_struct_info[i];
242                 memcpy(p, thread_info->data, sizeof(MSG_THREAD_VIEW_S));
243                 p = (void*)((char*)p + sizeof(MSG_THREAD_VIEW_S));
244         }
245
246         return dataSize;
247 }
248
249
250 int MsgEncodeConversationViewList(msg_struct_list_s *pConvViewList, char **ppDest)
251 {
252         int count = 0, dataSize = 0;
253
254         count = pConvViewList->nCount;
255
256         dataSize = sizeof(int) + (sizeof(msg_struct_list_s)*count);
257
258         *ppDest = (char*)new char[dataSize];
259
260         void* p = (void*)*ppDest;
261
262         memcpy(p, &count, sizeof(int));
263         p = (void*)((char*)p + sizeof(int));
264
265         for (int i = 0; i < count; i++)
266         {
267                 memcpy(p, &(pConvViewList->msg_struct_info[i]), sizeof(msg_struct_list_s));
268                 p = (void*)((char*)p + sizeof(msg_struct_list_s));
269         }
270
271         return dataSize;
272 }
273
274
275 int MsgEncodeMsgGetContactCount(MSG_THREAD_COUNT_INFO_S *threadCountInfo, char **ppDest)
276 {
277         int dataSize = sizeof(int) + sizeof(int) + sizeof(int) + sizeof(int);
278
279         MSG_DEBUG("datasize = [%d] \n", dataSize);
280
281         *ppDest = (char*)new char[dataSize];
282
283         void* p = (void*)*ppDest;
284
285         memcpy(p, &(threadCountInfo->totalCount), sizeof(int));
286         p = (void*)((char*)p + sizeof(int));
287
288         memcpy(p, &(threadCountInfo->unReadCount), sizeof(int));
289         p = (void*)((char*)p + sizeof(int));
290
291         memcpy(p, &(threadCountInfo->mmsMsgCount), sizeof(int));
292         p = (void*)((char*)p + sizeof(int));
293
294         memcpy(p, &(threadCountInfo->smsMsgCount), sizeof(int));
295         p = (void*)((char*)p + sizeof(int));
296
297         return dataSize;
298 }
299
300 int MsgEncodeMemSize(unsigned int *memsize, char **ppDest)
301 {
302         int dataSize = 0;
303
304         dataSize = sizeof(unsigned int);
305
306         *ppDest = (char*)new char[dataSize];
307
308         void* p = (void*)*ppDest;
309
310         memcpy(p, memsize, dataSize);
311
312         return dataSize;
313 }
314
315
316 int MsgEncodeSyncMLOperationData(int msgId, int extId, char **ppDest)
317 {
318         int dataSize = 0;
319
320         dataSize = sizeof(int) + sizeof(int);
321
322         *ppDest = (char*)new char[dataSize];
323
324         void* p = (void*)*ppDest;
325
326         memcpy(p, &msgId, sizeof(int));
327         p = (void*)((char*)p + sizeof(int));
328
329         memcpy(p, &extId, sizeof(int));
330
331         return dataSize;
332 }
333
334
335 int MsgEncodeStorageChangeData(const msg_storage_change_type_t storageChangeType, const msg_id_list_s *pMsgIdList, char **ppDest)
336 {
337         int dataSize = 0;
338         int count = 0;
339
340         count = pMsgIdList->nCount;
341
342         dataSize = sizeof(msg_storage_change_type_t) + sizeof(int) + (sizeof(msg_message_id_t)*count);
343
344         *ppDest = (char*)new char[dataSize];
345
346         void* p = (void*)*ppDest;
347
348         memcpy(p, &storageChangeType, sizeof(msg_storage_change_type_t));
349         p = (void*)((char*)p + sizeof(msg_storage_change_type_t));
350
351         memcpy(p, &count, sizeof(int));
352         p = (void*)((char*)p + sizeof(int));
353
354         for (int i = 0; i < count; i++) {
355                 memcpy(p, &(pMsgIdList->msgIdList[i]), sizeof(msg_message_id_t));
356                 p = (void*)((char*)p + sizeof(msg_message_id_t));
357         }
358
359         return dataSize;
360 }
361
362
363 int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, int count, char **ppDest)
364 {
365         int dataSize = 0;
366
367         dataSize = (sizeof(MSG_REPORT_STATUS_INFO_S)*count + sizeof(int));
368
369         *ppDest = (char*)new char[dataSize];
370
371         void* p = (void*)*ppDest;
372
373         memcpy(p, &count, sizeof(int));
374
375         p = (void*)(p + sizeof(int));
376
377         memcpy(p, pReportStatus, sizeof(MSG_REPORT_STATUS_INFO_S)*count);
378
379         return dataSize;
380 }
381
382
383 int MsgEncodeThreadId(msg_thread_id_t *pThreadId, char **ppDest)
384 {
385         int dataSize = 0;
386
387         dataSize = (sizeof(msg_thread_id_t));
388
389         *ppDest = (char*)new char[dataSize];
390
391         void* p = (void*)*ppDest;
392
393         memcpy(p, pThreadId, dataSize);
394
395         return dataSize;
396 }
397
398
399 int MsgEncodeThreadInfo(MSG_THREAD_VIEW_S *pThreadInfo, char **ppDest)
400 {
401         int dataSize = 0;
402
403         dataSize = sizeof(MSG_THREAD_VIEW_S);
404
405         *ppDest = (char*)new char[dataSize];
406
407         void* p = (void*)*ppDest;
408
409         memcpy(p, pThreadInfo, sizeof(MSG_THREAD_VIEW_S));
410
411         p = (void*)((char*)p + sizeof(MSG_THREAD_VIEW_S));
412
413         return dataSize;
414 }
415
416
417
418 // Decoders
419 void MsgDecodeMsgId(char *pSrc, msg_message_id_t *pMsgId)
420 {
421         memcpy(pMsgId, pSrc, sizeof(msg_message_id_t));
422 }
423
424
425 void MsgDecodeCountInfo(char *pSrc, MSG_COUNT_INFO_S *pCountInfo)
426 {
427         memcpy(pCountInfo, pSrc, sizeof(MSG_COUNT_INFO_S));
428 }
429
430
431 void MsgDecodeMemSize(char *pSrc, unsigned int *memsize)
432 {
433         memcpy(memsize, pSrc, sizeof(unsigned int));
434 }
435
436
437 void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo)
438 {
439         memcpy(pMsgInfo, pSrc, sizeof(MSG_MESSAGE_INFO_S));
440
441         pSrc = pSrc + sizeof(MSG_MESSAGE_INFO_S);
442
443         memcpy(pSendOptInfo, pSrc, sizeof(MSG_SENDINGOPT_INFO_S));
444 }
445
446 void MsgDecodeRecipientList(char *pSrc, MSG_RECIPIENTS_LIST_S *pRecipientList)
447 {
448         int count = 0;
449
450         memcpy(&count, pSrc, sizeof(int));
451         pSrc = pSrc + sizeof(int);
452
453         pRecipientList->recipientCnt= count;
454         pRecipientList->recipientAddr = (MSG_ADDRESS_INFO_S*)new char[sizeof(MSG_ADDRESS_INFO_S)*count];
455
456         MSG_ADDRESS_INFO_S* pInfoTmp = pRecipientList->recipientAddr;
457
458         for (int i = 0; i < count; i++)
459         {
460                 memcpy(pInfoTmp, pSrc, sizeof(MSG_ADDRESS_INFO_S));
461                 pSrc = pSrc + sizeof(MSG_ADDRESS_INFO_S);
462                 pInfoTmp++;
463         }
464 }
465
466
467 void MsgDecodeFolderList(char *pSrc, msg_struct_list_s *pFolderList)
468 {
469         int count = 0;
470
471         memcpy(&count, pSrc, sizeof(int));
472         pSrc = pSrc + sizeof(int);
473
474         if( count > 0 )
475         {
476                 pFolderList->nCount = count;
477                 pFolderList->msg_struct_info = (msg_struct_t *)new char[sizeof(MSG_FOLDER_INFO_S *)*count];
478
479                 msg_struct_s *pInfoTmp = NULL;
480
481                 for (int i = 0; i < count; i++)
482                 {
483
484                         pFolderList->msg_struct_info[i] = (msg_struct_t )new char[sizeof(msg_struct_s)];
485                         pInfoTmp = (msg_struct_s *)pFolderList->msg_struct_info[i];
486                         pInfoTmp->type = MSG_STRUCT_FOLDER_INFO;
487                         pInfoTmp->data = new char[sizeof(MSG_FOLDER_INFO_S)];
488                         memcpy(pInfoTmp->data, pSrc, sizeof(MSG_FOLDER_INFO_S));
489                         pSrc = pSrc + sizeof(MSG_FOLDER_INFO_S);
490                 }
491         }
492         else if ( count == 0 )
493         {
494                 pFolderList->nCount = count;
495                 pFolderList->msg_struct_info = NULL;
496         }
497 }
498
499 void MsgDecodeFilterList(char *pSrc, msg_struct_list_s *pFilterList)
500 {
501         int count = 0;
502
503         memcpy(&count, pSrc, sizeof(int));
504         pSrc = pSrc + sizeof(int);
505
506         if( count > 0 )
507         {
508                 pFilterList->nCount = count;
509                 pFilterList->msg_struct_info = (msg_struct_t *)new char[sizeof(MSG_FILTER_S *)*count];
510
511                 msg_struct_s *pStructTmp = NULL;
512
513                 for (int i = 0; i < count; i++)
514                 {
515                         pFilterList->msg_struct_info[i] = (msg_struct_t )new char[sizeof(msg_struct_s)];
516                         pStructTmp = (msg_struct_s *)pFilterList->msg_struct_info[i];
517                         pStructTmp->type = MSG_STRUCT_FILTER;
518                         pStructTmp->data = new char[sizeof(MSG_FILTER_S)];
519                         memcpy(pStructTmp->data, pSrc, sizeof(MSG_FILTER_S));
520                         pSrc = pSrc + sizeof(MSG_FILTER_S);
521                 }
522         }
523         else if ( count == 0 )
524         {
525                 pFilterList->nCount = count;
526                 pFilterList->msg_struct_info = NULL;
527         }
528
529 }
530
531
532 void MsgDecodeFilterFlag(char *pSrc, bool *pSetFlag)
533 {
534         memcpy(pSetFlag, pSrc, sizeof(bool));
535 }
536
537
538 void MsgDecodeMsgType(char *pSrc, MSG_MESSAGE_TYPE_S* pMsgType)
539 {
540         memcpy(pMsgType, pSrc, sizeof(MSG_MESSAGE_TYPE_S));
541 }
542
543 void    MsgDecodeContactCount(char *pSrc,  MSG_THREAD_COUNT_INFO_S *pMsgThreadCountList)
544 {
545         int count = 0;
546
547         if(pSrc == NULL)
548                 return;
549
550         memcpy(&count, pSrc, sizeof(int));
551         pSrc = pSrc + sizeof(int);
552         pMsgThreadCountList->totalCount = count;
553
554
555         memcpy(&count, pSrc, sizeof(int));
556         pSrc = pSrc + sizeof(int);
557         pMsgThreadCountList->unReadCount        = count;
558
559
560         memcpy(&count, pSrc, sizeof(int));
561         pSrc = pSrc + sizeof(int);
562         pMsgThreadCountList->mmsMsgCount        = count;
563
564
565         memcpy(&count, pSrc, sizeof(int));
566         pSrc = pSrc + sizeof(int);
567         pMsgThreadCountList->smsMsgCount        = count;
568
569
570         return;
571 }
572
573
574 void MsgDecodeReportStatus(char *pSrc,  msg_struct_list_s *report_list)
575 {
576         int count = 0;
577
578         if(pSrc == NULL)
579                 return;
580
581         memcpy(&count, pSrc, sizeof(int));
582         pSrc = pSrc + sizeof(int);
583
584         report_list->nCount = count;
585
586         msg_struct_t *report_status =  (msg_struct_t *)new char[sizeof(msg_struct_t)*count];
587         for (int i = 0; i < count; i++) {
588
589                 msg_struct_s *report_status_item = new msg_struct_s;
590                 report_status_item->type = MSG_STRUCT_REPORT_STATUS_INFO;
591                 report_status_item->data = new MSG_REPORT_STATUS_INFO_S;
592                 memset(report_status_item->data, 0x00, sizeof(MSG_REPORT_STATUS_INFO_S));
593
594                 MSG_REPORT_STATUS_INFO_S *report_status_info =  (MSG_REPORT_STATUS_INFO_S *)report_status_item->data;
595                 memcpy(report_status_info, pSrc, sizeof(MSG_REPORT_STATUS_INFO_S));
596
597                 pSrc = pSrc + sizeof(MSG_REPORT_STATUS_INFO_S);
598
599                 report_status[i] = (msg_struct_t)report_status_item;
600
601                 MSG_DEBUG("Report_type = %d, status addr = %s, status = %d, time = %d",
602                                 report_status_info->type, report_status_info->addressVal,
603                                 report_status_info->status, report_status_info->statusTime);
604         }
605
606         report_list->msg_struct_info = report_status;
607         return;
608 }
609
610 void MsgDecodeThreadId(char *pSrc, msg_thread_id_t *pThreadId)
611 {
612         memcpy(pThreadId, pSrc, sizeof(msg_thread_id_t));
613 }
614
615 void MsgDecodeThreadInfo(char *pSrc, MSG_THREAD_VIEW_S *pThreadInfo)
616 {
617         memcpy(pThreadInfo, pSrc, sizeof(MSG_THREAD_VIEW_S));
618 }
619
620 // Event Encoder
621 int MsgMakeEvent(const void *pData, int DataSize, MSG_EVENT_TYPE_T MsgEvent, msg_error_t MsgError, void **ppEvent)
622 {
623         MSG_EVENT_S* pMsgEvent = NULL;
624
625         *ppEvent = (MSG_EVENT_S*)new char[sizeof(MSG_EVENT_S) + DataSize];
626
627         pMsgEvent = (MSG_EVENT_S*)*ppEvent;
628
629         pMsgEvent->eventType = MsgEvent;
630         pMsgEvent->result = MsgError;
631
632         MSG_DEBUG("eventType [%d : %s]", pMsgEvent->eventType, MsgDbgEvtStr(pMsgEvent->eventType));
633         MSG_DEBUG("result [%d]", pMsgEvent->result);
634
635         if (DataSize > 0)
636                 memcpy((void*)pMsgEvent->data, pData, DataSize);
637
638         return (sizeof(MSG_EVENT_S) + DataSize);
639 }
640
641 int msg_verify_number(const char *raw, char *trimmed)
642 {
643         if (!(raw && trimmed)) {
644                 MSG_DEBUG("Phone Number is NULL");
645                 return MSG_ERR_NULL_POINTER;
646         }
647
648         for (int i=0, j=0 ; raw[i] ; i++) {
649                 if ((raw[i] >= '0' && raw[i] <= '9') || raw[i] == '+' || raw[i] == ',' || raw[i] == ' ' \
650                                 || raw[i] == '*' ||  raw[i] == '#') {
651                         trimmed[j++] = raw[i];
652                 } else if (raw[i] == '-') {
653                         continue;
654                 } else {
655                         MSG_DEBUG("Unacceptable character in telephone number: [%c]", raw[i]);
656                         return MSG_ERR_INVALID_PARAMETER;
657                 }
658         }
659
660         MSG_DEBUG("Trimming [%s]->[%s]", raw, trimmed);
661         return MSG_SUCCESS;
662 }
663
664 int msg_verify_email(const char *raw)
665 {
666         bool onlyNum = true;
667         bool atExist = false;
668
669         if (!raw) {
670                 MSG_DEBUG("Email is NULL");
671                 return MSG_ERR_NULL_POINTER;
672         }
673
674         for (int i = 0; raw[i]; i++) {
675
676                 if (raw[i] == '@') {
677                         onlyNum = false;
678
679                         if (atExist == false) {
680                                 atExist = true;
681                                 continue;
682                         } else {
683                                 MSG_DEBUG("Character [@] is included more than twice in email address.");
684                                 return MSG_ERR_INVALID_PARAMETER;
685                         }
686                 }
687
688                 if ((raw[i] >= '0' && raw[i] <= '9') || raw[i] == '+' || raw[i] == '*' ||  raw[i] == '#') {
689                         continue;
690                 } else if ((raw[i] >= 'a' && raw[i] <= 'z') ||(raw[i] >= 'A' && raw[i] <= 'Z') ||(raw[i] == '.') || raw[i] == '_' || raw[i] == '-') {
691                         onlyNum = false;
692                         continue;
693                 } else if (raw[i] == ',') {
694                         if (onlyNum == false && atExist == false) {
695                                 MSG_DEBUG("Unacceptable type in address.");
696                                 return MSG_ERR_INVALID_PARAMETER;
697                         }
698                         atExist = false;
699                         onlyNum = true;
700                         continue;
701                 } else {
702                         MSG_DEBUG("Unacceptable character in address : [%c]", raw[i]);
703                         return MSG_ERR_INVALID_PARAMETER;
704                 }
705         }
706
707         return MSG_SUCCESS;
708 }