• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* External declarations for the libdebuginfod client library.
2   Copyright (C) 2019-2020 Red Hat, Inc.
3   This file is part of elfutils.
4
5   This file is free software; you can redistribute it and/or modify
6   it under the terms of either
7
8   * the GNU Lesser General Public License as published by the Free
9       Software Foundation; either version 3 of the License, or (at
10       your option) any later version
11
12   or
13
14   * the GNU General Public License as published by the Free
15       Software Foundation; either version 2 of the License, or (at
16       your option) any later version
17
18   or both in parallel, as here.
19
20   elfutils is distributed in the hope that it will be useful, but
21   WITHOUT ANY WARRANTY; without even the implied warranty of
22   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23   General Public License for more details.
24
25   You should have received copies of the GNU General Public License and
26   the GNU Lesser General Public License along with this program.  If
27   not, see <http://www.gnu.org/licenses/>.  */
28
29#ifndef _DEBUGINFOD_CLIENT_H
30#define _DEBUGINFOD_CLIENT_H 1
31
32/* Names of environment variables that control the client logic. */
33#define DEBUGINFOD_URLS_ENV_VAR "DEBUGINFOD_URLS"
34#define DEBUGINFOD_CACHE_PATH_ENV_VAR "DEBUGINFOD_CACHE_PATH"
35#define DEBUGINFOD_TIMEOUT_ENV_VAR "DEBUGINFOD_TIMEOUT"
36#define DEBUGINFOD_PROGRESS_ENV_VAR "DEBUGINFOD_PROGRESS"
37#define DEBUGINFOD_VERBOSE_ENV_VAR "DEBUGINFOD_VERBOSE"
38#define DEBUGINFOD_RETRY_LIMIT_ENV_VAR "DEBUGINFOD_RETRY_LIMIT"
39#define DEBUGINFOD_MAXSIZE_ENV_VAR "DEBUGINFOD_MAXSIZE"
40#define DEBUGINFOD_MAXTIME_ENV_VAR "DEBUGINFOD_MAXTIME"
41
42/* The libdebuginfod soname.  */
43#define DEBUGINFOD_SONAME "@LIBDEBUGINFOD_SONAME@"
44
45/* Handle for debuginfod-client connection.  */
46typedef struct debuginfod_client debuginfod_client;
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52/* Create a handle for a new debuginfod-client session.  */
53debuginfod_client *debuginfod_begin (void);
54
55/* Query the urls contained in $DEBUGINFOD_URLS for a file with
56   the specified type and build id.  If build_id_len == 0, the
57   build_id is supplied as a lowercase hexadecimal string; otherwise
58   it is a binary blob of given length.
59
60   If successful, return a file descriptor to the target, otherwise
61   return a posix error code.  If successful, set *path to a
62   strdup'd copy of the name of the same file in the cache.
63   Caller must free() it later. */
64
65int debuginfod_find_debuginfo (debuginfod_client *client,
66			       const unsigned char *build_id,
67                               int build_id_len,
68                               char **path);
69
70int debuginfod_find_executable (debuginfod_client *client,
71				const unsigned char *build_id,
72                                int build_id_len,
73                                char **path);
74
75int debuginfod_find_source (debuginfod_client *client,
76			    const unsigned char *build_id,
77                            int build_id_len,
78                            const char *filename,
79                            char **path);
80
81typedef int (*debuginfod_progressfn_t)(debuginfod_client *c, long a, long b);
82void debuginfod_set_progressfn(debuginfod_client *c,
83			       debuginfod_progressfn_t fn);
84
85void debuginfod_set_verbose_fd(debuginfod_client *c, int fd);
86
87/* Set the user parameter.  */
88void debuginfod_set_user_data (debuginfod_client *client, void *value);
89
90/* Get the user parameter.  */
91void* debuginfod_get_user_data (debuginfod_client *client);
92
93/* Get the current or last active URL, if known.  */
94const char* debuginfod_get_url (debuginfod_client *client);
95
96/* Add an outgoing HTTP request  "Header: Value".  Copies string.  */
97int debuginfod_add_http_header (debuginfod_client *client, const char* header);
98
99/* Release debuginfod client connection context handle.  */
100void debuginfod_end (debuginfod_client *client);
101
102#ifdef __cplusplus
103}
104#endif
105
106
107#endif /* _DEBUGINFOD_CLIENT_H */
108