00001 /* 00002 * $Id: exec_hf.h 4518 2008-07-28 15:39:28Z henningw $ 00003 * 00004 * Copyright (C) 2001-2003 FhG Fokus 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 #ifndef _EXEC_HF_H 00024 #define _EXEC_HF_H 00025 00026 #include "../../parser/msg_parser.h" 00027 00028 /* prefix prepended to header field name in env var name */ 00029 #define SIP "SIP_" 00030 #define HF_PREFIX SIP "HF_" 00031 #define HF_PREFIX_LEN (sizeof(HF_PREFIX)-1) 00032 /* well known variable names */ 00033 #define EV_SRCIP SIP "SRCIP" 00034 #define EV_RURI SIP "RURI" 00035 #define EV_ORURI SIP "ORUI" 00036 #define EV_USER SIP "USER" 00037 #define EV_OUSER SIP "OUSER" 00038 #define EV_TID SIP "TID" 00039 #define EV_DID SIP "DID" 00040 /* env var assignment operator */ 00041 #define EV_ASSIGN '=' 00042 /* header field separator */ 00043 #define HF_SEPARATOR ',' 00044 /* RFC3261 -- characters legal in header names; a really 00045 * _bloated_ thing 00046 */ 00047 #define UNRESERVED_MARK "-_.!~*'()" 00048 #define HNV_UNRESERVED "[]/?:+$" 00049 #define ESCAPE '%' 00050 /* and this is what all such crazy symbols in header field 00051 * name will be replaced with in env vars */ 00052 #define HFN_SYMBOL '_' 00053 00054 #define VAR_VIA "VIA" 00055 #define VAR_VIA_LEN (sizeof(VAR_VIA)-1) 00056 #define VAR_CTYPE "CONTENT_TYPE" 00057 #define VAR_CTYPE_LEN (sizeof(VAR_CTYPE)-1) 00058 #define VAR_FROM "FROM" 00059 #define VAR_FROM_LEN (sizeof(VAR_FROM)-1) 00060 #define VAR_CALLID "CALLID" 00061 #define VAR_CALLID_LEN (sizeof(VAR_CALLID)-1) 00062 #define VAR_SUPPORTED "SUPPORTED" 00063 #define VAR_SUPPORTED_LEN (sizeof(VAR_SUPPORTED)-1) 00064 #define VAR_CLEN "CONTENT_LENGTH" 00065 #define VAR_CLEN_LEN (sizeof(VAR_CLEN)-1) 00066 #define VAR_CONTACT "CONTACT" 00067 #define VAR_CONTACT_LEN (sizeof(VAR_CONTACT)-1) 00068 #define VAR_TO "TO" 00069 #define VAR_TO_LEN (sizeof(VAR_TO)-1) 00070 #define VAR_EVENT "EVENT" 00071 #define VAR_EVENT_LEN (sizeof(VAR_EVENT)-1) 00072 00073 00074 00075 #if 0 00076 /* _JUST_FOR_INFO_HERE */ 00077 struct hdr_field { 00078 int type; /* Header field type */ 00079 str name; /* Header field name */ 00080 str body; /* Header field body */ 00081 void* parsed; /* Parsed data structures */ 00082 struct hdr_field* next; /* Next header field in the list */ 00083 }; 00084 #endif 00085 00086 typedef struct env { 00087 char** env; 00088 int old_cnt; 00089 } environment_t; 00090 00091 struct attrval { 00092 str attr; 00093 str val; 00094 }; 00095 00096 enum wrapper_type { W_HF=1, W_AV }; 00097 00098 struct hf_wrapper { 00099 enum wrapper_type var_type; 00100 union { 00101 struct hdr_field *hf; 00102 struct attrval av; 00103 } u; 00104 /* next header field of the same type */ 00105 struct hf_wrapper *next_same; 00106 /* next header field of a different type */ 00107 struct hf_wrapper *next_other; 00108 /* env var value (zero terminated) */ 00109 char *envvar; 00110 /* variable name prefix (if any) */ 00111 char *prefix; 00112 int prefix_len; 00113 }; 00114 00115 extern unsigned int setvars; 00116 extern char **environ; 00117 00118 environment_t *set_env(struct sip_msg *msg); 00119 void unset_env(environment_t *backup_env); 00120 00121 #endif
1.5.6