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,5 +1,6 @@
#ifndef _ADMINUSERS_H #pragma once
#define _ADMINUSERS_H #ifndef _MAXSCALE_ADMINUSERS_H
#define _MAXSCALE_ADMINUSERS_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -24,8 +25,12 @@
* *
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
MXS_BEGIN_DECLS
#define ADMIN_SALT "$1$MXS" #define ADMIN_SALT "$1$MXS"
/* Max length of fields in for admin users */ /* Max length of fields in for admin users */
@ -63,4 +68,6 @@ extern bool admin_verify_inet_user(const char *uname, const char *passwor
extern void dcb_PrintAdminUsers(DCB *dcb); extern void dcb_PrintAdminUsers(DCB *dcb);
MXS_END_DECLS
#endif #endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MAXSCALE_ALLOC_H #ifndef _MAXSCALE_ALLOC_H
#define _MAXSCALE_ALLOC_H #define _MAXSCALE_ALLOC_H
/* /*
@ -13,11 +14,11 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <maxscale/skygw_debug.h>
EXTERN_C_BLOCK_BEGIN MXS_BEGIN_DECLS
/* /*
* NOTE: Do not use these functions directly, use the macros below. * NOTE: Do not use these functions directly, use the macros below.
@ -77,6 +78,6 @@ char *mxs_strndup_a(const char *s, size_t n/*, const char *caller*/);
*/ */
#define MXS_ABORT_IF_FALSE(b) do { if (!b) { abort(); } } while (false) #define MXS_ABORT_IF_FALSE(b) do { if (!b) { abort(); } } while (false)
EXTERN_C_BLOCK_END MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _ATOMIC_H #pragma once
#define _ATOMIC_H #ifndef _MAXSCALE_ATOMIC_H
#define _MAXSCALE_ATOMIC_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -26,9 +27,13 @@
* @endverbatim * @endverbatim
*/ */
#ifdef __cplusplus #include <maxscale/cdefs.h>
extern "C" int atomic_add(int *variable, int value);
#else MXS_BEGIN_DECLS
extern int atomic_add(int *variable, int value);
#endif int atomic_add(int *variable, int value);
int atomic_add(int *variable, int value);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _BUFFER_H #pragma once
#define _BUFFER_H #ifndef _MAXSCALE_BUFFER_H
#define _MAXSCALE_BUFFER_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -42,13 +43,15 @@
* *
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <string.h> #include <string.h>
#include <maxscale/skygw_debug.h> #include <maxscale/skygw_debug.h>
#include <maxscale/hint.h> #include <maxscale/hint.h>
#include <maxscale/spinlock.h> #include <maxscale/spinlock.h>
#include <stdint.h> #include <stdint.h>
EXTERN_C_BLOCK_BEGIN MXS_BEGIN_DECLS
/** /**
* Buffer properties - used to store properties related to the buffer * Buffer properties - used to store properties related to the buffer
@ -214,7 +217,7 @@ void* gwbuf_get_buffer_object_data(GWBUF* buf, bufobj_id_t id)
#if defined(BUFFER_TRACE) #if defined(BUFFER_TRACE)
extern void dprintAllBuffers(void *pdcb); extern void dprintAllBuffers(void *pdcb);
#endif #endif
EXTERN_C_BLOCK_END
MXS_END_DECLS
#endif #endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MAXSCALE_CONFIG_H #ifndef _MAXSCALE_CONFIG_H
#define _MAXSCALE_CONFIG_H #define _MAXSCALE_CONFIG_H
/* /*
@ -12,6 +13,8 @@
* of this software will be governed by version 2 or later of the General * of this software will be governed by version 2 or later of the General
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/skygw_utils.h> #include <maxscale/skygw_utils.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <stdint.h> #include <stdint.h>
@ -33,6 +36,8 @@
* @endverbatim * @endverbatim
*/ */
MXS_BEGIN_DECLS
#define DEFAULT_NBPOLLS 3 /**< Default number of non block polls before we block */ #define DEFAULT_NBPOLLS 3 /**< Default number of non block polls before we block */
#define DEFAULT_POLLSLEEP 1000 /**< Default poll wait time (milliseconds) */ #define DEFAULT_POLLSLEEP 1000 /**< Default poll wait time (milliseconds) */
#define _RELEASE_STR_LENGTH 256 /**< release len */ #define _RELEASE_STR_LENGTH 256 /**< release len */
@ -160,4 +165,6 @@ int config_truth_value(char *);
void free_config_parameter(CONFIG_PARAMETER* p1); void free_config_parameter(CONFIG_PARAMETER* p1);
bool is_internal_service(const char *router); bool is_internal_service(const char *router);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _DBUSERS_H #pragma once
#define _DBUSERS_H #ifndef _MAXSCALE_DBUSERS_H
#define _MAXSCALE_DBUSERS_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -13,9 +14,11 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/service.h> #include <maxscale/service.h>
#include <arpa/inet.h> #include <arpa/inet.h>
MXS_BEGIN_DECLS
/** /**
* @file dbusers.h Extarct user information form the backend database * @file dbusers.h Extarct user information form the backend database
@ -77,4 +80,6 @@ extern char *mysql_users_fetch(USERS *users, MYSQL_USER_HOST *key);
extern int reload_mysql_users(SERV_LISTENER *listener); extern int reload_mysql_users(SERV_LISTENER *listener);
extern int replace_mysql_users(SERV_LISTENER *listener); extern int replace_mysql_users(SERV_LISTENER *listener);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _DCB_H #pragma once
#define _DCB_H #ifndef _MAXSCALE_DCB_H
#define _MAXSCALE_DCB_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -12,6 +13,7 @@
* of this software will be governed by version 2 or later of the General * of this software will be governed by version 2 or later of the General
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/spinlock.h> #include <maxscale/spinlock.h>
#include <maxscale/buffer.h> #include <maxscale/buffer.h>
#include <maxscale/listmanager.h> #include <maxscale/listmanager.h>
@ -23,6 +25,8 @@
#include <maxscale/skygw_utils.h> #include <maxscale/skygw_utils.h>
#include <netinet/in.h> #include <netinet/in.h>
MXS_BEGIN_DECLS
#define ERRHANDLE #define ERRHANDLE
struct session; struct session;
@ -369,4 +373,7 @@ void dcb_append_readqueue(DCB *dcb, GWBUF *buffer);
#define DCB_IS_CLONE(d) ((d)->flags & DCBF_CLONE) #define DCB_IS_CLONE(d) ((d)->flags & DCBF_CLONE)
#define DCB_REPLIED(d) ((d)->flags & DCBF_REPLIED) #define DCB_REPLIED(d) ((d)->flags & DCBF_REPLIED)
MXS_END_DECLS
#endif /* _DCB_H */ #endif /* _DCB_H */

View File

@ -1,5 +1,6 @@
#ifndef _EXTERN_CMD_HG #pragma once
#define _EXTERN_CMD_HG #ifndef _MAXSCALE_EXTERN_CMD_HG
#define _MAXSCALE_EXTERN_CMD_HG
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -13,6 +14,7 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@ -20,6 +22,8 @@
#include <maxscale/log_manager.h> #include <maxscale/log_manager.h>
#include <maxscale/pcre2.h> #include <maxscale/pcre2.h>
MXS_BEGIN_DECLS
#define MAXSCALE_EXTCMD_ARG_MAX 256 #define MAXSCALE_EXTCMD_ARG_MAX 256
typedef struct extern_cmd_t typedef struct extern_cmd_t
@ -38,4 +42,6 @@ bool externcmd_substitute_arg(EXTERNCMD* cmd, const char* re, const char* replac
bool externcmd_can_execute(const char* argstr); bool externcmd_can_execute(const char* argstr);
bool externcmd_matches(const EXTERNCMD* cmd, const char* match); bool externcmd_matches(const EXTERNCMD* cmd, const char* match);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _FILTER_H #pragma once
#define _FILTER_H #ifndef _MAXSCALE_FILTER_H
#define _MAXSCALE_FILTER_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -22,11 +23,15 @@
* 27/05/2014 Mark Riddoch Initial implementation * 27/05/2014 Mark Riddoch Initial implementation
* *
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
#include <maxscale/session.h> #include <maxscale/session.h>
#include <maxscale/buffer.h> #include <maxscale/buffer.h>
#include <stdint.h> #include <stdint.h>
MXS_BEGIN_DECLS
/** /**
* The FILTER handle points to module specific data, so the best we can do * The FILTER handle points to module specific data, so the best we can do
* is to make it a void * externally. * is to make it a void * externally.
@ -116,4 +121,6 @@ void dprintAllFilters(DCB *);
void dprintFilter(DCB *, FILTER_DEF *); void dprintFilter(DCB *, FILTER_DEF *);
void dListFilters(DCB *); void dListFilters(DCB *);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _GW_HG #pragma once
#define _GW_HG #ifndef _MAXSCALE_GW_HG
#define _MAXSCALE_GW_HG
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -13,7 +14,7 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
@ -35,6 +36,8 @@
#include <stdbool.h> #include <stdbool.h>
#include <maxscale/gwdirs.h> #include <maxscale/gwdirs.h>
MXS_BEGIN_DECLS
#define EXIT_FAILURE 1 #define EXIT_FAILURE 1
// network buffer is 32K // network buffer is 32K
@ -83,4 +86,7 @@ char* get_libdir();
long get_processor_count(); long get_processor_count();
void clean_up_pathname(char *path); void clean_up_pathname(char *path);
bool mxs_mkdir_all(const char *path, int mask); bool mxs_mkdir_all(const char *path, int mask);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef GW_AUTHENTICATOR_H #pragma once
#define GW_AUTHENTICATOR_H #ifndef _MAXSCALE_GW_AUTHENTICATOR_H
#define _MAXSCALE_GW_AUTHENTICATOR_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -27,12 +28,15 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/buffer.h> #include <maxscale/buffer.h>
#include <openssl/crypto.h> #include <openssl/crypto.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/dh.h> #include <openssl/dh.h>
MXS_BEGIN_DECLS
/** Maximum number of authenticator options */ /** Maximum number of authenticator options */
#define AUTHENTICATOR_MAX_OPTIONS 256 #define AUTHENTICATOR_MAX_OPTIONS 256
@ -134,5 +138,7 @@ typedef enum
bool authenticator_init(void **instance, const char *authenticator, const char *options); bool authenticator_init(void **instance, const char *authenticator, const char *options);
char* get_default_authenticator(const char *protocol); char* get_default_authenticator(const char *protocol);
MXS_END_DECLS
#endif /* GW_AUTHENTICATOR_H */ #endif /* GW_AUTHENTICATOR_H */

View File

@ -1,5 +1,6 @@
#ifndef GW_PROTOCOL_H #pragma once
#define GW_PROTOCOL_H #ifndef _MAXSCALE_GW_PROTOCOL_H
#define _MAXSCALE_GW_PROTOCOL_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -28,8 +29,11 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/buffer.h> #include <maxscale/buffer.h>
MXS_BEGIN_DECLS
struct dcb; struct dcb;
struct server; struct server;
struct session; struct session;
@ -81,6 +85,7 @@ typedef struct gw_protocol
*/ */
#define GWPROTOCOL_VERSION {1, 1, 0} #define GWPROTOCOL_VERSION {1, 1, 0}
MXS_END_DECLS
#endif /* GW_PROTOCOL_H */ #endif /* GW_PROTOCOL_H */

View File

@ -1,5 +1,6 @@
#ifndef _GW_SSL_H #pragma once
#define _GW_SSL_H #ifndef _MAXSCALE_GW_SSL_H
#define _MAXSCALE_GW_SSL_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -27,12 +28,15 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/gw_protocol.h> #include <maxscale/gw_protocol.h>
#include <openssl/crypto.h> #include <openssl/crypto.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/dh.h> #include <openssl/dh.h>
MXS_BEGIN_DECLS
struct dcb; struct dcb;
typedef enum ssl_method_type typedef enum ssl_method_type
@ -78,4 +82,6 @@ bool ssl_required_by_dcb(struct dcb *dcb);
bool ssl_required_but_not_negotiated(struct dcb *dcb); bool ssl_required_but_not_negotiated(struct dcb *dcb);
const char* ssl_method_type_to_string(ssl_method_type_t method_type); const char* ssl_method_type_to_string(ssl_method_type_t method_type);
MXS_END_DECLS
#endif /* _GW_SSL_H */ #endif /* _GW_SSL_H */

View File

@ -1,5 +1,6 @@
#ifndef _GWBITMASK_H #pragma once
#define _GWBITMASK_H #ifndef _MAXSCALE_GWBITMASK_H
#define _MAXSCALE_GWBITMASK_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -13,9 +14,12 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/spinlock.h> #include <maxscale/spinlock.h>
#include <maxscale/limits.h> #include <maxscale/limits.h>
MXS_BEGIN_DECLS
/** /**
* @file gwbitmask.h An implementation of an arbitrarily long bitmask * @file gwbitmask.h An implementation of an arbitrarily long bitmask
* *
@ -55,4 +59,6 @@ extern int bitmask_isallclear(GWBITMASK *);
extern void bitmask_copy(GWBITMASK *, GWBITMASK *); extern void bitmask_copy(GWBITMASK *, GWBITMASK *);
extern char *bitmask_render_readable(GWBITMASK *); extern char *bitmask_render_readable(GWBITMASK *);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _GW_DIRS_HG #pragma once
#define _GW_DIRS_HG #ifndef _MAXSCALE_GW_DIRS_HG
#define _MAXSCALE_GW_DIRS_HG
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -15,11 +16,13 @@
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#endif #endif
#include <maxscale/cdefs.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <maxscale/skygw_utils.h> #include <maxscale/skygw_utils.h>
EXTERN_C_BLOCK_BEGIN MXS_BEGIN_DECLS
/** /**
* All of the following DEFAULT_* variables are defined in cmake/install_layout.cmake * All of the following DEFAULT_* variables are defined in cmake/install_layout.cmake
@ -76,6 +79,6 @@ char* get_logdir();
char* get_langdir(); char* get_langdir();
char* get_execdir(); char* get_execdir();
EXTERN_C_BLOCK_END MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _HASTABLE_H #pragma once
#define _HASTABLE_H #ifndef _MAXSCALE_HASTABLE_H
#define _MAXSCALE_HASTABLE_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -28,10 +29,11 @@
* *
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/skygw_debug.h> #include <maxscale/skygw_debug.h>
#include <maxscale/spinlock.h> #include <maxscale/spinlock.h>
EXTERN_C_BLOCK_BEGIN MXS_BEGIN_DECLS
/** /**
* The entries within a hashtable. * The entries within a hashtable.
@ -150,6 +152,6 @@ extern int hashtable_item_strcmp(const void* str1, const void* str2);
extern void* hashtable_item_strdup(const void *str); extern void* hashtable_item_strdup(const void *str);
extern int hashtable_item_strhash(const void *str); extern int hashtable_item_strhash(const void *str);
EXTERN_C_BLOCK_END MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _HINT_H #pragma once
#define _HINT_H #ifndef _MAXSCALE_HINT_H
#define _MAXSCALE_HINT_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -25,8 +26,10 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/skygw_debug.h> #include <maxscale/skygw_debug.h>
MXS_BEGIN_DECLS
/** /**
* The types of hint that are supported by the generic hinting mechanism. * The types of hint that are supported by the generic hinting mechanism.
@ -63,4 +66,7 @@ extern HINT *hint_create_route(HINT *, HINT_TYPE, char *);
extern void hint_free(HINT *); extern void hint_free(HINT *);
extern HINT *hint_dup(HINT *); extern HINT *hint_dup(HINT *);
bool hint_exists(HINT **, HINT_TYPE); bool hint_exists(HINT **, HINT_TYPE);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _HK_HEARTBEAT_H #pragma once
#define _HK_HEARTBEAT_H #ifndef _MAXSCALE_HK_HEARTBEAT_H
#define _MAXSCALE_HK_HEARTBEAT_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
@ -14,6 +15,10 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
MXS_BEGIN_DECLS
/** /**
* The global housekeeper heartbeat value. This value is incremented * The global housekeeper heartbeat value. This value is incremented
* every 100 milliseconds and may be used for crude timing etc. * every 100 milliseconds and may be used for crude timing etc.
@ -21,4 +26,6 @@
extern long hkheartbeat; extern long hkheartbeat;
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _HOUSEKEEPER_H #pragma once
#define _HOUSEKEEPER_H #ifndef _MAXSCALE_HOUSEKEEPER_H
#define _MAXSCALE_HOUSEKEEPER_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -12,9 +13,14 @@
* of this software will be governed by version 2 or later of the General * of this software will be governed by version 2 or later of the General
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <time.h> #include <time.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
#include <maxscale/hk_heartbeat.h> #include <maxscale/hk_heartbeat.h>
MXS_BEGIN_DECLS
/** /**
* @file housekeeper.h A mechanism to have task run periodically * @file housekeeper.h A mechanism to have task run periodically
* *
@ -54,4 +60,6 @@ extern int hktask_remove(const char *name);
extern void hkshutdown(); extern void hkshutdown();
extern void hkshow_tasks(DCB *pdcb); extern void hkshow_tasks(DCB *pdcb);
MXS_END_DECLS
#endif #endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MAXSCALE_LIMITS_H #ifndef _MAXSCALE_LIMITS_H
#define _MAXSCALE_LIMITS_H #define _MAXSCALE_LIMITS_H
/* /*
@ -13,6 +14,10 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
MXS_BEGIN_DECLS
// This file defines hard limits of MaxScale. // This file defines hard limits of MaxScale.
// Thread information is stored in a bitmask whose size must be a // Thread information is stored in a bitmask whose size must be a
@ -21,4 +26,6 @@
// multiple of 8 minus 1. // multiple of 8 minus 1.
#define MXS_MAX_THREADS 255 #define MXS_MAX_THREADS 255
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _LISTENER_H #pragma once
#define _LISTENER_H #ifndef _MAXSCALE_LISTENER_H
#define _MAXSCALE_LISTENER_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -27,10 +28,13 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/gw_protocol.h> #include <maxscale/gw_protocol.h>
#include <maxscale/gw_ssl.h> #include <maxscale/gw_ssl.h>
#include <maxscale/hashtable.h> #include <maxscale/hashtable.h>
MXS_BEGIN_DECLS
struct dcb; struct dcb;
struct service; struct service;
@ -65,4 +69,6 @@ int listener_set_ssl_version(SSL_LISTENER *ssl_listener, char* version);
void listener_set_certificates(SSL_LISTENER *ssl_listener, char* cert, char* key, char* ca_cert); void listener_set_certificates(SSL_LISTENER *ssl_listener, char* cert, char* key, char* ca_cert);
int listener_init_SSL(SSL_LISTENER *ssl_listener); int listener_init_SSL(SSL_LISTENER *ssl_listener);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _LISTMANAGER_H #pragma once
#define _LISTMANAGER_H #ifndef _MAXSCALE_LISTMANAGER_H
#define _MAXSCALE_LISTMANAGER_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -26,9 +27,12 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/spinlock.h> #include <maxscale/spinlock.h>
#include <maxscale/skygw_debug.h> #include <maxscale/skygw_debug.h>
MXS_BEGIN_DECLS
struct dcb; struct dcb;
/* /*
@ -115,5 +119,6 @@ void list_map(LIST_CONFIG *list_config, bool (*callback)(void *, ...));
list_entry_t *list_remove_first(LIST_CONFIG *list_config); list_entry_t *list_remove_first(LIST_CONFIG *list_config);
list_entry_t *list_remove_last(LIST_CONFIG *list_config); list_entry_t *list_remove_last(LIST_CONFIG *list_config);
MXS_END_DECLS
#endif /* LISTMANAGER_H */ #endif /* LISTMANAGER_H */

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _MAXSCALE_LOG_MANAGER_H
#define _MAXSCALE_LOG_MANAGER_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -10,16 +13,13 @@
* of this software will be governed by version 2 or later of the General * of this software will be governed by version 2 or later of the General
* Public License. * Public License.
*/ */
#if !defined(LOG_MANAGER_H)
#define LOG_MANAGER_H
#include <maxscale/cdefs.h>
#include <stdbool.h> #include <stdbool.h>
#include <syslog.h> #include <syslog.h>
#include <unistd.h> #include <unistd.h>
#if defined(__cplusplus) MXS_BEGIN_DECLS
extern "C" {
#endif
/* /*
* We need a common.h file that is included by every component. * We need a common.h file that is included by every component.
@ -195,8 +195,6 @@ enum
trailing NULL. If longer, it will be cut. */ trailing NULL. If longer, it will be cut. */
}; };
#if defined(__cplusplus) MXS_END_DECLS
}
#endif
#endif /** LOG_MANAGER_H */ #endif /** LOG_MANAGER_H */

View File

@ -1,5 +1,6 @@
#ifndef _MAXADMIN_H #pragma once
#define _MAXADMIN_H #ifndef _MAXSCALE_MAXADMIN_H
#define _MAXSCALE_MAXADMIN_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -13,6 +14,10 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
MXS_BEGIN_DECLS
#define MAXADMIN_DEFAULT_SOCKET "/tmp/maxadmin.sock" #define MAXADMIN_DEFAULT_SOCKET "/tmp/maxadmin.sock"
#define MAXADMIN_CONFIG_DEFAULT_SOCKET_TAG_LEN 7 #define MAXADMIN_CONFIG_DEFAULT_SOCKET_TAG_LEN 7
@ -28,4 +33,6 @@
#define MAXADMIN_AUTH_PASSWORD_PROMPT "PASSWORD" #define MAXADMIN_AUTH_PASSWORD_PROMPT "PASSWORD"
#define MAXADMIN_AUTH_PASSWORD_PROMPT_LEN 8 #define MAXADMIN_AUTH_PASSWORD_PROMPT_LEN 8
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _MAXSCALE_H #pragma once
#define _MAXSCALE_H #ifndef _MAXSCALE_MAXSCALE_H
#define _MAXSCALE_MAXSCALE_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -27,8 +28,10 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <time.h> #include <time.h>
MXS_BEGIN_DECLS
/* Exit status for MaxScale */ /* Exit status for MaxScale */
#define MAXSCALE_SHUTDOWN 0 /* Good shutdown */ #define MAXSCALE_SHUTDOWN 0 /* Good shutdown */
@ -43,4 +46,6 @@ void maxscale_reset_starttime(void);
time_t maxscale_started(void); time_t maxscale_started(void);
int maxscale_uptime(void); int maxscale_uptime(void);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _MEMLOG_H #pragma once
#define _MEMLOG_H #ifndef _MAXSCALE_MEMLOG_H
#define _MAXSCALE_MEMLOG_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -24,8 +25,12 @@
* *
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/spinlock.h> #include <maxscale/spinlock.h>
MXS_BEGIN_DECLS
typedef enum { ML_INT, ML_LONG, ML_LONGLONG, ML_STRING } MEMLOGTYPE; typedef enum { ML_INT, ML_LONG, ML_LONGLONG, ML_STRING } MEMLOGTYPE;
typedef struct memlog typedef struct memlog
@ -59,4 +64,6 @@ extern void memlog_log(MEMLOG *, void *);
extern void memlog_flush_all(); extern void memlog_flush_all();
extern void memlog_flush(MEMLOG *); extern void memlog_flush(MEMLOG *);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _MLIST_H #pragma once
#define _MLIST_H #ifndef _MAXSCALE_MLIST_H
#define _MAXSCALE_MLIST_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -13,9 +14,10 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/skygw_utils.h> #include <maxscale/skygw_utils.h>
EXTERN_C_BLOCK_BEGIN MXS_BEGIN_DECLS
typedef struct mlist_node_st mlist_node_t; typedef struct mlist_node_st mlist_node_t;
@ -74,6 +76,6 @@ mlist_cursor_t* mlist_cursor_init(mlist_t* ml);
void* mlist_cursor_get_data_nomutex(mlist_cursor_t* c); void* mlist_cursor_get_data_nomutex(mlist_cursor_t* c);
bool mlist_cursor_move_to_first(mlist_cursor_t* c); bool mlist_cursor_move_to_first(mlist_cursor_t* c);
EXTERN_C_BLOCK_END MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _MODINFO_H #pragma once
#define _MODINFO_H #ifndef _MAXSCALE_MODINFO_H
#define _MAXSCALE_MODINFO_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -25,6 +26,10 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
MXS_BEGIN_DECLS
/** /**
* The status of the module. This gives some idea of the module * The status of the module. This gives some idea of the module
* maturity. * maturity.
@ -83,4 +88,7 @@ typedef struct
MODULE_VERSION api_version; MODULE_VERSION api_version;
char *description; char *description;
} MODULE_INFO; } MODULE_INFO;
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _MODULES_H #pragma once
#define _MODULES_H #ifndef _MAXSCALE_MODULES_H
#define _MAXSCALE_MODULES_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -12,12 +13,14 @@
* of this software will be governed by version 2 or later of the General * of this software will be governed by version 2 or later of the General
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
#include <maxscale/modinfo.h> #include <maxscale/modinfo.h>
#include <maxscale/resultset.h> #include <maxscale/resultset.h>
#include <maxscale/skygw_debug.h> #include <maxscale/skygw_debug.h>
EXTERN_C_BLOCK_BEGIN MXS_BEGIN_DECLS
/** /**
* @file modules.h Utilities for loading modules * @file modules.h Utilities for loading modules
@ -71,6 +74,6 @@ extern RESULTSET *moduleGetList();
extern void module_feedback_send(void*); extern void module_feedback_send(void*);
extern void moduleShowFeedbackReport(DCB *dcb); extern void moduleShowFeedbackReport(DCB *dcb);
EXTERN_C_BLOCK_END MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _MODUTIL_H #pragma once
#define _MODUTIL_H #ifndef _MAXSCALE_MODUTIL_H
#define _MAXSCALE_MODUTIL_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -26,11 +27,15 @@
* *
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/buffer.h> #include <maxscale/buffer.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
#include <string.h> #include <string.h>
#include <maxscale/pcre2.h> #include <maxscale/pcre2.h>
MXS_BEGIN_DECLS
#define PTR_IS_RESULTSET(b) (b[0] == 0x01 && b[1] == 0x0 && b[2] == 0x0 && b[3] == 0x01) #define PTR_IS_RESULTSET(b) (b[0] == 0x01 && b[1] == 0x0 && b[2] == 0x0 && b[3] == 0x01)
#define PTR_IS_EOF(b) (b[0] == 0x05 && b[1] == 0x0 && b[2] == 0x0 && b[4] == 0xfe) #define PTR_IS_EOF(b) (b[0] == 0x05 && b[1] == 0x0 && b[2] == 0x0 && b[4] == 0xfe)
#define PTR_IS_OK(b) (b[4] == 0x00) #define PTR_IS_OK(b) (b[4] == 0x00)
@ -70,4 +75,6 @@ bool is_mysql_statement_end(const char* start, int len);
bool is_mysql_sp_end(const char* start, int len); bool is_mysql_sp_end(const char* start, int len);
char* modutil_get_canonical(GWBUF* querybuf); char* modutil_get_canonical(GWBUF* querybuf);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _MONITOR_H #pragma once
#define _MONITOR_H #ifndef _MAXSCALE_MONITOR_H
#define _MAXSCALE_MONITOR_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -12,6 +13,8 @@
* of this software will be governed by version 2 or later of the General * of this software will be governed by version 2 or later of the General
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <mysql.h> #include <mysql.h>
#include <maxscale/server.h> #include <maxscale/server.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
@ -21,6 +24,8 @@
#include <maxscale/externcmd.h> #include <maxscale/externcmd.h>
#include <maxscale/secrets.h> #include <maxscale/secrets.h>
MXS_BEGIN_DECLS
/** /**
* @file monitor.h The interface to the monitor module * @file monitor.h The interface to the monitor module
* *
@ -226,4 +231,6 @@ connect_result_t mon_connect_to_db(MONITOR* mon, MONITOR_SERVERS *database);
void mon_log_connect_error(MONITOR_SERVERS* database, connect_result_t rval); void mon_log_connect_error(MONITOR_SERVERS* database, connect_result_t rval);
void mon_log_state_change(MONITOR_SERVERS *ptr); void mon_log_state_change(MONITOR_SERVERS *ptr);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef MYSQL_BINLOG_H #pragma once
#define MYSQL_BINLOG_H #ifndef _MAXSCALE_MYSQL_BINLOG_H
#define _MAXSCALE_MYSQL_BINLOG_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -17,10 +18,13 @@
* @file mysql_binlog.h - Extracting information from binary logs * @file mysql_binlog.h - Extracting information from binary logs
*/ */
#include <maxscale/cdefs.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <time.h> #include <time.h>
MXS_BEGIN_DECLS
/** Maximum GTID string length */ /** Maximum GTID string length */
#define GTID_MAX_LEN 64 #define GTID_MAX_LEN 64
@ -91,4 +95,6 @@ uint64_t unpack_bit(uint8_t *ptr, uint8_t *null_mask, uint32_t col_count,
void format_temporal_value(char *str, size_t size, uint8_t type, struct tm *tm); void format_temporal_value(char *str, size_t size, uint8_t type, struct tm *tm);
MXS_END_DECLS
#endif /* MYSQL_BINLOG_H */ #endif /* MYSQL_BINLOG_H */

View File

@ -1,5 +1,6 @@
#ifndef _MYSQL_UTILS_H #pragma once
#define _MYSQL_UTILS_H #ifndef _MAXSCALE_MYSQL_UTILS_H
#define _MAXSCALE_MYSQL_UTILS_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -13,11 +14,14 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <mysql.h> #include <mysql.h>
#include <maxscale/server.h> #include <maxscale/server.h>
MXS_BEGIN_DECLS
/** Length-encoded integers */ /** Length-encoded integers */
size_t leint_bytes(uint8_t* ptr); size_t leint_bytes(uint8_t* ptr);
uint64_t leint_value(uint8_t* c); uint64_t leint_value(uint8_t* c);
@ -27,7 +31,8 @@ uint64_t leint_consume(uint8_t ** c);
char* lestr_consume_dup(uint8_t** c); char* lestr_consume_dup(uint8_t** c);
char* lestr_consume(uint8_t** c, size_t *size); char* lestr_consume(uint8_t** c, size_t *size);
MYSQL *mxs_mysql_real_connect(MYSQL *mysql, SERVER *server, const char *user, const char *passwd); MYSQL *mxs_mysql_real_connect(MYSQL *mysql, SERVER *server, const char *user, const char *passwd);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _NOTIFICATION_SERVICE_H #pragma once
#define _NOTIFICATION_SERVICE_H #ifndef _MAXSCALE_NOTIFICATION_H
#define _MAXSCALE_NOTIFICATION_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -27,6 +28,10 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
MXS_BEGIN_DECLS
#define _NOTIFICATION_CONNECT_TIMEOUT 30 #define _NOTIFICATION_CONNECT_TIMEOUT 30
#define _NOTIFICATION_OPERATION_TIMEOUT 30 #define _NOTIFICATION_OPERATION_TIMEOUT 30
#define _NOTIFICATION_SEND_PENDING 0 #define _NOTIFICATION_SEND_PENDING 0
@ -57,4 +62,7 @@ typedef struct
extern char *gw_bin2hex(char *out, const uint8_t *in, unsigned int len); extern char *gw_bin2hex(char *out, const uint8_t *in, unsigned int len);
extern void gw_sha1_str(const uint8_t *in, int in_len, uint8_t *out); extern void gw_sha1_str(const uint8_t *in, int in_len, uint8_t *out);
extern FEEDBACK_CONF * config_get_feedback_data(); extern FEEDBACK_CONF * config_get_feedback_data();
MXS_END_DECLS
#endif #endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MAXSCALE_PCRE2_H #ifndef _MAXSCALE_PCRE2_H
#define _MAXSCALE_PCRE2_H #define _MAXSCALE_PCRE2_H
/* /*
@ -14,12 +15,16 @@
* *
*/ */
#include <maxscale/cdefs.h>
#ifndef PCRE2_CODE_UNIT_WIDTH #ifndef PCRE2_CODE_UNIT_WIDTH
#define PCRE2_CODE_UNIT_WIDTH 8 #define PCRE2_CODE_UNIT_WIDTH 8
#endif #endif
#include <pcre2.h> #include <pcre2.h>
MXS_BEGIN_DECLS
/** /**
* @file pcre2.h - Utility functions for regular expression matching * @file pcre2.h - Utility functions for regular expression matching
* with the bundled PCRE2 library. * with the bundled PCRE2 library.
@ -44,4 +49,6 @@ mxs_pcre2_result_t mxs_pcre2_substitute(pcre2_code *re, const char *subject,
mxs_pcre2_result_t mxs_pcre2_simple_match(const char* pattern, const char* subject, mxs_pcre2_result_t mxs_pcre2_simple_match(const char* pattern, const char* subject,
int options, int* error); int options, int* error);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _PLATFORM_H #pragma once
#define _PLATFORM_H #ifndef _MAXSCALE_PLATFORM_H
#define _MAXSCALE_PLATFORM_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -13,6 +14,10 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
MXS_BEGIN_DECLS
#if !defined(__cplusplus) #if !defined(__cplusplus)
#if __STDC_VERSION__ >= 201112 #if __STDC_VERSION__ >= 201112
@ -48,4 +53,6 @@
#endif // __cplusplus #endif // __cplusplus
MXS_END_DECLS
#endif // _PLATFORM_H #endif // _PLATFORM_H

View File

@ -1,5 +1,6 @@
#ifndef _POLL_H #pragma once
#define _POLL_H #ifndef _MAXSCALE_POLL_H
#define _MAXSCALE_POLL_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -12,11 +13,15 @@
* of this software will be governed by version 2 or later of the General * of this software will be governed by version 2 or later of the General
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
#include <maxscale/gwbitmask.h> #include <maxscale/gwbitmask.h>
#include <maxscale/resultset.h> #include <maxscale/resultset.h>
#include <sys/epoll.h> #include <sys/epoll.h>
MXS_BEGIN_DECLS
/** /**
* @file poll.h The poll related functionality * @file poll.h The poll related functionality
* *
@ -67,4 +72,7 @@ extern void poll_fake_event(DCB *dcb, enum EPOLL_EVENTS ev);
extern void poll_fake_hangup_event(DCB *dcb); extern void poll_fake_hangup_event(DCB *dcb);
extern void poll_fake_write_event(DCB *dcb); extern void poll_fake_write_event(DCB *dcb);
extern void poll_fake_read_event(DCB *dcb); extern void poll_fake_read_event(DCB *dcb);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef QUERY_CLASSIFIER_HG #pragma once
#define QUERY_CLASSIFIER_HG #ifndef _MAXSCALE_QUERY_CLASSIFIER_HG
#define _MAXSCALE_QUERY_CLASSIFIER_HG
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -13,10 +14,11 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/skygw_utils.h> #include <maxscale/skygw_utils.h>
#include <maxscale/buffer.h> #include <maxscale/buffer.h>
EXTERN_C_BLOCK_BEGIN MXS_BEGIN_DECLS
typedef enum typedef enum
{ {
@ -130,6 +132,6 @@ struct query_classifier
#define QUERY_CLASSIFIER_VERSION {1, 0, 0} #define QUERY_CLASSIFIER_VERSION {1, 0, 0}
EXTERN_C_BLOCK_END MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _QUEUEMANAGER_H #pragma once
#define _QUEUEMANAGER_H #ifndef _MAXSCALE_QUEUEMANAGER_H
#define _MAXSCALE_QUEUEMANAGER_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -26,9 +27,12 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <stdbool.h> #include <stdbool.h>
#include <maxscale/spinlock.h> #include <maxscale/spinlock.h>
MXS_BEGIN_DECLS
#define CONNECTION_QUEUE_LIMIT 1000 #define CONNECTION_QUEUE_LIMIT 1000
typedef struct queue_entry typedef struct queue_entry
@ -67,4 +71,6 @@ mxs_queue_count(QUEUE_CONFIG *queue_config)
return count < 0 ? (count + queue_config->queue_limit + 1): count; return count < 0 ? (count + queue_config->queue_limit + 1): count;
} }
MXS_END_DECLS
#endif /* QUEUEMANAGER_H */ #endif /* QUEUEMANAGER_H */

View File

@ -1,5 +1,6 @@
#ifndef RANDOM_JKISS_H #pragma once
#define RANDOM_JKISS_H #ifndef _MAXSCALE_RANDOM_JKISS_H
#define _MAXSCALE_RANDOM_JKISS_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -20,14 +21,12 @@
* Created on 26 August 2015, 15:34 * Created on 26 August 2015, 15:34
*/ */
#ifdef __cplusplus #include <maxscale/cdefs.h>
extern "C" {
#endif MXS_BEGIN_DECLS
extern unsigned int random_jkiss(void); extern unsigned int random_jkiss(void);
#ifdef __cplusplus MXS_END_DECLS
}
#endif
#endif /* RANDOM_H */ #endif /* RANDOM_H */

View File

@ -1,5 +1,6 @@
#ifndef _RDTSC_H #pragma once
#define _RDTSC_H #ifndef _MAXSCALE_RDTSC_H
#define _MAXSCALE_RDTSC_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -31,6 +32,10 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
MXS_BEGIN_DECLS
typedef unsigned long long CYCLES; typedef unsigned long long CYCLES;
/** /**
@ -53,4 +58,7 @@ static __inline__ CYCLES rdtsc(void)
__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)); __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
return x; return x;
} }
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _RESULTSET_H #pragma once
#define _RESULTSET_H #ifndef _MAXSCALE_RESULTSET_H
#define _MAXSCALE_RESULTSET_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -24,8 +25,11 @@
* *
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
MXS_BEGIN_DECLS
/** /**
* Column types * Column types
@ -85,4 +89,6 @@ extern int resultset_row_set(RESULT_ROW *, int, const char *);
extern void resultset_stream_mysql(RESULTSET *, DCB *); extern void resultset_stream_mysql(RESULTSET *, DCB *);
extern void resultset_stream_json(RESULTSET *, DCB *); extern void resultset_stream_json(RESULTSET *, DCB *);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _ROUTER_H #pragma once
#define _ROUTER_H #ifndef _MAXSCALE_ROUTER_H
#define _MAXSCALE_ROUTER_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -27,11 +28,15 @@
* 27/10/2015 Martin Brampton Add RCAP_TYPE_NO_RSESSION * 27/10/2015 Martin Brampton Add RCAP_TYPE_NO_RSESSION
* *
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/service.h> #include <maxscale/service.h>
#include <maxscale/session.h> #include <maxscale/session.h>
#include <maxscale/buffer.h> #include <maxscale/buffer.h>
#include <stdint.h> #include <stdint.h>
MXS_BEGIN_DECLS
/** /**
* The ROUTER handle points to module specific data, so the best we can do * The ROUTER handle points to module specific data, so the best we can do
* is to make it a void * externally. * is to make it a void * externally.
@ -100,6 +105,6 @@ typedef enum router_capability_t
users when the service is started */ users when the service is started */
} router_capability_t; } router_capability_t;
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _SECRETS_H #pragma once
#define _SECRETS_H #ifndef _MAXSCALE_SECRETS_H
#define _MAXSCALE_SECRETS_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -25,6 +26,7 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -32,9 +34,10 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <openssl/aes.h> #include <openssl/aes.h>
MXS_BEGIN_DECLS
#define MAXSCALE_KEYLEN 32 #define MAXSCALE_KEYLEN 32
#define MAXSCALE_IV_LEN 16 #define MAXSCALE_IV_LEN 16
@ -56,4 +59,6 @@ extern int secrets_writeKeys(const char *directory);
extern char *decryptPassword(const char *); extern char *decryptPassword(const char *);
extern char *encryptPassword(const char*, const char *); extern char *encryptPassword(const char*, const char *);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _SERVER_H #pragma once
#define _SERVER_H #ifndef _MAXSCALE_SERVER_H
#define _MAXSCALE_SERVER_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -12,6 +13,8 @@
* of this software will be governed by version 2 or later of the General * of this software will be governed by version 2 or later of the General
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
#include <maxscale/resultset.h> #include <maxscale/resultset.h>
@ -44,6 +47,8 @@
* @endverbatim * @endverbatim
*/ */
MXS_BEGIN_DECLS
#define MAX_SERVER_NAME_LEN 1024 #define MAX_SERVER_NAME_LEN 1024
#define MAX_NUM_SLAVES 128 /**< Maximum number of slaves under a single server*/ #define MAX_NUM_SLAVES 128 /**< Maximum number of slaves under a single server*/
@ -222,4 +227,6 @@ extern RESULTSET *serverGetList();
extern unsigned int server_map_status(char *str); extern unsigned int server_map_status(char *str);
extern bool server_set_version_string(SERVER* server, const char* string); extern bool server_set_version_string(SERVER* server, const char* string);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _SERVICE_H #pragma once
#define _SERVICE_H #ifndef _MAXSCALE_SERVICE_H
#define _MAXSCALE_SERVICE_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -13,6 +14,7 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <time.h> #include <time.h>
#include <maxscale/gw_protocol.h> #include <maxscale/gw_protocol.h>
#include <maxscale/spinlock.h> #include <maxscale/spinlock.h>
@ -53,6 +55,9 @@
* *
* @endverbatim * @endverbatim
*/ */
MXS_BEGIN_DECLS
struct server; struct server;
struct router; struct router;
struct router_object; struct router_object;
@ -222,4 +227,6 @@ extern RESULTSET *serviceGetList();
extern RESULTSET *serviceGetListenerList(); extern RESULTSET *serviceGetListenerList();
extern bool service_all_services_have_listeners(); extern bool service_all_services_have_listeners();
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _SESSION_H #pragma once
#define _SESSION_H #ifndef _MAXSCALE_SESSION_H
#define _MAXSCALE_SESSION_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -33,6 +34,8 @@
* *
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <time.h> #include <time.h>
#include <maxscale/atomic.h> #include <maxscale/atomic.h>
#include <maxscale/buffer.h> #include <maxscale/buffer.h>
@ -42,6 +45,8 @@
#include <maxscale/skygw_utils.h> #include <maxscale/skygw_utils.h>
#include <maxscale/log_manager.h> #include <maxscale/log_manager.h>
MXS_BEGIN_DECLS
struct dcb; struct dcb;
struct service; struct service;
struct filter_def; struct filter_def;
@ -201,4 +206,7 @@ void session_disable_log_priority(SESSION* ses, int priority);
RESULTSET *sessionGetList(SESSIONLISTFILTER); RESULTSET *sessionGetList(SESSIONLISTFILTER);
void process_idle_sessions(); void process_idle_sessions();
void enable_session_timeouts(); void enable_session_timeouts();
MXS_END_DECLS
#endif #endif

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _MAXSCALE_SKYGW_DEBUG_H
#define _MAXSCALE_SKYGW_DEBUG_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -11,6 +14,7 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
@ -21,19 +25,7 @@
#include <unistd.h> #include <unistd.h>
#include <stdbool.h> #include <stdbool.h>
#if !defined(SKYGW_DEBUG_H) MXS_BEGIN_DECLS
#define SKYGW_DEBUG_H
#ifdef __cplusplus
#define EXTERN_C_BLOCK_BEGIN extern "C" {
#define EXTERN_C_BLOCK_END }
#define EXTERN_C_FUNC extern "C"
#else
#define EXTERN_C_BLOCK_BEGIN
#define EXTERN_C_BLOCK_END
#define EXTERN_C_FUNC
#endif
#if defined(SS_DEBUG) #if defined(SS_DEBUG)
# define SS_PROF # define SS_PROF
@ -578,4 +570,6 @@ typedef enum skygw_chk_t
static bool conn_open[10240]; static bool conn_open[10240];
#endif /* FAKE_CODE */ #endif /* FAKE_CODE */
MXS_END_DECLS
#endif /* SKYGW_DEBUG_H */ #endif /* SKYGW_DEBUG_H */

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _MAXSCALE_SKYGW_TYPES_H
#define _MAXSCALE_SKYGW_TYPES_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -11,13 +14,13 @@
* Public License. * Public License.
*/ */
#if !defined(SKYGW_TYPES_H) #include <maxscale/cdefs.h>
#define SKYGW_TYPES_H
#include <math.h> #include <math.h>
#include <stdbool.h> #include <stdbool.h>
#include <ctype.h> #include <ctype.h>
MXS_BEGIN_DECLS
#define SECOND_USEC (1024*1024L) #define SECOND_USEC (1024*1024L)
#define MSEC_USEC (1024L) #define MSEC_USEC (1024L)
@ -44,4 +47,6 @@
#define MAX_ERROR_MSG PATH_MAX #define MAX_ERROR_MSG PATH_MAX
#define array_nelems(a) ((uint)(sizeof(a)/sizeof(a[0]))) #define array_nelems(a) ((uint)(sizeof(a)/sizeof(a[0])))
MXS_END_DECLS
#endif /* SKYGW_TYPES_H */ #endif /* SKYGW_TYPES_H */

View File

@ -1,5 +1,6 @@
#ifndef _SKYGW_UTILS_H #pragma once
#define _SKYGW_UTILS_H #ifndef _MAXSCALE_SKYGW_UTILS_H
#define _MAXSCALE_SKYGW_UTILS_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -13,6 +14,10 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
MXS_BEGIN_DECLS
/* /*
* We need a common.h file that is included by every component. * We need a common.h file that is included by every component.
*/ */
@ -105,13 +110,9 @@ struct skygw_file_st
skygw_chk_t sf_chk_tail; skygw_chk_t sf_chk_tail;
}; };
EXTERN_C_BLOCK_BEGIN
bool utils_init(); /*< Call this first before using any other function */ bool utils_init(); /*< Call this first before using any other function */
void utils_end(); void utils_end();
EXTERN_C_BLOCK_END
/** Skygw thread routines */ /** Skygw thread routines */
skygw_thread_t* skygw_thread_init(const char* name, skygw_thread_t* skygw_thread_init(const char* name,
void* (*sth_thrfun)(void* data), void* (*sth_thrfun)(void* data),
@ -126,8 +127,6 @@ size_t get_timestamp_len_hp(void);
size_t snprint_timestamp(char* p_ts, size_t tslen); size_t snprint_timestamp(char* p_ts, size_t tslen);
size_t snprint_timestamp_hp(char* p_ts, size_t tslen); size_t snprint_timestamp_hp(char* p_ts, size_t tslen);
EXTERN_C_BLOCK_BEGIN
void skygw_thread_set_state(skygw_thread_t* thr, void skygw_thread_set_state(skygw_thread_t* thr,
skygw_thr_state_t state); skygw_thr_state_t state);
void* skygw_thread_get_data(skygw_thread_t* thr); void* skygw_thread_get_data(skygw_thread_t* thr);
@ -136,8 +135,6 @@ bool skygw_thread_set_exitflag(skygw_thread_t* thr,
skygw_message_t* sendmes, skygw_message_t* sendmes,
skygw_message_t* recmes); skygw_message_t* recmes);
EXTERN_C_BLOCK_END
/** Skygw thread routines */ /** Skygw thread routines */
/** Skygw file routines */ /** Skygw file routines */
@ -159,8 +156,6 @@ int skygw_file_write(skygw_file_t* file,
bool flush); bool flush);
/** Skygw file routines */ /** Skygw file routines */
EXTERN_C_BLOCK_BEGIN
void acquire_lock(int* l); void acquire_lock(int* l);
void release_lock(int* l); void release_lock(int* l);
@ -179,15 +174,11 @@ void skygw_message_reset(skygw_message_t* mes);
/** Skygw message routines */ /** Skygw message routines */
EXTERN_C_BLOCK_END
int skygw_rwlock_wrlock(skygw_rwlock_t* rwlock); int skygw_rwlock_wrlock(skygw_rwlock_t* rwlock);
int skygw_rwlock_rdlock(skygw_rwlock_t* rwlock); int skygw_rwlock_rdlock(skygw_rwlock_t* rwlock);
int skygw_rwlock_unlock(skygw_rwlock_t* rwlock); int skygw_rwlock_unlock(skygw_rwlock_t* rwlock);
int skygw_rwlock_init(skygw_rwlock_t** rwlock); int skygw_rwlock_init(skygw_rwlock_t** rwlock);
EXTERN_C_BLOCK_BEGIN
size_t get_decimal_len(size_t s); size_t get_decimal_len(size_t s);
char* remove_mysql_comments(const char** src, const size_t* srcsize, char** dest, char* remove_mysql_comments(const char** src, const size_t* srcsize, char** dest,
@ -203,6 +194,6 @@ bool strip_escape_chars(char*);
char* trim(char *str); char* trim(char *str);
char* squeeze_whitespace(char* str); char* squeeze_whitespace(char* str);
EXTERN_C_BLOCK_END MXS_END_DECLS
#endif /* SKYGW_UTILS_H */ #endif /* SKYGW_UTILS_H */

View File

@ -1,5 +1,6 @@
#ifndef _SLIST_H #pragma once
#define _SLIST_H #ifndef _MAXSCALE_SLIST_H
#define _MAXSCALE_SLIST_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -13,9 +14,10 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/skygw_utils.h> #include <maxscale/skygw_utils.h>
EXTERN_C_BLOCK_BEGIN MXS_BEGIN_DECLS
typedef struct slist_node_st slist_node_t; typedef struct slist_node_st slist_node_t;
typedef struct slist_st slist_t; typedef struct slist_st slist_t;
@ -61,6 +63,6 @@ void slcursor_remove_data(slist_cursor_t* c);
bool slcursor_move_to_begin(slist_cursor_t* c); bool slcursor_move_to_begin(slist_cursor_t* c);
bool slcursor_step_ahead(slist_cursor_t* c); bool slcursor_step_ahead(slist_cursor_t* c);
EXTERN_C_BLOCK_END MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _SPINLOCK_H #pragma once
#define _SPINLOCK_H #ifndef _MAXSCALE_SPINLOCK_H
#define _MAXSCALE_SPINLOCK_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -23,9 +24,11 @@
* for the lock to be released. However they are useful in that they do not involve * for the lock to be released. However they are useful in that they do not involve
* system calls and are light weight when the expected wait time for a lock is low. * system calls and are light weight when the expected wait time for a lock is low.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/skygw_debug.h> #include <maxscale/skygw_debug.h>
EXTERN_C_BLOCK_BEGIN MXS_BEGIN_DECLS
#define SPINLOCK_PROFILE 0 #define SPINLOCK_PROFILE 0
@ -74,6 +77,6 @@ extern int spinlock_acquire_nowait(const SPINLOCK *lock);
extern void spinlock_release(const SPINLOCK *lock); extern void spinlock_release(const SPINLOCK *lock);
extern void spinlock_stats(const SPINLOCK *lock, void (*reporter)(void *, char *, int), void *hdl); extern void spinlock_stats(const SPINLOCK *lock, void (*reporter)(void *, char *, int), void *hdl);
EXTERN_C_BLOCK_END MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _STATISTICS_HG #pragma once
#define _STATISTICS_HG #ifndef _MAXSCALE_STATISTICS_HG
#define _MAXSCALE_STATISTICS_HG
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -25,8 +26,11 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <stdint.h> #include <stdint.h>
MXS_BEGIN_DECLS
typedef void* ts_stats_t; typedef void* ts_stats_t;
/** stats_init should be called only once */ /** stats_init should be called only once */
@ -68,4 +72,6 @@ ts_stats_set(ts_stats_t stats, int value, int thread_id)
((int64_t*)stats)[thread_id] = value; ((int64_t*)stats)[thread_id] = value;
} }
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _THREAD_H #pragma once
#define _THREAD_H #ifndef _MAXSCALE_THREAD_H
#define _MAXSCALE_THREAD_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -22,6 +23,10 @@
* of changes. * of changes.
*/ */
#include <maxscale/cdefs.h>
MXS_BEGIN_DECLS
/** /**
* Thread type and thread identifier function macros * Thread type and thread identifier function macros
*/ */
@ -33,4 +38,6 @@ extern THREAD *thread_start(THREAD *thd, void (*entry)(void *), void *arg);
extern void thread_wait(THREAD thd); extern void thread_wait(THREAD thd);
extern void thread_millisleep(int ms); extern void thread_millisleep(int ms);
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _USERS_H #pragma once
#define _USERS_H #ifndef _MAXSCALE_USERS_H
#define _MAXSCALE_USERS_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -12,11 +13,15 @@
* of this software will be governed by version 2 or later of the General * of this software will be governed by version 2 or later of the General
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/hashtable.h> #include <maxscale/hashtable.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
#include <maxscale/listener.h> #include <maxscale/listener.h>
#include <openssl/sha.h> #include <openssl/sha.h>
MXS_BEGIN_DECLS
/** /**
* @file users.h The functions to manipulate the table of users maintained * @file users.h The functions to manipulate the table of users maintained
* for each service * for each service
@ -70,4 +75,6 @@ extern int users_default_loadusers(SERV_LISTENER *port); /**< A generic implemen
extern void usersPrint(USERS *); /**< Print data about the users loaded */ extern void usersPrint(USERS *); /**< Print data about the users loaded */
extern void dcb_usersPrint(DCB *, USERS *); /**< Print data about the users loaded */ extern void dcb_usersPrint(DCB *, USERS *); /**< Print data about the users loaded */
MXS_END_DECLS
#endif #endif

View File

@ -1,5 +1,6 @@
#ifndef _UTILS_H #pragma once
#define _UTILS_H #ifndef _MAXSCALE_UTILS_H
#define _MAXSCALE_UTILS_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -25,6 +26,10 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
MXS_BEGIN_DECLS
int setnonblocking(int fd); int setnonblocking(int fd);
char *gw_strend(register const char *s); char *gw_strend(register const char *s);
static char gw_randomchar(); static char gw_randomchar();
@ -37,4 +42,6 @@ void gw_sha1_2_str(const uint8_t *in, int in_len, const uint8_t *in2, int in2_le
int gw_getsockerrno(int fd); int gw_getsockerrno(int fd);
char *create_hex_sha1_sha1_passwd(char *passwd); char *create_hex_sha1_sha1_passwd(char *passwd);
MXS_END_DECLS
#endif #endif

View File

@ -1,6 +1,6 @@
#pragma once
#ifndef TEST_UTILS_H #ifndef TEST_UTILS_H
#define TEST_UTILS_H #define TEST_UTILS_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -14,6 +14,7 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/poll.h> #include <maxscale/poll.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
#include <maxscale/housekeeper.h> #include <maxscale/housekeeper.h>

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MAXSCALE_FILTER_CACHE_RULES_H #ifndef _MAXSCALE_FILTER_CACHE_RULES_H
#define _MAXSCALE_FILTER_CACHE_RULES_H #define _MAXSCALE_FILTER_CACHE_RULES_H
/* /*
@ -13,12 +14,14 @@
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <stdbool.h> #include <stdbool.h>
#include <jansson.h> #include <jansson.h>
#include <maxscale/buffer.h> #include <maxscale/buffer.h>
#include <maxscale/session.h> #include <maxscale/session.h>
#include <maxscale/pcre2.h> #include <maxscale/pcre2.h>
MXS_BEGIN_DECLS
typedef enum cache_rule_attribute 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_store(CACHE_RULES *rules, const char *default_db, const GWBUF* query);
bool cache_rules_should_use(CACHE_RULES *rules, const SESSION *session); bool cache_rules_should_use(CACHE_RULES *rules, const SESSION *session);
MXS_END_DECLS
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _CDC_H
#define _CDC_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -18,6 +21,7 @@
* 11-01-2016 Massimiliano Pinto First Implementation * 11-01-2016 Massimiliano Pinto First Implementation
*/ */
#include <maxscale/cdefs.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -35,6 +39,8 @@
#include <maxscale/atomic.h> #include <maxscale/atomic.h>
#include <maxscale/gw.h> #include <maxscale/gw.h>
MXS_BEGIN_DECLS
#define CDC_SMALL_BUFFER 1024 #define CDC_SMALL_BUFFER 1024
#define CDC_METHOD_MAXLEN 128 #define CDC_METHOD_MAXLEN 128
#define CDC_USER_MAXLEN 128 #define CDC_USER_MAXLEN 128
@ -87,3 +93,7 @@ typedef struct cdc_protocol
/* routines */ /* routines */
extern int gw_hex2bin(uint8_t *out, const char *in, unsigned int len); 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 #ifndef _DEBUGCLI_H
#define _DEBUGCLI_H #define _DEBUGCLI_H
/* /*
@ -13,10 +14,14 @@
* of this software will be governed by version 2 or later of the General * of this software will be governed by version 2 or later of the General
* Public License. * Public License.
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/service.h> #include <maxscale/service.h>
#include <maxscale/session.h> #include <maxscale/session.h>
#include <maxscale/spinlock.h> #include <maxscale/spinlock.h>
MXS_BEGIN_DECLS
/** /**
* @file debugcli.h The debug interface to the gateway * @file debugcli.h The debug interface to the gateway
* *
@ -63,4 +68,7 @@ typedef struct cli_session
/* Command line interface modes */ /* Command line interface modes */
#define CLIM_USER 1 #define CLIM_USER 1
#define CLIM_DEVELOPER 2 #define CLIM_DEVELOPER 2
MXS_END_DECLS
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _HTTPD_H
#define _HTTPD_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -18,6 +21,7 @@
* 08-07-2013 Massimiliano Pinto Added HTTPD protocol header file * 08-07-2013 Massimiliano Pinto Added HTTPD protocol header file
*/ */
#include <maxscale/cdefs.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -35,6 +39,8 @@
#include <maxscale/atomic.h> #include <maxscale/atomic.h>
#include <maxscale/gw.h> #include <maxscale/gw.h>
MXS_BEGIN_DECLS
#define HTTPD_SMALL_BUFFER 1024 #define HTTPD_SMALL_BUFFER 1024
#define HTTPD_METHOD_MAXLEN 128 #define HTTPD_METHOD_MAXLEN 128
#define HTTPD_USER_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 */ 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 */ int headers_received; /*< All the headers has been received, if 1 */
} HTTPD_session; } HTTPD_session;
MXS_END_DECLS
#endif

View File

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

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _MXS_AVRO_H
#define _MXS_AVRO_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -15,8 +18,7 @@
* MaxScale AVRO router * MaxScale AVRO router
* *
*/ */
#ifndef _MXS_AVRO_H #include <maxscale/cdefs.h>
#define _MXS_AVRO_H
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <blr_constants.h> #include <blr_constants.h>
@ -35,6 +37,8 @@
#include <sqlite3.h> #include <sqlite3.h>
#include <maxscale/protocol/mysql.h> #include <maxscale/protocol/mysql.h>
MXS_BEGIN_DECLS
/** SQLite3 version 3.7.14 introduced the new v2 close interface */ /** SQLite3 version 3.7.14 introduced the new v2 close interface */
#if SQLITE_VERSION_NUMBER < 3007014 #if SQLITE_VERSION_NUMBER < 3007014
#define sqlite3_close_v2 sqlite3_close #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_CS_BUSY 0x0001
#define AVRO_WAIT_DATA 0x0002 #define AVRO_WAIT_DATA 0x0002
MXS_END_DECLS
#endif #endif

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _RWSPLITROUTER_H #ifndef _RWSPLITROUTER_H
#define _RWSPLITROUTER_H #define _RWSPLITROUTER_H
/* /*
@ -24,10 +25,13 @@
* @endverbatim * @endverbatim
*/ */
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
#include <maxscale/hashtable.h> #include <maxscale/hashtable.h>
#include <math.h> #include <math.h>
MXS_BEGIN_DECLS
#undef PREP_STMT_CACHING #undef PREP_STMT_CACHING
#if defined(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 : \ #define BACKEND_TYPE(b) (SERVER_IS_MASTER((b)->backend_server) ? BE_MASTER : \
(SERVER_IS_SLAVE((b)->backend_server) ? BE_SLAVE : BE_UNDEFINED)); (SERVER_IS_SLAVE((b)->backend_server) ? BE_SLAVE : BE_UNDEFINED));
MXS_END_DECLS
#endif /*< _RWSPLITROUTER_H */ #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 * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -18,15 +21,11 @@
* Created on 08 August 2016, 11:54 * Created on 08 August 2016, 11:54
*/ */
#ifndef RWSPLIT_INTERNAL_H #include <maxscale/cdefs.h>
#define RWSPLIT_INTERNAL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <maxscale/query_classifier.h> #include <maxscale/query_classifier.h>
MXS_BEGIN_DECLS
/* This needs to be removed along with dependency on it - see the /* This needs to be removed along with dependency on it - see the
* rwsplit_tmp_table_multi functions * rwsplit_tmp_table_multi functions
*/ */
@ -145,5 +144,7 @@ qc_query_type_t determine_query_type(GWBUF *querybuf, int packet_type, bool non_
} }
#endif #endif
MXS_END_DECLS
#endif /* RWSPLIT_INTERNAL_H */ #endif /* RWSPLIT_INTERNAL_H */

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _SCHEMAROUTER_H #ifndef _SCHEMAROUTER_H
#define _SCHEMAROUTER_H #define _SCHEMAROUTER_H
/* /*
@ -23,14 +24,15 @@
* *
* @endverbatim * @endverbatim
*/ */
#ifndef PCRE2_CODE_UNIT_WIDTH
#define PCRE2_CODE_UNIT_WIDTH 8
#endif
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
#include <maxscale/hashtable.h> #include <maxscale/hashtable.h>
#include <maxscale/protocol/mysql.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 * Bitmask values for the router session's initialization. These values are used
* to prevent responses from internal commands being forwarded to the client. * 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 : \ #define BACKEND_TYPE(b) (SERVER_IS_MASTER((b)->backend_server) ? BE_MASTER : \
(SERVER_IS_SLAVE((b)->backend_server) ? BE_SLAVE : BE_UNDEFINED)); (SERVER_IS_SLAVE((b)->backend_server) ? BE_SLAVE : BE_UNDEFINED));
MXS_END_DECLS
#endif /*< _SCHEMAROUTER_H */ #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 * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -11,9 +14,7 @@
* Public License. * Public License.
*/ */
#ifndef _SHARDING_COMMON_HG #include <maxscale/cdefs.h>
#define _SHARDING_COMMON_HG
#include <my_config.h> #include <my_config.h>
#include <poll.h> #include <poll.h>
#include <maxscale/buffer.h> #include <maxscale/buffer.h>
@ -23,8 +24,12 @@
#include <maxscale/log_manager.h> #include <maxscale/log_manager.h>
#include <maxscale/query_classifier.h> #include <maxscale/query_classifier.h>
MXS_BEGIN_DECLS
bool extract_database(GWBUF* buf, char* str); bool extract_database(GWBUF* buf, char* str);
void create_error_reply(char* fail_str, DCB* dcb); void create_error_reply(char* fail_str, DCB* dcb);
bool change_current_db(char* dest, HASHTABLE* dbhash, GWBUF* buf); bool change_current_db(char* dest, HASHTABLE* dbhash, GWBUF* buf);
MXS_END_DECLS
#endif #endif