added linuxtage presentation
[anytun.git] / src / Sockets / HttpdCookies.h
blob79af17cd6f3b3ce80dc88e8c46e969fec8e5cc6b
1 /** \file HttpdCookies.h
2 */
3 /*
4 Copyright (C) 2003-2007 Anders Hedstrom
6 This library is made available under the terms of the GNU GPL.
8 If you would like to use this library in a closed-source application,
9 a separate license agreement is available. For information about
10 the closed-source license agreement for the C++ sockets library,
11 please visit http://www.alhem.net/Sockets/license.html and/or
12 email license@alhem.net.
14 This program is free software; you can redistribute it and/or
15 modify it under the terms of the GNU General Public License
16 as published by the Free Software Foundation; either version 2
17 of the License, or (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #ifndef _SOCKETS_HttpdCookies_H
30 #define _SOCKETS_HttpdCookies_H
32 #include "sockets-config.h"
33 #include <list>
34 #include <string>
36 #ifdef SOCKETS_NAMESPACE
37 namespace SOCKETS_NAMESPACE {
38 #endif
41 //! Store the cookies name/value pairs.
45 //! Retrieve and manage cookies during a cgi call.
46 class HTTPSocket;
48 /** HTTP Cookie parse/container class.
49 \sa HttpdSocket
50 \sa HttpdForm
51 \ingroup webserver */
52 class HttpdCookies
54 /** list of key/value structs. */
55 typedef std::list<std::pair<std::string, std::string> > cookie_v;
57 public:
58 HttpdCookies();
59 HttpdCookies(const std::string& query_string);
60 ~HttpdCookies();
62 void add(const std::string& s);
64 bool getvalue(const std::string&,std::string&) const;
65 void replacevalue(const std::string& ,const std::string& );
66 void replacevalue(const std::string& ,long);
67 void replacevalue(const std::string& ,int);
68 size_t getlength(const std::string& ) const;
69 void setcookie(HTTPSocket *,const std::string& d,const std::string& p,const std::string& c,const std::string& v);
70 void setcookie(HTTPSocket *,const std::string& d,const std::string& p,const std::string& c,long v);
71 void setcookie(HTTPSocket *,const std::string& d,const std::string& p,const std::string& c,int v);
72 const std::string& expiredatetime() const;
74 cookie_v& GetHttpdCookies() { return m_cookies; }
76 void Reset();
78 private:
79 cookie_v m_cookies;
80 mutable std::string m_date;
84 #ifdef SOCKETS_NAMESPACE
86 #endif
88 #endif // _SOCKETS_HttpdCookies_H