00001 /* 00002 * Copyright 2002-2004 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 * imitations 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.4 2004/02/08 10:50:22 blautenb Exp $ 00029 * 00030 * $Log: XSECBinHTTPURIInputStream.hpp,v $ 00031 * Revision 1.4 2004/02/08 10:50:22 blautenb 00032 * Update to Apache 2.0 license 00033 * 00034 * Revision 1.3 2003/09/11 11:29:12 blautenb 00035 * Fix Xerces namespace usage in *NIX build 00036 * 00037 * Revision 1.2 2003/07/05 10:30:38 blautenb 00038 * Copyright update 00039 * 00040 * Revision 1.1 2003/02/12 11:21:03 blautenb 00041 * UNIX generic URI resolver 00042 * 00043 * 00044 */ 00045 00046 #ifndef UNIXXSECBINHTTPURIINPUTSTREAM_HEADER 00047 #define UNIXXSECBINHTTPURIINPUTSTREAM_HEADER 00048 00049 #include <xsec/framework/XSECDefs.hpp> 00050 00051 #include <xercesc/util/XMLUri.hpp> 00052 #include <xercesc/util/XMLExceptMsgs.hpp> 00053 #include <xercesc/util/BinInputStream.hpp> 00054 00055 // 00056 // This class implements the BinInputStream interface specified by the XML 00057 // parser. 00058 // 00059 00060 class DSIG_EXPORT XSECBinHTTPURIInputStream : public XERCES_CPP_NAMESPACE_QUALIFIER BinInputStream 00061 { 00062 public : 00063 XSECBinHTTPURIInputStream(const XERCES_CPP_NAMESPACE_QUALIFIER XMLUri& urlSource); 00064 ~XSECBinHTTPURIInputStream(); 00065 00066 unsigned int curPos() const; 00067 unsigned int readBytes 00068 ( 00069 XMLByte* const toFill 00070 , const unsigned int maxToRead 00071 ); 00072 00073 00074 private : 00075 // ----------------------------------------------------------------------- 00076 // Private data members 00077 // 00078 // fSocket 00079 // The socket representing the connection to the remote file. 00080 // fBytesProcessed 00081 // Its a rolling count of the number of bytes processed off this 00082 // input stream. 00083 // fBuffer 00084 // Holds the http header, plus the first part of the actual 00085 // data. Filled at the time the stream is opened, data goes 00086 // out to user in response to readBytes(). 00087 // fBufferPos, fBufferEnd 00088 // Pointers into fBuffer, showing start and end+1 of content 00089 // that readBytes must return. 00090 // ----------------------------------------------------------------------- 00091 00092 int getSocketHandle(const XERCES_CPP_NAMESPACE_QUALIFIER XMLUri& urlSource); 00093 00094 int fSocket; 00095 unsigned int fBytesProcessed; 00096 char fBuffer[4000]; 00097 char * fBufferEnd; 00098 char * fBufferPos; 00099 00100 }; 00101 00102 00103 inline unsigned int XSECBinHTTPURIInputStream::curPos() const 00104 { 00105 return fBytesProcessed; 00106 } 00107 00108 00109 #endif // UNIXXSECBINHTTPURIINPUTSTREAM_HEADER