X-Git-Url: http://tinc-vpn.org/git/browse?a=blobdiff_plain;f=lib%2Futility.h;h=9437cb8dbf5591a17e8126ffde6fcfcc8bdf2417;hb=fa1153b4c3237d897a871331f0f9c0f8d30ca5a1;hp=7ad7ab1474ab9fb6a456e0051337c086cddb655f;hpb=401e0b5e1d97ded0e2c7415c6dd0f94ee6bfb470;p=fides diff --git a/lib/utility.h b/lib/utility.h index 7ad7ab1..9437cb8 100644 --- a/lib/utility.h +++ b/lib/utility.h @@ -18,12 +18,13 @@ #ifndef __FIDES_UTILITY_H__ #define __FIDES_UTILITY_H__ +#ifdef __cplusplus #include #include #include #include -namespace fides { +namespace Fides { class regexp { regex_t comp; @@ -40,13 +41,13 @@ namespace fides { /// /// @param exp Regular expression to compile. /// @param cflags Bitwise OR of options to apply when compiling the regular expression: - /// - fides::regexp::EXTENDED + /// - Fides::regexp::EXTENDED /// Use POSIX Extended Regular Expression syntax when interpreting exp. - /// - fides::regexp::ICASE + /// - Fides::regexp::ICASE /// Make the expression case-insensitive. - /// - fides::regexp::NOSUB + /// - Fides::regexp::NOSUB /// Disable support for substring addressing. - /// - fides::regexp::NEWLINE + /// - Fides::regexp::NEWLINE /// Do not treat the newline character as the start or end of a line. regexp(const std::string &exp, int cflags = 0) { int err = regcomp(&comp, exp.c_str(), cflags); @@ -62,9 +63,9 @@ namespace fides { /// /// @param in String to test. /// @param eflags Bitwise OR of options to apply when matching the string: - /// - fides::regexp::NOTBOL + /// - Fides::regexp::NOTBOL /// Do not treat the start of the string as the start of a line. - /// - fides::regexp::NOTEOL + /// - Fides::regexp::NOTEOL /// Do not treat the end of the string as the end of a line. /// @return True if the string matches the regular expression, false otherwise. bool match(const std::string &in, int eflags = 0) { @@ -80,4 +81,16 @@ namespace fides { std::vector dirlist(const std::string &path); } +extern "C" { +#endif + +extern char *fides_b64encode(const char *in); +extern char *fides_b64decode(const char *in); +extern char *fides_hexencode(const char *in); +extern char *fides_hexdecode(const char *in); + +#ifdef __cplusplus +} +#endif + #endif