00001 /* 00002 Copyright 2007 Erez Bibi (erezbibi@users.sourceforge.net) 00003 This file is part of Beesnest. 00004 Beesnest is released under the GNU General Public License. 00005 But this file is in the public domain, you can do whatever you want with it. 00006 */ 00007 00008 #ifndef __IDC_REQUEST 00009 #define __IDC_REQUEST 00010 00011 #include "BufferHolder.h" 00012 00013 /** 00014 * This interface is implemented by Beesnest! <br> 00015 * 00016 * This abstract class is the interface for <b>CdcRequest</b>. <b>IdcEngine</b> 00017 * will use this interface, so a script will be able use some of the request 00018 * features. A script should be able to read the request headers, get request 00019 * variables, get a list of all the request variables names (if need to pass all 00020 * vars to other page) and set a new request variable. The last option forms a 00021 * way that different scripts on the same page can communicate (pass data from 00022 * the earlier script to the later one). This communication is possible also 00023 * between different types of scripts (different script language). 00024 * 00025 * <p> 00026 * All interfaces uses BufferHolder to pass strings or buffers. 00027 */ 00028 class IdcRequest 00029 { 00030 public: 00031 00032 /** 00033 * Empty virtual Destructor. 00034 */ 00035 virtual ~IdcRequest() {}; 00036 00037 /** 00038 * Return a BufferHolder of a request header value, or of an empty string 00039 * if it cannot find the header field name. Case insensitive. 00040 * <br> 00041 * NOTE: Do not try to change the returned string! 00042 * <p> 00043 * @param name The name of the field, as a BufferHolder. 00044 * @return (BufferHolder) Holds the value of this field. 00045 * The returned string WILL have NULL in it's end! 00046 */ 00047 virtual BufferHolder GetRequestHeader (BufferHolder name) const = 0; 00048 00049 /** 00050 * Returns a BufferHolder of a request variables values, or of an empty 00051 * string if it cannot find the variable name. Case sensitive 00052 * <br> 00053 * NOTE: Do not try to change the returned string! 00054 * <p> 00055 * @param name The name of the variable, as a BufferHolder. 00056 * @return (BufferHolder) Holds the value of this variable string. 00057 * The returned string WILL have NULL in its end! 00058 */ 00059 virtual BufferHolder GetRequestVariable (BufferHolder name) const = 0; 00060 00061 /** 00062 * Create a new request variable, or modify existing one. 00063 * <p> 00064 * @param name The name of the variable to create, as a BufferHolder. 00065 * @param val The value of the variable, as a BufferHolder. 00066 */ 00067 virtual void SetRequestVariable (BufferHolder name, BufferHolder value) = 0; 00068 00069 /** 00070 * Return a list (string) of all the request variables names, the list is 00071 * separated by the string 'sep'. 00072 * <br> 00073 * If 'sep' starts with an "H", the returned list will be the request 00074 * headers names (w/o the "H" in the beginning of 'sep'). 00075 * <br> 00076 * NOTE: Do not try to change the returned string! 00077 * <p> 00078 * @param sep Optional list separator as a BufferHolder. Default value is 00079 * a BufferHolder that holds pipe (|). 00080 * @return (BufferHolder) Holds a list of all the request variables names. 00081 * The returned string WILL have NULL in its end! 00082 */ 00083 virtual BufferHolder GetRequestVarsNamesList 00084 (BufferHolder sep = BufferHolder ("|")) = 0; 00085 }; 00086 00087 #endif /* __IDC_REQUEST */ 00088