activemq-cpp-3.9.5
URIHelper.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _DECAF_INTERNAL_NET_URIHELPER_H_
19#define _DECAF_INTERNAL_NET_URIHELPER_H_
20
21#include <string>
22#include <decaf/util/Config.h>
25
26namespace decaf {
27namespace internal {
28namespace net {
29
34 private:
35
36 const std::string unreserved;
37 const std::string punct;
38 const std::string reserved;
39 const std::string someLegal;
40 const std::string allLegal;
41
42 public:
43
55 URIHelper( const std::string& unreserved,
56 const std::string& punct,
57 const std::string& reserved,
58 const std::string& someLegal,
59 const std::string& allLegal );
60
65
66 virtual ~URIHelper() {}
67
75 URIType parseURI( const std::string& uri, bool forceServer );
76
84 void validateScheme( const std::string& uri, const std::string& scheme, int index );
85
93 void validateSsp( const std::string& uri, const std::string& ssp,
94 std::size_t index );
95
103 void validateAuthority( const std::string& uri, const std::string& authority,
104 std::size_t index );
105
113 void validatePath( const std::string& uri, const std::string& path,
114 std::size_t index );
115
123 void validateQuery( const std::string& uri, const std::string& query,
124 std::size_t index );
125
133 void validateFragment( const std::string& uri, const std::string& fragment,
134 std::size_t index );
135
153 URIType parseAuthority( bool forceServer, const std::string& authority );
154
163 void validateUserinfo( const std::string& uri, const std::string& userinfo, std::size_t index );
164
173 bool isValidHost( bool forceServer, const std::string& host );
174
181 bool isValidDomainName( const std::string& host );
182
190 bool isValidIPv4Address( const std::string& host );
191
197 bool isValidIP6Address( const std::string& ipAddress );
198
205 bool isValidIP4Word( const std::string& word );
206
213 bool isValidHexChar( char c );
214
215 };
216
217}}}
218
219#endif /* _DECAF_INTERNAL_NET_URIHELPER_H_ */
void validatePath(const std::string &uri, const std::string &path, std::size_t index)
Validate that the URI Path Segment contains no invalid encodings.
void validateAuthority(const std::string &uri, const std::string &authority, std::size_t index)
Validate that the URI Authority Segment contains no invalid encodings.
bool isValidDomainName(const std::string &host)
Validates the string past to determine if it is a well formed domain name.
URIHelper()
Sets up the filter strings with sane defaults.
void validateSsp(const std::string &uri, const std::string &ssp, std::size_t index)
Validate that the URI Ssp Segment contains no invalid encodings.
bool isValidIPv4Address(const std::string &host)
Validate if the host value is a well formed IPv4 address, this is the form XXX.XXX....
void validateFragment(const std::string &uri, const std::string &fragment, std::size_t index)
Validate that the URI fragment contains no invalid encodings.
bool isValidIP4Word(const std::string &word)
Check is the string passed contains a Valid IPv4 word, which is an integer in the range of 0 to 255.
void validateUserinfo(const std::string &uri, const std::string &userinfo, std::size_t index)
Check the supplied user info for validity.
URIType parseURI(const std::string &uri, bool forceServer)
Parse the passed in URI.
void validateScheme(const std::string &uri, const std::string &scheme, int index)
Validate the schema portin of the URI.
virtual ~URIHelper()
Definition URIHelper.h:66
URIHelper(const std::string &unreserved, const std::string &punct, const std::string &reserved, const std::string &someLegal, const std::string &allLegal)
Setup the URIHelper with values assigned to the various fields that are used in the validation proces...
void validateQuery(const std::string &uri, const std::string &query, std::size_t index)
Validate that the URI Query Segment contains no invalid encodings.
bool isValidIP6Address(const std::string &ipAddress)
Determines if the given address is valid according to the IPv6 spec.
bool isValidHost(bool forceServer, const std::string &host)
distinguish between IPv4, IPv6, domain name and validate it based on its type
bool isValidHexChar(char c)
Determines if the given char is a valid Hex char.
URIType parseAuthority(bool forceServer, const std::string &authority)
determine the host, port and user-info if the authority parses successfully to a server based authori...
Basic type object that holds data that composes a given URI.
Definition URIType.h:31
#define DECAF_API
Definition Config.h:29
Definition DefaultServerSocketFactory.h:27
Definition AprPool.h:26
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25