1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/* $OpenBSD: parse.h,v 1.13 2019/06/17 12:42:52 florian Exp $ */
/*
* Copyright (c) 2016 Sebastian Benoit <benno@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef PARSE_H
#define PARSE_H
#include <sys/queue.h>
#define AUTH_MAXLEN 120 /* max length of an authority_c name */
#define DOMAIN_MAXLEN 255 /* max len of a domain name (rfc2181) */
/*
* XXX other size limits needed?
* limit all paths to PATH_MAX
*/
enum keytype {
KT_RSA = 0,
KT_ECDSA
};
struct authority_c {
TAILQ_ENTRY(authority_c) entry;
char *name;
char *api;
char *account;
enum keytype keytype;
};
struct domain_c {
TAILQ_ENTRY(domain_c) entry;
TAILQ_HEAD(, altname_c) altname_list;
int altname_count;
enum keytype keytype;
char *domain;
char *key;
char *cert;
char *chain;
char *fullchain;
char *auth;
char *challengedir;
};
struct altname_c {
TAILQ_ENTRY(altname_c) entry;
char *domain;
};
struct keyfile {
LIST_ENTRY(keyfile) entry;
char *name;
};
#define ACME_OPT_VERBOSE 0x00000001
#define ACME_OPT_CHECK 0x00000004
struct acme_conf {
int opts;
TAILQ_HEAD(, authority_c) authority_list;
TAILQ_HEAD(, domain_c) domain_list;
LIST_HEAD(, keyfile) used_key_list;
};
struct acme_conf *parse_config(const char *, int);
int cmdline_symset(char *);
/* use these to find a authority or domain by name */
struct authority_c *authority_find(struct acme_conf *, char *);
struct authority_c *authority_find0(struct acme_conf *);
struct domain_c *domain_find(struct acme_conf *, char *);
int domain_valid(const char *);
#endif /* PARSE_H */
|