mirror of
https://github.com/neocturne/fastd.git
synced 2025-05-15 04:35:08 +02:00
Use #pragma once
This commit is contained in:
parent
4ab823eb50
commit
2b3043e578
21 changed files with 22 additions and 81 deletions
|
@ -2,10 +2,8 @@ set(VERSION_FILE "${FASTD_BINARY_DIR}/src/fastd_version.h")
|
|||
|
||||
add_custom_target(
|
||||
version
|
||||
COMMAND echo "#ifndef _FASTD_FASTD_VERSION_H_" > "${VERSION_FILE}.new"
|
||||
COMMAND echo "#define _FASTD_FASTD_VERSION_H_" >> "${VERSION_FILE}.new"
|
||||
COMMAND echo "#pragma once" > "${VERSION_FILE}.new"
|
||||
COMMAND sh -c "echo \"#define FASTD_VERSION \\\"$(git --git-dir=./.git describe --dirty 2>/dev/null || echo ${FASTD_VERSION})\\\"\"" >> "${VERSION_FILE}.new"
|
||||
COMMAND echo "#endif /* _FASTD_FASTD_VERSION_H_ */" >> "${VERSION_FILE}.new"
|
||||
COMMAND cmp -s "${VERSION_FILE}" "${VERSION_FILE}.new" && rm "${VERSION_FILE}.new" || mv "${VERSION_FILE}.new" "${VERSION_FILE}"
|
||||
WORKING_DIRECTORY "${FASTD_SOURCE_DIR}"
|
||||
VERBATIM
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_BUFFER_H_
|
||||
#define _FASTD_BUFFER_H_
|
||||
#pragma once
|
||||
|
||||
#include "log.h"
|
||||
|
||||
|
@ -91,5 +90,3 @@ static inline void fastd_buffer_push_head_to(const fastd_context_t *ctx, fastd_b
|
|||
memcpy(data, buffer->data, len);
|
||||
fastd_buffer_push_head(ctx, buffer, len);
|
||||
}
|
||||
|
||||
#endif /* _FASTD_BUFFER_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_COMPAT_H_
|
||||
#define _FASTD_COMPAT_H_
|
||||
#pragma once
|
||||
|
||||
#include <fastd_config.h>
|
||||
|
||||
|
@ -72,5 +71,3 @@ static inline char *get_current_dir_name(void) {
|
|||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _FASTD_COMPAT_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_CONFIG_H_
|
||||
#define _FASTD_CONFIG_H_
|
||||
#pragma once
|
||||
|
||||
#include "fastd.h"
|
||||
|
||||
|
@ -47,5 +46,3 @@ void fastd_config_verify(fastd_context_t *ctx, fastd_config_t *conf);
|
|||
|
||||
void fastd_add_peer_dir(fastd_context_t *ctx, fastd_config_t *conf, const char *dir);
|
||||
bool fastd_read_config(fastd_context_t *ctx, fastd_config_t *conf, const char *filename, bool peer_config, int depth);
|
||||
|
||||
#endif /* _FASTD_CONFIG_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_CPUID_H_
|
||||
#define _FASTD_CPUID_H_
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -42,5 +41,3 @@ static inline uint64_t fastd_cpuid(void) {
|
|||
|
||||
return ((uint64_t)ecx) << 32 | edx;
|
||||
}
|
||||
|
||||
#endif /* _FASTD_CPUID_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_CRYPTO_H_
|
||||
#define _FASTD_CRYPTO_H_
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
|
||||
|
@ -92,5 +91,3 @@ static inline void xor_a(fastd_block128_t *x, const fastd_block128_t *a) {
|
|||
static inline bool fastd_true(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* _FASTD_CRYPTO_H_ */
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../../../crypto.h"
|
||||
|
||||
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_DLIST_H_
|
||||
#define _FASTD_DLIST_H_
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
|
||||
|
@ -63,5 +62,3 @@ static inline void fastd_dlist_remove(fastd_dlist_head_t *elem) {
|
|||
|
||||
elem->prev = elem->next = NULL;
|
||||
}
|
||||
|
||||
#endif /* _FASTD_DLIST_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_FASTD_H_
|
||||
#define _FASTD_FASTD_H_
|
||||
#pragma once
|
||||
|
||||
#include "compat.h"
|
||||
#include "types.h"
|
||||
|
@ -436,5 +435,3 @@ static inline size_t max_size_t(size_t a, size_t b) {
|
|||
static inline size_t min_size_t(size_t a, size_t b) {
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
#endif /* _FASTD_FASTD_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_FASTD_CONFIG_H_
|
||||
#define _FASTD_FASTD_CONFIG_H_
|
||||
#pragma once
|
||||
|
||||
#cmakedefine HAVE_AI_ADDRCONFIG
|
||||
#cmakedefine HAVE_ETHHDR
|
||||
|
@ -52,5 +51,3 @@
|
|||
#cmakedefine ENABLE_OPENSSL
|
||||
|
||||
#define MAX_CONFIG_DEPTH @MAX_CONFIG_DEPTH_NUM@
|
||||
|
||||
#endif /* _FASTD_FASTD_CONFIG_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_HANDSHAKE_H_
|
||||
#define _FASTD_HANDSHAKE_H_
|
||||
#pragma once
|
||||
|
||||
#include "fastd.h"
|
||||
|
||||
|
@ -138,6 +137,3 @@ static inline void fastd_handshake_add_uint16(fastd_context_t *ctx, fastd_buffer
|
|||
dst[0] = value;
|
||||
dst[1] = value >> 8;
|
||||
}
|
||||
|
||||
|
||||
#endif /* _FASTD_HANDSHAKE_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_HKDF_SHA256_H_
|
||||
#define _FASTD_HKDF_SHA256_H_
|
||||
#pragma once
|
||||
|
||||
#include "sha256.h"
|
||||
#include "types.h"
|
||||
|
@ -36,5 +35,3 @@ static inline void fastd_hkdf_sha256_extract(fastd_sha256_t *out, const uint32_t
|
|||
}
|
||||
|
||||
void fastd_hkdf_sha256_expand(fastd_sha256_t *out, size_t blocks, const fastd_sha256_t *prk, const uint8_t *info, size_t infolen);
|
||||
|
||||
#endif /* _FASTD_HKDF_SHA256_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_LEX_H_
|
||||
#define _FASTD_LEX_H_
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include <config.yy.h>
|
||||
|
@ -37,5 +36,3 @@ fastd_lex_t* fastd_lex_init(FILE *file);
|
|||
void fastd_lex_destroy(fastd_lex_t *lex);
|
||||
|
||||
int fastd_lex(YYSTYPE *yylval, YYLTYPE *yylloc, fastd_lex_t *lex);
|
||||
|
||||
#endif /* _FASTD_LEX_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_LOG_H_
|
||||
#define _FASTD_LOG_H_
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
|
||||
|
@ -55,6 +54,3 @@ void fastd_logf(const fastd_context_t *ctx, fastd_loglevel_t level, const char *
|
|||
#define exit_bug(ctx, message) exit_fatal(ctx, "BUG: %s", message)
|
||||
#define exit_error(ctx, args...) do { pr_error(ctx, args); exit(1); } while(0)
|
||||
#define exit_errno(ctx, message) exit_error(ctx, "%s: %s", message, strerror(errno))
|
||||
|
||||
#endif /* _FASTD_LOG_H_ */
|
||||
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_METHOD_H_
|
||||
#define _FASTD_METHOD_H_
|
||||
#pragma once
|
||||
|
||||
#include "fastd.h"
|
||||
|
||||
|
@ -73,5 +72,3 @@ static inline const fastd_method_info_t* fastd_method_get_by_name(fastd_context_
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* _FASTD_METHOD_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_METHODS_COMMON_H_
|
||||
#define _FASTD_METHODS_COMMON_H_
|
||||
#pragma once
|
||||
|
||||
#include "../fastd.h"
|
||||
|
||||
|
@ -116,5 +115,3 @@ static inline void fastd_method_expand_nonce(uint8_t *buf, const uint8_t nonce[C
|
|||
memcpy(buf, nonce, min_size_t(len, COMMON_NONCEBYTES));
|
||||
buf[len-1] = 1;
|
||||
}
|
||||
|
||||
#endif /* _FASTD_METHODS_COMMON_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_PEER_H_
|
||||
#define _FASTD_PEER_H_
|
||||
#pragma once
|
||||
|
||||
#include "fastd.h"
|
||||
|
||||
|
@ -219,5 +218,3 @@ static inline bool fastd_eth_addr_is_unicast(fastd_eth_addr_t addr) {
|
|||
void fastd_peer_eth_addr_add(fastd_context_t *ctx, fastd_peer_t *peer, fastd_eth_addr_t addr);
|
||||
void fastd_peer_eth_addr_cleanup(fastd_context_t *ctx);
|
||||
fastd_peer_t* fastd_peer_find_by_eth_addr(fastd_context_t *ctx, fastd_eth_addr_t addr);
|
||||
|
||||
#endif /* _FASTD_PEER_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_PROTOCOL_EC25519_FHMQVC_H_
|
||||
#define _FASTD_PROTOCOL_EC25519_FHMQVC_H_
|
||||
#pragma once
|
||||
|
||||
#include "../../fastd.h"
|
||||
#include "../../method.h"
|
||||
|
@ -106,5 +105,3 @@ static inline void hexdump(char out[65], const unsigned char d[32]) {
|
|||
static inline bool is_session_valid(fastd_context_t *ctx, const protocol_session_t *session) {
|
||||
return (session->method && session->method->provider->session_is_valid(ctx, session->method_state));
|
||||
}
|
||||
|
||||
#endif /* _FASTD_PROTOCOL_EC25519_FHMQVC_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_PROTOCOL_EC25519_FHMQVC_HANDSHAKE_H_
|
||||
#define _FASTD_PROTOCOL_EC25519_FHMQVC_HANDSHAKE_H_
|
||||
#pragma once
|
||||
|
||||
#include "ec25519_fhmqvc.h"
|
||||
|
||||
|
@ -51,5 +50,3 @@ static inline bool is_handshake_key_valid(fastd_context_t *ctx, const handshake_
|
|||
static inline bool is_handshake_key_preferred(fastd_context_t *ctx, const handshake_key_t *handshake_key) {
|
||||
return !fastd_timed_out(ctx, &handshake_key->preferred_till);
|
||||
}
|
||||
|
||||
#endif /* _FASTD_PROTOCOL_EC25519_FHMQVC_HANDSHAKE_H_ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_SHA256_H_
|
||||
#define _FASTD_SHA256_H_
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
@ -56,5 +55,3 @@ void fastd_hmacsha256_blocks(fastd_sha256_t *out, const uint32_t key[FASTD_HMACS
|
|||
bool fastd_hmacsha256_blocks_verify(const uint8_t mac[FASTD_SHA256_HASH_BYTES], const uint32_t key[FASTD_HMACSHA256_KEY_WORDS], ...);
|
||||
void fastd_hmacsha256(fastd_sha256_t *out, const uint32_t key[FASTD_HMACSHA256_KEY_WORDS], const uint32_t *in, size_t len);
|
||||
bool fastd_hmacsha256_verify(const uint8_t mac[FASTD_SHA256_HASH_BYTES], const uint32_t key[FASTD_HMACSHA256_KEY_WORDS], const uint32_t *in, size_t len);
|
||||
|
||||
#endif /* _FASTD_SHA256_H_ */
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _FASTD_TYPES_H_
|
||||
#define _FASTD_TYPES_H_
|
||||
#pragma once
|
||||
|
||||
#include <fastd_config.h>
|
||||
|
||||
|
@ -149,5 +148,3 @@ typedef struct fastd_method_session_state fastd_method_session_state_t;
|
|||
|
||||
typedef struct fastd_cipher_state fastd_cipher_state_t;
|
||||
typedef struct fastd_mac_state fastd_mac_state_t;
|
||||
|
||||
#endif /* _FASTD_TYPES_H_ */
|
||||
|
|
Loading…
Add table
Reference in a new issue