Apache2
md_status.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef md_status_h
18 #define md_status_h
19 
20 struct md_json_t;
21 struct md_reg_t;
22 struct md_result_t;
23 struct md_ocsp_reg_t;
24 
25 #include "md_store.h"
26 
30 apr_status_t md_status_get_md_json(struct md_json_t **pjson, const md_t *md,
31  struct md_reg_t *reg, struct md_ocsp_reg_t *ocsp,
32  apr_pool_t *p);
33 
38  struct md_reg_t *reg, struct md_ocsp_reg_t *ocsp,
39  apr_pool_t *p);
40 
46 void md_status_take_stock(struct md_json_t **pjson, apr_array_header_t *mds,
47  struct md_reg_t *reg, apr_pool_t *p);
48 
49 
50 typedef struct md_job_t md_job_t;
51 
52 struct md_job_t {
53  md_store_group_t group;/* group where job is persisted */
54  const char *mdomain; /* Name of the MD this job is about */
55  md_store_t *store; /* store where it is persisted */
57  apr_time_t next_run; /* Time this job wants to be processed next */
58  apr_time_t last_run; /* Time this job ran last (or 0) */
59  struct md_result_t *last_result; /* Result from last run */
60  int finished; /* true iff the job finished successfully */
61  int notified; /* true iff notifications were handled successfully */
62  int notified_renewed; /* true iff a 'renewed' notification was handled successfully */
63  apr_time_t valid_from; /* at which time the finished job results become valid, 0 if immediate */
64  int error_runs; /* Number of errored runs of an unfinished job */
65  int fatal_error; /* a fatal error is remedied by retrying */
66  md_json_t *log; /* array of log objects with minimum fields
67  MD_KEY_WHEN (timestamp) and MD_KEY_TYPE (string) */
68  apr_size_t max_log; /* max number of log entries, new ones replace oldest */
69  int dirty;
71 };
72 
78  md_store_group_t group, const char *name);
79 
81 
86 
91 
98 void md_job_log_append(md_job_t *job, const char *type,
99  const char *status, const char *detail);
100 
104 md_json_t *md_job_log_get_latest(md_job_t *job, const char *type);
105 
110 apr_time_t md_job_log_get_time_of_latest(md_job_t *job, const char *type);
111 
112 void md_job_start_run(md_job_t *job, struct md_result_t *result, md_store_t *store);
113 void md_job_end_run(md_job_t *job, struct md_result_t *result);
114 void md_job_retry_at(md_job_t *job, apr_time_t later);
115 
120 apr_time_t md_job_delay_on_errors(md_job_t *job, int err_count, const char *last_problem);
121 
122 apr_status_t md_job_notify(md_job_t *job, const char *reason, struct md_result_t *result);
123 
124 #endif /* md_status_h */
size_t apr_size_t
Definition: apr.h:393
apr_time_t valid_from
Definition: md_status.h:63
Definition: md.h:76
Definition: md_store.h:307
struct md_json_t md_json_t
Definition: md_json.h:29
apr_status_t md_status_get_json(struct md_json_t **pjson, apr_array_header_t *mds, struct md_reg_t *reg, struct md_ocsp_reg_t *ocsp, apr_pool_t *p)
Definition: apr_tables.h:62
md_store_t * store
Definition: md_status.h:55
md_store_group_t
Definition: md_store.h:62
md_job_t * md_job_make(apr_pool_t *p, md_store_t *store, md_store_group_t group, const char *name)
int finished
Definition: md_status.h:60
void md_job_set_group(md_job_t *job, md_store_group_t group)
apr_time_t next_run
Definition: md_status.h:57
const char * detail
Definition: md_result.h:34
int error_runs
Definition: md_status.h:64
apr_status_t md_job_load(md_job_t *job)
Definition: md_status.h:52
const char * mdomain
Definition: md_status.h:54
apr_time_t md_job_delay_on_errors(md_job_t *job, int err_count, const char *last_problem)
apr_int64_t apr_time_t
Definition: apr_time.h:45
void md_job_start_run(md_job_t *job, struct md_result_t *result, md_store_t *store)
void md_job_log_append(md_job_t *job, const char *type, const char *status, const char *detail)
apr_status_t md_job_save(md_job_t *job, struct md_result_t *result, apr_pool_t *p)
void md_status_take_stock(struct md_json_t **pjson, apr_array_header_t *mds, struct md_reg_t *reg, apr_pool_t *p)
md_json_t * log
Definition: md_status.h:66
int dirty
Definition: md_status.h:69
apr_size_t max_log
Definition: md_status.h:68
apr_status_t md_job_notify(md_job_t *job, const char *reason, struct md_result_t *result)
apr_time_t md_job_log_get_time_of_latest(md_job_t *job, const char *type)
apr_time_t last_run
Definition: md_status.h:58
Definition: md_result.h:29
struct md_reg_t md_reg_t
Definition: md_reg.h:33
apr_status_t md_status_get_md_json(struct md_json_t **pjson, const md_t *md, struct md_reg_t *reg, struct md_ocsp_reg_t *ocsp, apr_pool_t *p)
apr_pool_t * p
int notified
Definition: md_status.h:61
apr_pool_t * p
Definition: md_status.h:56
int status
Definition: mod_dav.h:141
struct md_ocsp_reg_t md_ocsp_reg_t
Definition: md_ocsp.h:36
const char * name
Definition: mod_dav.h:805
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
md_store_group_t group
Definition: md_status.h:53
int apr_status_t
Definition: apr_errno.h:44
md_json_t * md_job_log_get_latest(md_job_t *job, const char *type)
struct md_result_t * last_result
Definition: md_status.h:59
void md_job_end_run(md_job_t *job, struct md_result_t *result)
int notified_renewed
Definition: md_status.h:62
void md_job_retry_at(md_job_t *job, apr_time_t later)
int fatal_error
Definition: md_status.h:65
struct md_result_t * observing
Definition: md_status.h:70