1 /* $OpenBSD: parse.h,v 1.1 2016/09/18 20:18:25 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 LIST_ENTRY(authority_c) entry; 32 char *name; 33 char *agreement; 34 char *api; 35 char *account; 36 }; 37 38 struct domain_c { 39 LIST_ENTRY(domain_c) entry; 40 LIST_HEAD(, altname_c) altname_list; 41 char *domain; 42 char *key; 43 char *cert; 44 char *auth; 45 }; 46 47 struct altname_c { 48 LIST_ENTRY(altname_c) entry; 49 char *domain; 50 }; 51 52 struct keyfile { 53 LIST_ENTRY(keyfile) entry; 54 char *name; 55 }; 56 57 #define ACME_OPT_VERBOSE 0x00000001 58 59 struct acme_conf { 60 int opts; 61 LIST_HEAD(, authority_c) authority_list; 62 LIST_HEAD(, domain_c) domain_list; 63 LIST_HEAD(, keyfile) used_key_list; 64 }; 65 66 struct acme_conf *parse_config(const char *, int); 67 int cmdline_symset(char *); 68 69 /* use these to find a authority or domain by name */ 70 struct authority_c *authority_find(struct acme_conf *, char *); 71 struct authority_c *authority_find0(struct acme_conf *); 72 struct domain_c *domain_find(struct acme_conf *, char *); 73 74 int domain_valid(const char *); 75 76 #endif /* PARSE_H */ 77