Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 6de995e505c7785275e786dd8bd6ac88 > files > 76

libcgi-devel-1.0-10.fc12.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>session.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3-rc2 -->
<center>
<a class="qindex" href="main.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; </center>
<hr><h1>session.h</h1><div class="fragment"><pre>00001 <span class="comment">/*</span>
00002 <span class="comment">    LibCGI - A library to make CGI programs using C</span>
00003 <span class="comment">    Copyright (C) 2001 Rafael Steil</span>
00004 <span class="comment"></span>
00005 <span class="comment">    This library is free software; you can redistribute it and/or</span>
00006 <span class="comment">    modify it under the terms of the GNU Lesser General Public</span>
00007 <span class="comment">    License as published by the Free Software Foundation; either</span>
00008 <span class="comment">    version 2.1 of the License, or (at your option) any later version.</span>
00009 <span class="comment"></span>
00010 <span class="comment">    This library is distributed in the hope that it will be useful,</span>
00011 <span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
00012 <span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
00013 <span class="comment">    Lesser General Public License for more details.</span>
00014 <span class="comment"></span>
00015 <span class="comment">    You should have received a copy of the GNU Lesser General Public</span>
00016 <span class="comment">    License along with this library; if not, write to the Free Software</span>
00017 <span class="comment">    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span>
00018 <span class="comment"></span>
00019 <span class="comment">    You can contact the author by e-mail: rafael@insanecorp.com</span>
00020 <span class="comment">*/</span>
00021 
00022 <span class="preprocessor">#ifndef _SESSION_H</span>
00023 <span class="preprocessor"></span><span class="preprocessor">#define _SESSION_H      1</span>
00024 <span class="preprocessor"></span>
00025 <span class="preprocessor">#ifdef __cplusplus</span>
00026 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00027 <span class="preprocessor">#endif</span>
00028 <span class="preprocessor"></span>
00029 <span class="preprocessor">#ifndef SESSION_FILE_PREFIX</span>
00030 <span class="preprocessor"></span><span class="preprocessor">#define SESSION_FILE_PREFIX "cgisess_"</span>
00031 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00032 <span class="preprocessor"></span>
00033 <span class="comment">// Just for compatibility with older versions of libcgi</span>
00034 <span class="preprocessor">#define session_var(name) cgi_session_var(name)</span>
00035 <span class="preprocessor"></span><span class="preprocessor">#define session_destroy() cgi_session_destroy()</span>
00036 <span class="preprocessor"></span><span class="preprocessor">#define session_register_var(name, value) cgi_session_register_var(name, value)</span>
00037 <span class="preprocessor"></span><span class="preprocessor">#define session_alter_var(name, value) cgi_session_alter_var(name, value)</span>
00038 <span class="preprocessor"></span><span class="preprocessor">#define session_var_exists(name) cgi_session_var_exists(name)</span>
00039 <span class="preprocessor"></span><span class="preprocessor">#define session_unregister_var(name) cgi_session_unregister_var(name)</span>
00040 <span class="preprocessor"></span><span class="preprocessor">#define session_start() cgi_session_start()</span>
00041 <span class="preprocessor"></span>
00042 <span class="keywordtype">char</span> SESSION_SAVE_PATH[255] = <span class="stringliteral">"/tmp/"</span>;
00043 <span class="keywordtype">char</span> SESSION_COOKIE_NAME[50] = <span class="stringliteral">"CGISID"</span>;
00044 <span class="preprocessor">#define cgi_session_cookie_name(cookie_name) strncpy(SESSION_COOKIE_NAME, cookie_name, 49)</span>
00045 <span class="preprocessor"></span><span class="preprocessor">#define cgi_session_save_path(path) strncpy(SESSION_SAVE_PATH, path, 254)</span>
00046 <span class="preprocessor"></span>
00047 <span class="preprocessor">#define cgi_session_var(var_name) List_item(var_name, sess_list_start)</span>
00048 <span class="preprocessor"></span>
00049 <span class="comment">// General purpose session functions</span>
00050 <span class="keyword">extern</span> <span class="keywordtype">int</span> sess_initialized;
00051 <span class="keyword">extern</span> <span class="keywordtype">int</span> session_lasterror;
00052 
00053 <span class="keyword">extern</span> formvars *sess_list_start;
00054 
00055 <span class="comment">// We can use this variable to get the error message from a ( possible ) session error</span>
00056 <span class="comment">// Use it togheter with session_lasterror</span>
00057 <span class="comment">// i.e: printf("Session error: %s&lt;br&gt;", session_error_message[session_last_error]);</span>
00058 <span class="keyword">const</span> <span class="keywordtype">char</span> *session_error_message[] = {
00059         <span class="stringliteral">"Session not initialized"</span>,
00060         <span class="stringliteral">"Session file not initialized"</span>,
00061         <span class="stringliteral">"Headers already been sent"</span>,
00062         <span class="stringliteral">"Session already started"</span>,
00063         <span class="stringliteral">"Failed to create session file"</span>,
00064         <span class="stringliteral">"Failed to remove session file"</span>,
00065         <span class="stringliteral">"Failed to destroy the session"</span>,
00066         <span class="stringliteral">"Failed to remove session value from list"</span>,
00067         <span class="stringliteral">"Session variable already registered"</span>,
00068         <span class="stringliteral">"Session variable not registered"</span>,
00069         <span class="stringliteral">"Failed to open session file for manipulation"</span>
00070 };
00071 
00072 <span class="comment">// stores last session error that was occured</span>
00073 <span class="keyword">extern</span> <span class="keywordtype">int</span> session_lasterror;
00074                                                                                         
00075 <span class="keyword">extern</span> <span class="keywordtype">int</span> cgi_session_destroy();
00076 <span class="keyword">extern</span> <span class="keywordtype">int</span> cgi_session_register_var(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">const</span> <span class="keywordtype">char</span> *value);
00077 <span class="keyword">extern</span> <span class="keywordtype">int</span> cgi_session_alter_var(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">const</span> <span class="keywordtype">char</span> *new_value);
00078 <span class="keyword">extern</span> <span class="keywordtype">int</span> cgi_session_var_exists(<span class="keyword">const</span> <span class="keywordtype">char</span> *name);
00079 <span class="keyword">extern</span> <span class="keywordtype">int</span> cgi_session_unregister_var(<span class="keywordtype">char</span> *name);
00080 <span class="keyword">extern</span> <span class="keywordtype">int</span> cgi_session_start();
00081 
00082 <span class="preprocessor">#ifdef __cplusplus</span>
00083 <span class="preprocessor"></span>}
00084 <span class="preprocessor">#endif</span>
00085 <span class="preprocessor"></span>
00086 <span class="preprocessor">#endif // _SESSION_H</span>
</pre></div><hr><address style="align: right;"><small>Generated on Thu Dec 26 22:12:30 2002 for LibCGI by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.3-rc2 </small></address>
</body>
</html>