00001 /* 00002 * $Id: parse_privacy.h 4720 2008-08-23 10:56:15Z henningw $ 00003 * 00004 * Copyright (c) 2006 Juha Heinanen 00005 * 00006 * This file is part of Kamailio, a free SIP server. 00007 * 00008 * Kamailio 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 * Kamailio 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 00023 /*! 00024 * \file 00025 * \brief Privacy value parser 00026 * \ingroup parser 00027 */ 00028 00029 #ifndef PARSE_PRIVACY_H 00030 #define PARSE_PRIVACY_H 00031 00032 #include "../mem/mem.h" 00033 #include "msg_parser.h" 00034 00035 00036 /*! bitmap of Privacy header privacy values 00037 * (http://www.iana.org/assignments/sip-priv-values) 00038 */ 00039 enum privacy_value { 00040 PRIVACY_USER=1, 00041 PRIVACY_HEADER=2, 00042 PRIVACY_SESSION=4, 00043 PRIVACY_NONE=8, 00044 PRIVACY_CRITICAL=16, 00045 PRIVACY_ID=32, 00046 PRIVACY_HISTORY=64 00047 }; 00048 00049 00050 /*! 00051 * casting macro for accessing enumeration of priv-values 00052 */ 00053 #define get_privacy_values(p_msg) \ 00054 ((unsigned int)(long)((p_msg)->privacy->parsed)) 00055 00056 00057 /*! 00058 * This method is used to parse Privacy HF body, which consist of 00059 * comma separated list of priv-values. After parsing, msg->privacy->parsed 00060 * contains enum bits of privacy values defined in parse_privacy.h. 00061 * \return 0 on success and -1 on failure. 00062 */ 00063 int parse_privacy(struct sip_msg *msg); 00064 00065 00066 /*! 00067 * Parse a privacy value pointed by start that can be at most max_len long. 00068 * \return length of matched privacy value on success or NULL otherwise 00069 */ 00070 unsigned int parse_priv_value(char* start, unsigned int max_len, 00071 unsigned int* value); 00072 00073 00074 #endif /* PARSE_PRIVACY_H */
1.5.6