Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:00:00

0001 /* External declarations for the libdebuginfod client library.
0002    Copyright (C) 2019-2020 Red Hat, Inc.
0003    This file is part of elfutils.
0004 
0005    This file is free software; you can redistribute it and/or modify
0006    it under the terms of either
0007 
0008    * the GNU Lesser General Public License as published by the Free
0009        Software Foundation; either version 3 of the License, or (at
0010        your option) any later version
0011 
0012    or
0013 
0014    * the GNU General Public License as published by the Free
0015        Software Foundation; either version 2 of the License, or (at
0016        your option) any later version
0017 
0018    or both in parallel, as here.
0019 
0020    elfutils is distributed in the hope that it will be useful, but
0021    WITHOUT ANY WARRANTY; without even the implied warranty of
0022    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0023    General Public License for more details.
0024 
0025    You should have received copies of the GNU General Public License and
0026    the GNU Lesser General Public License along with this program.  If
0027    not, see <http://www.gnu.org/licenses/>.  */
0028 
0029 #ifndef _DEBUGINFOD_CLIENT_H
0030 #define _DEBUGINFOD_CLIENT_H 1
0031 
0032 /* Names of environment variables that control the client logic. */
0033 #define DEBUGINFOD_URLS_ENV_VAR "DEBUGINFOD_URLS"
0034 #define DEBUGINFOD_CACHE_PATH_ENV_VAR "DEBUGINFOD_CACHE_PATH"
0035 #define DEBUGINFOD_TIMEOUT_ENV_VAR "DEBUGINFOD_TIMEOUT"
0036 #define DEBUGINFOD_PROGRESS_ENV_VAR "DEBUGINFOD_PROGRESS"
0037 #define DEBUGINFOD_VERBOSE_ENV_VAR "DEBUGINFOD_VERBOSE"
0038 #define DEBUGINFOD_RETRY_LIMIT_ENV_VAR "DEBUGINFOD_RETRY_LIMIT"
0039 #define DEBUGINFOD_MAXSIZE_ENV_VAR "DEBUGINFOD_MAXSIZE"
0040 #define DEBUGINFOD_MAXTIME_ENV_VAR "DEBUGINFOD_MAXTIME"
0041 #define DEBUGINFOD_HEADERS_FILE_ENV_VAR "DEBUGINFOD_HEADERS_FILE"
0042 
0043 /* The libdebuginfod soname.  */
0044 #define DEBUGINFOD_SONAME "libdebuginfod.so.1"
0045 
0046 /* Handle for debuginfod-client connection.  */
0047 #ifndef _ELFUTILS_DEBUGINFOD_CLIENT_TYPEDEF
0048 typedef struct debuginfod_client debuginfod_client;
0049 #define _ELFUTILS_DEBUGINFOD_CLIENT_TYPEDEF 1
0050 #endif
0051 
0052 #ifdef __cplusplus
0053 extern "C" {
0054 #endif
0055 
0056 /* Create a handle for a new debuginfod-client session.  */
0057 debuginfod_client *debuginfod_begin (void);
0058 
0059 /* Query the urls contained in $DEBUGINFOD_URLS for a file with
0060    the specified type and build id.  If build_id_len == 0, the
0061    build_id is supplied as a lowercase hexadecimal string; otherwise
0062    it is a binary blob of given length.
0063 
0064    If successful, return a file descriptor to the target, otherwise
0065    return a posix error code.  If successful, set *path to a
0066    strdup'd copy of the name of the same file in the cache.
0067    Caller must free() it later. */
0068 
0069 int debuginfod_find_debuginfo (debuginfod_client *client,
0070                    const unsigned char *build_id,
0071                                int build_id_len,
0072                                char **path);
0073 
0074 int debuginfod_find_executable (debuginfod_client *client,
0075                 const unsigned char *build_id,
0076                                 int build_id_len,
0077                                 char **path);
0078 
0079 int debuginfod_find_source (debuginfod_client *client,
0080                 const unsigned char *build_id,
0081                             int build_id_len,
0082                             const char *filename,
0083                             char **path);
0084 
0085 int debuginfod_find_section (debuginfod_client *client,
0086                  const unsigned char *build_id,
0087                  int build_id_len,
0088                  const char *section,
0089                  char **path);
0090 
0091 typedef int (*debuginfod_progressfn_t)(debuginfod_client *c, long a, long b);
0092 void debuginfod_set_progressfn(debuginfod_client *c,
0093                    debuginfod_progressfn_t fn);
0094 
0095 void debuginfod_set_verbose_fd(debuginfod_client *c, int fd);
0096 
0097 /* Set the user parameter.  */
0098 void debuginfod_set_user_data (debuginfod_client *client, void *value);
0099 
0100 /* Get the user parameter.  */
0101 void* debuginfod_get_user_data (debuginfod_client *client);
0102 
0103 /* Get the current or last active URL, if known.  */
0104 const char* debuginfod_get_url (debuginfod_client *client);
0105 
0106 /* Returns set of x-debuginfod* header lines received from current or
0107    last active transfer, \n separated, if known. */
0108 const char* debuginfod_get_headers(debuginfod_client *client);
0109 
0110 /* Add an outgoing HTTP request  "Header: Value".  Copies string.  */
0111 int debuginfod_add_http_header (debuginfod_client *client, const char* header);
0112 
0113 /* Release debuginfod client connection context handle.  */
0114 void debuginfod_end (debuginfod_client *client);
0115 
0116 #ifdef __cplusplus
0117 }
0118 #endif
0119 
0120 
0121 #endif /* _DEBUGINFOD_CLIENT_H */