Blame debuginfod/debuginfod.h

Packit Service 97d2fb
/* External declarations for the libdebuginfod client library.
Packit Service 97d2fb
   Copyright (C) 2019-2020 Red Hat, Inc.
Packit Service 97d2fb
   This file is part of elfutils.
Packit Service 97d2fb
Packit Service 97d2fb
   This file is free software; you can redistribute it and/or modify
Packit Service 97d2fb
   it under the terms of either
Packit Service 97d2fb
Packit Service 97d2fb
   * the GNU Lesser General Public License as published by the Free
Packit Service 97d2fb
       Software Foundation; either version 3 of the License, or (at
Packit Service 97d2fb
       your option) any later version
Packit Service 97d2fb
Packit Service 97d2fb
   or
Packit Service 97d2fb
Packit Service 97d2fb
   * the GNU General Public License as published by the Free
Packit Service 97d2fb
       Software Foundation; either version 2 of the License, or (at
Packit Service 97d2fb
       your option) any later version
Packit Service 97d2fb
Packit Service 97d2fb
   or both in parallel, as here.
Packit Service 97d2fb
Packit Service 97d2fb
   elfutils is distributed in the hope that it will be useful, but
Packit Service 97d2fb
   WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 97d2fb
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 97d2fb
   General Public License for more details.
Packit Service 97d2fb
Packit Service 97d2fb
   You should have received copies of the GNU General Public License and
Packit Service 97d2fb
   the GNU Lesser General Public License along with this program.  If
Packit Service 97d2fb
   not, see <http://www.gnu.org/licenses/>.  */
Packit Service 97d2fb
Packit Service 97d2fb
#ifndef _DEBUGINFOD_CLIENT_H
Packit Service 97d2fb
#define _DEBUGINFOD_CLIENT_H 1
Packit Service 97d2fb
Packit Service 97d2fb
/* Names of environment variables that control the client logic. */
Packit Service 97d2fb
#define DEBUGINFOD_URLS_ENV_VAR "DEBUGINFOD_URLS"
Packit Service 97d2fb
#define DEBUGINFOD_CACHE_PATH_ENV_VAR "DEBUGINFOD_CACHE_PATH"
Packit Service 97d2fb
#define DEBUGINFOD_TIMEOUT_ENV_VAR "DEBUGINFOD_TIMEOUT"
Packit Service 97d2fb
#define DEBUGINFOD_PROGRESS_ENV_VAR "DEBUGINFOD_PROGRESS"
Packit Service 97d2fb
Packit Service 97d2fb
/* Handle for debuginfod-client connection.  */
Packit Service 97d2fb
typedef struct debuginfod_client debuginfod_client;
Packit Service 97d2fb
Packit Service 97d2fb
#ifdef __cplusplus
Packit Service 97d2fb
extern "C" {
Packit Service 97d2fb
#endif
Packit Service 97d2fb
Packit Service 97d2fb
/* Create a handle for a new debuginfod-client session.  */
Packit Service 97d2fb
debuginfod_client *debuginfod_begin (void);
Packit Service 97d2fb
Packit Service 97d2fb
/* Query the urls contained in $DEBUGINFOD_URLS for a file with
Packit Service 97d2fb
   the specified type and build id.  If build_id_len == 0, the
Packit Service 97d2fb
   build_id is supplied as a lowercase hexadecimal string; otherwise
Packit Service 97d2fb
   it is a binary blob of given length.
Packit Service 97d2fb
Packit Service 97d2fb
   If successful, return a file descriptor to the target, otherwise
Packit Service 97d2fb
   return a posix error code.  If successful, set *path to a
Packit Service 97d2fb
   strdup'd copy of the name of the same file in the cache.
Packit Service 97d2fb
   Caller must free() it later. */
Packit Service 97d2fb
Packit Service 97d2fb
int debuginfod_find_debuginfo (debuginfod_client *client,
Packit Service 97d2fb
			       const unsigned char *build_id,
Packit Service 97d2fb
                               int build_id_len,
Packit Service 97d2fb
                               char **path);
Packit Service 97d2fb
Packit Service 97d2fb
int debuginfod_find_executable (debuginfod_client *client,
Packit Service 97d2fb
				const unsigned char *build_id,
Packit Service 97d2fb
                                int build_id_len,
Packit Service 97d2fb
                                char **path);
Packit Service 97d2fb
Packit Service 97d2fb
int debuginfod_find_source (debuginfod_client *client,
Packit Service 97d2fb
			    const unsigned char *build_id,
Packit Service 97d2fb
                            int build_id_len,
Packit Service 97d2fb
                            const char *filename,
Packit Service 97d2fb
                            char **path);
Packit Service 97d2fb
Packit Service 97d2fb
typedef int (*debuginfod_progressfn_t)(debuginfod_client *c, long a, long b);
Packit Service 97d2fb
void debuginfod_set_progressfn(debuginfod_client *c,
Packit Service 97d2fb
			       debuginfod_progressfn_t fn);
Packit Service 97d2fb
Packit Service 97d2fb
/* Set the user parameter.  */
Packit Service 97d2fb
void debuginfod_set_user_data (debuginfod_client *client, void *value);
Packit Service 97d2fb
Packit Service 97d2fb
/* Get the user parameter.  */
Packit Service 97d2fb
void* debuginfod_get_user_data (debuginfod_client *client);
Packit Service 97d2fb
Packit Service 97d2fb
/* Get the current or last active URL, if known.  */
Packit Service 97d2fb
const char* debuginfod_get_url (debuginfod_client *client);
Packit Service 97d2fb
Packit Service 97d2fb
/* Add an outgoing HTTP request  "Header: Value".  Copies string.  */
Packit Service 97d2fb
int debuginfod_add_http_header (debuginfod_client *client, const char* header);
Packit Service 97d2fb
Packit Service 97d2fb
/* Release debuginfod client connection context handle.  */
Packit Service 97d2fb
void debuginfod_end (debuginfod_client *client);
Packit Service 97d2fb
Packit Service 97d2fb
#ifdef __cplusplus
Packit Service 97d2fb
}
Packit Service 97d2fb
#endif
Packit Service 97d2fb
Packit Service 97d2fb
Packit Service 97d2fb
#endif /* _DEBUGINFOD_CLIENT_H */