1 /*
2  * Copyright (c) 2007 iptelorg GmbH
3  *
4  * This file is part of Kamailio, a free SIP server.
5  *
6  * Kamailio 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
10  *
11  * Kamailio 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.
15  *
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20 
21 /*! \file
22  * \brief Parser :: Parse Identity-info header field
23  *
24  * \ingroup parser
25  */
26 
27 #ifndef PARSE_IDENTITYNFO
28 #define PARSE_IDENTITYNFO
29 
30 #include "../str.h"
31 #include "msg_parser.h"
32 
33 enum {
34 	II_START,
35 	II_URI_BEGIN,
36 	II_URI_DOMAIN,
37 	II_URI_IPV4,
38 	II_URI_IPV6,
39 	II_URI_PATH,
40 	II_URI_END,
41 	II_LWS,
42 	II_LWSCR,
43 	II_LWSCRLF,
44 	II_LWSCRLFSP,
45 	II_SEMIC,
46 	II_TAG,
47 	II_EQUAL,
48 	II_TOKEN,
49 	II_ENDHEADER
50 };
51 
52 enum {
53 	II_M_START,
54 	II_M_URI_BEGIN,
55 	II_M_URI_END,
56 	II_M_SEMIC,
57 	II_M_TAG,
58 	II_M_EQUAL,
59 	II_M_TOKEN
60 };
61 
62 #define ZSW(_c) ((_c)?(_c):"")
63 
64 struct identityinfo_body {
65 	int error;  	/* Error code */
66 	str uri;    	/* URI */
67 	str domain; 	/* Domain part of the URI */
68 	str alg; 		/* Identity-Info header field MUST contain an 'alg' parameter */
69 };
70 
71 
72 /* casting macro for accessing IDENTITY-INFO body */
73 #define get_identityinfo(p_msg) ((struct identityinfo_body*)(p_msg)->identity_info->parsed)
74 
75 
76 /*
77  * Parse Identity-Info header field
78  */
79 void parse_identityinfo(char *buffer, char* end, struct identityinfo_body *ii_b);
80 int parse_identityinfo_header(struct sip_msg *msg);
81 
82 /*
83  * Free all associated memory
84  */
85 void free_identityinfo(struct identityinfo_body *ii_b);
86 
87 
88 #endif
89