2 * $Id: parse_cseq.c,v 1.6 2004/08/24 09:01:25 janakj Exp $
4 * Copyright (C) 2001-2003 FhG Fokus
6 * This file is part of ser, a free SIP server.
8 * ser is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version
13 * For a license to use the ser software under conditions
14 * other than those described here, or to purchase support for this
15 * software, please contact iptel.org by e-mail at the following addresses:
18 * ser is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 * 2003-02-28 scratchpad compatibility abandoned (jiri)
30 * 2003-01-22 zero-termination in CSeq eliminated (jiri)
34 #include "../comp_defs.h"
35 #include "parse_cseq.h"
36 #include "parser_f.h" /* eat_space_end and so on */
37 #include "../dprint.h"
38 #include "parse_def.h"
39 #include "../mem/mem.h"
42 * Parse CSeq header field
46 char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
50 cb->error=PARSE_ERROR;
54 t=eat_token_end(t, end);
55 if (t>=end) goto error;
56 cb->number.len=t-cb->number.s;
58 m=eat_space_end(t, end);
59 m_end=eat_token_end(m, end);
62 LOG(L_ERR, "ERROR: parse_cseq: "
63 "method terminated unexpectedly\n");
68 LOG(L_ERR, "ERROR:parse_cseq: no method found\n");
73 cb->method.len=t-cb->method.s;
75 /* there may be trailing LWS
76 * (it was not my idea to put it in SIP; -jiri )
78 t=eat_lws_end(t, end);
79 /*check if the header ends here*/
81 LOG(L_ERR, "ERROR: parse_cseq: strange EoHF\n");
84 if (*t=='\r' && t+1<end && *(t+1)=='\n') {
92 LOG(L_ERR, "ERROR: CSeq EoL expected\n");
95 LOG(L_ERR, "ERROR: parse_cseq: bad cseq\n");
100 void free_cseq(struct cseq_body* cb)