Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
54b12f5f
Kaydet (Commit)
54b12f5f
authored
Şub 24, 2012
tarafından
Oliver-Rainer Wittmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
remove neon wrapper source code
üst
8fb198c6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
0 additions
and
1846 deletions
+0
-1846
LinkSequence.cxx
ucb/source/ucp/webdav/LinkSequence.cxx
+0
-215
LinkSequence.hxx
ucb/source/ucp/webdav/LinkSequence.hxx
+0
-47
LockEntrySequence.cxx
ucb/source/ucp/webdav/LockEntrySequence.cxx
+0
-236
LockEntrySequence.hxx
ucb/source/ucp/webdav/LockEntrySequence.hxx
+0
-44
LockSequence.cxx
ucb/source/ucp/webdav/LockSequence.cxx
+0
-0
LockSequence.hxx
ucb/source/ucp/webdav/LockSequence.hxx
+0
-44
NeonHeadRequest.cxx
ucb/source/ucp/webdav/NeonHeadRequest.cxx
+0
-125
NeonHeadRequest.hxx
ucb/source/ucp/webdav/NeonHeadRequest.hxx
+0
-49
NeonInputStream.cxx
ucb/source/ucp/webdav/NeonInputStream.cxx
+0
-191
NeonInputStream.hxx
ucb/source/ucp/webdav/NeonInputStream.hxx
+0
-120
NeonLockStore.cxx
ucb/source/ucp/webdav/NeonLockStore.cxx
+0
-241
NeonLockStore.hxx
ucb/source/ucp/webdav/NeonLockStore.hxx
+0
-98
NeonPropFindRequest.cxx
ucb/source/ucp/webdav/NeonPropFindRequest.cxx
+0
-0
NeonPropFindRequest.hxx
ucb/source/ucp/webdav/NeonPropFindRequest.hxx
+0
-58
NeonSession.cxx
ucb/source/ucp/webdav/NeonSession.cxx
+0
-0
NeonSession.hxx
ucb/source/ucp/webdav/NeonSession.hxx
+0
-0
NeonTypes.hxx
ucb/source/ucp/webdav/NeonTypes.hxx
+0
-42
NeonUri.cxx
ucb/source/ucp/webdav/NeonUri.cxx
+0
-336
NeonUri.hxx
ucb/source/ucp/webdav/NeonUri.hxx
+0
-0
No files found.
ucb/source/ucp/webdav/LinkSequence.cxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_ucb.hxx"
#include <string.h>
#include <ne_xml.h>
#ifndef _LINKSEQUENCE_HXX_
#include "LinkSequence.hxx"
#endif
using
namespace
webdav_ucp
;
using
namespace
com
::
sun
::
star
;
//////////////////////////////////////////////////////////////////////////
struct
LinkSequenceParseContext
{
ucb
::
Link
*
pLink
;
bool
hasSource
;
bool
hasDestination
;
LinkSequenceParseContext
()
:
pLink
(
0
),
hasSource
(
false
),
hasDestination
(
false
)
{}
~
LinkSequenceParseContext
()
{
delete
pLink
;
}
};
#define STATE_TOP (1)
#define STATE_LINK (STATE_TOP)
#define STATE_DST (STATE_TOP + 1)
#define STATE_SRC (STATE_TOP + 2)
//////////////////////////////////////////////////////////////////////////
extern
"C"
int
LinkSequence_startelement_callback
(
void
*
,
int
parent
,
const
char
*
/*nspace*/
,
const
char
*
name
,
const
char
**
)
{
if
(
name
!=
0
)
{
switch
(
parent
)
{
case
NE_XML_STATEROOT
:
if
(
strcmp
(
name
,
"link"
)
==
0
)
return
STATE_LINK
;
break
;
case
STATE_LINK
:
if
(
strcmp
(
name
,
"dst"
)
==
0
)
return
STATE_DST
;
else
if
(
strcmp
(
name
,
"src"
)
==
0
)
return
STATE_SRC
;
break
;
}
}
return
NE_XML_DECLINE
;
}
//////////////////////////////////////////////////////////////////////////
extern
"C"
int
LinkSequence_chardata_callback
(
void
*
userdata
,
int
state
,
const
char
*
buf
,
size_t
len
)
{
LinkSequenceParseContext
*
pCtx
=
static_cast
<
LinkSequenceParseContext
*
>
(
userdata
);
if
(
!
pCtx
->
pLink
)
pCtx
->
pLink
=
new
ucb
::
Link
;
switch
(
state
)
{
case
STATE_DST
:
pCtx
->
pLink
->
Destination
=
rtl
::
OUString
(
buf
,
len
,
RTL_TEXTENCODING_ASCII_US
);
pCtx
->
hasDestination
=
true
;
break
;
case
STATE_SRC
:
pCtx
->
pLink
->
Source
=
rtl
::
OUString
(
buf
,
len
,
RTL_TEXTENCODING_ASCII_US
);
pCtx
->
hasSource
=
true
;
break
;
}
return
0
;
// zero to continue, non-zero to abort parsing
}
//////////////////////////////////////////////////////////////////////////
extern
"C"
int
LinkSequence_endelement_callback
(
void
*
userdata
,
int
state
,
const
char
*
,
const
char
*
)
{
LinkSequenceParseContext
*
pCtx
=
static_cast
<
LinkSequenceParseContext
*
>
(
userdata
);
if
(
!
pCtx
->
pLink
)
pCtx
->
pLink
=
new
ucb
::
Link
;
switch
(
state
)
{
case
STATE_LINK
:
if
(
!
pCtx
->
hasDestination
||
!
pCtx
->
hasSource
)
return
1
;
// abort
break
;
}
return
0
;
// zero to continue, non-zero to abort parsing
}
//////////////////////////////////////////////////////////////////////////
// static
bool
LinkSequence
::
createFromXML
(
const
rtl
::
OString
&
rInData
,
uno
::
Sequence
<
ucb
::
Link
>
&
rOutData
)
{
const
sal_Int32
TOKEN_LENGTH
=
7
;
// </link>
bool
success
=
true
;
// rInData may contain multiple <link>...</link> tags.
sal_Int32
nCount
=
0
;
sal_Int32
nStart
=
0
;
sal_Int32
nEnd
=
rInData
.
indexOf
(
"</link>"
);
while
(
nEnd
>
-
1
)
{
ne_xml_parser
*
parser
=
ne_xml_create
();
if
(
!
parser
)
{
success
=
false
;
break
;
}
LinkSequenceParseContext
aCtx
;
ne_xml_push_handler
(
parser
,
LinkSequence_startelement_callback
,
LinkSequence_chardata_callback
,
LinkSequence_endelement_callback
,
&
aCtx
);
ne_xml_parse
(
parser
,
rInData
.
getStr
()
+
nStart
,
nEnd
-
nStart
+
TOKEN_LENGTH
);
success
=
!
ne_xml_failed
(
parser
);
ne_xml_destroy
(
parser
);
if
(
!
success
)
break
;
if
(
aCtx
.
pLink
)
{
nCount
++
;
if
(
nCount
>
rOutData
.
getLength
()
)
rOutData
.
realloc
(
rOutData
.
getLength
()
+
1
);
rOutData
[
nCount
-
1
]
=
*
aCtx
.
pLink
;
}
nStart
=
nEnd
+
TOKEN_LENGTH
;
nEnd
=
rInData
.
indexOf
(
"</link>"
,
nStart
);
}
return
success
;
}
//////////////////////////////////////////////////////////////////////////
// static
bool
LinkSequence
::
toXML
(
const
uno
::
Sequence
<
ucb
::
Link
>
&
rInData
,
rtl
::
OUString
&
rOutData
)
{
// <link><src>value</src><dst>value</dst></link><link><src>....
sal_Int32
nCount
=
rInData
.
getLength
();
if
(
nCount
)
{
rtl
::
OUString
aPre
(
rtl
::
OUString
::
createFromAscii
(
"<link><src>"
)
);
rtl
::
OUString
aMid
(
rtl
::
OUString
::
createFromAscii
(
"</src><dst>"
)
);
rtl
::
OUString
aEnd
(
rtl
::
OUString
::
createFromAscii
(
"</dst></link>"
)
);
for
(
sal_Int32
n
=
0
;
n
<
nCount
;
++
n
)
{
rOutData
+=
aPre
;
rOutData
+=
rInData
[
n
].
Source
;
rOutData
+=
aMid
;
rOutData
+=
rInData
[
n
].
Destination
;
rOutData
+=
aEnd
;
}
return
true
;
}
return
false
;
}
ucb/source/ucp/webdav/LinkSequence.hxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _LINKSEQUENCE_HXX_
#define _LINKKSEQUENCE_HXX_
#include <rtl/string.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/ucb/Link.hpp>
namespace
webdav_ucp
{
class
LinkSequence
{
public
:
static
bool
createFromXML
(
const
rtl
::
OString
&
rInData
,
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
ucb
::
Link
>
&
rOutData
);
static
bool
toXML
(
const
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
ucb
::
Link
>
&
rInData
,
rtl
::
OUString
&
rOutData
);
};
}
#endif
/* _LINKSEQUENCE_HXX_ */
ucb/source/ucp/webdav/LockEntrySequence.cxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_ucb.hxx"
#include <string.h>
#include <ne_xml.h>
#include "LockEntrySequence.hxx"
using
namespace
webdav_ucp
;
using
namespace
com
::
sun
::
star
;
//////////////////////////////////////////////////////////////////////////
struct
LockEntrySequenceParseContext
{
ucb
::
LockEntry
*
pEntry
;
bool
hasScope
;
bool
hasType
;
LockEntrySequenceParseContext
()
:
pEntry
(
0
),
hasScope
(
false
),
hasType
(
false
)
{}
~
LockEntrySequenceParseContext
()
{
delete
pEntry
;
}
};
#define STATE_TOP (1)
#define STATE_LOCKENTRY (STATE_TOP)
#define STATE_LOCKSCOPE (STATE_TOP + 1)
#define STATE_EXCLUSIVE (STATE_TOP + 2)
#define STATE_SHARED (STATE_TOP + 3)
#define STATE_LOCKTYPE (STATE_TOP + 4)
#define STATE_WRITE (STATE_TOP + 5)
//////////////////////////////////////////////////////////////////////////
extern
"C"
int
LockEntrySequence_startelement_callback
(
void
*
,
int
parent
,
const
char
*
/*nspace*/
,
const
char
*
name
,
const
char
**
)
{
if
(
name
!=
0
)
{
switch
(
parent
)
{
case
NE_XML_STATEROOT
:
if
(
strcmp
(
name
,
"lockentry"
)
==
0
)
return
STATE_LOCKENTRY
;
break
;
case
STATE_LOCKENTRY
:
if
(
strcmp
(
name
,
"lockscope"
)
==
0
)
return
STATE_LOCKSCOPE
;
else
if
(
strcmp
(
name
,
"locktype"
)
==
0
)
return
STATE_LOCKTYPE
;
#define IIS_BUGS_WORKAROUND
#ifdef IIS_BUGS_WORKAROUND
/* IIS (6) returns XML violating RFC 4918
for DAV:supportedlock property value.
<lockentry>
<write></write>
<shared></shared>
</lockentry>
<lockentry>
<write></write>
<exclusive></exclusive>
</lockentry>
Bother...
*/
else
if
(
strcmp
(
name
,
"exclusive"
)
==
0
)
return
STATE_EXCLUSIVE
;
else
if
(
strcmp
(
name
,
"shared"
)
==
0
)
return
STATE_SHARED
;
else
if
(
strcmp
(
name
,
"write"
)
==
0
)
return
STATE_WRITE
;
#endif
break
;
case
STATE_LOCKSCOPE
:
if
(
strcmp
(
name
,
"exclusive"
)
==
0
)
return
STATE_EXCLUSIVE
;
else
if
(
strcmp
(
name
,
"shared"
)
==
0
)
return
STATE_SHARED
;
break
;
case
STATE_LOCKTYPE
:
if
(
strcmp
(
name
,
"write"
)
==
0
)
return
STATE_WRITE
;
break
;
}
}
return
NE_XML_DECLINE
;
}
//////////////////////////////////////////////////////////////////////////
extern
"C"
int
LockEntrySequence_chardata_callback
(
void
*
,
int
,
const
char
*
,
size_t
)
{
return
0
;
// zero to continue, non-zero to abort parsing
}
//////////////////////////////////////////////////////////////////////////
extern
"C"
int
LockEntrySequence_endelement_callback
(
void
*
userdata
,
int
state
,
const
char
*
,
const
char
*
)
{
LockEntrySequenceParseContext
*
pCtx
=
static_cast
<
LockEntrySequenceParseContext
*
>
(
userdata
);
if
(
!
pCtx
->
pEntry
)
pCtx
->
pEntry
=
new
ucb
::
LockEntry
;
switch
(
state
)
{
case
STATE_EXCLUSIVE
:
pCtx
->
pEntry
->
Scope
=
ucb
::
LockScope_EXCLUSIVE
;
pCtx
->
hasScope
=
true
;
break
;
case
STATE_SHARED
:
pCtx
->
pEntry
->
Scope
=
ucb
::
LockScope_SHARED
;
pCtx
->
hasScope
=
true
;
break
;
case
STATE_WRITE
:
pCtx
->
pEntry
->
Type
=
ucb
::
LockType_WRITE
;
pCtx
->
hasType
=
true
;
break
;
case
STATE_LOCKSCOPE
:
if
(
!
pCtx
->
hasScope
)
return
1
;
// abort
break
;
case
STATE_LOCKTYPE
:
if
(
!
pCtx
->
hasType
)
return
1
;
// abort
break
;
case
STATE_LOCKENTRY
:
if
(
!
pCtx
->
hasType
||
!
pCtx
->
hasType
)
return
1
;
// abort
break
;
default
:
break
;
}
return
0
;
// zero to continue, non-zero to abort parsing
}
//////////////////////////////////////////////////////////////////////////
// static
bool
LockEntrySequence
::
createFromXML
(
const
rtl
::
OString
&
rInData
,
uno
::
Sequence
<
ucb
::
LockEntry
>
&
rOutData
)
{
const
sal_Int32
TOKEN_LENGTH
=
12
;
// </lockentry>
bool
success
=
true
;
// rInData may contain multiple <lockentry>...</lockentry> tags.
sal_Int32
nCount
=
0
;
sal_Int32
nStart
=
0
;
sal_Int32
nEnd
=
rInData
.
indexOf
(
"</lockentry>"
);
while
(
nEnd
>
-
1
)
{
ne_xml_parser
*
parser
=
ne_xml_create
();
if
(
!
parser
)
{
success
=
false
;
break
;
}
LockEntrySequenceParseContext
aCtx
;
ne_xml_push_handler
(
parser
,
LockEntrySequence_startelement_callback
,
LockEntrySequence_chardata_callback
,
LockEntrySequence_endelement_callback
,
&
aCtx
);
ne_xml_parse
(
parser
,
rInData
.
getStr
()
+
nStart
,
nEnd
-
nStart
+
TOKEN_LENGTH
);
success
=
!
ne_xml_failed
(
parser
);
ne_xml_destroy
(
parser
);
if
(
!
success
)
break
;
if
(
aCtx
.
pEntry
)
{
nCount
++
;
if
(
nCount
>
rOutData
.
getLength
()
)
rOutData
.
realloc
(
rOutData
.
getLength
()
+
2
);
rOutData
[
nCount
-
1
]
=
*
aCtx
.
pEntry
;
}
nStart
=
nEnd
+
TOKEN_LENGTH
;
nEnd
=
rInData
.
indexOf
(
"</lockentry>"
,
nStart
);
}
rOutData
.
realloc
(
nCount
);
return
success
;
}
ucb/source/ucp/webdav/LockEntrySequence.hxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _LOCKENTRYSEQUENCE_HXX_
#define _LOCKENTRYSEQUENCE_HXX_
#include <rtl/string.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/ucb/LockEntry.hpp>
namespace
webdav_ucp
{
class
LockEntrySequence
{
public
:
static
bool
createFromXML
(
const
rtl
::
OString
&
rInData
,
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
ucb
::
LockEntry
>
&
rOutData
);
};
}
#endif
/* _LOCKENTRYSEQUENCE_HXX_ */
ucb/source/ucp/webdav/LockSequence.cxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
This diff is collapsed.
Click to expand it.
ucb/source/ucp/webdav/LockSequence.hxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _LOCKSEQUENCE_HXX_
#define _LOCKSEQUENCE_HXX_
#include <rtl/string.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/ucb/Lock.hpp>
namespace
webdav_ucp
{
class
LockSequence
{
public
:
static
bool
createFromXML
(
const
rtl
::
OString
&
rInData
,
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
ucb
::
Lock
>
&
rOutData
);
};
}
#endif
/* _LOCKSEQUENCE_HXX_ */
ucb/source/ucp/webdav/NeonHeadRequest.cxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_ucb.hxx"
#include <osl/diagnose.h>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/PropertyState.hpp>
#include "NeonHeadRequest.hxx"
using
namespace
webdav_ucp
;
using
namespace
com
::
sun
::
star
;
namespace
{
void
process_headers
(
ne_request
*
req
,
DAVResource
&
rResource
,
const
std
::
vector
<
::
rtl
::
OUString
>
&
rHeaderNames
)
{
void
*
cursor
=
NULL
;
const
char
*
name
,
*
value
;
while
(
(
cursor
=
ne_response_header_iterate
(
req
,
cursor
,
&
name
,
&
value
)
)
!=
NULL
)
{
rtl
::
OUString
aHeaderName
(
rtl
::
OUString
::
createFromAscii
(
name
)
);
rtl
::
OUString
aHeaderValue
(
rtl
::
OUString
::
createFromAscii
(
value
)
);
// Note: Empty vector means that all headers are requested.
bool
bIncludeIt
=
(
rHeaderNames
.
size
()
==
0
);
if
(
!
bIncludeIt
)
{
// Check whether this header was requested.
std
::
vector
<
::
rtl
::
OUString
>::
const_iterator
it
(
rHeaderNames
.
begin
()
);
const
std
::
vector
<
::
rtl
::
OUString
>::
const_iterator
end
(
rHeaderNames
.
end
()
);
while
(
it
!=
end
)
{
if
(
(
*
it
)
==
aHeaderName
)
break
;
++
it
;
}
if
(
it
!=
end
)
bIncludeIt
=
true
;
}
if
(
bIncludeIt
)
{
// Create & set the PropertyValue
DAVPropertyValue
thePropertyValue
;
thePropertyValue
.
Name
=
aHeaderName
;
thePropertyValue
.
IsCaseSensitive
=
false
;
thePropertyValue
.
Value
<<=
aHeaderValue
;
// Add the newly created PropertyValue
rResource
.
properties
.
push_back
(
thePropertyValue
);
}
}
}
}
// namespace
// -------------------------------------------------------------------
// Constructor
// -------------------------------------------------------------------
NeonHeadRequest
::
NeonHeadRequest
(
HttpSession
*
inSession
,
const
rtl
::
OUString
&
inPath
,
const
std
::
vector
<
::
rtl
::
OUString
>
&
inHeaderNames
,
DAVResource
&
ioResource
,
int
&
nError
)
{
ioResource
.
uri
=
inPath
;
ioResource
.
properties
.
clear
();
// Create and dispatch HEAD request. Install catcher for all response
// header fields.
ne_request
*
req
=
ne_request_create
(
inSession
,
"HEAD"
,
rtl
::
OUStringToOString
(
inPath
,
RTL_TEXTENCODING_UTF8
)
);
nError
=
ne_request_dispatch
(
req
);
process_headers
(
req
,
ioResource
,
inHeaderNames
);
if
(
nError
==
NE_OK
&&
ne_get_status
(
req
)
->
klass
!=
2
)
nError
=
NE_ERROR
;
ne_request_destroy
(
req
);
}
// -------------------------------------------------------------------
// Destructor
// -------------------------------------------------------------------
NeonHeadRequest
::~
NeonHeadRequest
()
{
}
ucb/source/ucp/webdav/NeonHeadRequest.hxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _NEONHEADREQUEST_HXX_
#define _NEONHEADREQUEST_HXX_
#include <vector>
#include "NeonTypes.hxx"
#include "DAVResource.hxx"
namespace
webdav_ucp
{
class
NeonHeadRequest
{
public
:
// named / allprop
NeonHeadRequest
(
HttpSession
*
inSession
,
const
rtl
::
OUString
&
inPath
,
const
std
::
vector
<
::
rtl
::
OUString
>
&
inHeaderNames
,
DAVResource
&
ioResource
,
int
&
nError
);
~
NeonHeadRequest
();
};
}
// namespace webdav_ucp
#endif // _NEONHEADREQUEST_HXX_
ucb/source/ucp/webdav/NeonInputStream.cxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_ucb.hxx"
#include "NeonInputStream.hxx"
#include <rtl/memory.h>
using
namespace
cppu
;
using
namespace
rtl
;
using
namespace
com
::
sun
::
star
::
io
;
using
namespace
com
::
sun
::
star
::
uno
;
using
namespace
webdav_ucp
;
// -------------------------------------------------------------------
// Constructor
// -------------------------------------------------------------------
NeonInputStream
::
NeonInputStream
(
void
)
:
mLen
(
0
),
mPos
(
0
)
{
}
// -------------------------------------------------------------------
// Destructor
// -------------------------------------------------------------------
NeonInputStream
::~
NeonInputStream
(
void
)
{
}
// -------------------------------------------------------------------
// AddToStream
// Allows the caller to add some data to the "end" of the stream
// -------------------------------------------------------------------
void
NeonInputStream
::
AddToStream
(
const
char
*
inBuf
,
sal_Int32
inLen
)
{
mInputBuffer
.
realloc
(
sal
::
static_int_cast
<
sal_Int32
>
(
mLen
)
+
inLen
);
rtl_copyMemory
(
mInputBuffer
.
getArray
()
+
mLen
,
inBuf
,
inLen
);
mLen
+=
inLen
;
}
// -------------------------------------------------------------------
// queryInterface
// -------------------------------------------------------------------
Any
NeonInputStream
::
queryInterface
(
const
Type
&
type
)
throw
(
RuntimeException
)
{
Any
aRet
=
::
cppu
::
queryInterface
(
type
,
static_cast
<
XInputStream
*
>
(
this
),
static_cast
<
XSeekable
*
>
(
this
)
);
return
aRet
.
hasValue
()
?
aRet
:
OWeakObject
::
queryInterface
(
type
);
}
// -------------------------------------------------------------------
// readBytes
// "Reads" the specified number of bytes from the stream
// -------------------------------------------------------------------
sal_Int32
SAL_CALL
NeonInputStream
::
readBytes
(
::
com
::
sun
::
star
::
uno
::
Sequence
<
sal_Int8
>&
aData
,
sal_Int32
nBytesToRead
)
throw
(
::
com
::
sun
::
star
::
io
::
NotConnectedException
,
::
com
::
sun
::
star
::
io
::
BufferSizeExceededException
,
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
)
{
// Work out how much we're actually going to write
sal_Int32
theBytes2Read
=
nBytesToRead
;
sal_Int32
theBytesLeft
=
sal
::
static_int_cast
<
sal_Int32
>
(
mLen
-
mPos
);
if
(
theBytes2Read
>
theBytesLeft
)
theBytes2Read
=
theBytesLeft
;
// Realloc buffer.
aData
.
realloc
(
theBytes2Read
);
// Write the data
rtl_copyMemory
(
aData
.
getArray
(),
mInputBuffer
.
getConstArray
()
+
mPos
,
theBytes2Read
);
// Update our stream position for next time
mPos
+=
theBytes2Read
;
return
theBytes2Read
;
}
// -------------------------------------------------------------------
// readSomeBytes
// -------------------------------------------------------------------
sal_Int32
SAL_CALL
NeonInputStream
::
readSomeBytes
(
::
com
::
sun
::
star
::
uno
::
Sequence
<
sal_Int8
>&
aData
,
sal_Int32
nMaxBytesToRead
)
throw
(
::
com
::
sun
::
star
::
io
::
NotConnectedException
,
::
com
::
sun
::
star
::
io
::
BufferSizeExceededException
,
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
)
{
// Warning: What should this be doing ?
return
readBytes
(
aData
,
nMaxBytesToRead
);
}
// -------------------------------------------------------------------
// skipBytes
// Moves the current stream position forward
// -------------------------------------------------------------------
void
SAL_CALL
NeonInputStream
::
skipBytes
(
sal_Int32
nBytesToSkip
)
throw
(
::
com
::
sun
::
star
::
io
::
NotConnectedException
,
::
com
::
sun
::
star
::
io
::
BufferSizeExceededException
,
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
)
{
mPos
+=
nBytesToSkip
;
if
(
mPos
>=
mLen
)
mPos
=
mLen
;
}
// -------------------------------------------------------------------
// available
// Returns the number of unread bytes currently remaining on the stream
// -------------------------------------------------------------------
sal_Int32
SAL_CALL
NeonInputStream
::
available
(
)
throw
(
::
com
::
sun
::
star
::
io
::
NotConnectedException
,
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
)
{
return
sal
::
static_int_cast
<
sal_Int32
>
(
mLen
-
mPos
);
}
// -------------------------------------------------------------------
// closeInput
// -------------------------------------------------------------------
void
SAL_CALL
NeonInputStream
::
closeInput
(
void
)
throw
(
::
com
::
sun
::
star
::
io
::
NotConnectedException
,
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
)
{
}
// -------------------------------------------------------------------
// seek
// -------------------------------------------------------------------
void
SAL_CALL
NeonInputStream
::
seek
(
sal_Int64
location
)
throw
(
::
com
::
sun
::
star
::
lang
::
IllegalArgumentException
,
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
)
{
if
(
location
<
0
)
throw
::
com
::
sun
::
star
::
lang
::
IllegalArgumentException
();
if
(
location
<=
mLen
)
mPos
=
location
;
else
throw
::
com
::
sun
::
star
::
lang
::
IllegalArgumentException
();
}
// -------------------------------------------------------------------
// getPosition
// -------------------------------------------------------------------
sal_Int64
SAL_CALL
NeonInputStream
::
getPosition
()
throw
(
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
)
{
return
mPos
;
}
// -------------------------------------------------------------------
// getLength
// -------------------------------------------------------------------
sal_Int64
SAL_CALL
NeonInputStream
::
getLength
()
throw
(
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
)
{
return
mLen
;
}
ucb/source/ucp/webdav/NeonInputStream.hxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _NEONINPUTSTREAM_HXX_
#define _NEONINPUTSTREAM_HXX_
#include <sal/types.h>
#include <rtl/ustring.hxx>
#include <cppuhelper/weak.hxx>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
namespace
webdav_ucp
{
// -------------------------------------------------------------------
// NeonInputStream
// A simple XInputStream implementation provided specifically for use
// by the DAVSession::GET method.
// -------------------------------------------------------------------
class
NeonInputStream
:
public
::
com
::
sun
::
star
::
io
::
XInputStream
,
public
::
com
::
sun
::
star
::
io
::
XSeekable
,
public
::
cppu
::
OWeakObject
{
private
:
com
::
sun
::
star
::
uno
::
Sequence
<
sal_Int8
>
mInputBuffer
;
sal_Int64
mLen
;
sal_Int64
mPos
;
public
:
NeonInputStream
(
void
);
virtual
~
NeonInputStream
();
// Add some data to the end of the stream
void
AddToStream
(
const
char
*
inBuf
,
sal_Int32
inLen
);
// XInterface
virtual
com
::
sun
::
star
::
uno
::
Any
SAL_CALL
queryInterface
(
const
::
com
::
sun
::
star
::
uno
::
Type
&
type
)
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
void
SAL_CALL
acquire
(
void
)
throw
()
{
OWeakObject
::
acquire
();
}
virtual
void
SAL_CALL
release
(
void
)
throw
()
{
OWeakObject
::
release
();
}
// XInputStream
virtual
sal_Int32
SAL_CALL
readBytes
(
::
com
::
sun
::
star
::
uno
::
Sequence
<
sal_Int8
>
&
aData
,
sal_Int32
nBytesToRead
)
throw
(
::
com
::
sun
::
star
::
io
::
NotConnectedException
,
::
com
::
sun
::
star
::
io
::
BufferSizeExceededException
,
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
sal_Int32
SAL_CALL
readSomeBytes
(
::
com
::
sun
::
star
::
uno
::
Sequence
<
sal_Int8
>
&
aData
,
sal_Int32
nMaxBytesToRead
)
throw
(
::
com
::
sun
::
star
::
io
::
NotConnectedException
,
::
com
::
sun
::
star
::
io
::
BufferSizeExceededException
,
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
void
SAL_CALL
skipBytes
(
sal_Int32
nBytesToSkip
)
throw
(
::
com
::
sun
::
star
::
io
::
NotConnectedException
,
::
com
::
sun
::
star
::
io
::
BufferSizeExceededException
,
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
sal_Int32
SAL_CALL
available
(
void
)
throw
(
::
com
::
sun
::
star
::
io
::
NotConnectedException
,
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
void
SAL_CALL
closeInput
(
void
)
throw
(
::
com
::
sun
::
star
::
io
::
NotConnectedException
,
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
// XSeekable
virtual
void
SAL_CALL
seek
(
sal_Int64
location
)
throw
(
::
com
::
sun
::
star
::
lang
::
IllegalArgumentException
,
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
sal_Int64
SAL_CALL
getPosition
()
throw
(
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
sal_Int64
SAL_CALL
getLength
()
throw
(
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
};
}
// namespace webdav_ucp
#endif // _NEONINPUTSTREAM_HXX_
ucb/source/ucp/webdav/NeonLockStore.cxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_ucb.hxx"
#include <ne_locks.h>
#include <ne_uri.h>
#include "rtl/ustring.hxx"
#include "osl/time.h"
#include "osl/thread.hxx"
#include "NeonSession.hxx"
#include "NeonLockStore.hxx"
using
namespace
webdav_ucp
;
namespace
webdav_ucp
{
class
TickerThread
:
public
osl
::
Thread
{
bool
m_bFinish
;
NeonLockStore
&
m_rLockStore
;
public
:
TickerThread
(
NeonLockStore
&
rLockStore
)
:
osl
::
Thread
(),
m_bFinish
(
false
),
m_rLockStore
(
rLockStore
)
{}
void
finish
()
{
m_bFinish
=
true
;
}
protected
:
virtual
void
SAL_CALL
run
();
};
}
// namespace webdav_ucp
// -------------------------------------------------------------------
void
TickerThread
::
run
()
{
OSL_TRACE
(
"TickerThread: start."
);
// we have to go through the loop more often to be able to finish ~quickly
const
int
nNth
=
25
;
int
nCount
=
nNth
;
while
(
!
m_bFinish
)
{
if
(
nCount
--
<=
0
)
{
m_rLockStore
.
refreshLocks
();
nCount
=
nNth
;
}
TimeValue
aTV
;
aTV
.
Seconds
=
0
;
aTV
.
Nanosec
=
1000000000
/
nNth
;
wait
(
aTV
);
}
OSL_TRACE
(
"TickerThread: stop."
);
}
// -------------------------------------------------------------------
NeonLockStore
::
NeonLockStore
()
:
m_pNeonLockStore
(
ne_lockstore_create
()
),
m_pTickerThread
(
0
)
{
OSL_ENSURE
(
m_pNeonLockStore
,
"Unable to create neon lock store!"
);
}
// -------------------------------------------------------------------
NeonLockStore
::~
NeonLockStore
()
{
stopTicker
();
// release active locks, if any.
OSL_ENSURE
(
m_aLockInfoMap
.
size
()
==
0
,
"NeonLockStore::~NeonLockStore - Releasing active locks!"
);
LockInfoMap
::
const_iterator
it
(
m_aLockInfoMap
.
begin
()
);
const
LockInfoMap
::
const_iterator
end
(
m_aLockInfoMap
.
end
()
);
while
(
it
!=
end
)
{
NeonLock
*
pLock
=
(
*
it
).
first
;
(
*
it
).
second
.
xSession
->
UNLOCK
(
pLock
);
ne_lockstore_remove
(
m_pNeonLockStore
,
pLock
);
ne_lock_destroy
(
pLock
);
++
it
;
}
ne_lockstore_destroy
(
m_pNeonLockStore
);
}
// -------------------------------------------------------------------
void
NeonLockStore
::
startTicker
()
{
osl
::
MutexGuard
aGuard
(
m_aMutex
);
if
(
!
m_pTickerThread
)
{
m_pTickerThread
=
new
TickerThread
(
*
this
);
m_pTickerThread
->
create
();
}
}
// -------------------------------------------------------------------
void
NeonLockStore
::
stopTicker
()
{
osl
::
MutexGuard
aGuard
(
m_aMutex
);
if
(
m_pTickerThread
)
{
m_pTickerThread
->
finish
();
m_pTickerThread
->
join
();
delete
m_pTickerThread
;
m_pTickerThread
=
0
;
}
}
// -------------------------------------------------------------------
void
NeonLockStore
::
registerSession
(
HttpSession
*
pHttpSession
)
{
osl
::
MutexGuard
aGuard
(
m_aMutex
);
ne_lockstore_register
(
m_pNeonLockStore
,
pHttpSession
);
}
// -------------------------------------------------------------------
NeonLock
*
NeonLockStore
::
findByUri
(
rtl
::
OUString
const
&
rUri
)
{
osl
::
MutexGuard
aGuard
(
m_aMutex
);
ne_uri
aUri
;
ne_uri_parse
(
rtl
::
OUStringToOString
(
rUri
,
RTL_TEXTENCODING_UTF8
).
getStr
(),
&
aUri
);
return
ne_lockstore_findbyuri
(
m_pNeonLockStore
,
&
aUri
);
}
// -------------------------------------------------------------------
void
NeonLockStore
::
addLock
(
NeonLock
*
pLock
,
rtl
::
Reference
<
NeonSession
>
const
&
xSession
,
sal_Int32
nLastChanceToSendRefreshRequest
)
{
osl
::
MutexGuard
aGuard
(
m_aMutex
);
ne_lockstore_add
(
m_pNeonLockStore
,
pLock
);
m_aLockInfoMap
[
pLock
]
=
LockInfo
(
xSession
,
nLastChanceToSendRefreshRequest
);
startTicker
();
}
// -------------------------------------------------------------------
void
NeonLockStore
::
updateLock
(
NeonLock
*
pLock
,
sal_Int32
nLastChanceToSendRefreshRequest
)
{
osl
::
MutexGuard
aGuard
(
m_aMutex
);
LockInfoMap
::
iterator
it
(
m_aLockInfoMap
.
find
(
pLock
)
);
OSL_ENSURE
(
it
!=
m_aLockInfoMap
.
end
(),
"NeonLockStore::updateLock: lock not found!"
);
if
(
it
!=
m_aLockInfoMap
.
end
()
)
{
(
*
it
).
second
.
nLastChanceToSendRefreshRequest
=
nLastChanceToSendRefreshRequest
;
}
}
// -------------------------------------------------------------------
void
NeonLockStore
::
removeLock
(
NeonLock
*
pLock
)
{
osl
::
MutexGuard
aGuard
(
m_aMutex
);
m_aLockInfoMap
.
erase
(
pLock
);
ne_lockstore_remove
(
m_pNeonLockStore
,
pLock
);
if
(
m_aLockInfoMap
.
size
()
==
0
)
stopTicker
();
}
// -------------------------------------------------------------------
void
NeonLockStore
::
refreshLocks
()
{
osl
::
MutexGuard
aGuard
(
m_aMutex
);
LockInfoMap
::
iterator
it
(
m_aLockInfoMap
.
begin
()
);
const
LockInfoMap
::
const_iterator
end
(
m_aLockInfoMap
.
end
()
);
while
(
it
!=
end
)
{
LockInfo
&
rInfo
=
(
*
it
).
second
;
if
(
rInfo
.
nLastChanceToSendRefreshRequest
!=
-
1
)
{
// 30 seconds or less remaining until lock expires?
TimeValue
t1
;
osl_getSystemTime
(
&
t1
);
if
(
rInfo
.
nLastChanceToSendRefreshRequest
-
30
<=
sal_Int32
(
t1
.
Seconds
)
)
{
// refresh the lock.
sal_Int32
nlastChanceToSendRefreshRequest
=
-
1
;
if
(
rInfo
.
xSession
->
LOCK
(
(
*
it
).
first
,
/* out param */
nlastChanceToSendRefreshRequest
)
)
{
rInfo
.
nLastChanceToSendRefreshRequest
=
nlastChanceToSendRefreshRequest
;
}
else
{
// refresh failed. stop auto-refresh.
rInfo
.
nLastChanceToSendRefreshRequest
=
-
1
;
}
}
}
++
it
;
}
}
ucb/source/ucp/webdav/NeonLockStore.hxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef INCLUDED_NEONLOCKSTORE_HXX
#define INCLUDED_NEONLOCKSTORE_HXX
#include <map>
#include "ne_locks.h"
#include "osl/mutex.hxx"
#include "rtl/ref.hxx"
#include "NeonTypes.hxx"
namespace
webdav_ucp
{
class
TickerThread
;
class
NeonSession
;
struct
ltptr
{
bool
operator
()(
const
NeonLock
*
p1
,
const
NeonLock
*
p2
)
const
{
return
p1
<
p2
;
}
};
typedef
struct
_LockInfo
{
rtl
::
Reference
<
NeonSession
>
xSession
;
sal_Int32
nLastChanceToSendRefreshRequest
;
_LockInfo
()
:
nLastChanceToSendRefreshRequest
(
-
1
)
{}
_LockInfo
(
rtl
::
Reference
<
NeonSession
>
const
&
_xSession
,
sal_Int32
_nLastChanceToSendRefreshRequest
)
:
xSession
(
_xSession
),
nLastChanceToSendRefreshRequest
(
_nLastChanceToSendRefreshRequest
)
{}
}
LockInfo
;
typedef
std
::
map
<
NeonLock
*
,
LockInfo
,
ltptr
>
LockInfoMap
;
class
NeonLockStore
{
osl
::
Mutex
m_aMutex
;
ne_lock_store
*
m_pNeonLockStore
;
TickerThread
*
m_pTickerThread
;
LockInfoMap
m_aLockInfoMap
;
public
:
NeonLockStore
();
~
NeonLockStore
();
void
registerSession
(
HttpSession
*
pHttpSession
);
NeonLock
*
findByUri
(
rtl
::
OUString
const
&
rUri
);
void
addLock
(
NeonLock
*
pLock
,
rtl
::
Reference
<
NeonSession
>
const
&
xSession
,
// time in seconds since Jan 1 1970
// -1: infinite lock, no refresh
sal_Int32
nLastChanceToSendRefreshRequest
);
void
updateLock
(
NeonLock
*
pLock
,
sal_Int32
nLastChanceToSendRefreshRequest
);
void
removeLock
(
NeonLock
*
pLock
);
void
refreshLocks
();
private
:
void
startTicker
();
void
stopTicker
();
};
}
// namespace webdav_ucp
#endif // INCLUDED_NEONLOCKSTORE_HXX
ucb/source/ucp/webdav/NeonPropFindRequest.cxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
This diff is collapsed.
Click to expand it.
ucb/source/ucp/webdav/NeonPropFindRequest.hxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _NEONPROPFINDREQUEST_HXX_
#define _NEONPROPFINDREQUEST_HXX_
#include <vector>
#include <rtl/ustring.hxx>
#include "NeonTypes.hxx"
#include "DAVTypes.hxx"
#include "DAVResource.hxx"
namespace
webdav_ucp
{
class
NeonPropFindRequest
{
public
:
// named / allprop
NeonPropFindRequest
(
HttpSession
*
inSession
,
const
char
*
inPath
,
const
Depth
inDepth
,
const
std
::
vector
<
::
rtl
::
OUString
>
&
inPropNames
,
std
::
vector
<
DAVResource
>
&
ioResources
,
int
&
nError
);
// propnames
NeonPropFindRequest
(
HttpSession
*
inSession
,
const
char
*
inPath
,
const
Depth
inDepth
,
std
::
vector
<
DAVResourceInfo
>
&
ioResInfo
,
int
&
nError
);
~
NeonPropFindRequest
();
};
}
// namespace webdav_ucp
#endif // _NEONPROPFINDREQUEST_HXX_
ucb/source/ucp/webdav/NeonSession.cxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
This diff is collapsed.
Click to expand it.
ucb/source/ucp/webdav/NeonSession.hxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
This diff is collapsed.
Click to expand it.
ucb/source/ucp/webdav/NeonTypes.hxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _NEONTYPES_HXX_
#define _NEONTYPES_HXX_
#include <ne_session.h>
#include <ne_utils.h>
#include <ne_basic.h>
#include <ne_props.h>
#include <ne_locks.h>
typedef
ne_session
HttpSession
;
typedef
ne_status
HttpStatus
;
typedef
ne_server_capabilities
HttpServerCapabilities
;
typedef
ne_propname
NeonPropName
;
typedef
ne_prop_result_set
NeonPropFindResultSet
;
typedef
struct
ne_lock
NeonLock
;
#endif // _NEONTYPES_HXX_
ucb/source/ucp/webdav/NeonUri.cxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_ucb.hxx"
#include <string.h>
#include <rtl/uri.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include "ne_alloc.h"
#include "NeonUri.hxx"
#include "DAVException.hxx"
#include "../inc/urihelper.hxx"
using
namespace
webdav_ucp
;
# if defined __SUNPRO_CC
// FIXME: not sure whether initializing a ne_uri statically is supposed to work
// the string fields of ne_uri are char*, not const char*
# pragma disable_warn
# endif
#if defined __GNUC__
#define GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
/* Diagnostics pragma was introduced with gcc-4.2.1 */
#if GCC_VERSION > 40201
#pragma GCC diagnostic ignored "-Wwrite-strings"
#endif
#endif
namespace
{
const
ne_uri
g_sUriDefaultsHTTP
=
{
"http"
,
NULL
,
NULL
,
DEFAULT_HTTP_PORT
,
NULL
,
NULL
,
NULL
};
const
ne_uri
g_sUriDefaultsHTTPS
=
{
"https"
,
NULL
,
NULL
,
DEFAULT_HTTPS_PORT
,
NULL
,
NULL
,
NULL
};
const
ne_uri
g_sUriDefaultsFTP
=
{
"ftp"
,
NULL
,
NULL
,
DEFAULT_FTP_PORT
,
NULL
,
NULL
,
NULL
};
}
// namespace
# if defined __SUNPRO_CC
# pragma enable_warn
#endif
// -------------------------------------------------------------------
// Constructor
// -------------------------------------------------------------------
namespace
{
//TODO! rtl::OString::matchIgnoreAsciiCaseAsciiL() missing
inline
bool
matchIgnoreAsciiCase
(
rtl
::
OString
const
&
rStr1
,
sal_Char
const
*
pStr2
,
sal_Int32
nStr2Len
)
SAL_THROW
(())
{
return
rtl_str_shortenedCompareIgnoreAsciiCase_WithLength
(
rStr1
.
getStr
(),
rStr1
.
getLength
(),
pStr2
,
nStr2Len
,
nStr2Len
)
==
0
;
}
}
NeonUri
::
NeonUri
(
const
ne_uri
*
inUri
)
throw
(
DAVException
)
{
if
(
inUri
==
0
)
throw
DAVException
(
DAVException
::
DAV_INVALID_ARG
);
char
*
uri
=
ne_uri_unparse
(
inUri
);
if
(
uri
==
0
)
throw
DAVException
(
DAVException
::
DAV_INVALID_ARG
);
init
(
rtl
::
OString
(
uri
),
inUri
);
ne_free
(
uri
);
calculateURI
();
}
NeonUri
::
NeonUri
(
const
rtl
::
OUString
&
inUri
)
throw
(
DAVException
)
{
if
(
inUri
.
getLength
()
<=
0
)
throw
DAVException
(
DAVException
::
DAV_INVALID_ARG
);
// #i77023#
rtl
::
OUString
aEscapedUri
(
ucb_impl
::
urihelper
::
encodeURI
(
inUri
)
);
rtl
::
OString
theInputUri
(
aEscapedUri
.
getStr
(),
aEscapedUri
.
getLength
(),
RTL_TEXTENCODING_UTF8
);
ne_uri
theUri
;
if
(
ne_uri_parse
(
theInputUri
.
getStr
(),
&
theUri
)
!=
0
)
{
ne_uri_free
(
&
theUri
);
throw
DAVException
(
DAVException
::
DAV_INVALID_ARG
);
}
init
(
theInputUri
,
&
theUri
);
ne_uri_free
(
&
theUri
);
calculateURI
();
}
void
NeonUri
::
init
(
const
rtl
::
OString
&
rUri
,
const
ne_uri
*
pUri
)
{
// Complete URI.
const
ne_uri
*
pUriDefs
=
matchIgnoreAsciiCase
(
rUri
,
RTL_CONSTASCII_STRINGPARAM
(
"ftp:"
)
)
?
&
g_sUriDefaultsFTP
:
matchIgnoreAsciiCase
(
rUri
,
RTL_CONSTASCII_STRINGPARAM
(
"https:"
)
)
?
&
g_sUriDefaultsHTTPS
:
&
g_sUriDefaultsHTTP
;
mScheme
=
rtl
::
OStringToOUString
(
pUri
->
scheme
?
pUri
->
scheme
:
pUriDefs
->
scheme
,
RTL_TEXTENCODING_UTF8
);
mUserInfo
=
rtl
::
OStringToOUString
(
pUri
->
userinfo
?
pUri
->
userinfo
:
pUriDefs
->
userinfo
,
RTL_TEXTENCODING_UTF8
);
mHostName
=
rtl
::
OStringToOUString
(
pUri
->
host
?
pUri
->
host
:
pUriDefs
->
host
,
RTL_TEXTENCODING_UTF8
);
mPort
=
pUri
->
port
>
0
?
pUri
->
port
:
pUriDefs
->
port
;
mPath
=
rtl
::
OStringToOUString
(
pUri
->
path
?
pUri
->
path
:
pUriDefs
->
path
,
RTL_TEXTENCODING_UTF8
);
if
(
pUri
->
query
)
{
mPath
+=
rtl
::
OUString
::
createFromAscii
(
"?"
);
mPath
+=
rtl
::
OStringToOUString
(
pUri
->
query
,
RTL_TEXTENCODING_UTF8
);
}
if
(
pUri
->
fragment
)
{
mPath
+=
rtl
::
OUString
::
createFromAscii
(
"#"
);
mPath
+=
rtl
::
OStringToOUString
(
pUri
->
fragment
,
RTL_TEXTENCODING_UTF8
);
}
}
// -------------------------------------------------------------------
// Destructor
// -------------------------------------------------------------------
NeonUri
::~
NeonUri
(
)
{
}
void
NeonUri
::
calculateURI
()
{
rtl
::
OUStringBuffer
aBuf
(
mScheme
);
aBuf
.
appendAscii
(
"://"
);
if
(
mUserInfo
.
getLength
()
>
0
)
{
//TODO! differentiate between empty and missing userinfo
aBuf
.
append
(
mUserInfo
);
aBuf
.
appendAscii
(
"@"
);
}
// Is host a numeric IPv6 address?
if
(
(
mHostName
.
indexOf
(
':'
)
!=
-
1
)
&&
(
mHostName
[
0
]
!=
sal_Unicode
(
'['
)
)
)
{
aBuf
.
appendAscii
(
"["
);
aBuf
.
append
(
mHostName
);
aBuf
.
appendAscii
(
"]"
);
}
else
{
aBuf
.
append
(
mHostName
);
}
// append port, but only, if not default port.
bool
bAppendPort
=
true
;
switch
(
mPort
)
{
case
DEFAULT_HTTP_PORT
:
bAppendPort
=
!
mScheme
.
equalsAsciiL
(
RTL_CONSTASCII_STRINGPARAM
(
"http"
)
);
break
;
case
DEFAULT_HTTPS_PORT
:
bAppendPort
=
!
mScheme
.
equalsAsciiL
(
RTL_CONSTASCII_STRINGPARAM
(
"https"
)
);
break
;
case
DEFAULT_FTP_PORT
:
bAppendPort
=
!
mScheme
.
equalsAsciiL
(
RTL_CONSTASCII_STRINGPARAM
(
"ftp"
)
);
break
;
}
if
(
bAppendPort
)
{
aBuf
.
appendAscii
(
":"
);
aBuf
.
append
(
rtl
::
OUString
::
valueOf
(
mPort
)
);
}
aBuf
.
append
(
mPath
);
mURI
=
aBuf
.
makeStringAndClear
();
}
::
rtl
::
OUString
NeonUri
::
GetPathBaseName
()
const
{
sal_Int32
nPos
=
mPath
.
lastIndexOf
(
'/'
);
sal_Int32
nTrail
=
0
;
if
(
nPos
==
mPath
.
getLength
()
-
1
)
{
// Trailing slash found. Skip.
nTrail
=
1
;
nPos
=
mPath
.
lastIndexOf
(
'/'
,
nPos
);
}
if
(
nPos
!=
-
1
)
{
rtl
::
OUString
aTemp
(
mPath
.
copy
(
nPos
+
1
,
mPath
.
getLength
()
-
nPos
-
1
-
nTrail
)
);
// query, fragment present?
nPos
=
aTemp
.
indexOf
(
'?'
);
if
(
nPos
==
-
1
)
nPos
=
aTemp
.
indexOf
(
'#'
);
if
(
nPos
!=
-
1
)
aTemp
=
aTemp
.
copy
(
0
,
nPos
);
return
aTemp
;
}
else
return
rtl
::
OUString
::
createFromAscii
(
"/"
);
}
bool
NeonUri
::
operator
==
(
const
NeonUri
&
rOther
)
const
{
return
(
mURI
==
rOther
.
mURI
);
}
::
rtl
::
OUString
NeonUri
::
GetPathBaseNameUnescaped
()
const
{
return
unescape
(
GetPathBaseName
()
);
}
void
NeonUri
::
AppendPath
(
const
rtl
::
OUString
&
rPath
)
{
if
(
mPath
.
lastIndexOf
(
'/'
)
!=
mPath
.
getLength
()
-
1
)
mPath
+=
rtl
::
OUString
::
createFromAscii
(
"/"
);
mPath
+=
rPath
;
calculateURI
();
};
// static
rtl
::
OUString
NeonUri
::
escapeSegment
(
const
rtl
::
OUString
&
segment
)
{
return
rtl
::
Uri
::
encode
(
segment
,
rtl_UriCharClassPchar
,
rtl_UriEncodeIgnoreEscapes
,
RTL_TEXTENCODING_UTF8
);
}
// static
rtl
::
OUString
NeonUri
::
unescape
(
const
rtl
::
OUString
&
segment
)
{
return
rtl
::
Uri
::
decode
(
segment
,
rtl_UriDecodeWithCharset
,
RTL_TEXTENCODING_UTF8
);
}
// static
rtl
::
OUString
NeonUri
::
makeConnectionEndPointString
(
const
rtl
::
OUString
&
rHostName
,
int
nPort
)
{
rtl
::
OUStringBuffer
aBuf
;
// Is host a numeric IPv6 address?
if
(
(
rHostName
.
indexOf
(
':'
)
!=
-
1
)
&&
(
rHostName
[
0
]
!=
sal_Unicode
(
'['
)
)
)
{
aBuf
.
appendAscii
(
"["
);
aBuf
.
append
(
rHostName
);
aBuf
.
appendAscii
(
"]"
);
}
else
{
aBuf
.
append
(
rHostName
);
}
if
(
(
nPort
!=
DEFAULT_HTTP_PORT
)
&&
(
nPort
!=
DEFAULT_HTTPS_PORT
)
)
{
aBuf
.
appendAscii
(
":"
);
aBuf
.
append
(
rtl
::
OUString
::
valueOf
(
sal_Int32
(
nPort
)
)
);
}
return
aBuf
.
makeStringAndClear
();
}
ucb/source/ucp/webdav/NeonUri.hxx
deleted
100644 → 0
Dosyayı görüntüle @
8fb198c6
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment