Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
md_store.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 mod_md_md_store_h
18 #define mod_md_md_store_h
19 
20 struct apr_array_header_t;
21 struct md_cert_t;
22 struct md_pkey_t;
23 
24 const char *md_store_group_name(unsigned int group);
25 
26 typedef struct md_store_t md_store_t;
27 
51 typedef enum {
52  MD_SV_TEXT, /* plain text, value is (char*) */
53  MD_SV_JSON, /* JSON serialization, value is (md_json_t*) */
54  MD_SV_CERT, /* PEM x509 certificate, value is (md_cert_t*) */
55  MD_SV_PKEY, /* PEM private key, value is (md_pkey_t*) */
56  MD_SV_CHAIN, /* list of PEM x509 certificates, value is
57  (apr_array_header_t*) of (md_cert*) */
59 
61 typedef enum {
62  MD_SG_NONE, /* top level of store, name MUST be NULL in calls */
63  MD_SG_ACCOUNTS, /* ACME accounts */
64  MD_SG_CHALLENGES, /* challenge response data for a domain */
65  MD_SG_DOMAINS, /* live certificates and settings for a domain */
66  MD_SG_STAGING, /* staged set of certificate and settings, maybe incomplete */
67  MD_SG_ARCHIVE, /* Archived live sets of a domain */
68  MD_SG_TMP, /* temporary domain storage */
69  MD_SG_OCSP, /* OCSP stapling related domain data */
70  MD_SG_COUNT, /* number of storage groups, used in setups */
72 
73 #define MD_FN_MD "md.json"
74 #define MD_FN_JOB "job.json"
75 #define MD_FN_PRIVKEY "privkey.pem"
76 #define MD_FN_PUBCERT "pubcert.pem"
77 #define MD_FN_CERT "cert.pem"
78 #define MD_FN_HTTPD_JSON "httpd.json"
79 
80 #define MD_FN_FALLBACK_PKEY "fallback-privkey.pem"
81 #define MD_FN_FALLBACK_CERT "fallback-cert.pem"
82 
88  const char *name, const char *aspect,
89  struct md_json_t **pdata, apr_pool_t *p);
95  const char *name, const char *aspect,
96  struct md_json_t *data, int create);
97 
105  const char *name, const char *aspect,
106  md_store_vtype_t vtype, void **pdata,
107  apr_pool_t *p);
113  const char *name, const char *aspect,
114  md_store_vtype_t vtype, void *data,
115  int create);
116 
122  const char *name, const char *aspect,
123  apr_pool_t *p, int force);
128  md_store_group_t group, const char *name);
129 
135  apr_time_t modified,
137  const char *name,
138  const char *aspect);
139 
145 typedef int md_store_inspect(void *baton, const char *name, const char *aspect,
146  md_store_vtype_t vtype, void *value, apr_pool_t *ptemp);
147 
152 apr_status_t md_store_iter(md_store_inspect *inspect, void *baton, md_store_t *store,
153  apr_pool_t *p, md_store_group_t group, const char *pattern,
154  const char *aspect, md_store_vtype_t vtype);
155 
162  const char *name, int archive);
163 
168  md_store_group_t group, const char *name, const char *to);
169 
174 apr_status_t md_store_get_fname(const char **pfname,
176  const char *name, const char *aspect,
177  apr_pool_t *p);
178 
183  const char *name, const char *aspect, apr_pool_t *p);
184 
190 apr_status_t md_store_iter_names(md_store_inspect *inspect, void *baton, md_store_t *store,
191  apr_pool_t *p, md_store_group_t group, const char *pattern);
192 
198  const char *name, const char *aspect, apr_pool_t *p);
199 
200 
201 
202 /**************************************************************************************************/
203 /* Storage handling utils */
204 
206  const char *name, md_t **pmd, apr_pool_t *p);
208  md_t *md, int create);
210  const char *name, int force);
211 
212 int md_is_newer(md_store_t *store, md_store_group_t group1, md_store_group_t group2,
213  const char *name, apr_pool_t *p);
214 
215 typedef int md_store_md_inspect(void *baton, md_store_t *store, md_t *md, apr_pool_t *ptemp);
216 
217 apr_status_t md_store_md_iter(md_store_md_inspect *inspect, void *baton, md_store_t *store,
218  apr_pool_t *p, md_store_group_t group, const char *pattern);
219 
220 
222  const char *name, struct md_pkey_t **ppkey, apr_pool_t *p);
224  const char *name, struct md_pkey_t *pkey, int create);
225 
227  struct apr_array_header_t **ppubcert, apr_pool_t *p);
229  md_store_group_t group, const char *name,
230  struct apr_array_header_t *pubcert, int create);
231 
232 /**************************************************************************************************/
233 /* implementation interface */
234 
236  const char *name, const char *aspect,
237  md_store_vtype_t vtype, void **pvalue,
238  apr_pool_t *p);
240  const char *name, const char *aspect,
241  md_store_vtype_t vtype, void *value,
242  int create);
244  const char *name, const char *aspect,
245  apr_pool_t *p, int force);
247  const char *name);
248 
249 typedef apr_status_t md_store_iter_cb(md_store_inspect *inspect, void *baton, md_store_t *store,
250  apr_pool_t *p, md_store_group_t group, const char *pattern,
251  const char *aspect, md_store_vtype_t vtype);
252 
253 typedef apr_status_t md_store_names_iter_cb(md_store_inspect *inspect, void *baton, md_store_t *store,
254  apr_pool_t *p, md_store_group_t group, const char *pattern);
255 
257  md_store_group_t to, const char *name, int archive);
258 
260  const char *from, const char *to);
261 
262 typedef apr_status_t md_store_get_fname_cb(const char **pfname,
264  const char *name, const char *aspect,
265  apr_pool_t *p);
266 
267 typedef int md_store_is_newer_cb(md_store_t *store,
268  md_store_group_t group1, md_store_group_t group2,
269  const char *name, const char *aspect, apr_pool_t *p);
270 
272  const char *name, const char *aspect, apr_pool_t *p);
273 
275  apr_time_t modified, md_store_group_t group,
276  const char *name, const char *aspect);
277 
278 struct md_store_t {
291 };
292 
293 
294 #endif /* mod_md_md_store_h */
Definition: md_store.h:66
struct md_cert_t md_cert_t
Definition: md_crypt.h:94
apr_status_t md_store_load_json(md_store_t *store, md_store_group_t group, const char *name, const char *aspect, struct md_json_t **pdata, apr_pool_t *p)
Definition: md.h:74
Definition: md_store.h:278
struct md_json_t md_json_t
Definition: md_json.h:29
apr_status_t md_save(struct md_store_t *store, apr_pool_t *p, md_store_group_t group, md_t *md, int create)
apr_status_t md_store_move_cb(md_store_t *store, apr_pool_t *p, md_store_group_t from, md_store_group_t to, const char *name, int archive)
Definition: md_store.h:256
apr_status_t md_remove(md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *name, int force)
apr_status_t md_store_save(md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *name, const char *aspect, md_store_vtype_t vtype, void *data, int create)
Definition: apr_tables.h:62
md_store_group_t
Definition: md_store.h:61
apr_status_t md_store_iter_cb(md_store_inspect *inspect, void *baton, md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *pattern, const char *aspect, md_store_vtype_t vtype)
Definition: md_store.h:249
Definition: md_store.h:55
md_store_purge_cb * purge
Definition: md_store.h:286
apr_status_t md_store_save_json(md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *name, const char *aspect, struct md_json_t *data, int create)
md_store_remove_nms_cb * remove_nms
Definition: md_store.h:290
apr_time_t md_store_get_modified(md_store_t *store, md_store_group_t group, const char *name, const char *aspect, apr_pool_t *p)
apr_status_t md_store_rename_cb(md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *from, const char *to)
Definition: md_store.h:259
Definition: md_store.h:64
apr_status_t md_store_purge(md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *name)
int md_store_md_inspect(void *baton, md_store_t *store, md_t *md, apr_pool_t *ptemp)
Definition: md_store.h:215
apr_status_t md_store_iter(md_store_inspect *inspect, void *baton, md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *pattern, const char *aspect, md_store_vtype_t vtype)
apr_status_t md_store_get_fname_cb(const char **pfname, md_store_t *store, md_store_group_t group, const char *name, const char *aspect, apr_pool_t *p)
Definition: md_store.h:262
int md_is_newer(md_store_t *store, md_store_group_t group1, md_store_group_t group2, const char *name, apr_pool_t *p)
apr_status_t md_pubcert_load(md_store_t *store, md_store_group_t group, const char *name, struct apr_array_header_t **ppubcert, apr_pool_t *p)
Definition: md_store.h:65
apr_status_t md_store_md_iter(md_store_md_inspect *inspect, void *baton, md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *pattern)
md_store_vtype_t
Definition: md_store.h:51
apr_status_t md_store_remove(md_store_t *store, md_store_group_t group, const char *name, const char *aspect, apr_pool_t *p, int force)
apr_status_t md_store_remove_nms_cb(md_store_t *store, apr_pool_t *p, apr_time_t modified, md_store_group_t group, const char *name, const char *aspect)
Definition: md_store.h:274
md_store_is_newer_cb * is_newer
Definition: md_store.h:288
apr_int64_t apr_time_t
Definition: apr_time.h:45
Definition: md_store.h:70
int md_store_inspect(void *baton, const char *name, const char *aspect, md_store_vtype_t vtype, void *value, apr_pool_t *ptemp)
Definition: md_store.h:145
const char * md_store_group_name(unsigned int group)
apr_status_t md_store_load_cb(md_store_t *store, md_store_group_t group, const char *name, const char *aspect, md_store_vtype_t vtype, void **pvalue, apr_pool_t *p)
Definition: md_store.h:235
apr_status_t md_store_names_iter_cb(md_store_inspect *inspect, void *baton, md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *pattern)
Definition: md_store.h:253
Definition: md_store.h:56
apr_status_t md_store_move(md_store_t *store, apr_pool_t *p, md_store_group_t from, md_store_group_t to, const char *name, int archive)
const char const dav_liveprop_group * group
Definition: mod_dav.h:1048
apr_status_t md_store_iter_names(md_store_inspect *inspect, void *baton, md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *pattern)
apr_status_t md_store_load(md_store_t *store, md_store_group_t group, const char *name, const char *aspect, md_store_vtype_t vtype, void **pdata, apr_pool_t *p)
Definition: md_store.h:67
md_store_load_cb * load
Definition: md_store.h:280
Definition: md_store.h:53
apr_status_t md_pubcert_save(md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *name, struct apr_array_header_t *pubcert, int create)
md_store_get_fname_cb * get_fname
Definition: md_store.h:287
md_store_names_iter_cb * iterate_names
Definition: md_store.h:285
apr_status_t md_load(md_store_t *store, md_store_group_t group, const char *name, md_t **pmd, apr_pool_t *p)
apr_status_t md_store_get_fname(const char **pfname, md_store_t *store, md_store_group_t group, const char *name, const char *aspect, apr_pool_t *p)
apr_pool_t * p
md_store_get_modified_cb * get_modified
Definition: md_store.h:289
md_store_save_cb * save
Definition: md_store.h:279
Definition: md_store.h:62
int md_store_is_newer_cb(md_store_t *store, md_store_group_t group1, md_store_group_t group2, const char *name, const char *aspect, apr_pool_t *p)
Definition: md_store.h:267
apr_status_t md_store_remove_not_modified_since(md_store_t *store, apr_pool_t *p, apr_time_t modified, md_store_group_t group, const char *name, const char *aspect)
md_store_iter_cb * iterate
Definition: md_store.h:284
md_store_move_cb * move
Definition: md_store.h:282
int md_store_is_newer(md_store_t *store, md_store_group_t group1, md_store_group_t group2, const char *name, const char *aspect, apr_pool_t *p)
apr_time_t md_store_get_modified_cb(md_store_t *store, md_store_group_t group, const char *name, const char *aspect, apr_pool_t *p)
Definition: md_store.h:271
apr_status_t md_pkey_load(md_store_t *store, md_store_group_t group, const char *name, struct md_pkey_t **ppkey, apr_pool_t *p)
apr_status_t md_pkey_save(md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *name, struct md_pkey_t *pkey, int create)
apr_status_t md_store_save_cb(md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *name, const char *aspect, md_store_vtype_t vtype, void *value, int create)
Definition: md_store.h:239
Definition: md_store.h:54
const char * name
Definition: mod_dav.h:805
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
md_store_rename_cb * rename
Definition: md_store.h:283
int apr_status_t
Definition: apr_errno.h:44
Definition: md_store.h:52
apr_status_t md_store_purge_cb(md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *name)
Definition: md_store.h:246
apr_status_t md_store_rename(md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *name, const char *to)
struct md_pkey_t md_pkey_t
Definition: md_crypt.h:49
Definition: md_store.h:69
Definition: md_store.h:63
Definition: md_store.h:68
apr_status_t md_store_remove_cb(md_store_t *store, md_store_group_t group, const char *name, const char *aspect, apr_pool_t *p, int force)
Definition: md_store.h:243