diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2009-11-03 16:59:42 +0100 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-11-09 10:53:49 -0500 |
commit | b9f94bc83f139df3e143cc020b98e6e652887049 (patch) | |
tree | ca0990b2843a852c22cc6c86aa7e3e656148b7bb /server/providers/ipa/ipa_timerules.h | |
parent | c9bb0b019a811b9d26ddb7c5a037dc19754cf0b3 (diff) | |
download | sssd-b9f94bc83f139df3e143cc020b98e6e652887049.tar.gz sssd-b9f94bc83f139df3e143cc020b98e6e652887049.tar.bz2 sssd-b9f94bc83f139df3e143cc020b98e6e652887049.zip |
IPA time rules parsing routines
Diffstat (limited to 'server/providers/ipa/ipa_timerules.h')
-rw-r--r-- | server/providers/ipa/ipa_timerules.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/server/providers/ipa/ipa_timerules.h b/server/providers/ipa/ipa_timerules.h new file mode 100644 index 00000000..e1beaa22 --- /dev/null +++ b/server/providers/ipa/ipa_timerules.h @@ -0,0 +1,56 @@ +/* + SSSD + + IPA Provider Time Rules Parsing + + Authors: + Jakub Hrozek <jhrozek@redhat.com> + + Copyright (C) Red Hat, Inc 2009 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __IPA_TIMERULES_H_ +#define __IPA_TIMERULES_H_ + +#include <stdbool.h> +#include <talloc.h> + +/* Opaque structure given after init */ +struct time_rules_ctx; + +/* + * Init the parser. Destroy the allocated resources by simply + * talloc_free()-ing the time_rules_ctx + */ +int init_time_rules_parser(TALLOC_CTX *mem_ctx, + struct time_rules_ctx **_out); + +/* + * This is actually the meat of the library. The function takes a string + * representation of a time rule in STR and time to check against (usually that + * would be current time) in NOW. + * + * It returns EOK if the rule can be parsed, error code if not. If the time + * given in the NOW parameter would be accepted by the rule, it stores true in + * RESULT, false otherwise. + */ +int check_time_rule(TALLOC_CTX *mem_ctx, + struct time_rules_ctx *trctx, + const char *str, + const time_t now, + bool *result); + +#endif /* __IPA_TIMERULES_H_ */ |