1
/* $Id: msg_err_test.c 4712 2014-01-23 08:09:29Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
#define THIS_FILE "msg_err_test.c"
27
static pj_bool_t verify_success(pjsip_msg *msg,
28
pjsip_parser_err_report *err_list)
31
PJ_UNUSED_ARG(err_list);
36
static struct test_entry
39
pj_bool_t (*verify)(pjsip_msg *msg,
40
pjsip_parser_err_report *err_list);
44
/* Syntax error in status line */
52
/* Syntax error in header */
61
/* Multiple syntax errors in headers */
73
int msg_err_test(void)
78
PJ_LOG(3,(THIS_FILE, "Testing parsing error"));
80
pool = pjsip_endpt_create_pool(endpt, "msgerrtest", 4000, 4000);
82
for (i=0; i<PJ_ARRAY_SIZE(test_entries); ++i) {
83
pjsip_parser_err_report err_list, *e;
85
PJ_LOG(3,(THIS_FILE, " Parsing msg %d", i));
86
pj_list_init(&err_list);
87
pjsip_parse_msg(pool, test_entries[i].msg,
88
strlen(test_entries[i].msg), &err_list);
91
while (e != &err_list) {
93
" reported syntax error at line %d col %d for %.*s",
101
pj_pool_release(pool);