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
00050
00051
00052
00053
00054
00055
00056
00057
00058 #ifndef XSECBINHTTPURIINPUTSTREAM_HEADER
00059 #define XSECBINHTTPURIINPUTSTREAM_HEADER
00060
00061 #include <xsec/framework/XSECDefs.hpp>
00062
00063 #include <xercesc/util/XMLUri.hpp>
00064 #include <xercesc/util/XMLExceptMsgs.hpp>
00065 #include <xercesc/util/BinInputStream.hpp>
00066 #include <xercesc/util/Mutexes.hpp>
00067
00068
00069
00070
00071
00072
00073 struct hostent;
00074 struct sockaddr;
00075
00076 class XSECSOAPRequestorSimple;
00077
00078 class DSIG_EXPORT XSECBinHTTPURIInputStream : public XERCES_CPP_NAMESPACE_QUALIFIER BinInputStream
00079 {
00080 public :
00081
00082 XSECBinHTTPURIInputStream(const XERCES_CPP_NAMESPACE_QUALIFIER XMLUri& urlSource);
00083 ~XSECBinHTTPURIInputStream();
00084
00085 unsigned int curPos() const;
00086 unsigned int readBytes(XMLByte* const toFill, const unsigned int maxToRead);
00087
00088 static void Cleanup();
00089
00090 friend class XSECSOAPRequestorSimple;
00091
00092 protected:
00093
00094
00095
00096
00097
00098
00099
00100
00101 static void ExternalInitialize(void);
00102
00103 static hostent* gethostbyname(const char* name);
00104 static unsigned long inet_addr(const char* cp);
00105 static hostent* gethostbyaddr(const char* addr,int len,int type);
00106 static unsigned short htons(unsigned short hostshort);
00107 static unsigned short socket(int af,int type,int protocol);
00108 static int connect(unsigned short s,const sockaddr* name,int namelen);
00109 static int send(unsigned short s,const char* buf,int len,int flags);
00110 static int recv(unsigned short s,char* buf,int len,int flags);
00111 static int shutdown(unsigned int s,int how);
00112 static int closesocket(unsigned int socket);
00113
00114
00115 private :
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135 unsigned int fSocketHandle;
00136 unsigned int fBytesProcessed;
00137 char fBuffer[4000];
00138 char * fBufferEnd;
00139 char * fBufferPos;
00140 static bool fInitialized;
00141 static XERCES_CPP_NAMESPACE_QUALIFIER XMLMutex* fInitMutex;
00142
00143 static void Initialize();
00144 unsigned int getSocketHandle(const XERCES_CPP_NAMESPACE_QUALIFIER XMLUri& urlSource);
00145
00146 };
00147
00148
00149 inline unsigned int XSECBinHTTPURIInputStream::curPos() const
00150 {
00151 return fBytesProcessed;
00152 }
00153
00154
00155 #endif // XSECBINHTTPURIINPUTSTREAM_HEADER