scd: Do not conflict if a card with another serialno is demanded.
[gnupg.git] / dirmngr / crlfetch.h
1 /* crlfetch.h - LDAP access
2  *      Copyright (C) 2002 Klarälvdalens Datakonsult AB
3  *
4  * This file is part of DirMngr.
5  *
6  * DirMngr is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * DirMngr is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see <https://www.gnu.org/licenses/>.
18  */
19
20 #ifndef CRLFETCH_H
21 #define CRLFETCH_H
22
23 #include "dirmngr.h"
24
25
26 struct cert_fetch_context_s;
27 typedef struct cert_fetch_context_s *cert_fetch_context_t;
28
29
30 /* Fetch CRL from URL. */
31 gpg_error_t crl_fetch (ctrl_t ctrl, const char* url, ksba_reader_t *reader);
32
33 /* Fetch CRL for ISSUER using default server. */
34 gpg_error_t crl_fetch_default (ctrl_t ctrl,
35                                const char* issuer, ksba_reader_t *reader);
36
37
38 /* Fetch cert for DN. */
39 gpg_error_t ca_cert_fetch (ctrl_t ctrl, cert_fetch_context_t *context,
40                            const char *dn);
41
42
43 /* Query the server for certs matching patterns. */
44 gpg_error_t start_cert_fetch (ctrl_t ctrl,
45                               cert_fetch_context_t *context,
46                               strlist_t patterns,
47                               const ldap_server_t server);
48 gpg_error_t fetch_next_cert(cert_fetch_context_t context,
49                             unsigned char **value, size_t *valuelen);
50 gpg_error_t fetch_next_ksba_cert (cert_fetch_context_t context,
51                                   ksba_cert_t *r_cert);
52 void end_cert_fetch (cert_fetch_context_t context);
53
54 /* Lookup a cert by it's URL.  */
55 gpg_error_t fetch_cert_by_url (ctrl_t ctrl, const char *url,
56                                unsigned char **value, size_t *valuelen);
57
58 /* Close a reader object. */
59 void crl_close_reader (ksba_reader_t reader);
60
61
62
63 /*-- ldap.c --*/
64 gpg_error_t url_fetch_ldap (ctrl_t ctrl,
65                             const char *url, const char *host, int port,
66                             ksba_reader_t *reader);
67 gpg_error_t attr_fetch_ldap (ctrl_t ctrl,
68                              const char *dn, const char *attr,
69                              ksba_reader_t *reader);
70
71
72 gpg_error_t start_default_fetch_ldap (ctrl_t ctrl,
73                                       cert_fetch_context_t *context,
74                                       const char *dn, const char *attr);
75 gpg_error_t start_cert_fetch_ldap( ctrl_t ctrl,
76                                    cert_fetch_context_t *context,
77                                    strlist_t patterns,
78                                    const ldap_server_t server );
79 gpg_error_t fetch_next_cert_ldap (cert_fetch_context_t context,
80                                   unsigned char **value, size_t *valuelen );
81 void end_cert_fetch_ldap (cert_fetch_context_t context);
82
83
84
85
86
87
88 #endif /* CRLFETCH_H */