00001 /* 00002 * Copyright 2002-2005 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /* 00018 * XSEC 00019 * 00020 * XSECBinHTTPURIInputStream := Re-implementation of Xerces BinHTTPInputStream 00021 * Allows us to modify and create an input 00022 * stream that follows re-directs which is 00023 * necessary to fully support XML-DSIG interop 00024 * tests 00025 * 00026 * Author(s): Berin Lautenbach 00027 * 00028 * $Id: XSECBinHTTPURIInputStream.hpp,v 1.5 2005/02/03 13:55:08 milan Exp $ 00029 * 00030 * $Log: XSECBinHTTPURIInputStream.hpp,v $ 00031 * Revision 1.5 2005/02/03 13:55:08 milan 00032 * Apache licence fix. 00033 * 00034 * Revision 1.4 2004/02/08 10:50:22 blautenb 00035 * Update to Apache 2.0 license 00036 * 00037 * Revision 1.3 2003/09/11 11:29:12 blautenb 00038 * Fix Xerces namespace usage in *NIX build 00039 * 00040 * Revision 1.2 2003/07/05 10:30:38 blautenb 00041 * Copyright update 00042 * 00043 * Revision 1.1 2003/02/12 11:21:03 blautenb 00044 * UNIX generic URI resolver 00045 * 00046 * 00047 */ 00048 00049 #ifndef UNIXXSECBINHTTPURIINPUTSTREAM_HEADER 00050 #define UNIXXSECBINHTTPURIINPUTSTREAM_HEADER 00051 00052 #include <xsec/framework/XSECDefs.hpp> 00053 00054 #include <xercesc/util/XMLUri.hpp> 00055 #include <xercesc/util/XMLExceptMsgs.hpp> 00056 #include <xercesc/util/BinInputStream.hpp> 00057 00058 // 00059 // This class implements the BinInputStream interface specified by the XML 00060 // parser. 00061 // 00062 00063 class DSIG_EXPORT XSECBinHTTPURIInputStream : public XERCES_CPP_NAMESPACE_QUALIFIER BinInputStream 00064 { 00065 public : 00066 XSECBinHTTPURIInputStream(const XERCES_CPP_NAMESPACE_QUALIFIER XMLUri& urlSource); 00067 ~XSECBinHTTPURIInputStream(); 00068 00069 unsigned int curPos() const; 00070 unsigned int readBytes 00071 ( 00072 XMLByte* const toFill 00073 , const unsigned int maxToRead 00074 ); 00075 00076 00077 private : 00078 // ----------------------------------------------------------------------- 00079 // Private data members 00080 // 00081 // fSocket 00082 // The socket representing the connection to the remote file. 00083 // fBytesProcessed 00084 // Its a rolling count of the number of bytes processed off this 00085 // input stream. 00086 // fBuffer 00087 // Holds the http header, plus the first part of the actual 00088 // data. Filled at the time the stream is opened, data goes 00089 // out to user in response to readBytes(). 00090 // fBufferPos, fBufferEnd 00091 // Pointers into fBuffer, showing start and end+1 of content 00092 // that readBytes must return. 00093 // ----------------------------------------------------------------------- 00094 00095 int getSocketHandle(const XERCES_CPP_NAMESPACE_QUALIFIER XMLUri& urlSource); 00096 00097 int fSocket; 00098 unsigned int fBytesProcessed; 00099 char fBuffer[4000]; 00100 char * fBufferEnd; 00101 char * fBufferPos; 00102 00103 }; 00104 00105 00106 inline unsigned int XSECBinHTTPURIInputStream::curPos() const 00107 { 00108 return fBytesProcessed; 00109 } 00110 00111 00112 #endif // UNIXXSECBINHTTPURIINPUTSTREAM_HEADER