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