Cleanup header files

- All now include maxscale/cdefs.h as the very first file.
- MXS_[BEGIN|END]_DECLS added to all C-headers.
  Strictly speaking not necessary for private headers, but
  does not hurt either.
- Include guards moved to the very top of the file.
- #pragma once added.
This commit is contained in:
Johan Wikman
2016-10-14 11:51:44 +03:00
parent dc1f599b49
commit 1a978be6b6
86 changed files with 647 additions and 206 deletions

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _GSSAPI_AUTH_H
#define _GSSAPI_AUTH_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -11,13 +14,13 @@
* Public License.
*/
#ifndef _GSSAPI_AUTH_H
#define _GSSAPI_AUTH_H
#include <maxscale/cdefs.h>
#include <stdint.h>
#include <stddef.h>
#include <gssapi.h>
MXS_BEGIN_DECLS
/** Client auth plugin name */
static const char auth_plugin_name[] = "auth_gssapi_client";
@ -48,4 +51,6 @@ void gssapi_auth_free(void *data);
/** Report GSSAPI errors */
void report_error(OM_uint32 major, OM_uint32 minor);
MXS_END_DECLS
#endif

View File

@ -1,5 +1,6 @@
#ifndef CACHE_H
#define CACHE_H
#pragma once
#ifndef _MAXSCALE_FILTER_CACHE_CACHE_H
#define _MAXSCALE_FILTER_CACHE_CACHE_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -15,6 +16,8 @@
#include <limits.h>
MXS_BEGIN_DECLS
#define CACHE_DEBUG_NONE 0
#define CACHE_DEBUG_MATCHING 1
#define CACHE_DEBUG_NON_MATCHING 2
@ -35,4 +38,6 @@
// Integer value
#define CACHE_DEFAULT_DEBUG 0
MXS_END_DECLS
#endif

View File

@ -1,5 +1,6 @@
#ifndef _MAXSCALE_FILTER_CACHE_CACHE_H
#define _MAXSCALE_FILTER_CACHE_CACHE_H
#pragma once
#ifndef _MAXSCALE_FILTER_CACHE_CACHE_STORAGE_API_H
#define _MAXSCALE_FILTER_CACHE_CACHE_STORAGE_API_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -19,7 +20,7 @@
#include <maxscale/protocol/mysql.h>
#include <maxscale/skygw_debug.h>
EXTERN_C_BLOCK_BEGIN
MXS_BEGIN_DECLS
typedef enum cache_result
{
@ -116,6 +117,6 @@ typedef struct cache_storage_api
#define CACHE_STORAGE_ENTRY_POINT "CacheGetStorageAPI"
typedef CACHE_STORAGE_API* (*CacheGetStorageAPIFN)();
EXTERN_C_BLOCK_END
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MAXSCALE_FILTER_CACHE_RULES_H
#define _MAXSCALE_FILTER_CACHE_RULES_H
/*
@ -13,12 +14,14 @@
* Public License.
*/
#include <maxscale/cdefs.h>
#include <stdbool.h>
#include <jansson.h>
#include <maxscale/buffer.h>
#include <maxscale/session.h>
#include <maxscale/pcre2.h>
MXS_BEGIN_DECLS
typedef enum cache_rule_attribute
{
@ -71,4 +74,6 @@ CACHE_RULES *cache_rules_parse(const char *json, uint32_t debug);
bool cache_rules_should_store(CACHE_RULES *rules, const char *default_db, const GWBUF* query);
bool cache_rules_should_use(CACHE_RULES *rules, const SESSION *session);
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MAXSCALE_FILTER_CACHE_STORAGE_H
#define _MAXSCALE_FILTER_CACHE_STORAGE_H
/*
@ -13,8 +14,11 @@
* Public License.
*/
#include <maxscale/cdefs.h>
#include "cache_storage_api.h"
MXS_BEGIN_DECLS
typedef struct cache_storage_module_t
{
void* handle;
@ -24,4 +28,6 @@ typedef struct cache_storage_module_t
CACHE_STORAGE_MODULE* cache_storage_open(const char *name);
void cache_storage_close(CACHE_STORAGE_MODULE *module);
MXS_END_DECLS
#endif

View File

@ -14,6 +14,7 @@
* Public License.
*/
#include <maxscale/cdefs.h>
#include "storage_rocksdb.h"
#include <rocksdb/env.h>
#include <rocksdb/version.h>

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _ROCKSDBSTORAGE_H
#define _ROCKSDBSTORAGE_H
/*
@ -13,6 +14,7 @@
* Public License.
*/
#include <maxscale/cdefs.h>
#include "storage_rocksdb.h"
#include <memory>
#include <string>

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _STORAGE_ROCKSDB_H
#define _STORAGE_ROCKSDB_H
/*
@ -14,6 +15,7 @@
*/
#define MXS_MODULE_NAME "storage_rocksdb"
#include <maxscale/cdefs.h>
#include <maxscale/log_manager.h>
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _DBFWFILTER_H
#define _DBFWFILTER_H
/*
@ -20,8 +21,11 @@
* the generater parser which is created from the ruleparser.y and token.l files.
*/
#include <maxscale/cdefs.h>
#include <stdbool.h>
MXS_BEGIN_DECLS
/** Matching type */
enum match_type
{
@ -49,4 +53,6 @@ bool add_active_rule(void* scanner, const char* name);
void set_matching_mode(void* scanner, enum match_type mode);
bool create_user_templates(void* scanner);
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MYSQLHINT_H
#define _MYSQLHINT_H
/*
@ -19,8 +20,12 @@
* Date Who Description
* 17-07-2014 Mark Riddoch Initial implementation
*/
#include <maxscale/cdefs.h>
#include <maxscale/hint.h>
MXS_BEGIN_DECLS
/* Parser tokens for the hint parser */
typedef enum
{
@ -105,11 +110,10 @@ typedef struct
#define HS_PVALUE 5
#define HS_PREPARE 6
extern HINT *hint_parser(HINT_SESSION *session, GWBUF *request);
NAMEDHINTS* free_named_hint(NAMEDHINTS* named_hint);
HINTSTACK* free_hint_stack(HINTSTACK* hint_stack);
MXS_END_DECLS
#endif

View File

@ -1,5 +1,6 @@
#ifndef BINLOG_COMMON_H
#define BINLOG_COMMON_H
#pragma once
#ifndef _BINLOG_COMMON_H
#define _BINLOG_COMMON_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -13,9 +14,13 @@
* Public License.
*/
#include <maxscale/cdefs.h>
#include <stdbool.h>
#include <stdint.h>
#include <time.h>
MXS_BEGIN_DECLS
/**
* Packet header for replication messages
*/
@ -45,4 +50,6 @@ bool binlog_next_file_exists(const char* binlogdir, const char* binlog);
uint32_t extract_field(uint8_t *src, int bits);
const char* binlog_event_name(int type);
MXS_END_DECLS
#endif /* BINLOG_COMMON_H */

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _BLR_DEFINES_H
#define _BLR_DEFINES_H
/*
@ -13,16 +14,19 @@
* Public License.
*/
/*
/**
* @file blr_defines.h - Various definitions for binlogrouter
* @verbatim
* Revision History
*
* 26/04/16 Massimiliano Pinto Added MariaDB 10.0 and 10.1 GTID event flags detection
* @endverbatim
*/
/**
* @file blr_defines.h - Various definitions for binlogrouter
*/
#include <maxscale/cdefs.h>
MXS_BEGIN_DECLS
#define BINLOG_FNAMELEN 255
#define BLR_PROTOCOL "MySQLBackend"
@ -201,4 +205,6 @@
#define EXTRACT32(x) extract_field((x), 32)
#endif
MXS_END_DECLS
#endif

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _CDC_H
#define _CDC_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -18,6 +21,7 @@
* 11-01-2016 Massimiliano Pinto First Implementation
*/
#include <maxscale/cdefs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -35,6 +39,8 @@
#include <maxscale/atomic.h>
#include <maxscale/gw.h>
MXS_BEGIN_DECLS
#define CDC_SMALL_BUFFER 1024
#define CDC_METHOD_MAXLEN 128
#define CDC_USER_MAXLEN 128
@ -87,3 +93,7 @@ typedef struct cdc_protocol
/* routines */
extern int gw_hex2bin(uint8_t *out, const char *in, unsigned int len);
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _DEBUGCLI_H
#define _DEBUGCLI_H
/*
@ -13,10 +14,14 @@
* of this software will be governed by version 2 or later of the General
* Public License.
*/
#include <maxscale/cdefs.h>
#include <maxscale/service.h>
#include <maxscale/session.h>
#include <maxscale/spinlock.h>
MXS_BEGIN_DECLS
/**
* @file debugcli.h The debug interface to the gateway
*
@ -63,4 +68,7 @@ typedef struct cli_session
/* Command line interface modes */
#define CLIM_USER 1
#define CLIM_DEVELOPER 2
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MYSQL_AUTH_H
#define _MYSQL_AUTH_H
/*
@ -23,11 +24,14 @@
* @endverbatim
*/
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h>
#include <maxscale/buffer.h>
#include <stdint.h>
#include <maxscale/protocol/mysql.h>
MXS_BEGIN_DECLS
int gw_check_mysql_scramble_data(DCB *dcb,
uint8_t *token,
unsigned int token_len,
@ -41,4 +45,6 @@ int gw_find_mysql_user_password_sha1(
uint8_t *gateway_password,
DCB *dcb);
MXS_END_DECLS
#endif /** _MYSQL_AUTH_H */

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _TELNETD_H
#define _TELNETD_H
/*
@ -24,8 +25,13 @@
*
* @endverbatim
*/
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h>
#include <maxscale/housekeeper.h>
MXS_BEGIN_DECLS
/**
* The telnetd specific protocol structure to put in the DCB.
*/
@ -57,4 +63,7 @@ typedef struct telnetd
#define TELNET_IAC 255
#define TELNET_ECHO 1
#define TELNET_SUPPRESS_GO_AHEAD 3
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _GALERAMON_H
#define _GALERAMON_H
/*
@ -13,6 +14,7 @@
* Public License.
*/
#include <maxscale/cdefs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -29,6 +31,8 @@
#include <maxscale/modinfo.h>
#include <maxscale/config.h>
MXS_BEGIN_DECLS
/**
* @file galeramon.h - The Galera cluster monitor
*
@ -59,4 +63,6 @@ typedef struct
bool events[MAX_MONITOR_EVENT]; /*< enabled events */
} GALERA_MONITOR;
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MMMON_H
#define _MMMON_H
/*
@ -13,6 +14,7 @@
* Public License.
*/
#include <maxscale/cdefs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -33,6 +35,8 @@
* @file mmmon.h - The Multi-Master monitor
*/
MXS_BEGIN_DECLS
/**
* The handle for an instance of a Multi-Master Monitor module
*/
@ -49,4 +53,6 @@ typedef struct
bool events[MAX_MONITOR_EVENT]; /*< enabled events */
} MM_MONITOR;
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MYSQLMON_H
#define _MYSQLMON_H
/*
@ -13,6 +14,7 @@
* Public License.
*/
#include <maxscale/cdefs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -30,6 +32,8 @@
#include <maxscale/externcmd.h>
#include <maxscale/hashtable.h>
MXS_BEGIN_DECLS
/**
* @file mysqlmon.h - The MySQL monitor
*
@ -80,4 +84,6 @@ typedef struct
bool warn_failover; /**< Log a warning when failover happens */
} MYSQL_MONITOR;
MXS_END_DECLS
#endif

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _HTTPD_H
#define _HTTPD_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -18,6 +21,7 @@
* 08-07-2013 Massimiliano Pinto Added HTTPD protocol header file
*/
#include <maxscale/cdefs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -35,6 +39,8 @@
#include <maxscale/atomic.h>
#include <maxscale/gw.h>
MXS_BEGIN_DECLS
#define HTTPD_SMALL_BUFFER 1024
#define HTTPD_METHOD_MAXLEN 128
#define HTTPD_USER_MAXLEN 128
@ -59,3 +65,7 @@ typedef struct httpd_session
char *query_string; /*< the Query string, starts with ?, after path_info and document name */
int headers_received; /*< All the headers has been received, if 1 */
} HTTPD_session;
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MAXSCALED_H
#define _MAXSCALED_H
/*
@ -27,6 +28,9 @@
#include <maxscale/dcb.h>
#include <maxscale/spinlock.h>
#include <maxscale/housekeeper.h>
MXS_BEGIN_DECLS
/**
* The maxscaled specific protocol structure to put in the DCB.
*/
@ -41,4 +45,6 @@ typedef struct maxscaled
#define MAXSCALED_STATE_PASSWD 2 /**< Waiting for password */
#define MAXSCALED_STATE_DATA 3 /**< User logged in */
MXS_END_DECLS
#endif

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _MXS_AVRO_H
#define _MXS_AVRO_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -15,8 +18,7 @@
* MaxScale AVRO router
*
*/
#ifndef _MXS_AVRO_H
#define _MXS_AVRO_H
#include <maxscale/cdefs.h>
#include <stdbool.h>
#include <stdint.h>
#include <blr_constants.h>
@ -35,6 +37,8 @@
#include <sqlite3.h>
#include <maxscale/protocol/mysql.h>
MXS_BEGIN_DECLS
/** SQLite3 version 3.7.14 introduced the new v2 close interface */
#if SQLITE_VERSION_NUMBER < 3007014
#define sqlite3_close_v2 sqlite3_close
@ -312,4 +316,6 @@ extern void table_map_remap(uint8_t *ptr, uint8_t hdr_len, TABLE_MAP *map);
#define AVRO_CS_BUSY 0x0001
#define AVRO_WAIT_DATA 0x0002
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _BLR_H
#define _BLR_H
/*
@ -37,6 +38,7 @@
*
* @endverbatim
*/
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h>
#include <maxscale/buffer.h>
#include <pthread.h>
@ -46,6 +48,8 @@
#include <zlib.h>
#include <maxscale/protocol/mysql.h>
MXS_BEGIN_DECLS
#define BINLOG_FNAMELEN 255
#define BLR_PROTOCOL "MySQLBackend"
#define BINLOG_MAGIC { 0xfe, 0x62, 0x69, 0x6e }
@ -676,4 +680,6 @@ extern bool blr_send_event(blr_thread_role_t role,
REP_HEADER *hdr,
uint8_t *buf);
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MAXINFO_H
#define _MAXINFO_H
/*
@ -12,10 +13,13 @@
* of this software will be governed by version 2 or later of the General
* Public License.
*/
#include <maxscale/cdefs.h>
#include <maxscale/service.h>
#include <maxscale/session.h>
#include <maxscale/spinlock.h>
MXS_BEGIN_DECLS
/**
* @file maxinfo.h The MaxScale information schema provider
*
@ -138,4 +142,7 @@ extern void maxinfo_send_parse_error(DCB *, char *, PARSE_ERROR);
extern void maxinfo_send_error(DCB *, int, char *);
extern RESULTSET *maxinfo_variables();
extern RESULTSET *maxinfo_status();
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _READCONNECTION_H
#define _READCONNECTION_H
/*
@ -25,8 +26,12 @@
*
* @endverbatim
*/
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h>
MXS_BEGIN_DECLS
/**
* Internal structure used to define the set of backend servers we are routing
* connections to. This provides the storage for routing module specific data
@ -84,4 +89,7 @@ typedef struct router_instance
struct router_instance
*next;
} ROUTER_INSTANCE;
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _RWSPLITROUTER_H
#define _RWSPLITROUTER_H
/*
@ -24,10 +25,13 @@
* @endverbatim
*/
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h>
#include <maxscale/hashtable.h>
#include <math.h>
MXS_BEGIN_DECLS
#undef PREP_STMT_CACHING
#if defined(PREP_STMT_CACHING)
@ -356,5 +360,6 @@ typedef struct router_instance
#define BACKEND_TYPE(b) (SERVER_IS_MASTER((b)->backend_server) ? BE_MASTER : \
(SERVER_IS_SLAVE((b)->backend_server) ? BE_SLAVE : BE_UNDEFINED));
MXS_END_DECLS
#endif /*< _RWSPLITROUTER_H */

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _RWSPLIT_INTERNAL_H
#define _RWSPLIT_INTERNAL_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -18,15 +21,11 @@
* Created on 08 August 2016, 11:54
*/
#ifndef RWSPLIT_INTERNAL_H
#define RWSPLIT_INTERNAL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <maxscale/cdefs.h>
#include <maxscale/query_classifier.h>
MXS_BEGIN_DECLS
/* This needs to be removed along with dependency on it - see the
* rwsplit_tmp_table_multi functions
*/
@ -145,5 +144,7 @@ qc_query_type_t determine_query_type(GWBUF *querybuf, int packet_type, bool non_
}
#endif
MXS_END_DECLS
#endif /* RWSPLIT_INTERNAL_H */

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _SCHEMAROUTER_H
#define _SCHEMAROUTER_H
/*
@ -23,14 +24,15 @@
*
* @endverbatim
*/
#ifndef PCRE2_CODE_UNIT_WIDTH
#define PCRE2_CODE_UNIT_WIDTH 8
#endif
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h>
#include <maxscale/hashtable.h>
#include <maxscale/protocol/mysql.h>
#include <pcre2.h>
#include <maxscale/pcre2.h>
MXS_BEGIN_DECLS
/**
* Bitmask values for the router session's initialization. These values are used
* to prevent responses from internal commands being forwarded to the client.
@ -377,4 +379,6 @@ typedef struct router_instance
#define BACKEND_TYPE(b) (SERVER_IS_MASTER((b)->backend_server) ? BE_MASTER : \
(SERVER_IS_SLAVE((b)->backend_server) ? BE_SLAVE : BE_UNDEFINED));
MXS_END_DECLS
#endif /*< _SCHEMAROUTER_H */

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _SHARDING_COMMON_HG
#define _SHARDING_COMMON_HG
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -11,9 +14,7 @@
* Public License.
*/
#ifndef _SHARDING_COMMON_HG
#define _SHARDING_COMMON_HG
#include <maxscale/cdefs.h>
#include <my_config.h>
#include <poll.h>
#include <maxscale/buffer.h>
@ -23,8 +24,12 @@
#include <maxscale/log_manager.h>
#include <maxscale/query_classifier.h>
MXS_BEGIN_DECLS
bool extract_database(GWBUF* buf, char* str);
void create_error_reply(char* fail_str, DCB* dcb);
bool change_current_db(char* dest, HASHTABLE* dbhash, GWBUF* buf);
MXS_END_DECLS
#endif