Blame debuginfod/debuginfod.h

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