00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #ifndef XSECBINHTTPURIINPUTSTREAM_HEADER
00050 #define XSECBINHTTPURIINPUTSTREAM_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 #include <xercesc/util/Mutexes.hpp>
00058
00059
00060
00061
00062
00063
00064 struct hostent;
00065 struct sockaddr;
00066
00067
00068 class DSIG_EXPORT XSECBinHTTPURIInputStream : public XERCES_CPP_NAMESPACE_QUALIFIER BinInputStream
00069 {
00070 public :
00071
00072 XSECBinHTTPURIInputStream(const XERCES_CPP_NAMESPACE_QUALIFIER XMLUri& urlSource);
00073 ~XSECBinHTTPURIInputStream();
00074
00075 unsigned int curPos() const;
00076 unsigned int readBytes(XMLByte* const toFill, const unsigned int maxToRead);
00077
00078 static void Cleanup();
00079
00080
00081 private :
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 unsigned int fSocketHandle;
00102 unsigned int fBytesProcessed;
00103 char fBuffer[4000];
00104 char * fBufferEnd;
00105 char * fBufferPos;
00106 static bool fInitialized;
00107 static XERCES_CPP_NAMESPACE_QUALIFIER XMLMutex* fInitMutex;
00108
00109 static void Initialize();
00110 unsigned int getSocketHandle(const XERCES_CPP_NAMESPACE_QUALIFIER XMLUri& urlSource);
00111
00112 inline static hostent* gethostbyname(const char* name);
00113 inline static unsigned long inet_addr(const char* cp);
00114 inline static hostent* gethostbyaddr(const char* addr,int len,int type);
00115 inline static unsigned short htons(unsigned short hostshort);
00116 inline static unsigned short socket(int af,int type,int protocol);
00117 inline static int connect(unsigned short s,const sockaddr* name,int namelen);
00118 inline static int send(unsigned short s,const char* buf,int len,int flags);
00119 inline static int recv(unsigned short s,char* buf,int len,int flags);
00120 inline static int shutdown(unsigned int s,int how);
00121 inline static int closesocket(unsigned int socket);
00122 };
00123
00124
00125 inline unsigned int XSECBinHTTPURIInputStream::curPos() const
00126 {
00127 return fBytesProcessed;
00128 }
00129
00130
00131 #endif // XSECBINHTTPURIINPUTSTREAM_HEADER