1 /* External declarations for the libdebuginfod client library. 2 Copyright (C) 2019 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 37 /* Handle for debuginfod-client connection. */ 38 typedef struct debuginfod_client debuginfod_client; 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 /* Create a handle for a new debuginfod-client session. */ 45 debuginfod_client *debuginfod_begin (void); 46 47 /* Query the urls contained in $DEBUGINFOD_URLS for a file with 48 the specified type and build id. If build_id_len == 0, the 49 build_id is supplied as a lowercase hexadecimal string; otherwise 50 it is a binary blob of given legnth. 51 52 If successful, return a file descriptor to the target, otherwise 53 return a posix error code. If successful, set *path to a 54 strdup'd copy of the name of the same file in the cache. 55 Caller must free() it later. */ 56 57 int debuginfod_find_debuginfo (debuginfod_client *client, 58 const unsigned char *build_id, 59 int build_id_len, 60 char **path); 61 62 int debuginfod_find_executable (debuginfod_client *client, 63 const unsigned char *build_id, 64 int build_id_len, 65 char **path); 66 67 int debuginfod_find_source (debuginfod_client *client, 68 const unsigned char *build_id, 69 int build_id_len, 70 const char *filename, 71 char **path); 72 73 typedef int (*debuginfod_progressfn_t)(debuginfod_client *c, long a, long b); 74 void debuginfod_set_progressfn(debuginfod_client *c, 75 debuginfod_progressfn_t fn); 76 77 /* Release debuginfod client connection context handle. */ 78 void debuginfod_end (debuginfod_client *client); 79 80 #ifdef __cplusplus 81 } 82 #endif 83 84 85 #endif /* _DEBUGINFOD_CLIENT_H */ 86