1 /***************************************************************************
2 * Copyright (C) 2005-2018 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
33 # include <QSslSocket>
34 # include "sslserver.h"
36 # include <QTcpSocket>
37 # include <QTcpServer>
40 #include "authenticator.h"
41 #include "bufferinfo.h"
42 #include "deferredptr.h"
43 #include "identserver.h"
45 #include "oidentdconfiggenerator.h"
46 #include "sessionthread.h"
47 #include "singleton.h"
51 class CoreAuthHandler;
59 class AbstractSqlMigrationReader;
60 class AbstractSqlMigrationWriter;
62 class Core : public QObject, public Singleton<Core>
73 * Shuts down active core sessions, saves state and emits the shutdownComplete() signal afterwards.
78 /*** Storage access ***/
79 // These methods are threadsafe.
83 * \param userName The user's login name
84 * \param password The user's uncrypted password
85 * \return The user's ID if valid; 0 otherwise
87 static inline UserId validateUser(const QString &userName, const QString &password) {
88 return instance()->_storage->validateUser(userName, password);
91 //! Authenticate user against auth backend
93 * \param userName The user's login name
94 * \param password The user's uncrypted password
95 * \return The user's ID if valid; 0 otherwise
97 static inline UserId authenticateUser(const QString &userName, const QString &password) {
98 return instance()->_authenticator->validateUser(userName, password);
101 //! Add a new user, exposed so auth providers can call this without being the storage.
103 * \param userName The user's login name
104 * \param password The user's uncrypted password
105 * \param authenticator The name of the auth provider service used to log the user in, defaults to "Database".
106 * \return The user's ID if valid; 0 otherwise
108 static inline UserId addUser(const QString &userName, const QString &password, const QString &authenticator = "Database") {
109 return instance()->_storage->addUser(userName, password, authenticator);
112 //! Does a comparison test against the authenticator in the database and the authenticator currently in use for a UserID.
114 * \param userid The user's ID (note: not login name).
115 * \param authenticator The name of the auth provider service used to log the user in, defaults to "Database".
116 * \return True if the userid was configured with the passed authenticator, false otherwise.
118 static inline bool checkAuthProvider(const UserId userid, const QString &authenticator) {
119 return instance()->_storage->getUserAuthenticator(userid) == authenticator;
122 //! Change a user's password
124 * \param userId The user's ID
125 * \param password The user's unencrypted new password
126 * \return true, if the password change was successful
128 static bool changeUserPassword(UserId userId, const QString &password);
130 //! Check if we can change a user password.
132 * \param userID The user's ID
133 * \return true, if we can change their password, false otherwise
135 static bool canChangeUserPassword(UserId userId);
137 //! Store a user setting persistently
139 * \param userId The users Id
140 * \param settingName The Name of the Setting
141 * \param data The Value
143 static inline void setUserSetting(UserId userId, const QString &settingName, const QVariant &data)
145 instance()->_storage->setUserSetting(userId, settingName, data);
149 //! Retrieve a persistent user setting
151 * \param userId The users Id
152 * \param settingName The Name of the Setting
153 * \param defaultValue Value to return in case it's unset.
154 * \return the Value of the Setting or the default value if it is unset.
156 static inline QVariant getUserSetting(UserId userId, const QString &settingName, const QVariant &defaultValue = QVariant())
158 return instance()->_storage->getUserSetting(userId, settingName, defaultValue);
162 /* Identity handling */
163 static inline IdentityId createIdentity(UserId user, CoreIdentity &identity)
165 return instance()->_storage->createIdentity(user, identity);
169 static bool updateIdentity(UserId user, const CoreIdentity &identity)
171 return instance()->_storage->updateIdentity(user, identity);
175 static void removeIdentity(UserId user, IdentityId identityId)
177 instance()->_storage->removeIdentity(user, identityId);
181 static QList<CoreIdentity> identities(UserId user)
183 return instance()->_storage->identities(user);
187 //! Create a Network in the Storage and store it's Id in the given NetworkInfo
188 /** \note This method is thredsafe.
190 * \param user The core user
191 * \param networkInfo a NetworkInfo definition to store the newly created ID in
192 * \return true if successfull.
194 static bool createNetwork(UserId user, NetworkInfo &info);
196 //! Apply the changes to NetworkInfo info to the storage engine
197 /** \note This method is thredsafe.
199 * \param user The core user
200 * \param networkInfo The Updated NetworkInfo
201 * \return true if successfull.
203 static inline bool updateNetwork(UserId user, const NetworkInfo &info)
205 return instance()->_storage->updateNetwork(user, info);
209 //! Permanently remove a Network and all the data associated with it.
210 /** \note This method is thredsafe.
212 * \param user The core user
213 * \param networkId The network to delete
214 * \return true if successfull.
216 static inline bool removeNetwork(UserId user, const NetworkId &networkId)
218 return instance()->_storage->removeNetwork(user, networkId);
222 //! Returns a list of all NetworkInfos for the given UserId user
223 /** \note This method is thredsafe.
225 * \param user The core user
226 * \return QList<NetworkInfo>.
228 static inline QList<NetworkInfo> networks(UserId user)
230 return instance()->_storage->networks(user);
234 //! Get a list of Networks to restore
235 /** Return a list of networks the user was connected at the time of core shutdown
236 * \note This method is threadsafe.
238 * \param user The User Id in question
240 static inline QList<NetworkId> connectedNetworks(UserId user)
242 return instance()->_storage->connectedNetworks(user);
246 //! Update the connected state of a network
247 /** \note This method is threadsafe
249 * \param user The Id of the networks owner
250 * \param networkId The Id of the network
251 * \param isConnected whether the network is connected or not
253 static inline void setNetworkConnected(UserId user, const NetworkId &networkId, bool isConnected)
255 return instance()->_storage->setNetworkConnected(user, networkId, isConnected);
259 //! Get a hash of channels with their channel keys for a given network
260 /** The keys are channel names and values are passwords (possibly empty)
261 * \note This method is threadsafe
263 * \param user The id of the networks owner
264 * \param networkId The Id of the network
266 static inline QHash<QString, QString> persistentChannels(UserId user, const NetworkId &networkId)
268 return instance()->_storage->persistentChannels(user, networkId);
272 //! Update the connected state of a channel
273 /** \note This method is threadsafe
275 * \param user The Id of the networks owner
276 * \param networkId The Id of the network
277 * \param channel The name of the channel
278 * \param isJoined whether the channel is connected or not
280 static inline void setChannelPersistent(UserId user, const NetworkId &networkId, const QString &channel, bool isJoined)
282 return instance()->_storage->setChannelPersistent(user, networkId, channel, isJoined);
286 //! Get a hash of buffers with their ciphers for a given network
287 /** The keys are channel names and values are ciphers (possibly empty)
288 * \note This method is threadsafe
290 * \param user The id of the networks owner
291 * \param networkId The Id of the network
293 static inline QHash<QString, QByteArray> bufferCiphers(UserId user, const NetworkId &networkId)
295 return instance()->_storage->bufferCiphers(user, networkId);
299 //! Update the cipher of a buffer
300 /** \note This method is threadsafe
302 * \param user The Id of the networks owner
303 * \param networkId The Id of the network
304 * \param bufferName The Cname of the buffer
305 * \param cipher The cipher for the buffer
307 static inline void setBufferCipher(UserId user, const NetworkId &networkId, const QString &bufferName, const QByteArray &cipher)
309 return instance()->_storage->setBufferCipher(user, networkId, bufferName, cipher);
313 //! Update the key of a channel
314 /** \note This method is threadsafe
316 * \param user The Id of the networks owner
317 * \param networkId The Id of the network
318 * \param channel The name of the channel
319 * \param key The key of the channel (possibly empty)
321 static inline void setPersistentChannelKey(UserId user, const NetworkId &networkId, const QString &channel, const QString &key)
323 return instance()->_storage->setPersistentChannelKey(user, networkId, channel, key);
327 //! retrieve last known away message for session restore
328 /** \note This method is threadsafe
330 * \param user The Id of the networks owner
331 * \param networkId The Id of the network
333 static inline QString awayMessage(UserId user, NetworkId networkId)
335 return instance()->_storage->awayMessage(user, networkId);
339 //! Make away message persistent for session restore
340 /** \note This method is threadsafe
342 * \param user The Id of the networks owner
343 * \param networkId The Id of the network
344 * \param awayMsg The current away message of own user
346 static inline void setAwayMessage(UserId user, NetworkId networkId, const QString &awayMsg)
348 return instance()->_storage->setAwayMessage(user, networkId, awayMsg);
352 //! retrieve last known user mode for session restore
353 /** \note This method is threadsafe
355 * \param user The Id of the networks owner
356 * \param networkId The Id of the network
358 static inline QString userModes(UserId user, NetworkId networkId)
360 return instance()->_storage->userModes(user, networkId);
364 //! Make our user modes persistent for session restore
365 /** \note This method is threadsafe
367 * \param user The Id of the networks owner
368 * \param networkId The Id of the network
369 * \param userModes The current user modes of own user
371 static inline void setUserModes(UserId user, NetworkId networkId, const QString &userModes)
373 return instance()->_storage->setUserModes(user, networkId, userModes);
377 //! Get the unique BufferInfo for the given combination of network and buffername for a user.
378 /** \note This method is threadsafe.
380 * \param user The core user who owns this buffername
381 * \param networkId The network id
382 * \param type The type of the buffer (StatusBuffer, Channel, etc.)
383 * \param buffer The buffer name (if empty, the net's status buffer is returned)
384 * \param create Whether or not the buffer should be created if it doesnt exist
385 * \return The BufferInfo corresponding to the given network and buffer name, or 0 if not found
387 static inline BufferInfo bufferInfo(UserId user, const NetworkId &networkId, BufferInfo::Type type, const QString &buffer = "", bool create = true)
389 return instance()->_storage->bufferInfo(user, networkId, type, buffer, create);
393 //! Get the unique BufferInfo for a bufferId
394 /** \note This method is threadsafe
395 * \param user The core user who owns this buffername
396 * \param bufferId The id of the buffer
397 * \return The BufferInfo corresponding to the given buffer id, or an invalid BufferInfo if not found.
399 static inline BufferInfo getBufferInfo(UserId user, const BufferId &bufferId)
401 return instance()->_storage->getBufferInfo(user, bufferId);
405 //! Store a Message in the storage backend and set it's unique Id.
406 /** \note This method is threadsafe.
408 * \param message The message object to be stored
409 * \return true on success
411 static inline bool storeMessage(Message &message)
413 return instance()->_storage->logMessage(message);
417 //! Store a list of Messages in the storage backend and set their unique Id.
418 /** \note This method is threadsafe.
420 * \param messages The list message objects to be stored
421 * \return true on success
423 static inline bool storeMessages(MessageList &messages)
425 return instance()->_storage->logMessages(messages);
429 //! Request a certain number messages stored in a given buffer.
430 /** \param buffer The buffer we request messages from
431 * \param first if != -1 return only messages with a MsgId >= first
432 * \param last if != -1 return only messages with a MsgId < last
433 * \param limit if != -1 limit the returned list to a max of \limit entries
434 * \return The requested list of messages
436 static inline QList<Message> requestMsgs(UserId user, BufferId bufferId, MsgId first = -1, MsgId last = -1, int limit = -1)
438 return instance()->_storage->requestMsgs(user, bufferId, first, last, limit);
442 //! Request a certain number messages stored in a given buffer, matching certain filters
443 /** \param buffer The buffer we request messages from
444 * \param first if != -1 return only messages with a MsgId >= first
445 * \param last if != -1 return only messages with a MsgId < last
446 * \param limit if != -1 limit the returned list to a max of \limit entries
447 * \param type The Message::Types that should be returned
448 * \return The requested list of messages
450 static inline QList<Message> requestMsgsFiltered(UserId user, BufferId bufferId, MsgId first = -1, MsgId last = -1,
451 int limit = -1, Message::Types type = Message::Types{-1},
452 Message::Flags flags = Message::Flags{-1})
454 return instance()->_storage->requestMsgsFiltered(user, bufferId, first, last, limit, type, flags);
458 //! Request a certain number of messages across all buffers
459 /** \param first if != -1 return only messages with a MsgId >= first
460 * \param last if != -1 return only messages with a MsgId < last
461 * \param limit Max amount of messages
462 * \return The requested list of messages
464 static inline QList<Message> requestAllMsgs(UserId user, MsgId first = -1, MsgId last = -1, int limit = -1)
466 return instance()->_storage->requestAllMsgs(user, first, last, limit);
470 //! Request a certain number of messages across all buffers, matching certain filters
471 /** \param first if != -1 return only messages with a MsgId >= first
472 * \param last if != -1 return only messages with a MsgId < last
473 * \param limit Max amount of messages
474 * \param type The Message::Types that should be returned
475 * \return The requested list of messages
477 static inline QList<Message> requestAllMsgsFiltered(UserId user, MsgId first = -1, MsgId last = -1, int limit = -1,
478 Message::Types type = Message::Types{-1},
479 Message::Flags flags = Message::Flags{-1})
481 return instance()->_storage->requestAllMsgsFiltered(user, first, last, limit, type, flags);
485 //! Request a list of all buffers known to a user.
486 /** This method is used to get a list of all buffers we have stored a backlog from.
487 * \note This method is threadsafe.
489 * \param user The user whose buffers we request
490 * \return A list of the BufferInfos for all buffers as requested
492 static inline QList<BufferInfo> requestBuffers(UserId user)
494 return instance()->_storage->requestBuffers(user);
498 //! Request a list of BufferIds for a given NetworkId
499 /** \note This method is threadsafe.
501 * \param user The user whose buffers we request
502 * \param networkId The NetworkId of the network in question
503 * \return List of BufferIds belonging to the Network
505 static inline QList<BufferId> requestBufferIdsForNetwork(UserId user, NetworkId networkId)
507 return instance()->_storage->requestBufferIdsForNetwork(user, networkId);
511 //! Remove permanently a buffer and it's content from the storage backend
512 /** This call cannot be reverted!
513 * \note This method is threadsafe.
515 * \param user The user who is the owner of the buffer
516 * \param bufferId The bufferId
517 * \return true if successfull
519 static inline bool removeBuffer(const UserId &user, const BufferId &bufferId)
521 return instance()->_storage->removeBuffer(user, bufferId);
526 /** \note This method is threadsafe.
527 * \param user The id of the buffer owner
528 * \param bufferId The bufferId
529 * \param newName The new name of the buffer
530 * \return true if successfull
532 static inline bool renameBuffer(const UserId &user, const BufferId &bufferId, const QString &newName)
534 return instance()->_storage->renameBuffer(user, bufferId, newName);
538 //! Merge the content of two Buffers permanently. This cannot be reversed!
539 /** \note This method is threadsafe.
540 * \param user The id of the buffer owner
541 * \param bufferId1 The bufferId of the remaining buffer
542 * \param bufferId2 The buffer that is about to be removed
543 * \return true if successfulln
545 static inline bool mergeBuffersPermanently(const UserId &user, const BufferId &bufferId1, const BufferId &bufferId2)
547 return instance()->_storage->mergeBuffersPermanently(user, bufferId1, bufferId2);
551 //! Update the LastSeenDate for a Buffer
552 /** This Method is used to make the LastSeenDate of a Buffer persistent
553 * \note This method is threadsafe.
555 * \param user The Owner of that Buffer
556 * \param bufferId The buffer id
557 * \param MsgId The Message id of the message that has been just seen
559 static inline void setBufferLastSeenMsg(UserId user, const BufferId &bufferId, const MsgId &msgId)
561 return instance()->_storage->setBufferLastSeenMsg(user, bufferId, msgId);
565 //! Get a usable sysident for the given user in oidentd-strict mode
566 /** \param user The user to retrieve the sysident for
567 * \return The authusername
569 QString strictSysIdent(UserId user) const;
572 //! Get a Hash of all last seen message ids
573 /** This Method is called when the Quassel Core is started to restore the lastSeenMsgIds
574 * \note This method is threadsafe.
576 * \param user The Owner of the buffers
578 static inline QHash<BufferId, MsgId> bufferLastSeenMsgIds(UserId user)
580 return instance()->_storage->bufferLastSeenMsgIds(user);
584 //! Update the MarkerLineMsgId for a Buffer
585 /** This Method is used to make the marker line position of a Buffer persistent
586 * \note This method is threadsafe.
588 * \param user The Owner of that Buffer
589 * \param bufferId The buffer id
590 * \param MsgId The Message id where the marker line should be placed
592 static inline void setBufferMarkerLineMsg(UserId user, const BufferId &bufferId, const MsgId &msgId)
594 return instance()->_storage->setBufferMarkerLineMsg(user, bufferId, msgId);
598 //! Get a Hash of all marker line message ids
599 /** This Method is called when the Quassel Core is started to restore the MarkerLineMsgIds
600 * \note This method is threadsafe.
602 * \param user The Owner of the buffers
604 static inline QHash<BufferId, MsgId> bufferMarkerLineMsgIds(UserId user)
606 return instance()->_storage->bufferMarkerLineMsgIds(user);
609 //! Update the BufferActivity for a Buffer
610 /** This Method is used to make the activity state of a Buffer persistent
611 * \note This method is threadsafe.
613 * \param user The Owner of that Buffer
614 * \param bufferId The buffer id
615 * \param MsgId The Message id where the marker line should be placed
617 static inline void setBufferActivity(UserId user, BufferId bufferId, Message::Types activity) {
618 return instance()->_storage->setBufferActivity(user, bufferId, activity);
622 //! Get a Hash of all buffer activity states
623 /** This Method is called when the Quassel Core is started to restore the BufferActivity
624 * \note This method is threadsafe.
626 * \param user The Owner of the buffers
628 static inline QHash<BufferId, Message::Types> bufferActivities(UserId user) {
629 return instance()->_storage->bufferActivities(user);
632 //! Get the bitset of buffer activity states for a buffer
633 /** This method is used to load the activity state of a buffer when its last seen message changes.
634 * \note This method is threadsafe.
636 * \param bufferId The buffer
637 * \param lastSeenMsgId The last seen message
639 static inline Message::Types bufferActivity(BufferId bufferId, MsgId lastSeenMsgId) {
640 return instance()->_storage->bufferActivity(bufferId, lastSeenMsgId);
643 //! Update the highlight count for a Buffer
644 /** This Method is used to make the highlight count state of a Buffer persistent
645 * \note This method is threadsafe.
647 * \param user The Owner of that Buffer
648 * \param bufferId The buffer id
649 * \param MsgId The Message id where the marker line should be placed
651 static inline void setHighlightCount(UserId user, BufferId bufferId, int highlightCount) {
652 return instance()->_storage->setHighlightCount(user, bufferId, highlightCount);
656 //! Get a Hash of all highlight count states
657 /** This Method is called when the Quassel Core is started to restore the highlight count
658 * \note This method is threadsafe.
660 * \param user The Owner of the buffers
662 static inline QHash<BufferId, int> highlightCounts(UserId user) {
663 return instance()->_storage->highlightCounts(user);
665 //! Get the highlight count states for a buffer
666 /** This method is used to load the highlight count of a buffer when its last seen message changes.
667 * \note This method is threadsafe.
669 * \param bufferId The buffer
670 * \param lastSeenMsgId The last seen message
672 static inline int highlightCount(BufferId bufferId, MsgId lastSeenMsgId) {
673 return instance()->_storage->highlightCount(bufferId, lastSeenMsgId);
676 static inline QDateTime startTime() { return instance()->_startTime; }
677 static inline bool isConfigured() { return instance()->_configured; }
680 * Whether or not strict ident mode is enabled, locking users' idents to Quassel username
682 * @return True if strict mode enabled, otherwise false
684 static inline bool strictIdentEnabled() { return instance()->_strictIdentEnabled; }
686 static bool sslSupported();
688 static QVariantList backendInfo();
689 static QVariantList authenticatorInfo();
691 static QString setup(const QString &adminUser, const QString &adminPassword, const QString &backend, const QVariantMap &setupData, const QString &authenticator, const QVariantMap &authSetupMap);
693 static inline QTimer *syncTimer() { return &instance()->_storageSyncTimer; }
695 inline OidentdConfigGenerator *oidentdConfigGenerator() const { return _oidentdConfigGenerator; }
696 inline IdentServer *identServer() const { return _identServer; }
698 static const int AddClientEventId;
701 //! Sent when a BufferInfo is updated in storage.
702 void bufferInfoUpdated(UserId user, const BufferInfo &info);
704 //! Relay from CoreSession::sessionState(). Used for internal connection only
705 void sessionState(const Protocol::SessionState &sessionState);
707 //! Emitted when database schema upgrade starts or ends
708 void dbUpgradeInProgress(bool inProgress);
710 //! Emitted when a fatal error was encountered during async initialization
711 void exitRequested(int exitCode, const QString &reason);
713 //! Emitted once core shutdown is complete
714 void shutdownComplete();
721 * @note This method is threadsafe.
726 * Reload SSL certificates used for connection with clients.
728 * @return True if certificates reloaded successfully, otherwise false.
732 void cacheSysIdent();
734 QString setupCore(const QString &adminUser, const QString &adminPassword, const QString &backend, const QVariantMap &setupData, const QString &authenticator, const QVariantMap &authSetupMap);
736 void connectInternalPeer(QPointer<InternalPeer> peer);
739 void customEvent(QEvent *event) override;
742 bool startListening();
743 void stopListening(const QString &msg = QString());
744 void incomingConnection();
745 void clientDisconnected();
747 bool initStorage(const QString &backend, const QVariantMap &settings,
748 const QProcessEnvironment &environment, bool loadFromEnvironment,
750 bool initAuthenticator(const QString &backend, const QVariantMap &settings,
751 const QProcessEnvironment &environment, bool loadFromEnvironment,
754 void socketError(QAbstractSocket::SocketError err, const QString &errorString);
755 void setupClientSession(RemotePeer *, UserId);
757 bool changeUserPass(const QString &username);
759 void onSessionShutdown(SessionThread *session);
762 SessionThread *sessionForUser(UserId userId, bool restoreState = false);
763 void addClientHelper(RemotePeer *peer, UserId uid);
764 //void processCoreSetup(QTcpSocket *socket, QVariantMap &msg);
765 QString setupCoreForInternalUsage();
766 void setupInternalClientSession(QPointer<InternalPeer> peer);
770 template<typename Storage>
771 void registerStorageBackend();
773 template<typename Authenticator>
774 void registerAuthenticator();
776 void registerStorageBackends();
777 void registerAuthenticators();
779 DeferredSharedPtr<Storage> storageBackend(const QString& backendId) const;
780 DeferredSharedPtr<Authenticator> authenticator(const QString& authenticatorId) const;
782 bool selectBackend(const QString &backend);
783 bool selectAuthenticator(const QString &backend);
785 bool saveBackendSettings(const QString &backend, const QVariantMap &settings);
786 void saveAuthenticatorSettings(const QString &backend, const QVariantMap &settings);
791 template<typename Backend>
792 QVariantMap promptForSettings(const Backend *backend);
795 static Core *_instance;
796 QSet<CoreAuthHandler *> _connectingClients;
797 QHash<UserId, SessionThread *> _sessions;
798 DeferredSharedPtr<Storage> _storage; ///< Active storage backend
799 DeferredSharedPtr<Authenticator> _authenticator; ///< Active authenticator
800 QMap<UserId, QString> _authUserNames;
802 QTimer _storageSyncTimer;
805 SslServer _server, _v6server;
807 QTcpServer _server, _v6server;
810 OidentdConfigGenerator *_oidentdConfigGenerator {nullptr};
812 std::vector<DeferredSharedPtr<Storage>> _registeredStorageBackends;
813 std::vector<DeferredSharedPtr<Authenticator>> _registeredAuthenticators;
815 QDateTime _startTime;
817 IdentServer *_identServer {nullptr};
819 bool _initialized{false};
820 bool _configured{false};
822 QPointer<InternalPeer> _pendingInternalConnection;
824 /// Whether or not strict ident mode is enabled, locking users' idents to Quassel username
825 bool _strictIdentEnabled;
827 static std::unique_ptr<AbstractSqlMigrationReader> getMigrationReader(Storage *storage);
828 static std::unique_ptr<AbstractSqlMigrationWriter> getMigrationWriter(Storage *storage);
829 static void stdInEcho(bool on);
830 static inline void enableStdInEcho() { stdInEcho(true); }
831 static inline void disableStdInEcho() { stdInEcho(false); }