00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _DECAF_INTERNAL_NET_URIHELPER_H_
00019 #define _DECAF_INTERNAL_NET_URIHELPER_H_
00020
00021 #include <string>
00022 #include <decaf/util/Config.h>
00023 #include <decaf/net/URISyntaxException.h>
00024 #include <decaf/internal/net/URIType.h>
00025
00026 namespace decaf {
00027 namespace internal {
00028 namespace net {
00029
00033 class DECAF_API URIHelper {
00034 private:
00035
00036 const std::string unreserved;
00037 const std::string punct;
00038 const std::string reserved;
00039 const std::string someLegal;
00040 const std::string allLegal;
00041
00042 public:
00043
00055 URIHelper( const std::string& unreserved,
00056 const std::string& punct,
00057 const std::string& reserved,
00058 const std::string& someLegal,
00059 const std::string& allLegal );
00060
00064 URIHelper();
00065
00066 virtual ~URIHelper() {}
00067
00075 URIType parseURI( const std::string& uri, bool forceServer );
00076
00084 void validateScheme( const std::string& uri, const std::string& scheme, int index );
00085
00093 void validateSsp( const std::string& uri, const std::string& ssp,
00094 std::size_t index );
00095
00103 void validateAuthority( const std::string& uri, const std::string& authority,
00104 std::size_t index );
00105
00113 void validatePath( const std::string& uri, const std::string& path,
00114 std::size_t index );
00115
00123 void validateQuery( const std::string& uri, const std::string& query,
00124 std::size_t index );
00125
00133 void validateFragment( const std::string& uri, const std::string& fragment,
00134 std::size_t index );
00135
00153 URIType parseAuthority( bool forceServer, const std::string& authority );
00154
00163 void validateUserinfo( const std::string& uri, const std::string& userinfo, std::size_t index );
00164
00173 bool isValidHost( bool forceServer, const std::string& host );
00174
00181 bool isValidDomainName( const std::string& host );
00182
00190 bool isValidIPv4Address( const std::string& host );
00191
00197 bool isValidIP6Address( const std::string& ipAddress );
00198
00205 bool isValidIP4Word( const std::string& word );
00206
00213 bool isValidHexChar( char c );
00214
00215 };
00216
00217 }}}
00218
00219 #endif