1*f8e07b45SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f8e07b45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f8e07b45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f8e07b45SAndrew Rist * distributed with this work for additional information 6*f8e07b45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f8e07b45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f8e07b45SAndrew Rist * "License"); you may not use this file except in compliance 9*f8e07b45SAndrew Rist * with the License. You may obtain a copy of the License at 10*f8e07b45SAndrew Rist * 11*f8e07b45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f8e07b45SAndrew Rist * 13*f8e07b45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f8e07b45SAndrew Rist * software distributed under the License is distributed on an 15*f8e07b45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f8e07b45SAndrew Rist * KIND, either express or implied. See the License for the 17*f8e07b45SAndrew Rist * specific language governing permissions and limitations 18*f8e07b45SAndrew Rist * under the License. 19*f8e07b45SAndrew Rist * 20*f8e07b45SAndrew Rist *************************************************************/ 21*f8e07b45SAndrew Rist 22*f8e07b45SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_ 25cdf0e10cSrcweir #define __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir //***************************************************************************************************************** 28cdf0e10cSrcweir // special macros to debug asynchronous methods of plugin frame 29cdf0e10cSrcweir //***************************************************************************************************************** 30cdf0e10cSrcweir 31cdf0e10cSrcweir #ifdef ENABLE_PLUGINDEBUG 32cdf0e10cSrcweir 33cdf0e10cSrcweir //_____________________________________________________________________________________________________________ 34cdf0e10cSrcweir // includes 35cdf0e10cSrcweir //_____________________________________________________________________________________________________________ 36cdf0e10cSrcweir 37cdf0e10cSrcweir #ifndef _RTL_STRBUF_HXX_ 38cdf0e10cSrcweir #include <rtl/strbuf.hxx> 39cdf0e10cSrcweir #endif 40cdf0e10cSrcweir 41cdf0e10cSrcweir #ifndef _RTL_STRING_HXX_ 42cdf0e10cSrcweir #include <rtl/string.hxx> 43cdf0e10cSrcweir #endif 44cdf0e10cSrcweir 45cdf0e10cSrcweir /*_____________________________________________________________________________________________________________ 46cdf0e10cSrcweir LOGFILE_PLUGIN 47cdf0e10cSrcweir 48cdf0e10cSrcweir For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! 49cdf0e10cSrcweir _____________________________________________________________________________________________________________*/ 50cdf0e10cSrcweir 51cdf0e10cSrcweir #ifndef LOGFILE_PLUGIN 52cdf0e10cSrcweir #define LOGFILE_PLUGIN \ 53cdf0e10cSrcweir "plugin.log" 54cdf0e10cSrcweir #endif 55cdf0e10cSrcweir 56cdf0e10cSrcweir /*_____________________________________________________________________________________________________________ 57cdf0e10cSrcweir LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) 58cdf0e10cSrcweir 59cdf0e10cSrcweir Our plugin forward special url's to plugin dll, browser and webserver. 60cdf0e10cSrcweir We convert internal url's to an external notation. 61cdf0e10cSrcweir With this macro you can log some parameter of this operation. 62cdf0e10cSrcweir _____________________________________________________________________________________________________________*/ 63cdf0e10cSrcweir 64cdf0e10cSrcweir #define LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) \ 65cdf0e10cSrcweir /* Use new scope to declare local private variables! */ \ 66cdf0e10cSrcweir { \ 67cdf0e10cSrcweir ::rtl::OStringBuffer sBuffer(1024); \ 68cdf0e10cSrcweir sBuffer.append( "PlugInFrame [ \"" ); \ 69cdf0e10cSrcweir sBuffer.append( SFRAMENAME ); \ 70cdf0e10cSrcweir sBuffer.append( "\" ] send " ); \ 71cdf0e10cSrcweir sBuffer.append( SSENDMODE ); \ 72cdf0e10cSrcweir sBuffer.append( "( internalURL=\"" ); \ 73cdf0e10cSrcweir sBuffer.append( U2B( SINTERNALURL ) ); \ 74cdf0e10cSrcweir sBuffer.append( "\", externalURL=\""); \ 75cdf0e10cSrcweir sBuffer.append( U2B( SEXTERNALURL ) ); \ 76cdf0e10cSrcweir sBuffer.append( "\" ) to browser.\n"); \ 77cdf0e10cSrcweir WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ 78cdf0e10cSrcweir } 79cdf0e10cSrcweir 80cdf0e10cSrcweir /*_____________________________________________________________________________________________________________ 81cdf0e10cSrcweir LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) 82cdf0e10cSrcweir 83cdf0e10cSrcweir A plugin frame can get a url request in two different modes. 84cdf0e10cSrcweir 1) newURL() 85cdf0e10cSrcweir 2) newStream() 86cdf0e10cSrcweir We convert external url's to an internal notation. 87cdf0e10cSrcweir With this macro you can log some parameter of this operations. 88cdf0e10cSrcweir _____________________________________________________________________________________________________________*/ 89cdf0e10cSrcweir 90cdf0e10cSrcweir #define LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) \ 91cdf0e10cSrcweir /* Use new scope to declare local private variables! */ \ 92cdf0e10cSrcweir { \ 93cdf0e10cSrcweir ::rtl::OStringBuffer sBuffer(1024); \ 94cdf0e10cSrcweir sBuffer.append( "PlugInFrame [ \"" ); \ 95cdf0e10cSrcweir sBuffer.append( U2B( SFRAMENAME ) ); \ 96cdf0e10cSrcweir sBuffer.append( "\" ] receive " ); \ 97cdf0e10cSrcweir sBuffer.append( SRECEIVEMODE ); \ 98cdf0e10cSrcweir sBuffer.append( "( externalURL=\"" ); \ 99cdf0e10cSrcweir sBuffer.append( U2B( SEXTERNALURL ) ); \ 100cdf0e10cSrcweir sBuffer.append( "\", internalURL=\"" ); \ 101cdf0e10cSrcweir sBuffer.append( U2B( SINTERNALURL ) ); \ 102cdf0e10cSrcweir sBuffer.append( "\" ) from browser.\n" ); \ 103cdf0e10cSrcweir WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106cdf0e10cSrcweir /*_____________________________________________________________________________________________________________ 107cdf0e10cSrcweir LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, AANY ) 108cdf0e10cSrcweir 109cdf0e10cSrcweir Log information about parameter of a newURL() at a plugin frame. 110cdf0e10cSrcweir _____________________________________________________________________________________________________________*/ 111cdf0e10cSrcweir 112cdf0e10cSrcweir #define LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, sFILTER, AANY ) \ 113cdf0e10cSrcweir /* Use new scope to declare local private variables! */ \ 114cdf0e10cSrcweir { \ 115cdf0e10cSrcweir ::rtl::OStringBuffer sBuffer(1024); \ 116cdf0e10cSrcweir sBuffer.append( "PlugInFrame [ \"" ); \ 117cdf0e10cSrcweir sBuffer.append( U2B( SFRAMENAME ) ); \ 118cdf0e10cSrcweir sBuffer.append( "\" ] called with newURL( \"" ); \ 119cdf0e10cSrcweir sBuffer.append( U2B( SMIMETYPE ) ); \ 120cdf0e10cSrcweir sBuffer.append( "\", \"" ); \ 121cdf0e10cSrcweir sBuffer.append( U2B( SURL ) ); \ 122cdf0e10cSrcweir sBuffer.append( "\", \"" ); \ 123cdf0e10cSrcweir sBuffer.append( U2B( SFILTER ) ); \ 124cdf0e10cSrcweir sBuffer.append( "\", " ); \ 125cdf0e10cSrcweir if( AANY.hasValue() == sal_True ) \ 126cdf0e10cSrcweir { \ 127cdf0e10cSrcweir sBuffer.append( "filled Any )" ); \ 128cdf0e10cSrcweir } \ 129cdf0e10cSrcweir else \ 130cdf0e10cSrcweir { \ 131cdf0e10cSrcweir sBuffer.append( "empty Any )" ); \ 132cdf0e10cSrcweir } \ 133cdf0e10cSrcweir sBuffer.append( "\n" ); \ 134cdf0e10cSrcweir WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ 135cdf0e10cSrcweir } 136cdf0e10cSrcweir 137cdf0e10cSrcweir /*_____________________________________________________________________________________________________________ 138cdf0e10cSrcweir LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, ASTREAM, AANY ) 139cdf0e10cSrcweir 140cdf0e10cSrcweir Log information about parameter of a newStream() at a plugin frame. 141cdf0e10cSrcweir _____________________________________________________________________________________________________________*/ 142cdf0e10cSrcweir 143cdf0e10cSrcweir #define LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, SFILTER, XSTREAM, AANY ) \ 144cdf0e10cSrcweir /* Use new scope to declare local private variables! */ \ 145cdf0e10cSrcweir { \ 146cdf0e10cSrcweir ::rtl::OStringBuffer sBuffer(1024); \ 147cdf0e10cSrcweir sBuffer.append( "PlugInFrame [ \"" ); \ 148cdf0e10cSrcweir sBuffer.append( U2B( SFRAMENAME ) ); \ 149cdf0e10cSrcweir sBuffer.append( "\" ] called with newStream( \""); \ 150cdf0e10cSrcweir sBuffer.append( U2B( SMIMETYPE ) ); \ 151cdf0e10cSrcweir sBuffer.append( "\", \"" ); \ 152cdf0e10cSrcweir sBuffer.append( U2B( SURL ) ); \ 153cdf0e10cSrcweir sBuffer.append( "\", \"" ); \ 154cdf0e10cSrcweir sBuffer.append( U2B( SFILTER ) ); \ 155cdf0e10cSrcweir sBuffer.append( "\", " ); \ 156cdf0e10cSrcweir if( XSTREAM.is() == sal_True ) \ 157cdf0e10cSrcweir { \ 158cdf0e10cSrcweir sal_Int32 nBytes = XSTREAM->available(); \ 159cdf0e10cSrcweir OString sInfo("Stream with "); \ 160cdf0e10cSrcweir sInfo += OString::valueOf( (sal_Int32)nBytes ); \ 161cdf0e10cSrcweir sInfo += " Bytes, "; \ 162cdf0e10cSrcweir sBuffer.append( sInfo ); \ 163cdf0e10cSrcweir } \ 164cdf0e10cSrcweir else \ 165cdf0e10cSrcweir { \ 166cdf0e10cSrcweir sBuffer.append( "empty Stream, " ); \ 167cdf0e10cSrcweir } \ 168cdf0e10cSrcweir if( AANY.hasValue() == sal_True ) \ 169cdf0e10cSrcweir { \ 170cdf0e10cSrcweir sBuffer.append( "filled Any )" ); \ 171cdf0e10cSrcweir } \ 172cdf0e10cSrcweir else \ 173cdf0e10cSrcweir { \ 174cdf0e10cSrcweir sBuffer.append( "empty Any )" ); \ 175cdf0e10cSrcweir } \ 176cdf0e10cSrcweir sBuffer.append( "\n" ); \ 177cdf0e10cSrcweir WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ 178cdf0e10cSrcweir } 179cdf0e10cSrcweir 180cdf0e10cSrcweir #else // #ifdef ENABLE_PLUGINDEBUG 181cdf0e10cSrcweir 182cdf0e10cSrcweir /*_____________________________________________________________________________________________________________ 183cdf0e10cSrcweir If right testmode is'nt set - implements these macro empty! 184cdf0e10cSrcweir _____________________________________________________________________________________________________________*/ 185cdf0e10cSrcweir 186cdf0e10cSrcweir #undef LOGFILE_PLUGIN 187cdf0e10cSrcweir #define LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) 188cdf0e10cSrcweir #define LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) 189cdf0e10cSrcweir #define LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, SFILTER, AANY ) 190cdf0e10cSrcweir #define LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, SFILTER, XSTREAM, AANY ) 191cdf0e10cSrcweir 192cdf0e10cSrcweir #endif // #ifdef ENABLE_PLUGINDEBUG 193cdf0e10cSrcweir 194cdf0e10cSrcweir //***************************************************************************************************************** 195cdf0e10cSrcweir // end of file 196cdf0e10cSrcweir //***************************************************************************************************************** 197cdf0e10cSrcweir 198cdf0e10cSrcweir #endif // #ifndef __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_ 199