XRootD
XrdMacaroonsUtils.hh
Go to the documentation of this file.
1 #ifndef __XRD_MACAROONS_UTILS_HH__
2 #define __XRD_MACAROONS_UTILS_HH__
3 
4 #include <string>
5 #include <sys/types.h>
6 
7 namespace Macaroons {
8 
9 // 'Normalize' the macaroon path. This only takes care of double slashes
10 // but, as is common in XRootD, it doesn't treat these as a hierarchy.
11 // For example, these result in the same path:
12 //
13 // /foo/bar -> /foo/bar
14 // //foo////bar -> /foo/bar
15 //
16 // These are all distinct:
17 //
18 // /foo/bar -> /foo/bar
19 // /foo/bar/ -> /foo/bar/
20 // /foo/baz//../bar -> /foo/baz/../bar
21 //
22 std::string NormalizeSlashes(const std::string &input);
23 
24 // Parse an ISO 8601 duration of the form "PT<n>H<n>M<n>S" into a number of
25 // seconds. Returns -1 if the input is not a valid duration. The components
26 // are optional, but at least the "PT" prefix is required; "PT" on its own
27 // parses to a duration of zero seconds.
28 ssize_t determine_validity(const std::string &input);
29 
30 } // namespace Macaroons
31 
32 #endif // __XRD_MACAROONS_UTILS_HH__
ssize_t determine_validity(const std::string &input)
std::string NormalizeSlashes(const std::string &input)