sync master with lastest vba changes
[ooovba.git] / binfilter / inc / bf_svtools / httpcook.hxx
blob866e9dbf34f499f03a42ee0b791a605d88daa8df
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: httpcook.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SVTOOLS_HTTPCOOK_HXX
32 #define SVTOOLS_HTTPCOOK_HXX
34 #ifndef _DATETIME_HXX
35 #include <tools/datetime.hxx>
36 #endif
37 #ifndef _STREAM_HXX
38 #include <tools/stream.hxx>
39 #endif
40 #ifndef _STRING_HXX
41 #include <tools/string.hxx>
42 #endif
44 #ifndef _SFXPOOLITEM_HXX
45 #include <bf_svtools/poolitem.hxx>
46 #endif
48 namespace binfilter
51 /*=======================================================================
53 *=====================================================================*/
54 #define CNTHTTP_COOKIE_FLAG_SECURE 0x01
56 #define CNTHTTP_COOKIE_POLICY_INTERACTIVE 0x00
57 #define CNTHTTP_COOKIE_POLICY_ACCEPTED 0x01
58 #define CNTHTTP_COOKIE_POLICY_BANNED 0x02
60 #define CNTHTTP_COOKIE_DOMAIN_POLICY 0x10
62 #define CNTHTTP_COOKIE_DOMAIN_ACCEPTED \
63 (CNTHTTP_COOKIE_DOMAIN_POLICY | CNTHTTP_COOKIE_POLICY_ACCEPTED)
64 #define CNTHTTP_COOKIE_DOMAIN_BANNED \
65 (CNTHTTP_COOKIE_DOMAIN_POLICY | CNTHTTP_COOKIE_POLICY_BANNED)
67 /*=======================================================================
69 * CntHTTPCookie.
71 *=====================================================================*/
72 struct CntHTTPCookie
74 String m_aName;
75 String m_aValue;
76 String m_aDomain;
77 String m_aPath;
78 DateTime m_aExpires;
79 USHORT m_nFlags;
80 USHORT m_nPolicy;
82 CntHTTPCookie (void)
83 : m_aExpires (Date(0), Time(0)),
84 m_nFlags (0),
85 m_nPolicy (CNTHTTP_COOKIE_POLICY_INTERACTIVE)
88 BOOL replaces (const CntHTTPCookie& rOther) const
90 return ((m_aDomain == rOther.m_aDomain) &&
91 (m_aPath == rOther.m_aPath ) &&
92 (m_aName == rOther.m_aName ) );
95 BOOL operator== (const CntHTTPCookie& rOther) const
97 return ((m_aName == rOther.m_aName ) &&
98 (m_aValue == rOther.m_aValue ) &&
99 (m_aDomain == rOther.m_aDomain ) &&
100 (m_aPath == rOther.m_aPath ) &&
101 (m_aExpires == rOther.m_aExpires) &&
102 (m_nFlags == rOther.m_nFlags ) &&
103 (m_nPolicy == rOther.m_nPolicy ) );
106 void write (SvStream& rStrm) const
108 SfxPoolItem::writeUnicodeString(rStrm, m_aName);
109 SfxPoolItem::writeUnicodeString(rStrm, m_aValue);
110 SfxPoolItem::writeUnicodeString(rStrm, m_aDomain);
111 SfxPoolItem::writeUnicodeString(rStrm, m_aPath);
113 rStrm << m_aExpires.GetDate();
114 rStrm << m_aExpires.GetTime();
116 rStrm << m_nFlags;
117 rStrm << m_nPolicy;
120 void read (SvStream& rStrm, bool bUnicode)
122 SfxPoolItem::readUnicodeString(rStrm, m_aName, bUnicode);
123 SfxPoolItem::readUnicodeString(rStrm, m_aValue, bUnicode);
124 SfxPoolItem::readUnicodeString(rStrm, m_aDomain, bUnicode);
125 SfxPoolItem::readUnicodeString(rStrm, m_aPath, bUnicode);
127 sal_uInt32 nValue = 0;
128 rStrm >> nValue;
129 m_aExpires.SetDate (nValue);
130 rStrm >> nValue;
131 m_aExpires.SetTime (nValue);
133 rStrm >> m_nFlags;
134 rStrm >> m_nPolicy;
138 /*=======================================================================
140 * CntHTTPCookieRequest.
142 *=====================================================================*/
143 enum CntHTTPCookieRequestType
145 CNTHTTP_COOKIE_REQUEST_RECV = 0,
146 CNTHTTP_COOKIE_REQUEST_SEND
149 struct CntHTTPCookieRequest
151 const String& m_rURL;
152 List& m_rCookieList;
153 CntHTTPCookieRequestType m_eType;
154 USHORT m_nRet;
156 CntHTTPCookieRequest (
157 const String& rURL,
158 List& rCookieList,
159 CntHTTPCookieRequestType eType)
160 : m_rURL (rURL),
161 m_rCookieList (rCookieList),
162 m_eType(eType),
163 m_nRet (CNTHTTP_COOKIE_POLICY_BANNED) {}
168 #endif // SVTOOLS_HTTPCOOK_HXX