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