~ubuntu-branches/ubuntu/saucy/sssd/saucy

« back to all changes in this revision

Viewing changes to server/providers/ipa/ipa_timerules.h

  • Committer: Stéphane Graber
  • Date: 2011-06-15 16:23:14 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: stgraber@ubuntu.com-20110615162314-rbhoppnpaxfqo5q7
Merge 1.5.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
   SSSD
3
 
 
4
 
   IPA Provider Time Rules Parsing
5
 
 
6
 
   Authors:
7
 
        Jakub Hrozek <jhrozek@redhat.com>
8
 
 
9
 
   Copyright (C) Red Hat, Inc 2009
10
 
 
11
 
   This program is free software; you can redistribute it and/or modify
12
 
   it under the terms of the GNU General Public License as published by
13
 
   the Free Software Foundation; either version 3 of the License, or
14
 
   (at your option) any later version.
15
 
 
16
 
   This program is distributed in the hope that it will be useful,
17
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 
   GNU General Public License for more details.
20
 
 
21
 
   You should have received a copy of the GNU General Public License
22
 
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 
*/
24
 
 
25
 
#ifndef __IPA_TIMERULES_H_
26
 
#define __IPA_TIMERULES_H_
27
 
 
28
 
#include <stdbool.h>
29
 
#include <talloc.h>
30
 
 
31
 
/* Opaque structure given after init */
32
 
struct time_rules_ctx;
33
 
 
34
 
/*
35
 
 * Init the parser. Destroy the allocated resources by simply
36
 
 * talloc_free()-ing the time_rules_ctx
37
 
 */
38
 
int init_time_rules_parser(TALLOC_CTX *mem_ctx,
39
 
                           struct time_rules_ctx **_out);
40
 
 
41
 
/*
42
 
 * This is actually the meat of the library. The function takes a string
43
 
 * representation of a time rule in STR and time to check against (usually that
44
 
 * would be current time) in NOW.
45
 
 *
46
 
 * It returns EOK if the rule can be parsed, error code if not. If the time
47
 
 * given in the NOW parameter would be accepted by the rule, it stores true in
48
 
 * RESULT, false otherwise.
49
 
 */
50
 
int check_time_rule(TALLOC_CTX *mem_ctx,
51
 
                    struct time_rules_ctx *trctx,
52
 
                    const char *str,
53
 
                    const time_t now,
54
 
                    bool *result);
55
 
 
56
 
#endif /* __IPA_TIMERULES_H_ */