1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: httpcook.hxx,v $
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
35 #include <tools/datetime.hxx>
38 #include <tools/stream.hxx>
41 #include <tools/string.hxx>
44 #ifndef _SFXPOOLITEM_HXX
45 #include <bf_svtools/poolitem.hxx>
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 /*=======================================================================
71 *=====================================================================*/
83 : m_aExpires (Date(0), Time(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();
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;
129 m_aExpires
.SetDate (nValue
);
131 m_aExpires
.SetTime (nValue
);
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
;
153 CntHTTPCookieRequestType m_eType
;
156 CntHTTPCookieRequest (
159 CntHTTPCookieRequestType eType
)
161 m_rCookieList (rCookieList
),
163 m_nRet (CNTHTTP_COOKIE_POLICY_BANNED
) {}
168 #endif // SVTOOLS_HTTPCOOK_HXX