MXS-2205 Combine internal/session.h with internal/session.hh

This commit is contained in:
Esa Korhonen 2018-11-30 18:47:43 +02:00
parent 36792607d8
commit cdf323384c
8 changed files with 72 additions and 91 deletions

View File

@ -12,7 +12,9 @@
*/
#pragma once
#include <maxscale/ccdefs.hh>
#include <maxscale/utils.hh>
#include <maxscale/session.h>
namespace maxscale
{

View File

@ -53,7 +53,7 @@
#include <maxscale/routingworker.hh>
#include "internal/modules.hh"
#include "internal/session.h"
#include "internal/session.hh"
using maxscale::RoutingWorker;
using maxbase::Worker;

View File

@ -27,7 +27,7 @@
#include "monitor.hh"
#include "service.hh"
#include "filter.hh"
#include "session.h"
#include "session.hh"
typedef HttpResponse (* ResourceCallback)(const HttpRequest& request);

View File

@ -1,84 +0,0 @@
/*
* Copyright (c) 2018 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
*
* Change Date: 2022-01-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
#pragma once
/**
* @file core/maxscale/session.h - The private session interface
*/
#include <maxscale/session.h>
MXS_BEGIN_DECLS
#define SESSION_STATS_INIT {0}
#define MXS_DOWNSTREAM_INIT {0}
#define MXS_UPSTREAM_INIT {0}
#define SESSION_FILTER_INIT {0}
#define SESSION_INIT \
{.ses_chk_top = CHK_NUM_SESSION, \
.stats = SESSION_STATS_INIT, .head = MXS_DOWNSTREAM_INIT, .tail = MXS_UPSTREAM_INIT, \
.state = SESSION_STATE_ALLOC, .client_protocol_data = 0, .ses_chk_tail = CHK_NUM_SESSION}
#define SESSION_PROTOCOL(x, type) DCB_PROTOCOL((x)->client_dcb, type)
/**
* Filter type for the sessionGetList call
*/
typedef enum
{
SESSION_LIST_ALL,
SESSION_LIST_CONNECTION
} SESSIONLISTFILTER;
int session_isvalid(MXS_SESSION*);
const char* session_state(mxs_session_state_t);
/**
* Link a session to a backend DCB.
*
* @param session The session to link with the dcb
* @param dcb The backend DCB to be linked
*/
void session_link_backend_dcb(MXS_SESSION* session, struct dcb* dcb);
/**
* Unlink a session to a backend DCB.
*
* @param session The session to unlink with the dcb
* @param dcb The backend DCB to be unlinked
*/
void session_unlink_backend_dcb(MXS_SESSION* session, struct dcb* dcb);
void printAllSessions();
void printSession(MXS_SESSION*);
void dprintSessionList(DCB* pdcb);
void dprintAllSessions(struct dcb*);
void dprintSession(struct dcb*, MXS_SESSION*);
void dListSessions(struct dcb*);
/**
* @brief Get a session reference
*
* This creates an additional reference to a session which allows it to live
* as long as it is needed.
*
* @param session Session reference to get
* @return Reference to a MXS_SESSION
*
* @note The caller must free the session reference by calling session_put_ref
*/
MXS_SESSION* session_get_ref(MXS_SESSION* sessoin);
MXS_END_DECLS

View File

@ -21,13 +21,77 @@
#include <vector>
#include <maxscale/buffer.hh>
#include <maxscale/session.h>
#include <maxscale/session.hh>
#include <maxscale/resultset.hh>
#include <maxscale/utils.hh>
#include "filter.hh"
#include "service.hh"
#include "session.h"
#define SESSION_STATS_INIT {0}
#define MXS_DOWNSTREAM_INIT {0}
#define MXS_UPSTREAM_INIT {0}
#define SESSION_FILTER_INIT {0}
#define SESSION_INIT \
{.ses_chk_top = CHK_NUM_SESSION, \
.stats = SESSION_STATS_INIT, .head = MXS_DOWNSTREAM_INIT, .tail = MXS_UPSTREAM_INIT, \
.state = SESSION_STATE_ALLOC, .client_protocol_data = 0, .ses_chk_tail = CHK_NUM_SESSION}
#define SESSION_PROTOCOL(x, type) DCB_PROTOCOL((x)->client_dcb, type)
MXS_BEGIN_DECLS
/**
* Filter type for the sessionGetList call
*/
typedef enum
{
SESSION_LIST_ALL,
SESSION_LIST_CONNECTION
} SESSIONLISTFILTER;
int session_isvalid(MXS_SESSION*);
const char* session_state(mxs_session_state_t);
/**
* Link a session to a backend DCB.
*
* @param session The session to link with the dcb
* @param dcb The backend DCB to be linked
*/
void session_link_backend_dcb(MXS_SESSION* session, struct dcb* dcb);
/**
* Unlink a session to a backend DCB.
*
* @param session The session to unlink with the dcb
* @param dcb The backend DCB to be unlinked
*/
void session_unlink_backend_dcb(MXS_SESSION* session, struct dcb* dcb);
void printAllSessions();
void printSession(MXS_SESSION*);
void dprintSessionList(DCB* pdcb);
void dprintAllSessions(struct dcb*);
void dprintSession(struct dcb*, MXS_SESSION*);
void dListSessions(struct dcb*);
/**
* @brief Get a session reference
*
* This creates an additional reference to a session which allows it to live
* as long as it is needed.
*
* @param session Session reference to get
* @return Reference to a MXS_SESSION
*
* @note The caller must free the session reference by calling session_put_ref
*/
MXS_SESSION* session_get_ref(MXS_SESSION* sessoin);
MXS_END_DECLS
namespace maxscale
{

View File

@ -34,7 +34,7 @@
#include "internal/monitor.hh"
#include "internal/query_classifier.hh"
#include "internal/service.hh"
#include "internal/session.h"
#include "internal/session.hh"
using std::list;
using std::map;

View File

@ -62,7 +62,7 @@
#include "../../../core/internal/modules.hh"
#include "../../../core/internal/monitor.hh"
#include "../../../core/internal/poll.hh"
#include "../../../core/internal/session.h"
#include "../../../core/internal/session.hh"
#include "../../../core/internal/filter.hh"
#define MAXARGS 14

View File

@ -53,7 +53,6 @@
#include "../../../core/internal/modules.hh"
#include "../../../core/internal/monitor.hh"
#include "../../../core/internal/session.h"
#include "../../../core/internal/session.hh"
#include "../../../core/internal/poll.hh"