Make headers self-contained and include-order independent

Signed-off-by: Shreyas Mahajan <shreyasmahajan05@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Eshan Kelkar <eshankelkar@galorithm.com>
This commit is contained in:
Shreyas Mahajan
2026-02-09 23:36:31 +05:30
committed by Jakub Jelen
parent 67950c620d
commit e927820082
15 changed files with 62 additions and 11 deletions

View File

@@ -20,6 +20,10 @@
#ifndef _BYTEARRAY_H
#define _BYTEARRAY_H
#include "config.h"
#include <stdint.h>
#define _DATA_BYTE_CONST(data, pos) \
((uint8_t)(((const uint8_t *)(data))[(pos)]))

View File

@@ -25,14 +25,19 @@
#ifndef _CRYPTO_H_
#define _CRYPTO_H_
#include <stdbool.h>
#include "config.h"
#include <stdbool.h>
#ifdef HAVE_LIBGCRYPT
#include <gcrypt.h>
#elif defined(HAVE_LIBMBEDCRYPTO)
#include <mbedtls/gcm.h>
#endif
#ifdef HAVE_OPENSSL_ECDH_H
#include <openssl/ecdh.h>
#endif
#include "libssh/wrapper.h"
#ifdef cbc_encrypt
@@ -42,9 +47,6 @@
#undef cbc_decrypt
#endif
#ifdef HAVE_OPENSSL_ECDH_H
#include <openssl/ecdh.h>
#endif
#include "libssh/curve25519.h"
#include "libssh/dh.h"
#include "libssh/ecdh.h"

View File

@@ -23,6 +23,10 @@
#ifndef SRC_DH_GEX_H_
#define SRC_DH_GEX_H_
#include "config.h"
#include "libssh/libssh.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@@ -22,6 +22,10 @@
#ifndef SSH_KNOWNHOSTS_H_
#define SSH_KNOWNHOSTS_H_
#include "config.h"
#include "libssh/libssh.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@@ -24,8 +24,9 @@
#include "config.h"
#ifdef HAVE_LIBGCRYPT
#include <gcrypt.h>
#include "libssh/libssh.h"
typedef gcry_md_hd_t SHACTX;
typedef gcry_md_hd_t SHA256CTX;
typedef gcry_md_hd_t SHA384CTX;

View File

@@ -27,7 +27,6 @@
#include "config.h"
#ifdef HAVE_LIBMBEDCRYPTO
#include <mbedtls/md.h>
#include <mbedtls/bignum.h>
#include <mbedtls/pk.h>
@@ -36,6 +35,8 @@
#include <mbedtls/ctr_drbg.h>
#include <mbedtls/platform.h>
#include "libssh/libssh.h"
typedef mbedtls_md_context_t *SHACTX;
typedef mbedtls_md_context_t *SHA256CTX;
typedef mbedtls_md_context_t *SHA384CTX;

View File

@@ -23,6 +23,11 @@
#include "config.h"
#include <stdint.h>
#include "libssh/callbacks.h"
#include "libssh/libssh.h"
struct ssh_auth_request {
char *username;
int method;

View File

@@ -21,8 +21,9 @@
#ifndef MISC_H_
#define MISC_H_
#ifdef _WIN32
#include "config.h"
#ifdef _WIN32
# ifdef _MSC_VER
# ifndef _SSIZE_T_DEFINED
# undef ssize_t
@@ -31,13 +32,14 @@
# define _SSIZE_T_DEFINED
# endif /* _SSIZE_T_DEFINED */
# endif /* _MSC_VER */
#else
#include <sys/types.h>
#include <stdbool.h>
#endif /* _WIN32 */
#include <stdio.h>
#include "libssh/libssh.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@@ -21,6 +21,13 @@
#ifndef _OPTIONS_H
#define _OPTIONS_H
#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include "libssh/libssh.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@@ -21,6 +21,9 @@
#ifndef PACKET_H_
#define PACKET_H_
#include "config.h"
#include "libssh/callbacks.h"
#include "libssh/wrapper.h"
struct ssh_socket_struct;

View File

@@ -24,8 +24,12 @@
#include "config.h"
#ifdef HAVE_POLL
#include <poll.h>
#endif
#include "libssh/libssh.h"
#ifdef HAVE_POLL
typedef struct pollfd ssh_pollfd_t;
#else /* HAVE_POLL */

View File

@@ -21,9 +21,13 @@
#ifndef _SCP_H
#define _SCP_H
#include "config.h"
#include <stddef.h>
#include <stdint.h>
#include "libssh/libssh.h"
enum ssh_scp_states {
SSH_SCP_NEW, //Data structure just created
SSH_SCP_WRITE_INITED, //Gave our intention to write

View File

@@ -21,7 +21,12 @@
#ifndef SFTP_PRIV_H
#define SFTP_PRIV_H
#include "config.h"
#include <stdbool.h>
#include <stdint.h>
#include "libssh/sftp.h"
#ifdef __cplusplus
extern "C" {

View File

@@ -21,13 +21,14 @@
#ifndef WRAPPER_H_
#define WRAPPER_H_
#include "config.h"
#include <stdbool.h>
#include "config.h"
#include "libssh/libssh.h"
#include "libssh/libcrypto.h"
#include "libssh/libgcrypt.h"
#include "libssh/libmbedcrypto.h"
#include "libssh/libssh.h"
#ifdef __cplusplus
extern "C" {