diff options
author | Kai Sommerfeld <kso@openoffice.org> | 2002-08-22 10:37:32 +0000 |
---|---|---|
committer | Kai Sommerfeld <kso@openoffice.org> | 2002-08-22 10:37:32 +0000 |
commit | 5dbcc32f71a7a00d26f2d2f4499ade9a3a0b1dd1 (patch) | |
tree | 746860e9dca434e620418fcf2cc6f0d3a1e022e2 /ucb | |
parent | ef75a99275e59c6aac0488727481fdef0c241559 (diff) |
#96458# - Now compiles without errors/warnings on Solaris.
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/webdav/LinkSequence.cxx | 74 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/LinkSequence.hxx | 11 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/LockEntrySequence.cxx | 85 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/LockEntrySequence.hxx | 11 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/LockSequence.cxx | 131 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/LockSequence.hxx | 11 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/NeonPropFindRequest.cxx | 242 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/NeonPropFindRequest.hxx | 24 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/NeonSession.cxx | 306 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/NeonSession.hxx | 47 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx | 117 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/UCBDeadPropertyValue.hxx | 11 |
12 files changed, 503 insertions, 567 deletions
diff --git a/ucb/source/ucp/webdav/LinkSequence.cxx b/ucb/source/ucp/webdav/LinkSequence.cxx index af661e633b11..5d4107b7141d 100644 --- a/ucb/source/ucp/webdav/LinkSequence.cxx +++ b/ucb/source/ucp/webdav/LinkSequence.cxx @@ -2,9 +2,9 @@ * * $RCSfile: LinkSequence.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: kso $ $Date: 2002-08-15 10:05:25 $ + * last change: $Author: kso $ $Date: 2002-08-22 11:37:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,6 +92,40 @@ struct LinkSequenceParseContext }; ////////////////////////////////////////////////////////////////////////// +extern "C" static int validate_callback( + void * userdata, ne_xml_elmid parent, ne_xml_elmid child ) +{ + // @@@ + return NE_XML_VALID; +} + +////////////////////////////////////////////////////////////////////////// +extern "C" static int endelement_callback( void * userdata, + const struct ne_xml_elm * s, + const char * cdata ) +{ + LinkSequenceParseContext * pCtx + = static_cast< LinkSequenceParseContext * >( userdata ); + if ( !pCtx->pLink ) + pCtx->pLink = new ucb::Link; + + switch ( s->id ) + { + case DAV_ELM_src: + pCtx->pLink->Source = rtl::OUString::createFromAscii( cdata ); + break; + + case DAV_ELM_dst: + pCtx->pLink->Destination = rtl::OUString::createFromAscii( cdata ); + break; + + default: + break; + } + return 0; +} + +////////////////////////////////////////////////////////////////////////// // static bool LinkSequence::createFromXML( const rtl::OString & rInData, uno::Sequence< ucb::Link > & rOutData ) @@ -174,39 +208,3 @@ bool LinkSequence::toXML( const uno::Sequence< ucb::Link > & rInData, } return false; } - -////////////////////////////////////////////////////////////////////////// -// static -int LinkSequence::validate_callback( - void * userdata, ne_xml_elmid parent, ne_xml_elmid child ) -{ - // @@@ - return NE_XML_VALID; -} - -////////////////////////////////////////////////////////////////////////// -// static -int LinkSequence::endelement_callback( void * userdata, - const struct ne_xml_elm * s, - const char * cdata ) -{ - LinkSequenceParseContext * pCtx - = static_cast< LinkSequenceParseContext * >( userdata ); - if ( !pCtx->pLink ) - pCtx->pLink = new ucb::Link; - - switch ( s->id ) - { - case DAV_ELM_src: - pCtx->pLink->Source = rtl::OUString::createFromAscii( cdata ); - break; - - case DAV_ELM_dst: - pCtx->pLink->Destination = rtl::OUString::createFromAscii( cdata ); - break; - - default: - break; - } - return 0; -} diff --git a/ucb/source/ucp/webdav/LinkSequence.hxx b/ucb/source/ucp/webdav/LinkSequence.hxx index 0a7371f36faf..a6b6ee7c1b5f 100644 --- a/ucb/source/ucp/webdav/LinkSequence.hxx +++ b/ucb/source/ucp/webdav/LinkSequence.hxx @@ -2,9 +2,9 @@ * * $RCSfile: LinkSequence.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: kso $ $Date: 2002-08-15 10:05:25 $ + * last change: $Author: kso $ $Date: 2002-08-22 11:37:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,13 +95,6 @@ public: static bool toXML( const com::sun::star::uno::Sequence< com::sun::star::ucb::Link > & rInData, rtl::OUString & rOutData ); - - static int validate_callback( void * userdata, - ne_xml_elmid parent, - ne_xml_elmid child ); - static int endelement_callback( void * userdata, - const struct ne_xml_elm * s, - const char * cdata ); }; } diff --git a/ucb/source/ucp/webdav/LockEntrySequence.cxx b/ucb/source/ucp/webdav/LockEntrySequence.cxx index 42979168753b..e3187299c2b8 100644 --- a/ucb/source/ucp/webdav/LockEntrySequence.cxx +++ b/ucb/source/ucp/webdav/LockEntrySequence.cxx @@ -2,9 +2,9 @@ * * $RCSfile: LockEntrySequence.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: kso $ $Date: 2002-08-15 10:05:25 $ + * last change: $Author: kso $ $Date: 2002-08-22 11:37:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,6 +98,45 @@ struct LockEntrySequenceParseContext }; ////////////////////////////////////////////////////////////////////////// +extern "C" static int validate_callback( void * userdata, + ne_xml_elmid parent, + ne_xml_elmid child ) +{ + // @@@ + return NE_XML_VALID; +} + +////////////////////////////////////////////////////////////////////////// +extern "C" static int endelement_callback( void * userdata, + const struct ne_xml_elm * s, + const char * cdata ) +{ + LockEntrySequenceParseContext * pCtx + = static_cast< LockEntrySequenceParseContext * >( userdata ); + if ( !pCtx->pEntry ) + pCtx->pEntry = new ucb::LockEntry; + + switch ( s->id ) + { + case DAV_ELM_exclusive: + pCtx->pEntry->Scope = ucb::LockScope_EXCLUSIVE; + break; + + case DAV_ELM_shared: + pCtx->pEntry->Scope = ucb::LockScope_SHARED; + break; + + case DAV_ELM_write: + pCtx->pEntry->Type = ucb::LockType_WRITE; + break; + + default: + break; + } + return 0; +} + +////////////////////////////////////////////////////////////////////////// // static bool LockEntrySequence::createFromXML( const rtl::OString & rInData, uno::Sequence< @@ -154,45 +193,3 @@ bool LockEntrySequence::createFromXML( const rtl::OString & rInData, rOutData.realloc( nCount ); return success; } - -////////////////////////////////////////////////////////////////////////// -// static -int LockEntrySequence::validate_callback( void * userdata, - ne_xml_elmid parent, - ne_xml_elmid child ) -{ - // @@@ - return NE_XML_VALID; -} - -////////////////////////////////////////////////////////////////////////// -// static -int LockEntrySequence::endelement_callback( void * userdata, - const struct ne_xml_elm * s, - const char * cdata ) -{ - LockEntrySequenceParseContext * pCtx - = static_cast< LockEntrySequenceParseContext * >( userdata ); - if ( !pCtx->pEntry ) - pCtx->pEntry = new ucb::LockEntry; - - switch ( s->id ) - { - case DAV_ELM_exclusive: - pCtx->pEntry->Scope = ucb::LockScope_EXCLUSIVE; - break; - - case DAV_ELM_shared: - pCtx->pEntry->Scope = ucb::LockScope_SHARED; - break; - - case DAV_ELM_write: - pCtx->pEntry->Type = ucb::LockType_WRITE; - break; - - default: - break; - } - return 0; -} - diff --git a/ucb/source/ucp/webdav/LockEntrySequence.hxx b/ucb/source/ucp/webdav/LockEntrySequence.hxx index eb9fcdbc0ae6..f0de23dddfe7 100644 --- a/ucb/source/ucp/webdav/LockEntrySequence.hxx +++ b/ucb/source/ucp/webdav/LockEntrySequence.hxx @@ -2,9 +2,9 @@ * * $RCSfile: LockEntrySequence.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: kso $ $Date: 2002-08-15 10:05:25 $ + * last change: $Author: kso $ $Date: 2002-08-22 11:37:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,13 +92,6 @@ public: static bool createFromXML( const rtl::OString & rInData, com::sun::star::uno::Sequence< com::sun::star::ucb::LockEntry > & rOutData ); - - static int validate_callback( void * userdata, - ne_xml_elmid parent, - ne_xml_elmid child ); - static int endelement_callback( void * userdata, - const struct ne_xml_elm * s, - const char * cdata ); }; } diff --git a/ucb/source/ucp/webdav/LockSequence.cxx b/ucb/source/ucp/webdav/LockSequence.cxx index e2710b45d0c6..0e037cd1c113 100644 --- a/ucb/source/ucp/webdav/LockSequence.cxx +++ b/ucb/source/ucp/webdav/LockSequence.cxx @@ -2,9 +2,9 @@ * * $RCSfile: LockSequence.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: kso $ $Date: 2002-08-15 10:05:26 $ + * last change: $Author: kso $ $Date: 2002-08-22 11:37:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -108,67 +108,9 @@ struct LockSequenceParseContext }; ////////////////////////////////////////////////////////////////////////// -// static -bool LockSequence::createFromXML( const rtl::OString & rInData, - uno::Sequence< ucb::Lock > & rOutData ) -{ - const sal_Int32 TOKEN_LENGTH = 13; // </activelock> - bool success = true; - - // rInData may contain multiple <activelock>...</activelock> tags. - sal_Int32 nCount = 0; - sal_Int32 nStart = 0; - sal_Int32 nEnd = rInData.indexOf( "</activelock>" ); - while ( nEnd > -1 ) - { - ne_xml_parser * parser = ne_xml_create(); - if ( !parser ) - { - success = false; - break; - } - - LockSequenceParseContext aCtx; - ne_xml_push_handler( parser, - elements, - validate_callback, - 0, // startelement_callback - endelement_callback, - &aCtx ); - - ne_xml_parse( parser, - rInData.getStr() + nStart, - nEnd - nStart + TOKEN_LENGTH ); - - success = !!ne_xml_valid( parser ); - - ne_xml_destroy( parser ); - - if ( !success ) - break; - - if ( aCtx.pLock ) - { - nCount++; - if ( nCount > rOutData.getLength() ) - rOutData.realloc( rOutData.getLength() + 1 ); - - rOutData[ nCount - 1 ] = *aCtx.pLock; - } - - nStart = nEnd + TOKEN_LENGTH + 1; - nEnd = rInData.indexOf( "</activelock>", nStart ); - } - -// rOutData.realloc( nCount ); - return success; -} - -////////////////////////////////////////////////////////////////////////// -// static -int LockSequence::validate_callback( void * userdata, - ne_xml_elmid parent, - ne_xml_elmid child ) +extern "C" static int validate_callback( void * userdata, + ne_xml_elmid parent, + ne_xml_elmid child ) { // @@@ return NE_XML_VALID; @@ -176,9 +118,9 @@ int LockSequence::validate_callback( void * userdata, ////////////////////////////////////////////////////////////////////////// // static -int LockSequence::endelement_callback( void * userdata, - const struct ne_xml_elm * s, - const char * cdata ) +extern "C" static int endelement_callback( void * userdata, + const struct ne_xml_elm * s, + const char * cdata ) { LockSequenceParseContext * pCtx = static_cast< LockSequenceParseContext * >( userdata ); @@ -267,3 +209,60 @@ int LockSequence::endelement_callback( void * userdata, } return 0; } + +////////////////////////////////////////////////////////////////////////// +// static +bool LockSequence::createFromXML( const rtl::OString & rInData, + uno::Sequence< ucb::Lock > & rOutData ) +{ + const sal_Int32 TOKEN_LENGTH = 13; // </activelock> + bool success = true; + + // rInData may contain multiple <activelock>...</activelock> tags. + sal_Int32 nCount = 0; + sal_Int32 nStart = 0; + sal_Int32 nEnd = rInData.indexOf( "</activelock>" ); + while ( nEnd > -1 ) + { + ne_xml_parser * parser = ne_xml_create(); + if ( !parser ) + { + success = false; + break; + } + + LockSequenceParseContext aCtx; + ne_xml_push_handler( parser, + elements, + validate_callback, + 0, // startelement_callback + endelement_callback, + &aCtx ); + + ne_xml_parse( parser, + rInData.getStr() + nStart, + nEnd - nStart + TOKEN_LENGTH ); + + success = !!ne_xml_valid( parser ); + + ne_xml_destroy( parser ); + + if ( !success ) + break; + + if ( aCtx.pLock ) + { + nCount++; + if ( nCount > rOutData.getLength() ) + rOutData.realloc( rOutData.getLength() + 1 ); + + rOutData[ nCount - 1 ] = *aCtx.pLock; + } + + nStart = nEnd + TOKEN_LENGTH + 1; + nEnd = rInData.indexOf( "</activelock>", nStart ); + } + +// rOutData.realloc( nCount ); + return success; +} diff --git a/ucb/source/ucp/webdav/LockSequence.hxx b/ucb/source/ucp/webdav/LockSequence.hxx index 546c6092e6b6..5078de845183 100644 --- a/ucb/source/ucp/webdav/LockSequence.hxx +++ b/ucb/source/ucp/webdav/LockSequence.hxx @@ -2,9 +2,9 @@ * * $RCSfile: LockSequence.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: kso $ $Date: 2002-08-15 10:05:26 $ + * last change: $Author: kso $ $Date: 2002-08-22 11:37:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,13 +92,6 @@ public: static bool createFromXML( const rtl::OString & rInData, com::sun::star::uno::Sequence< com::sun::star::ucb::Lock > & rOutData ); - - static int validate_callback( void * userdata, - ne_xml_elmid parent, - ne_xml_elmid child ); - static int endelement_callback( void * userdata, - const struct ne_xml_elm * s, - const char * cdata ); }; } diff --git a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx index 33fa0b8f7a46..63d64a81f57b 100644 --- a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx +++ b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx @@ -2,9 +2,9 @@ * * $RCSfile: NeonPropFindRequest.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: kso $ $Date: 2002-08-15 10:05:28 $ + * last change: $Author: kso $ $Date: 2002-08-22 11:37:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -96,113 +96,10 @@ using namespace std; using namespace webdav_ucp; // ------------------------------------------------------------------- -// Constructor -// ------------------------------------------------------------------- - -NeonPropFindRequest::NeonPropFindRequest( HttpSession* inSession, - const char* inPath, - const Depth inDepth, - const vector< OUString >& inPropNames, - vector< DAVResource >& ioResources, - int & nError ) -{ - // Generate the list of properties we're looking for - int thePropCount = inPropNames.size(); - if ( thePropCount > 0 ) - { - NeonPropName* thePropNames = new NeonPropName[ thePropCount + 1 ]; - for ( int theIndex = 0; theIndex < thePropCount; theIndex ++ ) - { - // Split fullname into namespace and name! - DAVProperties::createNeonPropName( - inPropNames[ theIndex ], thePropNames[ theIndex ] ); - } - thePropNames[ theIndex ].nspace = NULL; - thePropNames[ theIndex ].name = NULL; - - nError = ne_simple_propfind( inSession, - inPath, - inDepth, - thePropNames, - propfind_results, - &ioResources ); - - for ( theIndex = 0; theIndex < thePropCount; theIndex ++ ) - free( (void *)thePropNames[ theIndex ].name ); - - delete [] thePropNames; - } - else - { - // ALLPROP - nError = ne_simple_propfind( inSession, - inPath, - inDepth, - NULL, // 0 == allprop - propfind_results, - &ioResources ); - } - - // #87585# - Sometimes neon lies (because some servers lie). - if ( ( nError == NE_OK ) && ioResources.empty() ) - nError = NE_ERROR; -} - -// ------------------------------------------------------------------- -// Constructor -// - obtains property names -// ------------------------------------------------------------------- - -NeonPropFindRequest::NeonPropFindRequest( - HttpSession* inSession, - const char* inPath, - const Depth inDepth, - std::vector< DAVResourceInfo > & ioResInfo, - int & nError ) -{ - nError = ne_propnames( inSession, - inPath, - inDepth, - propnames_results, - &ioResInfo ); - - // #87585# - Sometimes neon lies (because some servers lie). - if ( ( nError == NE_OK ) && ioResInfo.empty() ) - nError = NE_ERROR; -} - -// ------------------------------------------------------------------- -// Destructor -// ------------------------------------------------------------------- -NeonPropFindRequest::~NeonPropFindRequest( ) -{ -} - -// ------------------------------------------------------------------- -// static -void NeonPropFindRequest::propfind_results( void* userdata, - const char* href, - const NeonPropFindResultSet* set ) -{ - // @@@ href is not the uri! DAVResource ctor wants uri! - - DAVResource theResource( - OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) ); - - ne_propset_iterate( set, propfind_iter, &theResource ); - - // Add entry to resources list. - vector< DAVResource > * theResources - = static_cast< vector< DAVResource > * >( userdata ); - theResources->push_back( theResource ); -} - -// ------------------------------------------------------------------- -// static -int NeonPropFindRequest::propfind_iter( void* userdata, - const NeonPropName* pname, - const char* value, - const HttpStatus* status ) +extern "C" static int propfind_iter( void* userdata, + const NeonPropName* pname, + const char* value, + const HttpStatus* status ) { /* HTTP Response Status Classes: @@ -305,8 +202,41 @@ int NeonPropFindRequest::propfind_iter( void* userdata, } // ------------------------------------------------------------------- -// static -void NeonPropFindRequest::propnames_results( +extern "C" static void propfind_results( void* userdata, + const char* href, + const NeonPropFindResultSet* set ) +{ + // @@@ href is not the uri! DAVResource ctor wants uri! + + DAVResource theResource( + OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) ); + + ne_propset_iterate( set, propfind_iter, &theResource ); + + // Add entry to resources list. + vector< DAVResource > * theResources + = static_cast< vector< DAVResource > * >( userdata ); + theResources->push_back( theResource ); +} + +// ------------------------------------------------------------------- +extern "C" static int propnames_iter( void* userdata, + const NeonPropName* pname, + const char* value, + const HttpStatus* status ) +{ + OUString aFullName; + DAVProperties::createUCBPropName( pname->nspace, + pname->name, + aFullName ); + + DAVResourceInfo* theResource = static_cast< DAVResourceInfo * >( userdata ); + theResource->properties.push_back( aFullName ); + return 0; +} + +// ------------------------------------------------------------------- +extern "C" static void propnames_results( void* userdata, const char* href, const NeonPropFindResultSet* results ) @@ -326,18 +256,84 @@ void NeonPropFindRequest::propnames_results( } // ------------------------------------------------------------------- -// static -int NeonPropFindRequest::propnames_iter( void* userdata, - const NeonPropName* pname, - const char* value, - const HttpStatus* status ) +// Constructor +// ------------------------------------------------------------------- + +NeonPropFindRequest::NeonPropFindRequest( HttpSession* inSession, + const char* inPath, + const Depth inDepth, + const vector< OUString >& inPropNames, + vector< DAVResource >& ioResources, + int & nError ) { - OUString aFullName; - DAVProperties::createUCBPropName( pname->nspace, - pname->name, - aFullName ); + // Generate the list of properties we're looking for + int thePropCount = inPropNames.size(); + if ( thePropCount > 0 ) + { + NeonPropName* thePropNames = new NeonPropName[ thePropCount + 1 ]; + for ( int theIndex = 0; theIndex < thePropCount; theIndex ++ ) + { + // Split fullname into namespace and name! + DAVProperties::createNeonPropName( + inPropNames[ theIndex ], thePropNames[ theIndex ] ); + } + thePropNames[ theIndex ].nspace = NULL; + thePropNames[ theIndex ].name = NULL; - DAVResourceInfo* theResource = static_cast< DAVResourceInfo * >( userdata ); - theResource->properties.push_back( aFullName ); - return 0; + nError = ne_simple_propfind( inSession, + inPath, + inDepth, + thePropNames, + propfind_results, + &ioResources ); + + for ( theIndex = 0; theIndex < thePropCount; theIndex ++ ) + free( (void *)thePropNames[ theIndex ].name ); + + delete [] thePropNames; + } + else + { + // ALLPROP + nError = ne_simple_propfind( inSession, + inPath, + inDepth, + NULL, // 0 == allprop + propfind_results, + &ioResources ); + } + + // #87585# - Sometimes neon lies (because some servers lie). + if ( ( nError == NE_OK ) && ioResources.empty() ) + nError = NE_ERROR; +} + +// ------------------------------------------------------------------- +// Constructor +// - obtains property names +// ------------------------------------------------------------------- + +NeonPropFindRequest::NeonPropFindRequest( + HttpSession* inSession, + const char* inPath, + const Depth inDepth, + std::vector< DAVResourceInfo > & ioResInfo, + int & nError ) +{ + nError = ne_propnames( inSession, + inPath, + inDepth, + propnames_results, + &ioResInfo ); + + // #87585# - Sometimes neon lies (because some servers lie). + if ( ( nError == NE_OK ) && ioResInfo.empty() ) + nError = NE_ERROR; +} + +// ------------------------------------------------------------------- +// Destructor +// ------------------------------------------------------------------- +NeonPropFindRequest::~NeonPropFindRequest( ) +{ } diff --git a/ucb/source/ucp/webdav/NeonPropFindRequest.hxx b/ucb/source/ucp/webdav/NeonPropFindRequest.hxx index a0bc48d2a322..03bc2f9d7c2e 100644 --- a/ucb/source/ucp/webdav/NeonPropFindRequest.hxx +++ b/ucb/source/ucp/webdav/NeonPropFindRequest.hxx @@ -2,9 +2,9 @@ * * $RCSfile: NeonPropFindRequest.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: kso $ $Date: 2001-05-16 15:29:59 $ + * last change: $Author: kso $ $Date: 2002-08-22 11:37:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -99,26 +99,6 @@ public: int & nError ); ~NeonPropFindRequest(); - -private: - // Neon callback functions - static void propfind_results( void* userdata, - const char* href, - const NeonPropFindResultSet* set ); - - static int propfind_iter( void* userdata, - const NeonPropName* pname, - const char* value, - const HttpStatus* status ); - - static void propnames_results( void* userdata, - const char* href, - const NeonPropFindResultSet* results ); - - static int propnames_iter( void* userdata, - const NeonPropName* pname, - const char* value, - const HttpStatus* status ); }; }; // namespace webdav_ucp diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx index 60a0cce8c4bb..a12299c1f43f 100644 --- a/ucb/source/ucp/webdav/NeonSession.cxx +++ b/ucb/source/ucp/webdav/NeonSession.cxx @@ -2,9 +2,9 @@ * * $RCSfile: NeonSession.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: kso $ $Date: 2002-08-21 07:34:53 $ + * last change: $Author: kso $ $Date: 2002-08-22 11:37:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -181,6 +181,160 @@ static sal_uInt16 makeStatusCode( const rtl::OUString & rStatusText ) return sal_uInt16( rStatusText.copy( 0, nPos ).toInt32() ); } +//-------------------------------------------------------------------- +//-------------------------------------------------------------------- +// +// Callback functions +// +//-------------------------------------------------------------------- +//-------------------------------------------------------------------- + +// ------------------------------------------------------------------- +// ResponseBlockReader +// A simple Neon response_block_reader for use with an XInputStream +// ------------------------------------------------------------------- +extern "C" static void ResponseBlockReader( void * inUserData, + const char * inBuf, + size_t inLen ) +{ + // neon calls this function with (inLen == 0)... + if ( inLen > 0 ) + { + NeonInputStream * theInputStream + = static_cast< NeonInputStream *>( inUserData ); + theInputStream->AddToStream( inBuf, inLen ); + } +} + +// ------------------------------------------------------------------- +// ResponseBlockWriter +// A simple Neon response_block_reader for use with an XOutputStream +// ------------------------------------------------------------------- +extern "C" static void ResponseBlockWriter( void * inUserData, + const char * inBuf, + size_t inLen ) +{ + // neon calls this function with (inLen == 0)... + if ( inLen > 0 ) + { + uno::Reference< io::XOutputStream > * theOutputStreamPtr + = static_cast< uno::Reference< io::XOutputStream > * >( + inUserData ); + uno::Reference< io::XOutputStream > theOutputStream + = *theOutputStreamPtr; + + const uno::Sequence< sal_Int8 > theSequence( + (sal_Int8 *)inBuf, inLen ); + theOutputStream->writeBytes( theSequence ); + } +} + +extern "C" static int NeonAuth( void * inUserData, + const char * inRealm, + int attempt, + char * inoutUserName, + char * inoutPassWord ) +{ + NeonSession * theSession = static_cast< NeonSession * >( inUserData ); + if ( !theSession->getServerAuthListener() ) + { + // abort + return -1; + } + + // username buffer is prefilled with user name from last attempt. + rtl::OUString theUserName( + rtl::OUString::createFromAscii( inoutUserName ) ); + rtl::OUString thePassWord; /*( + // @@@ Neon does not initialize password buffer + // (last checked: 0.22.0). + rtl::OUString::createFromAscii( inoutPassWord ) ); */ + + int theRetVal = theSession->getServerAuthListener()->authenticate( + rtl::OUString::createFromAscii( inRealm ), + theSession->getHostName(), + theUserName, + thePassWord, + theSession->getCommandEnvironment() ); + strcpy( inoutUserName, + rtl::OUStringToOString( theUserName, RTL_TEXTENCODING_UTF8 ) ); + + strcpy( inoutPassWord, + rtl::OUStringToOString( thePassWord, RTL_TEXTENCODING_UTF8 ) ); + + return theRetVal; +} + + +extern "C" static void ProgressNotify( void * userdata, + off_t progress, + off_t total ) +{ + // progress: bytes read so far + // total: total bytes to read, -1 -> total count not known +} + +extern "C" static void StatusNotify( void * userdata, + ne_conn_status status, + const char *info ) +{ +#if 0 + typedef enum { + ne_conn_namelookup, /* lookup up hostname (info = hostname) */ + ne_conn_connecting, /* connecting to host (info = hostname) */ + ne_conn_connected, /* connected to host (info = hostname) */ + ne_conn_secure /* connection now secure (info = crypto level) */ + } ne_conn_status; +#endif + + // info: hostname +} + +extern "C" static void PreSendRequest( ne_request * req, + void * userdata, + ne_buffer * headers ) +{ + // userdata -> value returned by 'create' + + NeonSession * pSession = static_cast< NeonSession * >( userdata ); + if ( pSession ) + { + const RequestDataMap * pRequestData + = static_cast< const RequestDataMap* >( + pSession->getRequestData() ); + + RequestDataMap::const_iterator it = pRequestData->find( req ); + if ( it != pRequestData->end() ) + { + if ( (*it).second.aContentType.getLength() ) + { + char * pData = headers->data; + if ( strstr( pData, "Content-Type:" ) == NULL ) + { + rtl::OString aType + = rtl::OUStringToOString( (*it).second.aContentType, + RTL_TEXTENCODING_UTF8 ); + ne_buffer_concat( headers, "Content-Type: ", + aType.getStr(), EOL, NULL ); + } + } + + if ( (*it).second.aReferer.getLength() ) + { + char * pData = headers->data; + if ( strstr( pData, "Referer:" ) == NULL ) + { + rtl::OString aReferer + = rtl::OUStringToOString( (*it).second.aReferer, + RTL_TEXTENCODING_UTF8 ); + ne_buffer_concat( headers, "Referer: ", + aReferer.getStr(), EOL, NULL ); + } + } + } + } +} + // ------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------- @@ -504,7 +658,8 @@ uno::Reference< io::XInputStream > NeonSession::GET( NeonInputStream * theInputStream = new NeonInputStream; int theRetVal = GET( m_pHttpSession, - rtl::OUStringToOString( inPath, RTL_TEXTENCODING_UTF8 ), + rtl::OUStringToOString( + inPath, RTL_TEXTENCODING_UTF8 ), ResponseBlockReader, theInputStream ); HandleError( theRetVal ); @@ -525,7 +680,8 @@ void NeonSession::GET( const rtl::OUString & inPath, m_xEnv = inEnv; int theRetVal = GET( m_pHttpSession, - rtl::OUStringToOString( inPath, RTL_TEXTENCODING_UTF8 ), + rtl::OUStringToOString( + inPath, RTL_TEXTENCODING_UTF8 ), ResponseBlockWriter, &ioOutputStream ); HandleError( theRetVal ); @@ -938,44 +1094,6 @@ HttpSession * NeonSession::CreateSession( const ::rtl::OUString & inScheme, return theHttpSession; } -// ------------------------------------------------------------------- -// ResponseBlockReader -// A simple Neon response_block_reader for use with an XInputStream -// ------------------------------------------------------------------- -void NeonSession::ResponseBlockReader( void * inUserData, - const char * inBuf, - size_t inLen ) -{ - // neon calls this function with (inLen == 0)... - if ( inLen > 0 ) - { - NeonInputStream * theInputStream - = static_cast< NeonInputStream *>( inUserData ); - theInputStream->AddToStream( inBuf, inLen ); - } -} - -// ------------------------------------------------------------------- -// ResponseBlockWriter -// A simple Neon response_block_reader for use with an XOutputStream -// ------------------------------------------------------------------- -void NeonSession::ResponseBlockWriter( void * inUserData, - const char * inBuf, - size_t inLen ) -{ - // neon calls this function with (inLen == 0)... - if ( inLen > 0 ) - { - uno::Reference< io::XOutputStream > * theOutputStreamPtr - = static_cast< uno::Reference< io::XOutputStream > * >( inUserData ); - uno::Reference< io::XOutputStream > theOutputStream - = *theOutputStreamPtr; - - const uno::Sequence< sal_Int8 > theSequence( (sal_Int8 *)inBuf, inLen ); - theOutputStream->writeBytes( theSequence ); - } -} - // Note: Uncomment the following if locking support is required /* void NeonSession::Lockit( const Lock & inLock, bool inLockit ) @@ -1048,110 +1166,6 @@ void NeonSession::Lockit( const Lock & inLock, bool inLockit ) } */ -int NeonSession::NeonAuth( void * inUserData, - const char * inRealm, - int attempt, - char * inoutUserName, - char * inoutPassWord ) -{ - NeonSession * theSession = static_cast< NeonSession * >( inUserData ); - if ( !theSession->m_pListener ) - { - // abort - return -1; - } - - // username buffer is prefilled with user name from last attempt. - rtl::OUString theUserName( - rtl::OUString::createFromAscii( inoutUserName ) ); - rtl::OUString thePassWord; /*( - // @@@ Neon does not initialize password buffer - // (last checked: 0.22.0). - rtl::OUString::createFromAscii( inoutPassWord ) ); */ - - int theRetVal = theSession->m_pListener->authenticate( - rtl::OUString::createFromAscii( inRealm ), - theSession->m_aHostName, - theUserName, - thePassWord, - theSession->m_xEnv ); - strcpy( inoutUserName, - rtl::OUStringToOString( theUserName, RTL_TEXTENCODING_UTF8 ) ); - - strcpy( inoutPassWord, - rtl::OUStringToOString( thePassWord, RTL_TEXTENCODING_UTF8 ) ); - - return theRetVal; -} - -// static -void NeonSession::ProgressNotify( void * userdata, off_t progress, off_t total ) -{ - // progress: bytes read so far - // total: total bytes to read, -1 -> total count not known -} - -// static -void NeonSession::StatusNotify( - void * userdata, ne_conn_status status, const char *info ) -{ -#if 0 - typedef enum { - ne_conn_namelookup, /* lookup up hostname (info = hostname) */ - ne_conn_connecting, /* connecting to host (info = hostname) */ - ne_conn_connected, /* connected to host (info = hostname) */ - ne_conn_secure /* connection now secure (info = crypto level) */ - } ne_conn_status; -#endif - - // info: hostname -} - -// static -void NeonSession::PreSendRequest( ne_request * req, - void * userdata, - ne_buffer * headers ) -{ - // userdata -> value returned by 'create' - - NeonSession * pSession = static_cast< NeonSession * >( userdata ); - if ( pSession ) - { - RequestDataMap * pRequestData - = static_cast< RequestDataMap* >( pSession->m_pRequestData ); - - RequestDataMap::const_iterator it = pRequestData->find( req ); - if ( it != pRequestData->end() ) - { - if ( (*it).second.aContentType.getLength() ) - { - char * pData = headers->data; - if ( strstr( pData, "Content-Type:" ) == NULL ) - { - rtl::OString aType - = rtl::OUStringToOString( (*it).second.aContentType, - RTL_TEXTENCODING_UTF8 ); - ne_buffer_concat( headers, "Content-Type: ", - aType.getStr(), EOL, NULL ); - } - } - - if ( (*it).second.aReferer.getLength() ) - { - char * pData = headers->data; - if ( strstr( pData, "Referer:" ) == NULL ) - { - rtl::OString aReferer - = rtl::OUStringToOString( (*it).second.aReferer, - RTL_TEXTENCODING_UTF8 ); - ne_buffer_concat( headers, "Referer: ", - aReferer.getStr(), EOL, NULL ); - } - } - } - } -} - // static int NeonSession::GET( ne_session * sess, const char * uri, diff --git a/ucb/source/ucp/webdav/NeonSession.hxx b/ucb/source/ucp/webdav/NeonSession.hxx index 8ae02b6f0d2d..f6ab43cb4241 100644 --- a/ucb/source/ucp/webdav/NeonSession.hxx +++ b/ucb/source/ucp/webdav/NeonSession.hxx @@ -2,9 +2,9 @@ * * $RCSfile: NeonSession.hxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: kso $ $Date: 2002-08-15 10:05:29 $ + * last change: $Author: kso $ $Date: 2002-08-22 11:37:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -131,6 +131,17 @@ class NeonSession : public DAVSession com::sun::star::ucb::XCommandEnvironment >& inEnv ) throw ( DAVException ); + DAVAuthListener * getServerAuthListener() const + { return m_pListener; } + + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment > & + getCommandEnvironment() const { return m_xEnv; } + + const rtl::OUString & getHostName() const { return m_aHostName; } + + const void * getRequestData() const { return m_pRequestData; } + // allprop & named virtual void PROPFIND( const ::rtl::OUString & inPath, const Depth inDepth, @@ -250,42 +261,12 @@ class NeonSession : public DAVSession const ::rtl::OUString & inUserInfo ) throw( DAVException ); - // A simple Neon response_block_reader for use with an XInputStream - static void ResponseBlockReader( void * inUserData, - const char * inBuf, - size_t inLen ); - - // A simple Neon response_block_reader for use with an XOutputStream - static void ResponseBlockWriter( void * inUserData, - const char * inBuf, - size_t inLen ); - // Note: Uncomment the following if locking support is required // void Lockit( const Lock & inLock, bool inLockit ) // throw ( DAVException ); - // Authentication callback. - static int NeonAuth( void * inUserData, - const char * inRealm, - int attempt, - char * inoutUserName, - char * inoutPassWord ); - - // Progress / Status callbacks. - static void NeonSession::ProgressNotify( void * userdata, - off_t progress, - off_t total ); - - static void NeonSession::StatusNotify( void * userdata, - ne_conn_status status, - const char *info ); - - // pre-send-request callback - static void PreSendRequest( ne_request * req, - void * userdata, - ne_buffer * headers ); - // low level GET implementation, used by both public GET implementations + // low level GET implementation, used by public GET implementations static int GET( ne_session * sess, const char * uri, ne_block_reader reader, diff --git a/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx b/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx index be3d9e1798f1..bd5d3ce853e1 100644 --- a/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx +++ b/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx @@ -2,9 +2,9 @@ * * $RCSfile: UCBDeadPropertyValue.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: kso $ $Date: 2002-08-15 10:05:30 $ + * last change: $Author: kso $ $Date: 2002-08-22 11:37:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -128,6 +128,62 @@ struct UCBDeadPropertyValueParseContext }; ////////////////////////////////////////////////////////////////////////// +extern "C" static int validate_callback( void * userdata, + ne_xml_elmid parent, + ne_xml_elmid child ) +{ + switch ( parent ) + { + case 0: + if ( child == DAV_ELM_ucbprop ) + return NE_XML_VALID; + + break; + + case DAV_ELM_ucbprop: + return NE_XML_VALID; + + default: + break; + } + + return NE_XML_DECLINE; +} + +////////////////////////////////////////////////////////////////////////// +// static +extern "C" static int endelement_callback( void * userdata, + const struct ne_xml_elm * s, + const char * cdata ) +{ + UCBDeadPropertyValueParseContext * pCtx + = static_cast< UCBDeadPropertyValueParseContext * >( userdata ); + + switch ( s->id ) + { + case DAV_ELM_type: + OSL_ENSURE( !pCtx->pType, + "UCBDeadPropertyValue::endelement_callback - " + "Type already set!" ); + pCtx->pType = new rtl::OUString( + rtl::OUString::createFromAscii( cdata ) ); + break; + + case DAV_ELM_value: + OSL_ENSURE( !pCtx->pValue, + "UCBDeadPropertyValue::endelement_callback - " + "Value already set!" ); + pCtx->pValue = new rtl::OUString( + rtl::OUString::createFromAscii( cdata ) ); + break; + + default: + break; + } + return 0; +} + +////////////////////////////////////////////////////////////////////////// static rtl::OUString encodeValue( const rtl::OUString & rValue ) { // Note: I do not use the usual & + < + > encoding, because @@ -498,60 +554,3 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData, return true; } - -////////////////////////////////////////////////////////////////////////// -// static -int UCBDeadPropertyValue::validate_callback( void * userdata, - ne_xml_elmid parent, - ne_xml_elmid child ) -{ - switch ( parent ) - { - case 0: - if ( child == DAV_ELM_ucbprop ) - return NE_XML_VALID; - - break; - - case DAV_ELM_ucbprop: - return NE_XML_VALID; - - default: - break; - } - - return NE_XML_DECLINE; -} - -////////////////////////////////////////////////////////////////////////// -// static -int UCBDeadPropertyValue::endelement_callback( void * userdata, - const struct ne_xml_elm * s, - const char * cdata ) -{ - UCBDeadPropertyValueParseContext * pCtx - = static_cast< UCBDeadPropertyValueParseContext * >( userdata ); - - switch ( s->id ) - { - case DAV_ELM_type: - OSL_ENSURE( !pCtx->pType, - "UCBDeadPropertyValue::endelement_callback - " - "Type already set!" ); - pCtx->pType = new rtl::OUString( - rtl::OUString::createFromAscii( cdata ) ); - break; - - case DAV_ELM_value: - OSL_ENSURE( !pCtx->pValue, - "UCBDeadPropertyValue::endelement_callback - " - "Value already set!" ); - pCtx->pValue = new rtl::OUString( - rtl::OUString::createFromAscii( cdata ) ); - break; - - default: - break; - } - return 0; -} diff --git a/ucb/source/ucp/webdav/UCBDeadPropertyValue.hxx b/ucb/source/ucp/webdav/UCBDeadPropertyValue.hxx index 23c9d20534dc..2ffc2b810df3 100644 --- a/ucb/source/ucp/webdav/UCBDeadPropertyValue.hxx +++ b/ucb/source/ucp/webdav/UCBDeadPropertyValue.hxx @@ -2,9 +2,9 @@ * * $RCSfile: UCBDeadPropertyValue.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: kso $ $Date: 2002-08-15 10:05:30 $ + * last change: $Author: kso $ $Date: 2002-08-22 11:37:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -106,13 +106,6 @@ public: com::sun::star::uno::Any & rOutData ); static bool toXML( const com::sun::star::uno::Any & rInData, rtl::OUString & rOutData ); - - static int validate_callback( void * userdata, - ne_xml_elmid parent, - ne_xml_elmid child ); - static int endelement_callback( void * userdata, - const struct ne_xml_elm * s, - const char * cdata ); }; } |