parse_identityinfo.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Copyright (c) 2007 iptelorg GmbH
00005  *
00006  * This file is part of ser, a free SIP server.
00007  *
00008  * ser is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * ser is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  */
00022 
00029 #ifndef PARSE_IDENTITYNFO
00030 #define PARSE_IDENTITYNFO
00031 
00032 #include "../str.h"
00033 #include "msg_parser.h"
00034 
00035 enum {
00036         II_START,
00037         II_URI_BEGIN,
00038         II_URI_DOMAIN,
00039         II_URI_IPV4,
00040         II_URI_IPV6,
00041         II_URI_PATH,
00042         II_URI_END,
00043         II_LWS,
00044         II_LWSCR,
00045         II_LWSCRLF,
00046         II_LWSCRLFSP,
00047         II_SEMIC,
00048         II_TAG,
00049         II_EQUAL,
00050         II_TOKEN,
00051         II_ENDHEADER
00052 };
00053 
00054 enum {
00055         II_M_START,
00056         II_M_URI_BEGIN,
00057         II_M_URI_END,
00058         II_M_SEMIC,
00059         II_M_TAG,
00060         II_M_EQUAL,
00061         II_M_TOKEN
00062 };
00063 
00064 #define ZSW(_c) ((_c)?(_c):"")
00065 
00066 struct identityinfo_body {
00067         int error;      /* Error code */
00068         str uri;        /* URI */
00069         str domain;     /* Domain part of the URI */
00070         str alg;                /* Identity-Info header field MUST contain an 'alg' parameter */
00071 };
00072 
00073 
00074 /* casting macro for accessing IDENTITY-INFO body */
00075 #define get_identityinfo(p_msg) ((struct identityinfo_body*)(p_msg)->identity_info->parsed)
00076 
00077 
00078 /*
00079  * Parse Identity-Info header field
00080  */
00081 void parse_identityinfo(char *buffer, char* end, struct identityinfo_body *ii_b);
00082 int parse_identityinfo_header(struct sip_msg *msg);
00083 
00084 /*
00085  * Free all associated memory
00086  */
00087 void free_identityinfo(struct identityinfo_body *ii_b);
00088 
00089 
00090 #endif