• 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#define DEBUGINFOD_HEADERS_FILE_ENV_VAR "DEBUGINFOD_HEADERS_FILE"
42
43/* The libdebuginfod soname.  */
44#define DEBUGINFOD_SONAME "@LIBDEBUGINFOD_SONAME@"
45
46/* Handle for debuginfod-client connection.  */
47typedef struct debuginfod_client debuginfod_client;
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53/* Create a handle for a new debuginfod-client session.  */
54debuginfod_client *debuginfod_begin (void);
55
56/* Query the urls contained in $DEBUGINFOD_URLS for a file with
57   the specified type and build id.  If build_id_len == 0, the
58   build_id is supplied as a lowercase hexadecimal string; otherwise
59   it is a binary blob of given length.
60
61   If successful, return a file descriptor to the target, otherwise
62   return a posix error code.  If successful, set *path to a
63   strdup'd copy of the name of the same file in the cache.
64   Caller must free() it later. */
65
66int debuginfod_find_debuginfo (debuginfod_client *client,
67			       const unsigned char *build_id,
68                               int build_id_len,
69                               char **path);
70
71int debuginfod_find_executable (debuginfod_client *client,
72				const unsigned char *build_id,
73                                int build_id_len,
74                                char **path);
75
76int debuginfod_find_source (debuginfod_client *client,
77			    const unsigned char *build_id,
78                            int build_id_len,
79                            const char *filename,
80                            char **path);
81
82int debuginfod_find_section (debuginfod_client *client,
83			     const unsigned char *build_id,
84			     int build_id_len,
85			     const char *section,
86			     char **path);
87
88typedef int (*debuginfod_progressfn_t)(debuginfod_client *c, long a, long b);
89void debuginfod_set_progressfn(debuginfod_client *c,
90			       debuginfod_progressfn_t fn);
91
92void debuginfod_set_verbose_fd(debuginfod_client *c, int fd);
93
94/* Set the user parameter.  */
95void debuginfod_set_user_data (debuginfod_client *client, void *value);
96
97/* Get the user parameter.  */
98void* debuginfod_get_user_data (debuginfod_client *client);
99
100/* Get the current or last active URL, if known.  */
101const char* debuginfod_get_url (debuginfod_client *client);
102
103/* Returns set of x-debuginfod* header lines received from current or
104   last active transfer, \n separated, if known. */
105const char* debuginfod_get_headers(debuginfod_client *client);
106
107/* Add an outgoing HTTP request  "Header: Value".  Copies string.  */
108int debuginfod_add_http_header (debuginfod_client *client, const char* header);
109
110/* Release debuginfod client connection context handle.  */
111void debuginfod_end (debuginfod_client *client);
112
113#ifdef __cplusplus
114}
115#endif
116
117
118#endif /* _DEBUGINFOD_CLIENT_H */
119